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


Python QtCore.QSize方法代碼示例

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


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

示例1: __init__

# 需要導入模塊: from qtpy import QtCore [as 別名]
# 或者: from qtpy.QtCore import QSize [as 別名]
def __init__(self, parent=None):
        super(GraphView, self).__init__(parent)
        self.setObjectName('graphView')

        self.__graphViewWidget = parent

        self.setRenderHint(QtGui.QPainter.Antialiasing)
        self.setRenderHint(QtGui.QPainter.TextAntialiasing)

        self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)

        # Explicitly set the scene rect. This ensures all view parameters will be explicitly controlled
        # in the event handlers of this class.
        size = QtCore.QSize(600, 400);
        self.resize(size)
        self.setSceneRect(-size.width() * 0.5, -size.height() * 0.5, size.width(), size.height())

        self.setAcceptDrops(True)
        self.reset() 
開發者ID:EricTRocks,項目名稱:pyflowgraph,代碼行數:22,代碼來源:graph_view.py

示例2: resizeEvent

# 需要導入模塊: from qtpy import QtCore [as 別名]
# 或者: from qtpy.QtCore import QSize [as 別名]
def resizeEvent(self, event):
        """
        Re-implemented to re-calculate the grid size to provide scaling icons

        Parameters
        ----------
        event : QtCore.QEvent
        """
        width = self.viewport().width() - 30
        # The minus 30 above ensures we don't end up with an item width that
        # can't be drawn the expected number of times across the view without
        # being wrapped. Without this, the view can flicker during resize
        tileWidth = width / VIEW_COLUMNS
        iconWidth = int(tileWidth * 0.8)

        self.setGridSize(QtCore.QSize(tileWidth, tileWidth))
        self.setIconSize(QtCore.QSize(iconWidth, iconWidth))

        return super().resizeEvent(event) 
開發者ID:spyder-ide,項目名稱:qtawesome,代碼行數:21,代碼來源:icon_browser.py

示例3: __init__

# 需要導入模塊: from qtpy import QtCore [as 別名]
# 或者: from qtpy.QtCore import QSize [as 別名]
def __init__(
        self,
        title: str,
        algorithm_data: Sequence[Mapping[str, Any]],
        parent: QWidget
    ):
        """Add three tabs of chart."""
        super(ChartDialog, self).__init__(parent)
        self.setWindowTitle("Chart")
        self.setWindowFlags(self.windowFlags() | Qt.WindowMaximizeButtonHint)
        self.setSizeGripEnabled(True)
        self.setModal(True)
        self.setMinimumSize(QSize(800, 600))
        self.title = title
        self.algorithm_data = algorithm_data
        # Widgets
        main_layout = QVBoxLayout(self)
        main_layout.setContentsMargins(6, 6, 6, 6)
        self.tab_widget = QTabWidget(self)
        self.__set_chart("F-G Plot", 0, 1, 'Generation', 'Fitness')
        self.__set_chart("G-T Plot", 2, 0, 'Time', 'Generation')
        self.__set_chart("F-T Plot", 2, 1, 'Time', 'Fitness')
        main_layout.addWidget(self.tab_widget) 
開發者ID:KmolYuan,項目名稱:Pyslvs-UI,代碼行數:25,代碼來源:chart.py

示例4: __init__

# 需要導入模塊: from qtpy import QtCore [as 別名]
# 或者: from qtpy.QtCore import QSize [as 別名]
def __init__(self, parent: QWidget):
        super(QRotatableView, self).__init__(parent)
        scene = QGraphicsScene(self)
        self.setScene(scene)
        self.dial = QDial()
        self.dial.setMinimumSize(QSize(150, 150))
        self.dial.setSingleStep(100)
        self.dial.setPageStep(100)
        self.dial.setInvertedAppearance(True)
        self.dial.setWrapping(True)
        self.dial.setNotchTarget(0.1)
        self.dial.setNotchesVisible(True)
        self.dial.valueChanged.connect(self.__value_changed)
        self.set_maximum(360)
        graphics_item = scene.addWidget(self.dial)
        graphics_item.setRotation(-90)
        # make the QGraphicsView invisible.
        self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setFixedHeight(self.dial.height())
        self.setFixedWidth(self.dial.width())
        self.setStyleSheet("border: 0px;") 
開發者ID:KmolYuan,項目名稱:Pyslvs-UI,代碼行數:24,代碼來源:rotatable.py

示例5: wheelEvent

# 需要導入模塊: from qtpy import QtCore [as 別名]
# 或者: from qtpy.QtCore import QSize [as 別名]
def wheelEvent(self, event):
        """
        Handle mouse wheel event. No distinction between linear and log.
        :param event:
        :return:
        """
        if self.MOUSE_WHEEL_ACTIVATED:
            nsteps = int(event.delta() / 120)
            func = self.step_up if nsteps > 0 else self.step_down
            for i in range(abs(nsteps)):
                func(single_increment=True)


    # def sizeHint(self): #doesn t do anything, probably need to change
    #    # sizePolicy
    #    return QtCore.QSize(200, 20) 
開發者ID:lneuhaus,項目名稱:pyrpl,代碼行數:18,代碼來源:spinbox.py

示例6: setup

# 需要導入模塊: from qtpy import QtCore [as 別名]
# 或者: from qtpy.QtCore import QSize [as 別名]
def setup(self):
        for channel in sorted(self._channels):
            item = ListWidgetItemChannels(channel, self.list)
            item.setFlags(item.flags() | Qt.ItemIsUserCheckable)

            if channel in self._active_channels:
                item.setCheckState(Qt.Checked)
            else:
                item.setCheckState(Qt.Unchecked)

            self.list.addItem(item)
            item.setSizeHint(QSize(item.sizeHint().width(), self._height()))

        self.list.setCurrentRow(0)
        self.refresh()
        self.set_tab_order() 
開發者ID:spyder-ide,項目名稱:conda-manager,代碼行數:18,代碼來源:channels.py

示例7: sizeHint

# 需要導入模塊: from qtpy import QtCore [as 別名]
# 或者: from qtpy.QtCore import QSize [as 別名]
def sizeHint(self):
        w, h = self.get_width_height()
        return QtCore.QSize(w, h) 
開發者ID:rgerum,項目名稱:pylustrator,代碼行數:5,代碼來源:matplotlibwidget.py

示例8: minimumSizeHint

# 需要導入模塊: from qtpy import QtCore [as 別名]
# 或者: from qtpy.QtCore import QSize [as 別名]
def minimumSizeHint(self):
        return QtCore.QSize(10, 10) 
開發者ID:rgerum,項目名稱:pylustrator,代碼行數:4,代碼來源:matplotlibwidget.py

示例9: resizeEvent

# 需要導入模塊: from qtpy import QtCore [as 別名]
# 或者: from qtpy.QtCore import QSize [as 別名]
def resizeEvent(self, event):
        """ Resizes the details box if present (i.e. when 'Show Details' button was clicked)
        """
        result = super(ResizeDetailsMessageBox, self).resizeEvent(event)

        details_box = self.findChild(QtWidgets.QTextEdit)
        if details_box is not None:
            #details_box.setFixedSize(details_box.sizeHint())
            details_box.setFixedSize(QtCore.QSize(self.detailsBoxWidth, self.detailBoxHeight))

        return result 
開發者ID:titusjan,項目名稱:argos,代碼行數:13,代碼來源:misc.py

示例10: square_pixmap

# 需要導入模塊: from qtpy import QtCore [as 別名]
# 或者: from qtpy.QtCore import QSize [as 別名]
def square_pixmap(size):
    """Create a white/black hollow square pixmap. For use as labels cursor."""
    pixmap = QPixmap(QSize(size, size))
    pixmap.fill(Qt.transparent)
    painter = QPainter(pixmap)
    painter.setPen(Qt.white)
    painter.drawRect(0, 0, size - 1, size - 1)
    painter.setPen(Qt.black)
    painter.drawRect(1, 1, size - 3, size - 3)
    painter.end()
    return pixmap 
開發者ID:napari,項目名稱:napari,代碼行數:13,代碼來源:utils.py

示例11: sizeHint

# 需要導入模塊: from qtpy import QtCore [as 別名]
# 或者: from qtpy.QtCore import QSize [as 別名]
def sizeHint(self):
        """Return (width, height) of the table"""
        width = sum(map(self.columnWidth, range(self.columnCount()))) + 25
        height = self.rowHeight(0) * (self.rowCount() + 1)
        return QSize(width, height) 
開發者ID:napari,項目名稱:napari,代碼行數:7,代碼來源:qt_dict_table.py

示例12: data

# 需要導入模塊: from qtpy import QtCore [as 別名]
# 或者: from qtpy.QtCore import QSize [as 別名]
def data(self, index, role):
        column = index.column()
        if not index.isValid():
            return None
        if role == QtCore.Qt.DisplayRole:
            item = index.internalPointer()
            return item.data[column]
        elif role == QtCore.Qt.SizeHintRole:
            return QtCore.QSize(20, 20)
        elif role == QtCore.Qt.DecorationRole:
            if column == 1:
                itemType = index.internalPointer().data[column]
                isDeleted = index.internalPointer().data[3] == 'delete'

                if isDeleted:
                    return QtGui.QIcon(os.path.join(interop.getIconPath(), 'File0104.png'))

                # Try to figure out which icon is most applicable to the item
                if itemType == "Folder":
                    return QtGui.QIcon(os.path.join(interop.getIconPath(), 'File0059.png'))
                elif "binary" in itemType:
                    return QtGui.QIcon(os.path.join(interop.getIconPath(), 'File0315.png'))
                elif "text" in itemType:
                    return QtGui.QIcon(os.path.join(interop.getIconPath(), 'File0027.png'))
                else:
                    return QtGui.QIcon(os.path.join(interop.getIconPath(), 'File0106.png'))
            else:
                return None

        return None 
開發者ID:TomMinor,項目名稱:P4VFX,代碼行數:32,代碼來源:DepotClientViewModel.py

示例13: __init__

# 需要導入模塊: from qtpy import QtCore [as 別名]
# 或者: from qtpy.QtCore import QSize [as 別名]
def __init__(self, *names, **kwargs):
        super().__init__(parent=kwargs.get('parent'))
        self._icon = None
        self._size = QtCore.QSize(16, 16)
        self.setIcon(icon(*names, **kwargs)) 
開發者ID:spyder-ide,項目名稱:qtawesome,代碼行數:7,代碼來源:__init__.py

示例14: setIconSize

# 需要導入模塊: from qtpy import QtCore [as 別名]
# 或者: from qtpy.QtCore import QSize [as 別名]
def setIconSize(self, size):
        """
        set icon size

        Parameters
        ----------
        size: QtCore.QSize
            size of the icon
        """
        self._size = size 
開發者ID:spyder-ide,項目名稱:qtawesome,代碼行數:12,代碼來源:__init__.py

示例15: color_icon

# 需要導入模塊: from qtpy import QtCore [as 別名]
# 或者: from qtpy.QtCore import QSize [as 別名]
def color_icon(name: str, size: int = 20) -> QIcon:
    """Get color block as QIcon by name."""
    color_block = QPixmap(QSize(size, size))
    color_block.fill(color_qt(name))
    return QIcon(color_block)


# Target path color: (line, dot) 
開發者ID:KmolYuan,項目名稱:Pyslvs-UI,代碼行數:10,代碼來源:color.py


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