[Qt-interest] QGraphicsTextItem andMouseTracking

David Heremans david.heremans at intersoft-electronics.com
Thu Mar 17 14:30:30 CET 2011


Either I ran into a bug, or I'm missing some crucial info in
understanding this behavior.

I'm implementing a GUI utilizing the QGraphicsFrameWork and I ran into
the following problem....

Under normal circumstances my QGraphicsScene only receives calls to
mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent) when the
mousebutton is pressed. However, if I add a QGraphicsTextItem to the
QGraphicsScene it seems the the QGraphicsView has its mouse tracking
enabled, thus I get constant calls to the mouseMoveEvent() when my
cursor is over my view even if no buttons are pressed.

Is this intended behavior ? Shouldn't it be more logical that, if the
QGraphicsTextItem needs it while editing, the mouse tracking should be
restored to its previous state once editing is done or the focus is lost?
Can somebody enlighten me please.

regards,

David H


PS: I tried adding
foreach(QGraphicsView *view , views()){
                view->setMouseTracking(false);
            };
directly after the addItem() call where I add the QGraphicsTextItem to
the scene but this has no effect?





More information about the Qt-interest-old mailing list