Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

Access to item inside a GridView

$
0
0
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 :/

Viewing all articles
Browse latest Browse all 4972

Trending Articles