Unsolved Change QML item property in c++ code
-
Hi,
at the moment I am working on my first QML/QtQuick project. I create a forumlar / UI with some text items and textedit items. How can I change the content of the textedit item in my c++ code?Thank you for your help.
BR
martin -
Hi
Its described here
http://doc.qt.io/qt-5/qtqml-cppintegration-interactqmlfromcpp.htmlI think you are looking for the section with
QQuickItem item = qobject_cast<QQuickItem>(object); -
Hi,
ok I found it. That meens that I have to create a new QQuickItem for every item, which I want to change it?
I want to change a item with a id, so I think I need this one?
@
QObject rect = object->findChild<QObject>("rect");
if (rect)
rect->setProperty("color", "red");
@BR
martin -
Hi
The sample you shown searches for QObject named "rect"So yes, you would search for all this way but you can use a function wrapper so its
very compact.