2D canvas in QML
In all the previous examples of this chapter, we have discussed the methods and techniques used to render 2D graphics with Qt's C++ API. However, we have yet to learn how to achieve similar results using the powerful QML script.
How to do it…
In this project, we'll be do something quite different:
- As usual, the first step we should do is to create a new project by going to File | New File or Project and selecting Qt Quick Application as the project template.
- Once you are done creating the new project, open up
qml.qrc
from theResource
folder in the project pane by right-clicking on it and selecting Open in Editor. Then, removeMainForm.ui.qml
from your project's resources, as we don't need it for this project: - Next, open up
main.qml ...
Get Qt5 C++ GUI Programming Cookbook 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.