[Interest] famous issue : setMouseTracking

Nye kshegunov at gmail.com
Fri Mar 4 09:22:41 CET 2016


Hello Nicolas,

> if some widget has the setMouseTracking set to true, the event
mouseMoveEvent is detected only when a clicked is perfomed.

This doesn't sound right, enabling the mouse tracking causes mouse move
events to be dispatched to the widget without the need to have a mouse
click (provided the mouse is hovering over the widget, if not, mouse
tracking doesn't do you any good).

>  I set the SetMouseTracking to true when the mouse enters the widget, and
I set it to false when the mouse leave the widget. The reason I do that, I
read somewhere on internet (I didn't kept the link sry) that only one
widget at a time can truly have setMouseTracking settled to true. and I
want to use it for several widgets.

No need to do that. Just enable the mouse tracking for whichever widget you
want to receive the mouse move events. I believe you're confusing the mouse
tracking with grabbing the mouse, which is exclusive.

Kind regards,
Konstantin.

On Fri, Mar 4, 2016 at 3:45 AM, Nicolas Jäger <jagernicolas at legtux.org>
wrote:

> Hi,
>   I have a question many time asked on internet, why even if some widget
> has the setMouseTracking
>   set to true, the event mouseMoveEvent is detected only when a clicked is
> perfomed.
>
>   I don't just setMouseTracking, I did a grep over the whole project to be
> sure that there is no
>   other SetMouseTracking.
>
>   Also, I set the SetMouseTracking to true when the mouse enters the
> widget, and I set it to false
>   when the mouse leave the widget. The reason I do that, I read somewhere
> on internet (I didn't
>   kept the link sry) that only one widget at a time can truly have
> setMouseTracking settled to
>   true. and I want to use it for several widgets.
>
>   in my mouse move event function,I added some qDebug() <<
> hasMouseTracking() who always returns
>   true when the event is performed (by clicking).I also added som
> qDebug()s in enter/leave events
>   functions. everybody looks fine but I don't have my mouseMoveEvent
> performed.
>
>   I really would like to solve this issue wich is really annoying in my
> case. I don't know if I
>   misunderstood something or what-what...
>
>   or is it a bug ?
>
> Regards,
> Nicolas
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160304/32ed00e3/attachment.html>


More information about the Interest mailing list