当前位置: 首页>>代码示例>>Python>>正文


Python QItemDelegate.setEditorData方法代码示例

本文整理汇总了Python中PyQt4.QtGui.QItemDelegate.setEditorData方法的典型用法代码示例。如果您正苦于以下问题:Python QItemDelegate.setEditorData方法的具体用法?Python QItemDelegate.setEditorData怎么用?Python QItemDelegate.setEditorData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtGui.QItemDelegate的用法示例。


在下文中一共展示了QItemDelegate.setEditorData方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setEditorData

# 需要导入模块: from PyQt4.QtGui import QItemDelegate [as 别名]
# 或者: from PyQt4.QtGui.QItemDelegate import setEditorData [as 别名]
 def setEditorData(self, editor, index):
     """ load data from model to editor """
     m = index.model()
     if index.column() == 1:
         txt = m.data(index, Qt.DisplayRole)
         editor.setEditText(txt)
     else:
         # use default
         QItemDelegate.setEditorData(self, editor, index)
开发者ID:Geoneer,项目名称:QGIS,代码行数:11,代码来源:dlg_create_table.py

示例2: setEditorData

# 需要导入模块: from PyQt4.QtGui import QItemDelegate [as 别名]
# 或者: from PyQt4.QtGui.QItemDelegate import setEditorData [as 别名]
 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:koll00,项目名称:Gui_SM,代码行数:11,代码来源:shortcuts.py

示例3: setEditorData

# 需要导入模块: from PyQt4.QtGui import QItemDelegate [as 别名]
# 或者: from PyQt4.QtGui.QItemDelegate import setEditorData [as 别名]
 def setEditorData(self,editor,index):
     """Set initial data for the editor"""
     if index.column() == 0:
         current = index.model().data(index,Qt.DisplayRole)
         editor.setText(current)
     elif index.column() == 1:
         current = index.model().data(index,Qt.DisplayRole)
         editor.setCurrentIndex(editor.findData(current))
     else:
         QItemDelegate.setEditorData(self,editor,index)
开发者ID:toyg,项目名称:plasmaapplets,代码行数:12,代码来源:main.py

示例4: setEditorData

# 需要导入模块: from PyQt4.QtGui import QItemDelegate [as 别名]
# 或者: from PyQt4.QtGui.QItemDelegate import setEditorData [as 别名]
 def setEditorData(self, editor, index):
     model = index.model()
     horse = model.horseList[index.row()]
     if model.isColumn("name", index):
         editor.setText(horse.name)
     elif model.isColumn("rating", index):
         ratingIndex = model.getColumn("rating", index)
         editor.setValue(horse[ratingIndex])
     elif model.isColumn("adjust", index):
         adjustIndex = model.getColumn("adjust", index)
         editor.setValue(model.race.adjusts.getAdjust(model.race.adjusts[adjustIndex], horse))
     else:
         QItemDelegate.setEditorData(self, editor, index)
开发者ID:Whatang,项目名称:QBetty,代码行数:15,代码来源:RaceDelegate.py

示例5: setEditorData

# 需要导入模块: from PyQt4.QtGui import QItemDelegate [as 别名]
# 或者: from PyQt4.QtGui.QItemDelegate import setEditorData [as 别名]
 def setEditorData(self, editor, index):
     """ load data from model to editor """
     m = index.model()
     try:
         if index.column() == self.column:
             txt = m.data(index, Qt.DisplayRole)
             checkList = txt[1:-1].split(',')
             for i in range(editor.count()):
                 item = editor.item(i)
                 item.setCheckState(Qt.Checked if item.text() in checkList else Qt.Unchecked)
         else:
             # use default
             QItemDelegate.setEditorData(self, editor, index)
     except:
         pass
开发者ID:alexdsz,项目名称:DsgTools,代码行数:17,代码来源:manageComplex.py

示例6: setEditorData

# 需要导入模块: from PyQt4.QtGui import QItemDelegate [as 别名]
# 或者: from PyQt4.QtGui.QItemDelegate import setEditorData [as 别名]
 def setEditorData(self, editor, index):
     if isinstance(editor, QComboBox):
         i = editor.findText(index.data(Qt.EditRole).toString())
         if i > -1:
             editor.setCurrentIndex(i)
         else:
             editor.setEditText(index.data(Qt.EditRole).toString())
         editor.lineEdit().selectAll()
     elif isinstance(editor, QTextEdit):
         editor.setText(index.data(Qt.EditRole).toString())
         editor.selectAll()
     else:
         return QItemDelegate.setEditorData(self, editor, index)
开发者ID:Araneidae,项目名称:iocbuilder,代码行数:15,代码来源:delegates.py

示例7: setEditorData

# 需要导入模块: from PyQt4.QtGui import QItemDelegate [as 别名]
# 或者: from PyQt4.QtGui.QItemDelegate import setEditorData [as 别名]
 def setEditorData(self, QWidget, QModelIndex):
     QItemDelegate.setEditorData(self, QWidget, QModelIndex)
开发者ID:SevenLines,项目名称:Python-Turing-Machine,代码行数:4,代码来源:header_delegate.py

示例8: setEditorData

# 需要导入模块: from PyQt4.QtGui import QItemDelegate [as 别名]
# 或者: from PyQt4.QtGui.QItemDelegate import setEditorData [as 别名]
 def setEditorData(self, editor, index):
     if isinstance(editor, QComboBox):
         self.comboDel.setEditorData(editor, index)
     else:
         QItemDelegate.setEditorData(self, editor, index)
开发者ID:cklb,项目名称:pymoskito,代码行数:7,代码来源:simulation_interface.py

示例9: setEditorData

# 需要导入模块: from PyQt4.QtGui import QItemDelegate [as 别名]
# 或者: from PyQt4.QtGui.QItemDelegate import setEditorData [as 别名]
 def setEditorData(self, editor, index):
     delegate = self.delegates.get(index.column())
     if delegate is not None:
         delegate.setEditorData(editor, index)
     else:
         QItemDelegate.setEditorData(self, editor, index)
开发者ID:maximerobin,项目名称:Ufwi,代码行数:8,代码来源:genericdelegates.py


注:本文中的PyQt4.QtGui.QItemDelegate.setEditorData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。