本文整理汇总了Python中AnyQt.QtWidgets.QToolButton.setFixedSize方法的典型用法代码示例。如果您正苦于以下问题:Python QToolButton.setFixedSize方法的具体用法?Python QToolButton.setFixedSize怎么用?Python QToolButton.setFixedSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnyQt.QtWidgets.QToolButton
的用法示例。
在下文中一共展示了QToolButton.setFixedSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setup_gui_labels
# 需要导入模块: from AnyQt.QtWidgets import QToolButton [as 别名]
# 或者: from AnyQt.QtWidgets.QToolButton import setFixedSize [as 别名]
def _setup_gui_labels(self):
vlayout = QVBoxLayout()
vlayout.setContentsMargins(0, 0, 0, 0)
vlayout.setSpacing(1)
self.labels_edit = QTreeView()
self.labels_edit.setEditTriggers(QTreeView.CurrentChanged)
self.labels_edit.setRootIsDecorated(False)
self.labels_model = DictItemsModel()
self.labels_edit.setModel(self.labels_model)
self.labels_edit.selectionModel().selectionChanged.connect(
self.on_label_selection_changed)
# Necessary signals to know when the labels change
self.labels_model.dataChanged.connect(self.on_labels_changed)
self.labels_model.rowsInserted.connect(self.on_labels_changed)
self.labels_model.rowsRemoved.connect(self.on_labels_changed)
vlayout.addWidget(self.labels_edit)
hlayout = QHBoxLayout()
hlayout.setContentsMargins(0, 0, 0, 0)
hlayout.setSpacing(1)
self.add_label_action = QAction(
"+", self,
toolTip="Add a new label.",
triggered=self.on_add_label,
enabled=False,
shortcut=QKeySequence(QKeySequence.New))
self.remove_label_action = QAction(
unicodedata.lookup("MINUS SIGN"), self,
toolTip="Remove selected label.",
triggered=self.on_remove_label,
enabled=False,
shortcut=QKeySequence(QKeySequence.Delete))
button_size = gui.toolButtonSizeHint()
button_size = QSize(button_size, button_size)
button = QToolButton(self)
button.setFixedSize(button_size)
button.setDefaultAction(self.add_label_action)
hlayout.addWidget(button)
button = QToolButton(self)
button.setFixedSize(button_size)
button.setDefaultAction(self.remove_label_action)
hlayout.addWidget(button)
hlayout.addStretch(10)
vlayout.addLayout(hlayout)
self.main_form.addRow("Labels:", vlayout)
示例2: test_dock_mainwinow
# 需要导入模块: from AnyQt.QtWidgets import QToolButton [as 别名]
# 或者: from AnyQt.QtWidgets.QToolButton import setFixedSize [as 别名]
def test_dock_mainwinow(self):
mw = QMainWindow()
dock = CollapsibleDockWidget()
w1 = QTextEdit()
w2 = QToolButton()
w2.setFixedSize(38, 200)
dock.setExpandedWidget(w1)
dock.setCollapsedWidget(w2)
mw.addDockWidget(Qt.LeftDockWidgetArea, dock)
mw.setCentralWidget(QTextEdit())
mw.show()
timer = QTimer(dock, interval=200)
timer.timeout.connect(lambda: dock.setExpanded(not dock.expanded()))
timer.start()
示例3: test_dock_mainwinow
# 需要导入模块: from AnyQt.QtWidgets import QToolButton [as 别名]
# 或者: from AnyQt.QtWidgets.QToolButton import setFixedSize [as 别名]
def test_dock_mainwinow(self):
mw = QMainWindow()
dock = CollapsibleDockWidget()
w1 = QTextEdit()
w2 = QToolButton()
w2.setFixedSize(38, 200)
dock.setExpandedWidget(w1)
dock.setCollapsedWidget(w2)
mw.addDockWidget(Qt.LeftDockWidgetArea, dock)
mw.setCentralWidget(QTextEdit())
mw.show()
def toogle():
dock.setExpanded(not dock.expanded())
self.singleShot(2000, toogle)
toogle()
self.app.exec_()