本文整理汇总了Python中PySide.QtGui.QListWidget.setSizePolicy方法的典型用法代码示例。如果您正苦于以下问题:Python QListWidget.setSizePolicy方法的具体用法?Python QListWidget.setSizePolicy怎么用?Python QListWidget.setSizePolicy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QListWidget
的用法示例。
在下文中一共展示了QListWidget.setSizePolicy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PySide.QtGui import QListWidget [as 别名]
# 或者: from PySide.QtGui.QListWidget import setSizePolicy [as 别名]
def __init__(self, parent=None):
super(EditPreferencesDlg, self).__init__(parent)
self.setWindowTitle("Preferences")
# define widgets
pref_list = QListWidget()
pref_list.addItem("General")
pref_list.addItem("Display")
pref_list.setMaximumWidth(150)
pref_list.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding)
button_box = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
general_page = QWidget()
general_layout = QGridLayout()
general_layout.setAlignment(Qt.AlignTop)
general_layout.addWidget(QLabel("<b>General</b>"), 0, 0)
general_page.setLayout(general_layout)
display_page = QWidget()
display_layout = QGridLayout()
display_layout.setAlignment(Qt.AlignTop)
display_layout.addWidget(QLabel("<b>Display Options</b>"), 0, 0)
self.multitabs_checkbox = QCheckBox("Limit the display of tabs to one relief device (and the device's scenarios) at a time")
if parent.limit_tabs is True:
self.multitabs_checkbox.setChecked(True)
display_layout.addWidget(self.multitabs_checkbox, 1, 0)
display_page.setLayout(display_layout)
stacked_widget = QStackedWidget()
for page in general_page, display_page:
stacked_widget.addWidget(page)
main_layout = QVBoxLayout()
widgets_layout = QHBoxLayout()
widgets_layout.addWidget(pref_list)
widgets_layout.addWidget(stacked_widget)
buttons_layout = QHBoxLayout()
buttons_layout.addStretch()
buttons_layout.addWidget(button_box)
main_layout.addLayout(widgets_layout)
main_layout.addLayout(buttons_layout)
self.setLayout(main_layout)
pref_list.currentRowChanged.connect(stacked_widget.setCurrentIndex)
button_box.accepted.connect(self.accept)
button_box.rejected.connect(self.reject)