Commication between two qml files with repeater/list view
-
wrote on 30 Dec 2022, 10:53 last edited by
I'm developing an app and I am new to qml, I want to change the color of a rectangle when the particular button is clicked from another page, the rectangles are dynamic, I might use list view or repeater to call the 2nd page, number rect in page 2 = number of buttons in page1.
page1:
ListView { id: sprayerSettingsListView anchors.fill: parent model: sprayerSettingListModelId orientation: Qt.Horizontal interactive: false delegate: Booms_test { // another page onClickedBoom: sprayerSettingsListView.currentIndex = index totalListElement: sprayerSettingsListView.count } focus: true } //list model ListElement { rects: 10 }
page2:
Row { spacing:10 Repeater { id: nozzlerRepeater model: rects Rectangle { id: smallNozlesRectId height: 15 width: 10 color: "green" } } }
here I have 10 rects (from repeater/ list view) and 10 buttons in page 1 how do I change color of rect 1 in page 2 when butoon 1 clicked in page 1 ?
-
I'm developing an app and I am new to qml, I want to change the color of a rectangle when the particular button is clicked from another page, the rectangles are dynamic, I might use list view or repeater to call the 2nd page, number rect in page 2 = number of buttons in page1.
page1:
ListView { id: sprayerSettingsListView anchors.fill: parent model: sprayerSettingListModelId orientation: Qt.Horizontal interactive: false delegate: Booms_test { // another page onClickedBoom: sprayerSettingsListView.currentIndex = index totalListElement: sprayerSettingsListView.count } focus: true } //list model ListElement { rects: 10 }
page2:
Row { spacing:10 Repeater { id: nozzlerRepeater model: rects Rectangle { id: smallNozlesRectId height: 15 width: 10 color: "green" } } }
here I have 10 rects (from repeater/ list view) and 10 buttons in page 1 how do I change color of rect 1 in page 2 when butoon 1 clicked in page 1 ?
wrote on 30 Dec 2022, 12:47 last edited by@Prajwal what do you mean by pages here? I assume these components are managed by some top level component in which they are treated as "pages"? If that's the case, can you make the connections at that higher level? i.e bind a property or signal from one page to the other page?
1/2