[Interest] Adding QML code from C++ at runtime
boucard_olivier at yahoo.fr
Fri Dec 5 16:49:18 CET 2014
I think you are going in the wrong direction by trying to directly modify the QML from the C++ code.Normally, QML is great because it helps to better separate the functionalities (C++) from the UI (QML).
Le Vendredi 5 décembre 2014 12h20, Alexander Syvak <alexander.svk at gmail.com> a écrit :
here's the code attached to the e-mail.
In the method woman::add_hip() I need to add a button which refers to existing QML objects in main.qml.
In main.cpp the context and window are set to a global variable which is accessed in the method woman::add_hip().
However, after instantiating the button in the context (which is a global variable) there're errors
<Unknown File>: QML Button: Cannot anchor to an item that isn't a parent or sibling.<Unknown File>: QML Button: Cannot anchor to an item that isn't a parent or sibling.<Unknown File>: Unable to assign QQuickWindowQmlImpl to QQuickItem
How to achieve valid referencing from a dynamically created component in C++?
Interest mailing list
Interest at qt-project.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Interest