当前位置: 首页>>代码示例>>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;未经允许,请勿转载。