diff options
Diffstat (limited to 'examples/quickcontrols2/contactlist/ContactView.ui.qml')
-rw-r--r-- | examples/quickcontrols2/contactlist/ContactView.ui.qml | 69 |
1 files changed, 20 insertions, 49 deletions
diff --git a/examples/quickcontrols2/contactlist/ContactView.ui.qml b/examples/quickcontrols2/contactlist/ContactView.ui.qml index 30a72b65..2aaaa31d 100644 --- a/examples/quickcontrols2/contactlist/ContactView.ui.qml +++ b/examples/quickcontrols2/contactlist/ContactView.ui.qml @@ -52,65 +52,36 @@ import QtQuick 2.7 import QtQuick.Controls 2.1 import Backend 1.0 -Page { - id: page +ListView { + id: listView - signal addContact() - signal editContact(int index) - signal removeContact(int index) - - property alias model: contactModel + signal pressAndHold(int index) width: 320 height: 480 - ListView { - id: listView - anchors.fill: parent - - focus: true - boundsBehavior: Flickable.StopAtBounds - - section.property: "fullName" - section.criteria: ViewSection.FirstCharacter - section.delegate: SectionDelegate { - width: listView.width - } - - delegate: ContactDelegate { - id: delegate - width: listView.width + focus: true + boundsBehavior: Flickable.StopAtBounds - Connections { - target: delegate.edit - onClicked: page.editContact(index) - } + section.property: "fullName" + section.criteria: ViewSection.FirstCharacter + section.delegate: SectionDelegate { + width: listView.width + } - Connections { - target: delegate.remove - onClicked: page.removeContact(index) - } - } + delegate: ContactDelegate { + id: delegate + width: listView.width - model: ContactModel { - id: contactModel + Connections { + target: delegate + onPressAndHold: listView.pressAndHold(index) } - - ScrollBar.vertical: ScrollBar { } } - footer: ToolBar { - id: footer - - ToolButton { - id: addButton - text: qsTr("Add Contact") - anchors.right: parent.right - - Connections { - target: addButton - onClicked: page.addContact() - } - } + model: ContactModel { + id: contactModel } + + ScrollBar.vertical: ScrollBar { } } |