I'm trying to do this with PySide 1.2 and Python 2.73.
Here's my equivalent code:
class AssetTableModel(QtCore.QAbstractTableModel):
# ...
def data(self, index, role):
if not index.isValid():
return None
item = self.getItemFromIndex(index)
if role == QtCore.Qt.DisplayRole or role == QtCore.Qt.EditRole:
return item.qt_data(index.column())
if role == QtCore.Qt.ForegroundRole:
color = item.qt_foreColor()
if color is None:
# the following line is causing the error
return QtCore.QAbstractTableModel.data(self, index, role)
return QtGui.QBrush(color)
This is the error I'm obtaining:
NotImplementedError: pure virtual method 'QAbstractItemModel.data()' not implemented.
I tried returning QtCore.QAbstractItemModel.data(self, index, role) and it still reports an error. I'm doing this sort of thing for Delegates without an issue, and it seems to follow what I'm seeing in the above C++ example.
What should I be doing instead if this is indeed unsupported? I know I can change the condition to:
if role == QtCore.Qt.ForegroundRole and item.qt_foreColor():
However let's say I'd like to catch the Style color and modify it (change the alpha or darken). How do I go about this in PySide?