Custom OpenGL-based Qt Quick items

In Chapter 12, Customization in Qt Quick, we learned to create new QML element types that can be used to provide dynamic data engines or some other type of non-visual objects. Now we will see how to provide new types of visual items to Qt Quick.

The first question you should ask yourself is whether you really need a new type of item. Maybe you can achieve the same goal with the already existing elements? Very often, you can use vector or bitmap images to add custom shapes to your applications, or you can use Canvas to quickly draw the graphics you need directly in QML.

If you decide that you do require custom items, you will be doing that by implementing subclasses of the QQuickItem C++ class, which is the ...

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.