aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/quickcontrols2/contactlist/ContactDelegate.ui.qml24
1 files changed, 5 insertions, 19 deletions
diff --git a/examples/quickcontrols2/contactlist/ContactDelegate.ui.qml b/examples/quickcontrols2/contactlist/ContactDelegate.ui.qml
index 0ca9cedc..fb3d88eb 100644
--- a/examples/quickcontrols2/contactlist/ContactDelegate.ui.qml
+++ b/examples/quickcontrols2/contactlist/ContactDelegate.ui.qml
@@ -51,8 +51,10 @@
import QtQuick 2.7
import QtQuick.Controls 2.1
-Item {
+AbstractButton {
clip: true
+ checkable: true
+ autoExclusive: true
id: delegate
@@ -61,22 +63,6 @@ Item {
property alias edit: edit
width: 300
- MouseArea {
- id: mouseArea
- anchors.fill: parent
- }
-
- Connections {
- target: mouseArea
-
- onClicked: {
- if (delegate.ListView.view.currentIndex === index)
- delegate.ListView.view.currentIndex = -1
- else
- delegate.ListView.view.currentIndex = index
- }
- }
-
Column {
id: column1
height: 400
@@ -174,11 +160,11 @@ Item {
states: [
State {
name: "collapsed"
- when: !delegate.ListView.isCurrentItem
+ when: !delegate.checked
},
State {
name: "expanded"
- when: delegate.ListView.isCurrentItem
+ when: delegate.checked
PropertyChanges {
target: delegate