How to Pass values from C++ to QML in a QT widget application
Unsolved
QML and Qt Quick
-
I am beginner to Qt , I am facing issue on transmitting value from C++ to QML,
I am able to get the value from QT UI but I can't able to emit that ,
And in QML i am getting error called
ReferenceError: <class given in setContextProperty > is not defined
I was stuck here , help me in this -
.h signals: void attendanceSet(QString Stirng01); .cpp this->rootContext()->setContextProperty("MyClass", this); this->load(QUrl(QStringLiteral("qrc:///Qml/main.qml"))); .ccp (in a timer) emit attendanceSet("Hello"); .qml Connections { target: MyClass onAttendanceSet: attendanceSet(Stirng01); } function attendanceSet(Stirng01) { console.log(Stirng01) }