How is QApplication notified by the window system?
I started learning Qt with C++ and I trying to figure out how the event mechanism works. I kind of understand how it works within the application itself (signals,slots) and how QApplication handles the events and queue them for processing and notifying objects/widgets about them.
I still have some open questions though:
My understanding is the QApplication is the first object in my program that gets notified about new events. Is that correct ?
How's the QApplication itself notified by the windowing system about new events(e.g:mouseMoveEvent) to queue them in the first place?
How does the windowing system know about the internal naming of my widgets, so that it can tell QApplication that widget "x" was clicked, focused, etc.
If the window system doesn't know the widget names or doesn't have a reference to the clicked widget (or any other kind of event), how does QApplication figure out which widget needs to be notified.
Thanks in advance for your help.
That would be specific for the system you're using Qt on. Qt uses whatever the native window system uses for this.
Note that Qt may choose to make a whole screen one big widget in terms of the OS, and handle all the focus stuff and event handling itself. So, there really isn't one simple answer to all your questions. But yes, your basic understanding is sound: the QApplication will interface with the native system to make sure it gets the right messages.