[Qt-interest] setMouseTracking

Nikos Chantziaras realnc at arcor.de
Thu Jan 6 00:00:21 CET 2011


On 01/06/2011 12:29 AM, "Alexander Carôt" wrote:
>> window I setMouseTracking to true. Does this help to clarify the problem ?
>>
>> Try setting it on every widget, not just the main window.
>
> ... allright, this results in in the following: The mouseMoveEvent-Handler is only triggered whenever the mouse moves within the widgets but not in the remaining areas of the main window.
>
> At least that's progress but if anyone knows how this works for the whole application window and *ideally* also for the whole screen even if the mouse is not within an app window, so please let me know.
>
> In fact what I want to achieve is grabbing the current mouse coordinates no matter how large or where my app window is. I wonder if this is possible at all.

Does your main window derive from QMainWindow or just QWidget?  If not, 
what happens if you create a QMainWindow and set your current "main 
window" widget as the QMainWindow's centralWidget()?  I believe this 
should work (and is the common way of implementing a top level 
application window.)



More information about the Qt-interest-old mailing list