Commit 9ce5de77 authored by Maximilian Ernestus's avatar Maximilian Ernestus

missing item delegates

parent 1e42785e
from PyQt4.Qt import QStyledItemDelegate, QWidget, QModelIndex, QVariant, QStyleOptionViewItem
from PyQt4.QtGui import QLineEdit
from PyQt4 import QtCore
class ValueItemDelegate(QStyledItemDelegate):
"""
A version of the QStyledItemDelegate which ignores setEditorData and only sets the editor data during creation of
the editor.
"""
def __init__(self, parent=None):
QStyledItemDelegate.__init__(self, parent)
def setEditorData(self, widget, model_idx):
# type: (QWidget, QModelIndex) -> None
pass
def createEditor(self, widget, style_option, model_idx):
# type: (QWidget, QStyleOptionViewItem, QModelIndex) -> object
editor = QStyledItemDelegate.createEditor(self, widget, style_option, model_idx)
editor.setText(model_idx.data(QtCore.Qt.EditRole).toString())
return editor
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment