Gday,
I have subclassed QGraphicsPixmapItem in order to link the position of the item directly to a data model (subclassed from QAbstractItemModel).
I have overridden pos to return values from the model using appropriate QModelIndex objects (I am using PySide for Qt 4.8):
def pos(self):
x = self.model.data(self.x_index)
y = self.model.data(self.y_index)
def pos(self):
x = self.model.data(self.x_index)
y = self.model.data(self.y_index)
return QPointF(x, y)
To copy to clipboard, switch view to plain text mode
However, pos is never called! I assumed the view (via the scene) would call pos for each item when drawing, however from the source it looks like the view/scene gets the position of a QGraphicsItem directly through 'd_ptr'.
Is what I am trying to do possible? I was hoping there was some method that would form the single point of access to pos but it looks like this is not the case.
Thanks in advance
Bookmarks