I have a gridview with images. When an image is clicked a dialog appears, which is defined outside of the gridview. When the dialog is clicked, the state of the previously clicked image should be changed. How can I achieve this?
Example code:
Rectangle {
ListModel {
id: gridModel
ListElement{
imageSource: ""
}
}
Component {
id: gridDelegate
Item{
Image {
source: imageSource
MouseArea{
anchors.fill: parent
onClicked: dialog.visible = true
}
}
}
}
GridView {
model: gridModel
delegate: gridDelegate
}
Rectangle {
id: dialog
Button {
onClick: {
//change state of clicked image here//
dialog.visible = false;
}
}
}
}
Somehow the spaces are messed up in the code exampe :/
↧