本文整理汇总了Python中PySide.QtGui.QListWidget.font方法的典型用法代码示例。如果您正苦于以下问题:Python QListWidget.font方法的具体用法?Python QListWidget.font怎么用?Python QListWidget.font使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QListWidget
的用法示例。
在下文中一共展示了QListWidget.font方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ConfigEditor
# 需要导入模块: from PySide.QtGui import QListWidget [as 别名]
# 或者: from PySide.QtGui.QListWidget import font [as 别名]
class ConfigEditor(QMainWindow):
def __init__(self, app, cfg, title='Config Editor'):
super(ConfigEditor, self).__init__()
self.app = app
self.config = cfg
self.title = title
def setup(self):
self.dirty = False
self.def_cfg = copy.deepcopy(self.config)
self.config.update_from_user_file()
self.base_cfg = copy.deepcopy(self.config)
self.categories = QListWidget()
#self.categories.setSizePolicy(QSizePolicy.Fixed,QSizePolicy.Expanding)
self.settings = QStackedWidget()
#self.categories.setSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.Expanding)
QObject.connect(self.categories, SIGNAL('itemSelectionChanged()'), self.category_selected)
self.widget_list = {}
for cat in self.config.get_categories():
self.widget_list[cat] = {}
longest_cat = 0
for cat in self.config.get_categories():
if len(cat) > longest_cat:
longest_cat = len(cat)
self.categories.addItem(cat)
settings_layout = QGridLayout()
r = 0
c = 0
for setting in self.config.get_settings(cat):
info = self.config.get_setting(cat, setting, True)
s = QWidget()
s.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Fixed)
sl = QVBoxLayout()
label = QLabel()
if info.has_key('alias'):
label.setText(info['alias'])
else:
label.setText(setting)
if info.has_key('about'):
label.setToolTip(info['about'])
sl.addWidget(label)
if info['type'] == constants.CT_LINEEDIT:
w = LineEdit(self, self.config,cat,setting,info)
elif info['type'] == constants.CT_CHECKBOX:
w = CheckBox(self, self.config,cat,setting,info)
elif info['type'] == constants.CT_SPINBOX:
w = SpinBox(self, self.config,cat,setting,info)
elif info['type'] == constants.CT_DBLSPINBOX:
w = DoubleSpinBox(self, self.config,cat,setting,info)
elif info['type'] == constants.CT_COMBO:
w = ComboBox(self, self.config,cat,setting,info)
w.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Fixed)
self.widget_list[cat][setting] = w
sl.addWidget(w)
s.setLayout(sl)
c = self.config.config[cat].index(setting) % 2
settings_layout.addWidget(s, r, c)
if c == 1:
r += 1
settings = QWidget()
settings.setLayout(settings_layout)
settings_scroller = QScrollArea()
settings_scroller.setWidget(settings)
settings_scroller.setWidgetResizable(True)
self.settings.addWidget(settings_scroller)
font = self.categories.font()
fm = QFontMetrics(font)
self.categories.setMaximumWidth(fm.widthChar('X')*(longest_cat+4))
self.main = QWidget()
self.main_layout = QVBoxLayout()
self.config_layout = QHBoxLayout()
self.config_layout.addWidget(self.categories)
self.config_layout.addWidget(self.settings)
self.mainButtons = QDialogButtonBox(QDialogButtonBox.RestoreDefaults | QDialogButtonBox.Reset | QDialogButtonBox.Apply)
self.main_apply = self.mainButtons.button(QDialogButtonBox.StandardButton.Apply)
self.main_reset = self.mainButtons.button(QDialogButtonBox.StandardButton.Reset)
self.main_defaults = self.mainButtons.button(QDialogButtonBox.StandardButton.LastButton)
QObject.connect(self.mainButtons, SIGNAL('clicked(QAbstractButton *)'), self.mainbutton_clicked)
self.dirty_check()
self.main_layout.addLayout(self.config_layout)
self.main_layout.addWidget(self.mainButtons)
self.main.setLayout(self.main_layout)
self.setCentralWidget(self.main)
self.setWindowTitle(self.title)
self.setUnifiedTitleAndToolBarOnMac(True)
#.........这里部分代码省略.........