[Qt-interest] QGraphicsView::mouseMoveEvent not called after view tranform change (Qt-4.5.2)
r
nbs.public at gmail.com
Mon Feb 8 18:34:58 CET 2010
Sorry for the late response and thanks for all the clues.
I've checked that Lorenzo's solution (that using QGraphicsScene's
mouseMoveEvent) indeed works. I.e., the event handler is also called
when the transform changes.
So there is some inconsistency in the way QGraphicsScene and
QGraphicsView handle events. Personally I prefer the QGraphicsScene
behaviour. MouseMoveEvent should be generated whenever the mouse
position changes in _respect to the view_, which necessarily includes
transform changes.
Thanks again,
-r.
On Fri, Feb 5, 2010 at 8:25 AM, Malyushytsky, Alex <alex at wai.com> wrote:
> You can create and send/post an event any time you need an update,
> but there is no any reason for mouseMoveEvent to be generated,
> if mouse was not moved, so I doubt QT will ever do it for you.
>
> Mouse move is a result of mouse movement, nothing else.
>
> It is a good idea to place the code which synchronize information you want to display with
> current cursor position.
>
> And if you need function synchronize () to be called when mouseMoveEvent is received,
> view was moved or scaled, etc, make sure you call such function
> one or another way ( from the MouseMoveEvent handler, from your custom slots, etc )
> as a result of any such event.
>
> Regards,
> Alex
>
>
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of r
> Sent: Wednesday, February 03, 2010 10:19 PM
> To: qt-interest
> Subject: [Qt-interest] QGraphicsView::mouseMoveEvent not called after view tranform change (Qt-4.5.2)
>
> I'm reimplementing QGraphicsView::mouseMoveEvent to detect mouse hover
> on certain items. This works fine unless I change the view transform
> (e.g. move or rescale the view with a keyboard action). Since this
> doesn't trigger the execution of the mouseMoveEvent method my visual
> hover indicators are no longer in sync with the actual mouse cursor
> position. Tested with Qt-4.5.2.
>
> Would it be possible to emit such an event in future versions of Qt?
> What would be the best work-around for Qt-4.5/4.6? I imagine I can
> simply manually emit such an event from the code changing view
> transform.
>
> Cheers,
> -r.
More information about the Qt-interest-old
mailing list