本文整理汇总了Python中PyQt4.QtGui.QItemDelegate.setModelData方法的典型用法代码示例。如果您正苦于以下问题:Python QItemDelegate.setModelData方法的具体用法?Python QItemDelegate.setModelData怎么用?Python QItemDelegate.setModelData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QItemDelegate
的用法示例。
在下文中一共展示了QItemDelegate.setModelData方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setModelData
# 需要导入模块: from PyQt4.QtGui import QItemDelegate [as 别名]
# 或者: from PyQt4.QtGui.QItemDelegate import setModelData [as 别名]
def setModelData(self,editor,model,index):
"""Save value changes"""
if index.column() == 1:
value, ok = editor.itemData(editor.currentIndex()).toInt()
model.setData(index,QVariant(value),Qt.EditRole)
else:
QItemDelegate.setModelData(self,editor,model,index)
示例2: setModelData
# 需要导入模块: from PyQt4.QtGui import QItemDelegate [as 别名]
# 或者: from PyQt4.QtGui.QItemDelegate import setModelData [as 别名]
def setModelData(self, editor, model, index):
""" save data from editor back to model """
if index.column() == self.column:
model.setData(index, editor.currentText())
else:
# use default
QItemDelegate.setModelData(self, editor, model, index)
示例3: setModelData
# 需要导入模块: from PyQt4.QtGui import QItemDelegate [as 别名]
# 或者: from PyQt4.QtGui.QItemDelegate import setModelData [as 别名]
def setModelData(self, editor, model, index):
""" save data from editor back to model """
if index.column() == 1:
model.setData(index, editor.currentText())
else:
# use default
QItemDelegate.setModelData(self, editor, model, index)
if index.column() == 0:
self.emit(SIGNAL("columnNameChanged()"))
示例4: setModelData
# 需要导入模块: from PyQt4.QtGui import QItemDelegate [as 别名]
# 或者: from PyQt4.QtGui.QItemDelegate import setModelData [as 别名]
def setModelData(self, editor, model, index):
if isinstance(editor, QComboBox):
model.setData(index, QVariant(editor.currentText()), Qt.EditRole)
elif isinstance(editor, QTextEdit):
model.setData(index, QVariant(editor.toPlainText()), Qt.EditRole)
else:
return QItemDelegate.setModelData(self, editor, model, index)
示例5: setModelData
# 需要导入模块: from PyQt4.QtGui import QItemDelegate [as 别名]
# 或者: from PyQt4.QtGui.QItemDelegate import setModelData [as 别名]
def setModelData(self, QWidget, QAbstractItemModel, QModelIndex):
QItemDelegate.setModelData(self, QWidget, QAbstractItemModel, QModelIndex)
示例6: setModelData
# 需要导入模块: from PyQt4.QtGui import QItemDelegate [as 别名]
# 或者: from PyQt4.QtGui.QItemDelegate import setModelData [as 别名]
def setModelData(self, editor, model, index):
if isinstance(editor, QComboBox):
self.comboDel.setModelData(editor, model, index)
else:
QItemDelegate.setModelData(self, editor, model, index)
示例7: setModelData
# 需要导入模块: from PyQt4.QtGui import QItemDelegate [as 别名]
# 或者: from PyQt4.QtGui.QItemDelegate import setModelData [as 别名]
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)
示例8: setModelData
# 需要导入模块: from PyQt4.QtGui import QItemDelegate [as 别名]
# 或者: from PyQt4.QtGui.QItemDelegate import setModelData [as 别名]
def setModelData(self, editor, model, index):
""" PyQt API Method -- See the PyQt documentation for a description """
if type(editor) == QComboBox:
model.setData(index, QVariant(editor.currentText()), Qt.EditRole)
else:
QItemDelegate.setModelData(self, editor, model, index)
示例9: setModelData
# 需要导入模块: from PyQt4.QtGui import QItemDelegate [as 别名]
# 或者: from PyQt4.QtGui.QItemDelegate import setModelData [as 别名]
def setModelData(self, editor, model, index):
delegate = self.delegates.get(index.column())
if delegate is not None:
delegate.setModelData(editor, model, index)
else:
QItemDelegate.setModelData(self, editor, model, index)