See the example in QGraphicsItem::itemChange() documentation.