Okay so I've added the following:
QVariant ShipPart
::itemChange ( GraphicsItemChange change,
const QVariant & value
) {
if (change == ItemPositionChange && scene())
{
//Stuff will happen here
}
}
QVariant ShipPart::itemChange ( GraphicsItemChange change, const QVariant & value )
{
if (change == ItemPositionChange && scene())
{
QPointF newPos = value.toPointF();
//Stuff will happen here
}
return QGraphicsItem::itemChange(change, value);
}
To copy to clipboard, switch view to plain text mode
In debugging, I've found that the itemChange function gets called when I first add the item to the scene, as well as when I first make it visible. But when I move the item or just change it's position, it doesn't get called at all. Is that normal?
Bookmarks