View Full Version : The Mystery of MouseMove Signals

28th June 2012, 21:39
So I'm putting together a presentation based on what I've been up in Qt the past couple of weeks and ran into something I haven't figured out yet:

How Qt tracks mouse movement events.

My theory at the moment is that since the QApplication (presumably) handles all the mouse input; that it then distributes it to it's current window (all windows? non modal?) (which then propagates the mouse-move-event to it's children where applicable.)

Does this sound about right?

Any expansion on this discussion to push me in the right direction or verify my thoughts is very welcome and appreciated,

29th June 2012, 01:18
Native mouse events are received from the operating system by the active application. The event eventually reaches Qt's event dispatcher that maps the data received to the widget under those coordinates. Then it places an event into the event loop. Eventually this event is processed and reaches the destination mouse event handler through a series of calls to QCoreApplication::notify(), QObject::event() and QWidget::mouseMoveEvent() (optionally going through installed event filters).

29th June 2012, 18:45
I just read "notify()" and then investigated into labels.
*Mind Blown*

That was my mouse problem! Labels actually *do* care about mouse signals because they need to check if they are editable or not. Had they had no use for the signal (it sounds like) they would have ignored it. It looks like it's doing nothing because I had several variables/flags on that made it do nothing, but it captured the event because it needs to.

Notify() and such make sense though; as a means in which the event is propagated.

As a side note, I didn't meant to imply the OS didn't process the mouse/keyboard input and decide who to send it to; I meant after Qt got ahold of it.