O'Reilly logo

Game Programming using Qt 5 Beginner's Guide - Second Edition by Lorenz Haas, Witold Wysota, Pavel Strakhov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required