本文整理匯總了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'"]
示例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)
示例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()
示例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()
示例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)
示例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
示例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
示例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)
示例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)
示例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)
示例12: minimumSizeHint
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QSize [as 別名]
def minimumSizeHint(self):
return QtCore.QSize(50, 50)
示例13: sizeHint
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QSize [as 別名]
def sizeHint(self):
return QtCore.QSize(450, 450)
示例14: sizeHint
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QSize [as 別名]
def sizeHint(self):
return QtCore.QSize(1200,1000)
示例15: minumumSizeHint
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QSize [as 別名]
def minumumSizeHint(self):
return QtCore.QSize(500, 500)