How to quantize the position of multiple QGraphicsItems while dragging the mouse in a QGraphicsView?

Take a look at overriding the QGraphicsItem::itemChange protected function. From there you can be notified when an item position is about to change ( QGraphicsItem::ItemPositionChange ) and have the opportunity to modify the value. This method is called no matter how the change was initiated (mouse move, part of group, set in code, etc.).

Take a look at overriding the QGraphicsItem::itemChange protected function. From there you can be notified when an item position is about to change (QGraphicsItem::ItemPositionChange) and have the opportunity to modify the value. This method is called no matter how the change was initiated (mouse move, part of group, set in code, etc.) I suspect part of your problem is that QGraphicsItem::setPos() is not virtual, which means that your setPos() function will not be called if a caller is treating an instance of your MutaEvent* as a QGraphicsItem*.

This would be the case everywhere in the Qt framework since, of course, they have no knowledge of your MutaEvent class. This is why they provide the virtual itemChange method.

SetPos() is called on each selected item so if not it would just use the default implementation. You might need to implement your own mouse event handling if you want it to work properly (and by the way, calling setPos(pos()) in MutaEvent::mouseMoveEvent will have no effect).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions