本文整理汇总了Python中AnyQt.QtGui.QIcon.setThemeName方法的典型用法代码示例。如果您正苦于以下问题:Python QIcon.setThemeName方法的具体用法?Python QIcon.setThemeName怎么用?Python QIcon.setThemeName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnyQt.QtGui.QIcon
的用法示例。
在下文中一共展示了QIcon.setThemeName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from AnyQt.QtGui import QIcon [as 别名]
# 或者: from AnyQt.QtGui.QIcon import setThemeName [as 别名]
#.........这里部分代码省略.........
tooltip='If this is checked, instead of rolling windows '
'through the series, they are applied side-to-side, '
'so the resulting output series will be some '
'length-of-fixed-window-times shorter.')
fixed_wlen = gui.spin(box, self, 'fixed_wlen', 2, 1000,
label='Fixed window width:',
callback=self.on_changed)
fixed_wlen.setDisabled(not self.non_overlapping)
# TODO: allow the user to choose left-aligned, right-aligned, or center-aligned window
class TableView(gui.TableView):
def __init__(self, parent):
super().__init__(parent,
editTriggers=(self.SelectedClicked |
self.CurrentChanged |
self.DoubleClicked |
self.EditKeyPressed),
)
self.horizontalHeader().setStretchLastSection(False)
agg_functions = ListModel(AGG_FUNCTIONS +
[Cumulative_sum, Cumulative_product],
parent=self)
self.setItemDelegateForColumn(0, self.VariableDelegate(parent))
self.setItemDelegateForColumn(1, self.SpinDelegate(parent))
self.setItemDelegateForColumn(2, self.ComboDelegate(self, agg_functions))
class _ItemDelegate(QStyledItemDelegate):
def updateEditorGeometry(self, widget, option, _index):
widget.setGeometry(option.rect)
class ComboDelegate(_ItemDelegate):
def __init__(self, parent=None, combo_model=None):
super().__init__(parent)
self._parent = parent
if combo_model is not None:
self._combo_model = combo_model
def createEditor(self, parent, _QStyleOptionViewItem, index):
combo = QComboBox(parent)
combo.setModel(self._combo_model)
return combo
def setEditorData(self, combo, index):
var = index.model().data(index, Qt.EditRole)
combo.setCurrentIndex(self._combo_model.indexOf(var))
def setModelData(self, combo, model, index):
var = self._combo_model[combo.currentIndex()]
model.setData(index, var, Qt.EditRole)
class VariableDelegate(ComboDelegate):
@property
def _combo_model(self):
return self._parent.var_model
class SpinDelegate(_ItemDelegate):
def paint(self, painter, option, index):
# Don't paint window length if non-overlapping windows set
if not self.parent().non_overlapping:
super().paint(painter, option, index)
def createEditor(self, parent, _QStyleOptionViewItem, _index):
# Don't edit window length if non-overlapping windows set
if self.parent().non_overlapping:
return None
spin = QSpinBox(parent, minimum=1, maximum=1000)
return spin
def setEditorData(self, spin, index):
spin.setValue(index.model().data(index, Qt.EditRole))
def setModelData(self, spin, model, index):
spin.interpretText()
model.setData(index, spin.value(), Qt.EditRole)
self.var_model = VariableListModel(parent=self)
self.table_model = model = PyTableModel(self.transformations,
parent=self, editable=True)
model.setHorizontalHeaderLabels(['Series', 'Window width', 'Aggregation function'])
model.dataChanged.connect(self.on_changed)
self.view = view = TableView(self)
view.setModel(model)
box.layout().addWidget(view)
hbox = gui.hBox(box)
from os.path import dirname, join
self.add_button = button = gui.button(
hbox, self, 'Add &Transform',
callback=self.on_add_transform)
button.setIcon(QIcon(join(dirname(__file__), 'icons', 'LineChart-plus.png')))
self.del_button = button = gui.button(
hbox, self, '&Delete Selected',
callback=self.on_del_transform)
QIcon.setThemeName('gnome') # Works for me
button.setIcon(QIcon.fromTheme('edit-delete'))
gui.auto_commit(box, self, 'autocommit', '&Apply')