Accessing either one of two components
Unsolved
QML and Qt Quick
-
Hi,
What's the preferred way of accessing either one of of two rectangle items?
I "instantiate" a rectangle component (which contains other rectangles and an image) twice -> idRect1, idRect2.
Depending on some conditions, that are evaluated in JS i would like to access either one of the rectangles. Then, i need to:- read and set properties
- update bindings
So far i am using code like shown below. This seems to work, but is very prone to weird conditions. My code seems to "overwrite" properties of the not selected component.
idRectX = idRect1 idRectX.property1 = 111 idRectX.anchors.horizontalCenter = Qt.binding(function() {return idRoot.horizontalCenter})
Thanks for your help,
Ben -
Good idea, i will try that as soon as i find some spare time.
Though, that cannot be the final solution. I would have to copy too much code.
So, what's the right way of doing it?
1/3