当前位置: 首页>>代码示例>>Python>>正文


Python QtCore.QSize方法代码示例

本文整理汇总了Python中PyQt5.QtCore.QSize方法的典型用法代码示例。如果您正苦于以下问题:Python QtCore.QSize方法的具体用法?Python QtCore.QSize怎么用?Python QtCore.QSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtCore的用法示例。


在下文中一共展示了QtCore.QSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_read_size

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QSize [as 别名]
def test_read_size(self, config, width, height, position, expected_size,
                       state_config, splitter, fake_inspector, caplog):
        if config is not None:
            state_config['inspector'] = {position.name: config}

        splitter.resize(width, height)
        assert splitter.size() == QSize(width, height)

        with caplog.at_level(logging.ERROR):
            splitter.set_inspector(fake_inspector, position)

        assert splitter._preferred_size == expected_size

        if config == {'left': 'verybig'}:
            assert caplog.messages == ["Could not read inspector size: "
                                       "invalid literal for int() with "
                                       "base 10: 'verybig'"] 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:19,代码来源:test_miscwidgets.py

示例2: sizeHint

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QSize [as 别名]
def sizeHint(self):
        """Get the completion size according to the config."""
        # Get the configured height/percentage.
        confheight = str(config.val.completion.height)
        if confheight.endswith('%'):
            perc = int(confheight.rstrip('%'))
            height = self.window().height() * perc // 100
        else:
            height = int(confheight)
        # Shrink to content size if needed and shrinking is enabled
        if config.val.completion.shrink:
            contents_height = (
                self.viewportSizeHint().height() +
                self.horizontalScrollBar().sizeHint().height())
            if contents_height <= height:
                height = contents_height
        # The width isn't really relevant as we're expanding anyways.
        return QSize(-1, height) 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:20,代码来源:completionwidget.py

示例3: update_gui

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QSize [as 别名]
def update_gui(self, i_event_source=mc.mc_global.EventSource.undefined):
        self.updating_gui_bool = True

        # If the list is now empty, disabling buttons
        # If the list is no longer empty, enable buttons
        self.set_button_states(mc.model.PhrasesM.is_empty())

        # List
        self.list_widget.clear()
        for l_phrase in mc.model.PhrasesM.get_all():
            # self.list_widget.addItem(l_collection.title_str)
            custom_label = CustomQLabel(l_phrase.title, l_phrase.id)
            list_item = QtWidgets.QListWidgetItem()
            list_item.setSizeHint(QtCore.QSize(list_item.sizeHint().width(), mc_global.LIST_ITEM_HEIGHT_INT))
            self.list_widget.addItem(list_item)
            self.list_widget.setItemWidget(list_item, custom_label)

        if i_event_source == mc.mc_global.EventSource.breathing_phrase_deleted:
            self.update_selected(0)
        else:
            self.update_selected()

        self.updating_gui_bool = False 
开发者ID:mindfulness-at-the-computer,项目名称:mindfulness-at-the-computer,代码行数:25,代码来源:breathing_phrase_list_wt.py

示例4: generate_proxymodels

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QSize [as 别名]
def generate_proxymodels(self):
        self.itemProxyModel = ItemProxyModel()
        self.itemProxyModel.setSourceModel(self.libraryModel)
        self.itemProxyModel.setSortCaseSensitivity(False)
        s = QtCore.QSize(160, 250)  # Set icon sizing here
        self.main_window.listView.setIconSize(s)
        self.main_window.listView.setModel(self.itemProxyModel)

        self.tableProxyModel = TableProxyModel(
            self.main_window.temp_dir.path(),
            self.main_window.tableView.horizontalHeader(),
            self.main_window.settings['consider_read_at'])
        self.tableProxyModel.setSourceModel(self.libraryModel)
        self.tableProxyModel.setSortCaseSensitivity(False)
        self.main_window.tableView.setModel(self.tableProxyModel)

        self.update_proxymodels() 
开发者ID:BasioMeusPuga,项目名称:Lector,代码行数:19,代码来源:library.py

示例5: mousePressEvent

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QSize [as 别名]
def mousePressEvent(self, event):
        super(QGraphicsView, self).mousePressEvent(event)
        #==============================================================================
        #  Zoom to rectangle, from
        #  https://wiki.python.org/moin/PyQt/Selecting%20a%20region%20of%20a%20widget
        #==============================================================================
        if event.button() == Qt.RightButton:
            self._mousePressed = Qt.RightButton
            self._rb_origin = QPoint(event.pos())
            self.rubberBand.setGeometry(QRect(self._rb_origin, QSize()))
            self.rubberBand.show()
         #==============================================================================
        # Mouse panning, taken from
        # http://stackoverflow.com/a/15043279
        #==============================================================================
        elif event.button() == Qt.MidButton:
            self._mousePressed = Qt.MidButton
            self._mousePressedPos = event.pos()
            self.setCursor(QtCore.Qt.ClosedHandCursor)
            self._dragPos = event.pos() 
开发者ID:amccaugh,项目名称:phidl,代码行数:22,代码来源:quickplotter.py

示例6: __init__

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QSize [as 别名]
def __init__(self, parent):
        QDialog.__init__(self, parent=parent)
        self.setMinimumSize(QSize(1200, 600))
        layout = QVBoxLayout(self)

        self.label_collection = QLabel()
        self.label_collection.setAlignment(Qt.AlignCenter)
        layout.addWidget(self.label_collection)

        self.lineedit_filter = QLineEdit(self)
        layout.addWidget(self.lineedit_filter)

        self.coll_table = TableViewCollections(self)
        layout.addWidget(self.coll_table)

        self.model = CollectionTableModel()

        self.proxy_model = SortFilterProxyModel()
        self.proxy_model.setSourceModel(self.model)
        self.proxy_model.setFilterKeyColumn(-1)

        self.coll_table.setModel(self.proxy_model)

        # signals
        self.lineedit_filter.textChanged.connect(self._lineedit_changed) 
开发者ID:MTG,项目名称:dunya-desktop,代码行数:27,代码来源:table.py

示例7: widgetClassifierDisplay

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QSize [as 别名]
def widgetClassifierDisplay(self):
        """Create classifier display widget.
        """
        self.colorPicker = QPushButton('')
        self.colorPicker.setMaximumSize(QtCore.QSize(16, 16))
        self.shapeCBox = QComboBox(self)
        self.fillCBox = QComboBox(self)
        self.fillPath = QPushButton('...')
        self.fillPath.setMaximumWidth(40)
        self.showName = QCheckBox(self.tr('Show Name'))

        hbox = QHBoxLayout()
        hbox.addWidget(QLabel(self.tr('Shape')))
        hbox.addWidget(self.shapeCBox)
        hbox.addWidget(self.fillCBox)
        hbox.addWidget(self.fillPath)
        hbox.addWidget(self.colorPicker)
        hbox.addStretch(1)

        vbox = QVBoxLayout()
        vbox.addWidget(self.showName)
        vbox.addLayout(hbox)
        return vbox 
开发者ID:xsyann,项目名称:detection,代码行数:25,代码来源:window_ui.py

示例8: widgetGlobalParam

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QSize [as 别名]
def widgetGlobalParam(self):
        """Create global parameters widget.
        """
        hbox = QHBoxLayout()
        self.displayCBox = QComboBox(self)
        self.bgCBox = QComboBox(self)
        self.bgColorPicker = QPushButton('')
        self.bgColorPicker.setMaximumSize(QtCore.QSize(16, 16))
        self.bgPathButton = QPushButton('...')
        self.bgPathButton.setMaximumWidth(45)
        hbox.addWidget(QLabel(self.tr('Display')))
        hbox.addWidget(self.displayCBox)
        hbox.addStretch(1)
        hbox.addWidget(QLabel(self.tr('Background')))
        hbox.addWidget(self.bgCBox)
        hbox.addWidget(self.bgColorPicker)
        hbox.addWidget(self.bgPathButton)

        self.equalizeHist = QCheckBox(self.tr('Equalize histogram'))

        vbox = QVBoxLayout()
        vbox.addLayout(hbox)
        vbox.addWidget(self.equalizeHist)
        return vbox 
开发者ID:xsyann,项目名称:detection,代码行数:26,代码来源:window_ui.py

示例9: __init__

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QSize [as 别名]
def __init__(self, persepolis_setting):
        super().__init__(persepolis_setting)

        self.persepolis_setting = persepolis_setting

        # setting window size and position
        size = self.persepolis_setting.value(
            'AboutWindow/size', QSize(545, 375))
        position = self.persepolis_setting.value(
            'AboutWindow/position', QPoint(300, 300))

        # read translators.txt files.
        # this file contains all translators.
        f = QFile(':/translators.txt')

        f.open(QIODevice.ReadOnly | QFile.Text)
        f_text = QTextStream(f).readAll()
        f.close()

        self.translators_textEdit.insertPlainText(f_text)



        self.resize(size)
        self.move(position) 
开发者ID:persepolisdm,项目名称:persepolis,代码行数:27,代码来源:about.py

示例10: __init__

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QSize [as 别名]
def __init__(self, parent=None):
        """Initialize the widget
        """
        # Main widget setup
        QWidget.__init__(self, parent)
        self.u = gui_option.unit
        self.setTitle(self.tr("Output"))
        self.setMinimumSize(QSize(200, 0))
        self.setObjectName("g_output")
        self.layout = QVBoxLayout(self)
        self.layout.setObjectName("layout")

        # The widget is composed of 3 QLabel in a vertical layout
        self.out_Sbar = QLabel(self)
        self.out_Sbar.setObjectName("out_Sbar")
        self.layout.addWidget(self.out_Sbar)

        self.out_Sslot = QLabel(self)
        self.out_Sslot.setObjectName("out_Sslot")
        self.layout.addWidget(self.out_Sslot)

        self.out_ratio = QLabel(self)
        self.out_ratio.setMinimumSize(QSize(140, 0))
        self.out_ratio.setObjectName("out_ratio")
        self.layout.addWidget(self.out_ratio) 
开发者ID:Eomys,项目名称:pyleecan,代码行数:27,代码来源:WBarOut.py

示例11: attribute_bgsize

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QSize [as 别名]
def attribute_bgsize(self, value):
        try:
            bgsize = value.lower()
            self.bgsize = bgsize if bgsize == 'fit' else QtCore.QSize(*map(int, bgsize.split(',')))
        except:
            log.exception('Invalid background size: %s', value) 
开发者ID:pkkid,项目名称:pkmeter,代码行数:8,代码来源:pkmixins.py

示例12: minimumSizeHint

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QSize [as 别名]
def minimumSizeHint(self):
        return QtCore.QSize(50, 50) 
开发者ID:simnibs,项目名称:simnibs,代码行数:4,代码来源:electrodeGUI.py

示例13: sizeHint

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QSize [as 别名]
def sizeHint(self):
        return QtCore.QSize(450, 450) 
开发者ID:simnibs,项目名称:simnibs,代码行数:4,代码来源:electrodeGUI.py

示例14: sizeHint

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QSize [as 别名]
def sizeHint(self):
        return QtCore.QSize(1200,1000) 
开发者ID:simnibs,项目名称:simnibs,代码行数:4,代码来源:main_gui.py

示例15: minumumSizeHint

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QSize [as 别名]
def minumumSizeHint(self):
        return QtCore.QSize(500, 500) 
开发者ID:simnibs,项目名称:simnibs,代码行数:4,代码来源:main_gui.py


注:本文中的PyQt5.QtCore.QSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。