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