Tutorial by Examples

Register C++ classes in QML At C++ side, imagine we have a class named QmlCppBridge, it implements a method called printHello(). class QmlCppBridge : public QObject { Q_OBJECT public: Q_INVOKABLE static void printHello() { qDebug() << "Hello, QML!"; } }; ...
To call the QML classes in C++, you need to set the objectName property. In your Qml: import QtQuick.Controls 2.0 Button { objectName: "buttonTest" } Then, in your C++, you can get the object with QObject.FindChild<QObject*>(QString) Like that: QQmlApplicationEngine e...

Page 1 of 1