當前位置: 首頁>>代碼示例>>Python>>正文


Python QtCore.QSizeF方法代碼示例

本文整理匯總了Python中PyQt5.QtCore.QSizeF方法的典型用法代碼示例。如果您正苦於以下問題:Python QtCore.QSizeF方法的具體用法?Python QtCore.QSizeF怎麽用?Python QtCore.QSizeF使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt5.QtCore的用法示例。


在下文中一共展示了QtCore.QSizeF方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QSizeF [as 別名]
def __init__(self, page_size, print_pdf=False):

        super().__init__(page_size)

        self._printer = QPrinter(QPrinter.HighResolution)
        self._printer.setFullPage(True)
        self._printer.setPageSize(QtGui.QPageSize(QtCore.QSizeF(*page_size),
                                                  QtGui.QPageSize.Millimeter))
        self._printer.setColorMode(QPrinter.Color)

        logging.info('Using printer "%s"', self._printer.printerName())

        self._print_pdf = print_pdf
        if self._print_pdf:
            logging.info('Using PDF printer')
            self._counter = 0
            self._printer.setOutputFormat(QPrinter.PdfFormat) 
開發者ID:reuterbal,項目名稱:photobooth,代碼行數:19,代碼來源:PrinterPyQt5.py

示例2: _on_contents_size_changed

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QSizeF [as 別名]
def _on_contents_size_changed(self, size):
        self.contents_size_changed.emit(QSizeF(size)) 
開發者ID:qutebrowser,項目名稱:qutebrowser,代碼行數:4,代碼來源:webkittab.py

示例3: _breathing_gi_hover

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QSizeF [as 別名]
def _breathing_gi_hover(self):
        if mc.mc_global.breathing_state == mc.mc_global.BreathingState.breathing_in:
            return

        hover_rectangle_qsize = QtCore.QSizeF(BR_WIDTH_FT, BR_HEIGHT_FT)
        # noinspection PyCallByClass
        pos_pointf = QtWidgets.QGraphicsItem.mapFromItem(
            self._breathing_gi,
            self._breathing_gi,
            self._breathing_gi.x() + (self._breathing_gi.boundingRect().width() - hover_rectangle_qsize.width()) / 2,
            self._breathing_gi.y() + (self._breathing_gi.boundingRect().height() - hover_rectangle_qsize.height()) / 2
        )
        # -widget coords
        hover_rectangle_coords_qrect = QtCore.QRectF(pos_pointf, hover_rectangle_qsize)

        cursor = QtGui.QCursor()  # -screen coords
        cursor_pos_widget_coords_qp = self.mapFromGlobal(cursor.pos())  # -widget coords

        logging.debug("cursor.pos() = " + str(cursor.pos()))
        logging.debug("cursor_pos_widget_coords_qp = " + str(cursor_pos_widget_coords_qp))
        logging.debug("hover_rectangle_coords_qrect = " + str(hover_rectangle_coords_qrect))

        if hover_rectangle_coords_qrect.contains(cursor_pos_widget_coords_qp):
            mc.mc_global.breathing_state = mc.mc_global.BreathingState.breathing_in
            self.ib_signal.emit()
            self.text_gi.update_pos_and_origin_point(VIEW_WIDTH_INT, VIEW_HEIGHT_INT)
            self._breathing_gi.update_pos_and_origin_point(VIEW_WIDTH_INT, VIEW_HEIGHT_INT) 
開發者ID:mindfulness-at-the-computer,項目名稱:mindfulness-at-the-computer,代碼行數:29,代碼來源:breathing_dlg.py

示例4: create_pages

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QSizeF [as 別名]
def create_pages(self, text_mode=None):
        # Return to this value after page calcuation is done
        cursorTop = self.cursorForPosition(QtCore.QPoint(0, 0))

        # No changes in mode
        # if text_mode == self.text_mode:
        #     return

        # Account for resizeEvent
        if not text_mode:
            if self.text_mode == 'flow':
                return
            text_mode = self.text_mode

        # Single Page mode
        page_width = self.viewport().size().width()
        page_height = self.viewport().size().height()

        # Flow mode
        if text_mode == 'flow':
            page_height = -1

        # TODO
        # See what's an appropriate value to pad the text with
        # profile_index = self.bookToolBar.profileBox.currentIndex()
        # current_profile = self.bookToolBar.profileBox.itemData(
        #     profile_index, QtCore.Qt.UserRole)
        # padding = 20
        # Double page mode
        if text_mode == 'doublePage':
            page_width = page_width // 2 - 10

        self.text_mode = text_mode

        self.document().setPageSize(
            QtCore.QSizeF(page_width, page_height))

        self.generate_page_positions()
        self.set_page(cursorTop) 
開發者ID:BasioMeusPuga,項目名稱:Lector,代碼行數:41,代碼來源:contentwidgets.py

示例5: reset_view

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QSizeF [as 別名]
def reset_view(self):
        # The SceneRect controls how far you can pan, make it larger than
        # just the bounding box so middle-click panning works
        panning_rect = QRectF(self.scene_bounding_rect)
        panning_rect_center = panning_rect.center()
        panning_rect_size = max(panning_rect.width(), panning_rect.height())*3
        panning_rect.setSize(QSizeF(panning_rect_size, panning_rect_size))
        panning_rect.moveCenter(panning_rect_center)
        self.setSceneRect(panning_rect)
        self.fitInView(self.scene_bounding_rect, Qt.KeepAspectRatio)
        self.zoom_view(0.8)

        self.update_grid() 
開發者ID:amccaugh,項目名稱:phidl,代碼行數:15,代碼來源:quickplotter.py

示例6: getSize

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QSizeF [as 別名]
def getSize(self, size) -> QSizeF:
        if size in self._sizes:
            return self._sizes[size]

        Logger.log("w", "No size %s defined in Theme", size)
        return QSizeF() 
開發者ID:Ultimaker,項目名稱:Uranium,代碼行數:8,代碼來源:Theme.py

示例7: _initializeDefaults

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QSizeF [as 別名]
def _initializeDefaults(self) -> None:
        self._fonts = {
            "system": QCoreApplication.instance().font(),
            "fixed": QFontDatabase.systemFont(QFontDatabase.FixedFont)
        }

        palette = QCoreApplication.instance().palette()
        self._colors = {
            "system_window": palette.window(),
            "system_text": palette.text()
        }

        self._sizes = {
            "line": QSizeF(self._em_width, self._em_height)
        } 
開發者ID:Ultimaker,項目名稱:Uranium,代碼行數:17,代碼來源:Theme.py

示例8: test_getKnownSize

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QSizeF [as 別名]
def test_getKnownSize(theme):
    assert theme.getSize("test_size") == QSizeF(42, 1337) 
開發者ID:Ultimaker,項目名稱:Uranium,代碼行數:4,代碼來源:TestTheme.py

示例9: test_getUnknownSize

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QSizeF [as 別名]
def test_getUnknownSize(theme):
    assert theme.getSize("Dunno?") == QSizeF() 
開發者ID:Ultimaker,項目名稱:Uranium,代碼行數:4,代碼來源:TestTheme.py

示例10: calculateTextSize

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QSizeF [as 別名]
def calculateTextSize(text):
        """
        Calculates the size of text. Crops to 96 pixels wide.
        """
        fontMetrics = QtGui.QFontMetrics(QtGui.QFont())
        fontRect = fontMetrics.boundingRect(QtCore.QRect(0, 0, 96, 48), Qt.TextWordWrap, text)
        w, h = fontRect.width(), fontRect.height()
        return QtCore.QSizeF(min(w, 96), h) 
開發者ID:aboood40091,項目名稱:Miyamoto,代碼行數:10,代碼來源:stamp.py

示例11: _linetool_annotate_point

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QSizeF [as 別名]
def _linetool_annotate_point(self, point, idx):
        annotation = QgsTextAnnotation()

        c = QTextDocument()
        html = "<strong>" + str(idx) + "</strong>"
        c.setHtml(html)

        annotation.setDocument(c)

        annotation.setFrameSize(QSizeF(27, 20))
        annotation.setFrameOffsetFromReferencePoint(QPointF(5, 5))
        annotation.setMapPosition(point)
        annotation.setMapPositionCrs(self.map_crs)

        return QgsMapCanvasAnnotationItem(annotation, self._iface.mapCanvas()).annotation() 
開發者ID:GIScience,項目名稱:orstools-qgis-plugin,代碼行數:17,代碼來源:ORStoolsDialog.py

示例12: run

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QSizeF [as 別名]
def run(self, path):
        """
        Perform PDF document generation.
        :type path: str
        """
        shape = self.diagram.visibleRect(margin=20)
        if shape:
            LOGGER.info('Exporting diagram %s to %s', self.diagram.name, path)
            printer = QtPrintSupport.QPrinter(QtPrintSupport.QPrinter.HighResolution)
            printer.setOutputFormat(QtPrintSupport.QPrinter.PdfFormat)
            printer.setOutputFileName(path)
            printer.setPaperSize(QtPrintSupport.QPrinter.Custom)
            printer.setPageSize(QtGui.QPageSize(QtCore.QSizeF(shape.width(), shape.height()), QtGui.QPageSize.Point))
            painter = QtGui.QPainter()
            if painter.begin(printer):
                # TURN CACHING OFF
                for item in self.diagram.items():
                    if item.isNode() or item.isEdge():
                        item.setCacheMode(AbstractItem.NoCache)
                # RENDER THE DIAGRAM IN THE PAINTER
                self.diagram.render(painter, source=shape)
                # TURN CACHING ON
                for item in self.diagram.items():
                    if item.isNode() or item.isEdge():
                        item.setCacheMode(AbstractItem.DeviceCoordinateCache)
                # COMPLETE THE EXPORT
                painter.end()
                # OPEN THE DOCUMENT
                openPath(path) 
開發者ID:danielepantaleone,項目名稱:eddy,代碼行數:31,代碼來源:pdf.py

示例13: boundingRect

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QSizeF [as 別名]
def boundingRect(self) -> qc.QRectF:
        return qc.QRectF(self.pos, qc.QSizeF(1, 1)) 
開發者ID:mozman,項目名稱:ezdxf,代碼行數:4,代碼來源:pyqt_backend.py

示例14: set_page_size

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QSizeF [as 別名]
def set_page_size(self, qrect):
        self.doc_width = qrect.width()
        self.doc_height = qrect.height()
        self.setFixedSize(qtc.QSize(self.doc_width, self.doc_height))
        self.document().setPageSize(
            qtc.QSizeF(self.doc_width, self.doc_height)) 
開發者ID:PacktPublishing,項目名稱:Mastering-GUI-Programming-with-Python,代碼行數:8,代碼來源:invoice_maker_printable.py

示例15: mousePressEvent

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QSizeF [as 別名]
def mousePressEvent(self, event):
        # grabbing the position of the widget
        sp = self.mapToScene(event.pos())
        ret = self.scene().areaAt(sp)

        edge = ret % 100
        iArea = int(ret / 100) - 1

        # resizing/moving the area if it exists
        if edge:
            self.bResizing = True
            self.resizingEdge = edge
            self.resizingArea = self.scene().areas[iArea]
            self.resizingStartingPos = sp
            self.resizingAreaRect = self.resizingArea.rect()
            self.resizingAreaPos = self.resizingArea.pos()
            self.resizingArea.setFlag(QGraphicsItem.ItemIsMovable, False)
        # creation of a new area if there is an image
        elif iArea == -1 and self.filename:
            size = QSizeF(0, 0)
            newArea = self.scene().createArea(sp,
                size, self.areaType, self.areaBorder,
                self.areaTextSize)

            self.bResizing = True
            self.resizingEdge = 10
            self.resizingArea = newArea
            self.resizingStartingPos = sp
            self.resizingAreaRect = self.resizingArea.rect()
            self.resizingAreaPos = self.resizingArea.pos()
            self.resizingArea.setFlag(QGraphicsItem.ItemIsMovable, False)

        QGraphicsView.mousePressEvent(self, event) 
開發者ID:zdenop,項目名稱:lector,代碼行數:35,代碼來源:ocrwidget.py


注:本文中的PyQt5.QtCore.QSizeF方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。