本文整理汇总了Python中PyQt5.QtWidgets.QStackedWidget.setGeometry方法的典型用法代码示例。如果您正苦于以下问题:Python QStackedWidget.setGeometry方法的具体用法?Python QStackedWidget.setGeometry怎么用?Python QStackedWidget.setGeometry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QStackedWidget
的用法示例。
在下文中一共展示了QStackedWidget.setGeometry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AppSettings
# 需要导入模块: from PyQt5.QtWidgets import QStackedWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QStackedWidget import setGeometry [as 别名]
class AppSettings(QDialog):
SettingsWidgets = []
def __init__(self, conf, **kwargs):
super().__init__(**kwargs)
self.conf = conf
self.setWindowTitle('LiSP preferences')
self.setWindowModality(QtCore.Qt.ApplicationModal)
self.setMaximumSize(635, 530)
self.setMinimumSize(635, 530)
self.resize(635, 530)
self.listWidget = QListWidget(self)
self.listWidget.setGeometry(QtCore.QRect(5, 10, 185, 470))
self.sections = QStackedWidget(self)
self.sections.setGeometry(QtCore.QRect(200, 10, 430, 470))
for widget in self.SettingsWidgets:
widget = widget(QtCore.QSize(430, 465), self)
widget.set_configuration(self.conf)
self.listWidget.addItem(widget.NAME)
self.sections.addWidget(widget)
if len(self.SettingsWidgets) > 0:
self.listWidget.setCurrentRow(0)
self.listWidget.currentItemChanged.connect(self._change_page)
self.dialogButtons = QDialogButtonBox(self)
self.dialogButtons.setGeometry(10, 495, 615, 30)
self.dialogButtons.setStandardButtons(QDialogButtonBox.Cancel |
QDialogButtonBox.Ok)
self.dialogButtons.rejected.connect(self.reject)
self.dialogButtons.accepted.connect(self.accept)
def get_configuraton(self):
conf = {}
for n in range(self.sections.count()):
widget = self.sections.widget(n)
newconf = widget.get_configuration()
deep_update(conf, newconf)
return conf
@classmethod
def register_settings_widget(cls, widget):
if widget not in cls.SettingsWidgets:
cls.SettingsWidgets.append(widget)
@classmethod
def unregister_settings_widget(cls, widget):
if widget not in cls.SettingsWidgets:
cls.SettingsWidgets.remove(widget)
def _change_page(self, current, previous):
if not current:
current = previous
self.sections.setCurrentIndex(self.listWidget.row(current))