PDA

View Full Version : reimplementing mouseMoveEvent of QGraphicsItem



MTW
18th December 2010, 18:12
Hi there,

I have a question to QGraphicsSceneMouseEvents. I have several QGraphicsItems and I want to detect whether the items are colliding and if so move them in a certain way, so I reimplemented QGraphicsItem's mouseMoveEvent(QGraphicsSceneMouseEvent *event) to move the item in my own function. But it seems that the basic move implementation of QGraphicsItem::mouseMoveEvent() is still called despite I don't call it in my reimplemented moveEvent.
When I comment my own move function out the item is still moved. So how can I explicitly block the execution of the standard implementation? Or do I have to change something in my graphicsScene? I have my own QGraphicsScene but I haven't reimplemented the mouseMoveEvent() of the graphicsScene, maybe I have to do that, can you provide me any hints?
If I forgot any important info please let me know.

Thanks a lot in advance!:)

Lykurg
18th December 2010, 18:45
You don't move a item with mouseMoveEvent()! It is mainly done in setPos().