本文整理汇总了Python中PySide.QtGui.QComboBox.setStyleSheet方法的典型用法代码示例。如果您正苦于以下问题:Python QComboBox.setStyleSheet方法的具体用法?Python QComboBox.setStyleSheet怎么用?Python QComboBox.setStyleSheet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QComboBox
的用法示例。
在下文中一共展示了QComboBox.setStyleSheet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: newCombo
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import setStyleSheet [as 别名]
def newCombo(self):
taskList = [u'--請選擇--', u'值班', u'救護勤務', u'備勤', u'待命服勤', u'水源查察', u'消防查察', u'宣導勤務', u'訓(演)練', u'專案勤務', u'南山救護站']
nComboBox = QComboBox()
nComboBox.addItems(taskList)
for i in xrange(len(taskList)):
if i == 0:
nComboBox.setItemData(i, QColor('#550000'), Qt.BackgroundColorRole)
nComboBox.setItemData(i, Qt.AlignCenter, Qt.TextAlignmentRole)
nComboBox.setStyleSheet("text-align: right; font: bold 13px;")
return nComboBox
示例2: _fill_table
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import setStyleSheet [as 别名]
def _fill_table(self):
colors = ["yellow", "orange", "green", "red"]
dimensions = self._parser_result.get_dimensions()
row = 0
for dimension in dimensions:
dimension_name = QLabel(dimension[0])
dimension_name.setStyleSheet("background: %s" % colors[row % len(colors)])
self.table_widget.setCellWidget(row, 0, dimension_name)
choices_widget = QComboBox()
choices = dimension[1]
choices.insert(0, "No choice")
choices_widget.addItems(choices)
choices_widget.setStyleSheet("background: white")
choices_widget.setStyleSheet("border: none")
choices_widget.currentIndexChanged.connect(self.on_choice_change)
self.table_widget.setCellWidget(row, 1, choices_widget)
row += 1