本文整理汇总了Python中spyderlib.qt.QtGui.QItemDelegate类的典型用法代码示例。如果您正苦于以下问题:Python QItemDelegate类的具体用法?Python QItemDelegate怎么用?Python QItemDelegate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QItemDelegate类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: setEditorData
def setEditorData(self, editor, index):
text = from_qvariant(index.model().data(index, Qt.DisplayRole), str)
if index.column() in (MOD1, MOD2, MOD3, KEY):
i = editor.findText(text)
if i == -1:
i = 0
editor.setCurrentIndex(i)
else:
QItemDelegate.setEditorData(self, editor, index)
开发者ID:jromang,项目名称:spyderlib,代码行数:9,代码来源:shortcuts.py
示例2: sizeHint
def sizeHint(self, option, index):
fm = option.fontMetrics
if index.column() in (MOD1, MOD2, MOD3):
if self.mod is None:
w = 0
for mod in self.modifiers:
cw = fm.width(mod)
if cw > w:
w = cw
self.mod = mod
else:
w = fm.width(self.mod)
return QSize(w+20, fm.height())
elif index.column() == KEY:
if self.key is None:
w = 0
for key in self.keys:
cw = fm.width(key)
if cw > w:
w = cw
self.key = key
else:
w = fm.width(self.key)
return QSize(w+20, fm.height())
return QItemDelegate.sizeHint(self, option, index)
开发者ID:jromang,项目名称:spyderlib,代码行数:25,代码来源:shortcuts.py
示例3: createEditor
def createEditor(self, parent, option, index):
if index.column() in (MOD1, MOD2, MOD3):
combobox = QComboBox(parent)
combobox.addItems(self.modifiers)
return combobox
elif index.column() == KEY:
combobox = QComboBox(parent)
combobox.addItems(self.keys)
return combobox
else:
return QItemDelegate.createEditor(self, parent, option, index)
开发者ID:ftsiadimos,项目名称:spyder,代码行数:11,代码来源:shortcuts.py
示例4: __init__
def __init__(self, dtype, parent=None):
QItemDelegate.__init__(self, parent)
self.dtype = dtype
开发者ID:da-woods,项目名称:spyder,代码行数:3,代码来源:arrayeditor.py
示例5: __init__
def __init__(self, parent=None):
QItemDelegate.__init__(self, parent)
开发者ID:rthouvenin,项目名称:spyder,代码行数:2,代码来源:dependencies.py
示例6: setModelData
def setModelData(self, editor, model, index):
if index.column() in (MOD1, MOD2, MOD3, KEY):
model.setData(index, to_qvariant(editor.currentText()))
else:
QItemDelegate.setModelData(self, editor, model, index)
开发者ID:jromang,项目名称:spyderlib,代码行数:5,代码来源:shortcuts.py
示例7: __init__
def __init__(self, parent=None):
QItemDelegate.__init__(self, parent)
self.modifiers = sorted(Key.MODIFIERNAMES.values())
self.mod = None
self.keys = sorted(Key.KEYS.values())
self.key = None
开发者ID:jromang,项目名称:spyderlib,代码行数:6,代码来源:shortcuts.py
注:本文中的spyderlib.qt.QtGui.QItemDelegate类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论