本文整理匯總了Python中AnyQt.QtWidgets.QStackedWidget.setSizePolicy方法的典型用法代碼示例。如果您正苦於以下問題:Python QStackedWidget.setSizePolicy方法的具體用法?Python QStackedWidget.setSizePolicy怎麽用?Python QStackedWidget.setSizePolicy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AnyQt.QtWidgets.QStackedWidget
的用法示例。
在下文中一共展示了QStackedWidget.setSizePolicy方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __setupUi
# 需要導入模塊: from AnyQt.QtWidgets import QStackedWidget [as 別名]
# 或者: from AnyQt.QtWidgets.QStackedWidget import setSizePolicy [as 別名]
def __setupUi(self):
"""Set up the UI.
"""
if self.__macUnified:
self.tab = QToolBar()
self.addToolBar(Qt.TopToolBarArea, self.tab)
self.setUnifiedTitleAndToolBarOnMac(True)
# This does not seem to work
self.setWindowFlags(self.windowFlags() & \
~Qt.MacWindowToolBarButtonHint)
self.tab.actionTriggered[QAction].connect(
self.__macOnToolBarAction
)
central = QStackedWidget()
central.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
else:
self.tab = central = QTabWidget(self)
self.stack = central
self.setCentralWidget(central)
# General Tab
tab = QWidget()
self.addTab(tab, self.tr("General"),
toolTip=self.tr("General Options"))
form = QFormLayout()
tab.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
nodes = QWidget(self, objectName="nodes")
nodes.setLayout(QVBoxLayout())
nodes.layout().setContentsMargins(0, 0, 0, 0)
cb_anim = QCheckBox(
self.tr("Enable node animations"),
objectName="enable-node-animations",
toolTip=self.tr("Enable shadow and ping animations for nodes "
"in the workflow.")
)
self.bind(cb_anim, "checked", "schemeedit/enable-node-animations")
nodes.layout().addWidget(cb_anim)
form.addRow(self.tr("Nodes"), nodes)
links = QWidget(self, objectName="links")
links.setLayout(QVBoxLayout())
links.layout().setContentsMargins(0, 0, 0, 0)
cb_show = QCheckBox(
self.tr("Show channel names between widgets"),
objectName="show-channel-names",
toolTip=self.tr("Show source and sink channel names "
"over the links.")
)
self.bind(cb_show, "checked", "schemeedit/show-channel-names")
links.layout().addWidget(cb_show)
form.addRow(self.tr("Links"), links)
quickmenu = QWidget(self, objectName="quickmenu-options")
quickmenu.setLayout(QVBoxLayout())
quickmenu.layout().setContentsMargins(0, 0, 0, 0)
cb1 = QCheckBox(self.tr("On double click"),
toolTip=self.tr("Open quick menu on a double click "
"on an empty spot in the canvas"))
cb2 = QCheckBox(self.tr("On right click"),
toolTip=self.tr("Open quick menu on a right click "
"on an empty spot in the canvas"))
cb3 = QCheckBox(self.tr("On space key press"),
toolTip=self.tr("On Space key press while the mouse"
"is hovering over the canvas."))
cb4 = QCheckBox(self.tr("On any key press"),
toolTip=self.tr("On any key press while the mouse"
"is hovering over the canvas."))
self.bind(cb1, "checked", "quickmenu/trigger-on-double-click")
self.bind(cb2, "checked", "quickmenu/trigger-on-right-click")
self.bind(cb3, "checked", "quickmenu/trigger-on-space-key")
self.bind(cb4, "checked", "quickmenu/trigger-on-any-key")
quickmenu.layout().addWidget(cb1)
quickmenu.layout().addWidget(cb2)
quickmenu.layout().addWidget(cb3)
quickmenu.layout().addWidget(cb4)
form.addRow(self.tr("Open quick menu on"), quickmenu)
startup = QWidget(self, objectName="startup-group")
#.........這裏部分代碼省略.........
示例2: __setupUi
# 需要導入模塊: from AnyQt.QtWidgets import QStackedWidget [as 別名]
# 或者: from AnyQt.QtWidgets.QStackedWidget import setSizePolicy [as 別名]
def __setupUi(self):
"""Set up the UI.
"""
if self.__macUnified:
self.tab = QToolBar(
floatable=False, movable=False, allowedAreas=Qt.TopToolBarArea,
)
self.addToolBar(Qt.TopToolBarArea, self.tab)
self.setUnifiedTitleAndToolBarOnMac(True)
# This does not seem to work
self.setWindowFlags(self.windowFlags() & \
~Qt.MacWindowToolBarButtonHint)
self.tab.actionTriggered[QAction].connect(
self.__macOnToolBarAction
)
central = QStackedWidget()
central.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
else:
self.tab = central = QTabWidget(self)
# Add a close button to the bottom of the dialog
# (to satisfy GNOME 3 which shows the dialog without a title bar).
container = container_widget_helper()
container.layout().addWidget(central)
buttonbox = QDialogButtonBox(QDialogButtonBox.Close)
buttonbox.rejected.connect(self.close)
container.layout().addWidget(buttonbox)
self.setCentralWidget(container)
self.stack = central
# General Tab
tab = QWidget()
self.addTab(tab, self.tr("General"),
toolTip=self.tr("General Options"))
form = QFormLayout()
tab.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
nodes = QWidget(self, objectName="nodes")
nodes.setLayout(QVBoxLayout())
nodes.layout().setContentsMargins(0, 0, 0, 0)
cb_anim = QCheckBox(
self.tr("Enable node animations"),
objectName="enable-node-animations",
toolTip=self.tr("Enable shadow and ping animations for nodes "
"in the workflow.")
)
self.bind(cb_anim, "checked", "schemeedit/enable-node-animations")
nodes.layout().addWidget(cb_anim)
form.addRow(self.tr("Nodes"), nodes)
links = QWidget(self, objectName="links")
links.setLayout(QVBoxLayout())
links.layout().setContentsMargins(0, 0, 0, 0)
cb_show = QCheckBox(
self.tr("Show channel names between widgets"),
objectName="show-channel-names",
toolTip=self.tr("Show source and sink channel names "
"over the links.")
)
self.bind(cb_show, "checked", "schemeedit/show-channel-names")
links.layout().addWidget(cb_show)
form.addRow(self.tr("Links"), links)
quickmenu = QWidget(self, objectName="quickmenu-options")
quickmenu.setLayout(QVBoxLayout())
quickmenu.layout().setContentsMargins(0, 0, 0, 0)
cb1 = QCheckBox(self.tr("On double click"),
toolTip=self.tr("Open quick menu on a double click "
"on an empty spot in the canvas"))
cb2 = QCheckBox(self.tr("On right click"),
toolTip=self.tr("Open quick menu on a right click "
"on an empty spot in the canvas"))
cb3 = QCheckBox(self.tr("On space key press"),
toolTip=self.tr("On Space key press while the mouse"
"is hovering over the canvas."))
cb4 = QCheckBox(self.tr("On any key press"),
toolTip=self.tr("On any key press while the mouse"
"is hovering over the canvas."))
self.bind(cb1, "checked", "quickmenu/trigger-on-double-click")
self.bind(cb2, "checked", "quickmenu/trigger-on-right-click")
self.bind(cb3, "checked", "quickmenu/trigger-on-space-key")
self.bind(cb4, "checked", "quickmenu/trigger-on-any-key")
#.........這裏部分代碼省略.........