Game Programming using Qt 5 Beginner's Guide - Second Edition
by Pavel Strakhov, Witold Wysota, Lorenz Haas
What just happened?
Rendering in Qt Quick can happen in a thread different that is than the main thread. Before calling the updatePaintNode() function, Qt performs synchronization between the GUI thread and the rendering thread to allow us safely access our item's data and other objects living in the main thread. The function executing the main thread is blocked while this function executes, so it is crucial that it executes as quickly as possible and doesn't do any unnecessary calculations as this directly influences performance. This is also the only place in your code where at the same time you can safely call functions from your item (such as reading properties) and interact with the scene-graph (creating and updating the nodes). Try ...
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