I'm getting this error when trying to emit dataChanged
signal:
self.dataChanged.emit(index, index)
TypeError: Value types used on meta functions (including signals) need to be registered on meta type: QModelIndex
Here is the relevant part of my QAbstractItemModel
subclass:
class PropertyItemModel(QtCore.QAbstractItemModel):
def __init__(self, parent=None):
super(PropertyItemModel, self).__init__(parent)
def setData(self, index, value, role=Qt.EditRole):
if role != Qt.EditRole:
return False
item = self.getItem(index)
result = item.setData(index.column(), value)
if result:
self.dataChanged.emit(index, index)
# Doesn't work either (same error):
# self.emit(QtCore.SIGNAL("dataChanged(QModelIndex, QModelIndex)"), index, index)
# QtCore.QObject.emit(self, QtCore.SIGNAL("dataChanged(const QModelIndex&, const QModelIndex&)"), index, index)
return result
I'm using PySide version 1.2.1 with Qt 4.8.5 on Mac OS X (10.10). The error can be related with my specific environment. This code was working on another mac.
Indeed, this was caused by installation conflicts. I've had different flavours of python (system, brew, package from official site).
Fresh install using homebrew fixed the problem.