How to access a specific component
Unsolved
QML and Qt Quick
-
Hi
I wrote a litte qml application which will create an Object of a Component every time a button is clicked.import QtQuick 2.6 import QtQuick.Window 2.2 Window { id: mainWindow visible: true width: 1280 height: 720 property int idNumberCounter: 1 Component { id: testComponent Rectangle { id: rectangleMade property int idNumber: 0 width: 100 height: 100 x: 100*idNumber border.color: "blue" } } //The button for creating Rectangle { id: buttonMakeRectangle color: "red" width: 50 height: 50 MouseArea { anchors.fill: parent onClicked: { testComponent.createObject(mainWindow,{idNumber:mainWindow.idNumberCounter}); mainWindow.idNumberCounter++; } } } }
What I would like to do now is to have a second button, which will e.g. change the x-Value of the rectangle with the idNumber=3 (if available).
Is there a way to access a specific component?
FYI: Adding a MouseArea to the "rectagleMade" and simply perfom the work there is not possible, because in the real application this rectangles are controlled via dBus from another application. (it will be a windowing manager with QtWayland)
Thanks for help
Thorsten
-
@outdoor_guy Check if you can add these newly created objects in a
property variant
and then later access it.