當前位置: 首頁>>代碼示例>>Python>>正文


Python QtGui.QItemDelegate類代碼示例

本文整理匯總了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;未經允許,請勿轉載。