Dynamic and lazy loading of QML objects

All our previous QML projects contain an explicit declaration of the object tree. We usually create a window and place multiple specific elements into it in specific order. The QML engine creates these objects on startup and keeps them alive until the application terminates. This is a very convenient approach that allows you to save a lot of time, as you could see in our previous examples. However, sometimes you need the object tree to be more flexible—for example, if you don't know upfront which elements should be created. QML offers a few ways to create objects dynamically and to delay creating an object until you really need it. Utilizing these features can make your QML application more performant ...

Get Game Programming using Qt 5 Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.