Game Programming using Qt 5 Beginner's Guide - Second Edition
by Pavel Strakhov, Witold Wysota, Lorenz Haas
Events
Any GUI application needs to react to the input events. We are already familiar with the signals and slots mechanism in QObject-based classes. However, QObject is not exactly a lightweight class. Signals and slots are powerful and convenient for connecting parts of the application, but invoking a signal for processing each keyboard press or mouse move will be too inefficient. To process such events, Qt has a special system that uses the QEvent class.
The dispatcher of the events is the event loop. Almost any Qt application uses the main event loop that is started by calling QCoreApplication::exec at the end of the main() function. While the application is running, the control flow is either in your code (that is, in the implementation ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access