Hi Alexander,
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).
In my opinion, you should try to represent your "woman" object as a model 
exposed to the QML.And then deal with adding the item directly in QML with a 
Model View, in worse case with some Javascript.It will be way cleaner and 
easier.
Olivier
 

     Le Vendredi 5 décembre 2014 12h20, Alexander Syvak 
<[email protected]> a écrit :
   

 Hi,
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
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest


   
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to