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

Property MouseArea for each ListElement

$
0
0
Hello! I am a beginner user of Qt Project. Can’t add a property for each element on ListModel. Code: Rectangle {             id: settings             x: 0             y: parent.height/10             width: parent.width/4*3             height: parent.height/10*9             color: "black"             opacity: 0.5             visible: false             ListView {                 id: settingList                 x:0                 y:0                 width: parent.width                 height: parent.height                 model: ListModel {                     ListElement {                         name: "one"                     }                     ListElement {                         name: "two"                     }                     ListElement {                         name: "three"                     }                     ListElement {                         name: "four"                     }                     ListElement {                         name: "five"                     }                 }                 delegate: Item {                     width: settings.width                     height: 30                     Row {                         id: settingRow                         Rectangle {                             id: selectSetting                             width:settings.width                             height: 30                             color: "#00000000"                             Rectangle {                                 y: 30                                 width: settings.width                                 height: 1                                 color: "black"                             }                             Text {                                 text: name                                 font.bold: true                                 anchors.verticalCenter: parent.verticalCenter                             }                         }                     }                 }             }         } I want the property to be individualized for each list item. For example: Element “one” MouseArea { OnClicked: { function1} } Element “two” MouseArea { OnClicked: { function2 } }

Viewing all articles
Browse latest Browse all 4972

Trending Articles