Integrating QML and C++
Qt supports bridging between C++ classes with the QML engine. This combination allows developers to take advantage of both the simplicity of QML and the flexibility of C++. You can even integrate features that are not supported by Qt from an external library, then pass the resulting data to Qt Quick to be displayed in the UI. In this example, we will learn how to export our UI components from QML to the C++ framework and manipulate their properties before displaying them on screen.
How to do it…
- Once again, we will start everything from scratch. Therefore, create a new Qt Quick application project in Qt Creator and open up
MainForm.ui.qml
. - We can keep the mouse area and text widget, but place the text widget at the bottom ...
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.