This is done by calling the QObject’s event() function (thus QEvents are expected to be handled by QObjects). When it detects such stimuli, it creates an instance of a QEvent and directs it at the QObject instance that’s at the top of the object tree. Once started, the loop repeatedly checks for something to happen in the system, such as user-input through keyboard/mouse. Qt’s event loop starts the moment the underlying application’s exec() function gets called.
I had a bit of trouble wrapping my head around the idea of Qt’s event loop and how it relates to the signals and slots mechanism.