Unsolved Change property value from c++
-
Hi guys i need some help.
How to change QML property value from c++ ?
//main.cpp QQmlContext *ctx = engine.rootContext(); ctx->setContextProperty("control",&allofthem); ctx->setProperty("text","Qt Everywhere"); engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
//main.qml property string text . . . console.log(text)
Result
-
@w00t1234 You should set the property after loading the QML.
-
@p3c0 said in Change property value from c++:
@w00t1234 You should set the property after loading the QML.
It's not work
-
When are you printing the text? Use
onTextChanged
signal handler and print the text there. -
@p3c0 said in Change property value from c++:
When are you printing the text? Use
onTextChanged
signal handler and print the text there.Please example
-
Can you post your QML file ?