本文整理匯總了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)