Change property value from c++
-
wrote on 3 Oct 2016, 15:49 last edited by w00t1234 10 Mar 2016, 16:03
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)
-
@w00t1234 You should set the property after loading the QML.
-
wrote on 3 Oct 2016, 16:46 last edited by
@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. -
wrote on 3 Oct 2016, 16:51 last edited by
@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 ?
1/6