[Interest] famous issue : setMouseTracking

Bo Thorsen bo at vikingsoft.eu
Tue Mar 8 15:40:45 CET 2016


Den 04-03-2016 kl. 13:59 skrev Nicolas Jäger:
> hi,
>
>>> 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).
> yes it's doesn't sound right,that's why I try to figure what's going on. You can easily find some
> topics about that problem on internet.

You normally get mouseMoveEvent when someone clicked inside your widget, 
until the time when the mouse buttons are all released.

Setting mouse tracking to true means you get the mouse move events 
always, no matter where they are.

>>>   I set the SetMouseTracking to true when the mouse enters the widget, and

Don't do that. Set it to true always and filter the events.

>> 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  settled to true. and I
>> want to use it for several widgets.

That isn't correct. You can set multiple to true at the same time.

And for one of the other posters: I would be extremely surprised if 
there are any bugs with this. Doing this has worked from the very early 
days of Qt.

You should assume the bug is in your code.

Bo Thorsen,
Director, Viking Software.

-- 
Viking Software
Qt and C++ developers for hire
http://www.vikingsoft.eu



More information about the Interest mailing list