Eventloop/Event dispatching
-
Hello!
I know the events are being dispatched to the low level widgets, then depending on their acceptance, they bubble up in the parent tree.
There is this piece of information that puzzles me and can't seem to find the answer:
How does an event, lets say mouseMove or mousePressed, make its way from the QGuiApplication::exec/EventLoop to the appropriate widget, be it a QPushButton?I tried to follow the source code in QGuiApplication and found this QGuiApplicationPrivate::processMouseEvent.
In here I see that it queries the top level window under the mouse coords.
Then went over to the QMainWindow implementation but I can't seem to find specific handling for mouse events.Can you give me some pointers or brief description on how an event loop event actually reaches the appropriate widget handler?
Thanks!
-
@AlexandruS said in Eventloop/Event dispatching:
Can you give me some pointers
Read here.
And this sections says that key and mouse events originate from the window system that you are using. Then it's the same as for any other events. The event is created and send to the event location where it happened. The widget's
event()
handler receives it first, then calling the appropriate more specific handlers likemouseDoubleClickEvent
or something.