aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorThomas Hartmann <thomas.hartmann@qt.io>2016-11-15 17:22:40 +0100
committerThomas Hartmann <Thomas.Hartmann@theqtcompany.com>2016-11-17 07:43:20 +0000
commita4c3f074a6767850b05126959db0a7af8dfd49d3 (patch)
treeef7bf9a48357858b5e3c25bddce1a272ea36390f /examples
parent3ea7f91d9bb0e74f1c49384019f22d55b2fb6263 (diff)
Adding new example Contact List
This example shows how to integrate a C++ backend without disrupting the tooling. A custom list model is implemented in C++ and registered as a QML type. Change-Id: I958bc38797ef353cdb5ea23ec69ada67e132ced7 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/quickcontrols2/contactlist/ContactDelegate.ui.qml199
-rw-r--r--examples/quickcontrols2/contactlist/ContactDialog.qml96
-rw-r--r--examples/quickcontrols2/contactlist/ContactDialogForm.ui.qml120
-rw-r--r--examples/quickcontrols2/contactlist/MainForm.ui.qml120
-rw-r--r--examples/quickcontrols2/contactlist/SectionDelegate.ui.qml76
-rw-r--r--examples/quickcontrols2/contactlist/addressmodel.cpp150
-rw-r--r--examples/quickcontrols2/contactlist/addressmodel.h95
-rw-r--r--examples/quickcontrols2/contactlist/contactlist.pro26
-rw-r--r--examples/quickcontrols2/contactlist/contactlist.qml64
-rw-r--r--examples/quickcontrols2/contactlist/designer/Backend/AddressModel.qml88
-rw-r--r--examples/quickcontrols2/contactlist/designer/Backend/qmldir2
-rw-r--r--examples/quickcontrols2/contactlist/doc/images/qtquickcontrols2-contactlist.pngbin0 -> 7827 bytes
-rw-r--r--examples/quickcontrols2/contactlist/doc/src/qtquickcontrols2-contactlist.qdoc71
-rw-r--r--examples/quickcontrols2/contactlist/main.cpp67
-rw-r--r--examples/quickcontrols2/quickcontrols2.pro3
15 files changed, 1176 insertions, 1 deletions
diff --git a/examples/quickcontrols2/contactlist/ContactDelegate.ui.qml b/examples/quickcontrols2/contactlist/ContactDelegate.ui.qml
new file mode 100644
index 00000000..0ca9cedc
--- /dev/null
+++ b/examples/quickcontrols2/contactlist/ContactDelegate.ui.qml
@@ -0,0 +1,199 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.7
+import QtQuick.Controls 2.1
+
+Item {
+ clip: true
+
+ id: delegate
+
+ height: 50
+ property alias remove: remove
+ 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
+ width: parent.width - 20
+ spacing: 4
+
+ Row {
+ id: row1
+ spacing: 10
+
+ Text {
+ text: fullName
+ font.pointSize: 16
+ anchors.verticalCenter: parent.verticalCenter
+ font.bold: true
+ }
+ }
+
+ Grid {
+ id: grid
+ opacity: 0
+
+ x: 60
+ spacing: 10
+ columns: 2
+ Text {
+ text: qsTr("Address:")
+ font.bold: true
+ font.pixelSize: 16
+ }
+
+ Text {
+ text: address
+ font.pixelSize: 16
+ font.bold: true
+ }
+
+ Text {
+ text: qsTr("City:")
+ font.pixelSize: 16
+ font.bold: true
+ }
+
+ Text {
+ text: city
+ font.pixelSize: 16
+ font.bold: true
+ }
+
+ Text {
+ text: qsTr("Number:")
+ font.pixelSize: 16
+ font.bold: true
+ }
+
+ Text {
+ text: number
+ font.pixelSize: 16
+ font.bold: true
+ }
+ }
+
+ Row {
+ id: row
+ spacing: 12
+ anchors.right: parent.right
+
+ Button {
+ id: remove
+ width: 60
+ height: 20
+ text: "Remove"
+ }
+
+ Button {
+ id: edit
+ width: 60
+ height: 20
+ text: "Edit"
+ }
+ }
+
+ Rectangle {
+ id: line
+ opacity: 0
+ height: 1
+ color: "#dddddd"
+ anchors.right: parent.right
+ anchors.rightMargin: 4
+ anchors.left: parent.left
+ anchors.leftMargin: 4
+ }
+ }
+
+ states: [
+ State {
+ name: "collapsed"
+ when: !delegate.ListView.isCurrentItem
+ },
+ State {
+ name: "expanded"
+ when: delegate.ListView.isCurrentItem
+
+ PropertyChanges {
+ target: delegate
+ height: 160
+ }
+
+ PropertyChanges {
+ target: line
+ opacity: 1
+ }
+
+ PropertyChanges {
+ target: grid
+ opacity: 1
+ }
+ }
+ ]
+}
diff --git a/examples/quickcontrols2/contactlist/ContactDialog.qml b/examples/quickcontrols2/contactlist/ContactDialog.qml
new file mode 100644
index 00000000..ed781282
--- /dev/null
+++ b/examples/quickcontrols2/contactlist/ContactDialog.qml
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.7
+import QtQuick.Window 2.2
+import QtQuick.Controls 2.1
+
+Dialog {
+ standardButtons: Dialog.Ok | Dialog.Cancel
+ modal: true
+
+ x: parent.width / 2 - width / 2
+ y: parent.height / 2 - height / 2
+
+ property int lastIndex
+ property QtObject lastModel
+
+ property alias form: form
+
+ function addContact(model) {
+ form.fullName.clear();
+ form.address.clear();
+ form.city.clear();
+ form.number.clear();
+ lastIndex = -1;
+ lastModel = model;
+
+ dialog.open();
+ }
+
+ function editContact(model, index) {
+ form.fullName.text = model.getFullName(index);
+ form.address.text = model.getAddress(index);
+ form.city.text = model.getCity(index);
+ form.number.text = model.getNumber(index);
+ lastIndex = index;
+ lastModel = model;
+
+ dialog.open();
+ }
+
+ contentItem: ContactDialogForm {
+ id: form
+ }
+
+ onAccepted: lastModel.updateContact(lastIndex, form.fullName.text,
+ form.address.text, form.city.text,
+ form.number.text)
+}
diff --git a/examples/quickcontrols2/contactlist/ContactDialogForm.ui.qml b/examples/quickcontrols2/contactlist/ContactDialogForm.ui.qml
new file mode 100644
index 00000000..9f07d608
--- /dev/null
+++ b/examples/quickcontrols2/contactlist/ContactDialogForm.ui.qml
@@ -0,0 +1,120 @@
+
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.7
+import QtQuick.Layouts 1.0
+import QtQuick.Controls 2.1
+
+GridLayout {
+ id: grid
+ property alias fullName: fullName
+ property alias address: address
+ property alias city: city
+ property alias number: number
+ property int minimumInputSize: 120
+ property string placeholderText: qsTr("<enter>")
+
+ rows: 4
+ columns: 2
+
+ Text {
+ text: qsTr("Full Name:")
+ Layout.alignment: Qt.AlignLeft | Qt.AlignBaseline
+ }
+
+ TextField {
+ id: fullName
+ Layout.fillWidth: true
+ Layout.minimumWidth: grid.minimumInputSize
+ Layout.alignment: Qt.AlignLeft | Qt.AlignBaseline
+ placeholderText: grid.placeholderText
+ }
+
+ Text {
+ text: qsTr("Address")
+ Layout.alignment: Qt.AlignLeft | Qt.AlignBaseline
+ }
+
+ TextField {
+ id: address
+ Layout.fillWidth: true
+ Layout.minimumWidth: grid.minimumInputSize
+ Layout.alignment: Qt.AlignLeft | Qt.AlignBaseline
+ placeholderText: grid.placeholderText
+ }
+
+ Text {
+ text: qsTr("City")
+ Layout.alignment: Qt.AlignLeft | Qt.AlignBaseline
+ }
+
+ TextField {
+ id: city
+ Layout.fillWidth: true
+ Layout.minimumWidth: grid.minimumInputSize
+ Layout.alignment: Qt.AlignLeft | Qt.AlignBaseline
+ placeholderText: grid.placeholderText
+ }
+
+ Text {
+ text: qsTr("Number")
+ Layout.alignment: Qt.AlignLeft | Qt.AlignBaseline
+ }
+
+ TextField {
+ id: number
+ Layout.fillWidth: true
+ Layout.minimumWidth: grid.minimumInputSize
+ Layout.alignment: Qt.AlignLeft | Qt.AlignBaseline
+ placeholderText: grid.placeholderText
+ }
+}
+
diff --git a/examples/quickcontrols2/contactlist/MainForm.ui.qml b/examples/quickcontrols2/contactlist/MainForm.ui.qml
new file mode 100644
index 00000000..3779e670
--- /dev/null
+++ b/examples/quickcontrols2/contactlist/MainForm.ui.qml
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.7
+import Backend 1.0
+import QtQuick.Controls 2.1
+
+Item {
+ id: form
+
+ width: 320
+ height: 480
+
+ property alias button: button
+ property alias listView: listView
+
+ property ContactDialog dialog: ContactDialog {
+ }
+
+ ListView {
+ id: listView
+
+ currentIndex: -1
+ boundsBehavior: Flickable.StopAtBounds
+ clip: true
+ focus: true
+ anchors.bottom: button.top
+ anchors.right: parent.right
+ anchors.left: parent.left
+ anchors.top: parent.top
+ anchors.bottomMargin: 4
+ section.criteria: ViewSection.FirstCharacter
+ section.property: "fullName"
+ snapMode: ListView.SnapToItem
+
+ section.delegate: SectionDelegate {
+ width: listView.width
+ }
+
+ delegate: ContactDelegate {
+ id: delegate
+ width: listView.width
+ x: 5
+
+ Connections {
+ target: delegate.edit
+ onClicked: dialog.editContact(listView.model, index)
+ }
+
+ Connections {
+ target: delegate.remove
+ onClicked: listView.model.removeContact(index)
+ }
+ }
+
+ model: AddressModel {
+ }
+
+ ScrollBar.vertical: ScrollBar {
+ }
+ }
+
+ Button {
+ id: button
+ width: 80
+ height: 20
+ text: "Add Contact"
+ anchors.rightMargin: 4
+ anchors.bottomMargin: 4
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ }
+}
diff --git a/examples/quickcontrols2/contactlist/SectionDelegate.ui.qml b/examples/quickcontrols2/contactlist/SectionDelegate.ui.qml
new file mode 100644
index 00000000..6cc22d61
--- /dev/null
+++ b/examples/quickcontrols2/contactlist/SectionDelegate.ui.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.7
+
+Rectangle {
+ height: 20
+ width: 120
+ gradient: Gradient {
+ GradientStop {
+ position: 0
+ color: "#dddddd"
+ }
+
+ GradientStop {
+ position: 1
+ color: "blue"
+ }
+ }
+
+ Text {
+ x: 12
+ color: "white"
+ text: section
+ style: Text.Raised
+ font.pixelSize: 18
+ font.bold: true
+ }
+}
diff --git a/examples/quickcontrols2/contactlist/addressmodel.cpp b/examples/quickcontrols2/contactlist/addressmodel.cpp
new file mode 100644
index 00000000..fb83186e
--- /dev/null
+++ b/examples/quickcontrols2/contactlist/addressmodel.cpp
@@ -0,0 +1,150 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "addressmodel.h"
+
+AddressModel::AddressModel(QObject *parent ) : QAbstractListModel(parent)
+{
+ m_data.append({ "Angel Hogan", "Chapel St. 368 ", "Clearwater" , "0311 1823993" });
+ m_data.append({ "Felicia Patton", "Annadale Lane 2", "Knoxville" , "0368 1244494" });
+ m_data.append({ "Grant Crawford", "Windsor Drive 34", "Riverdale" , "0351 7826892" });
+ m_data.append({ "Gretchen Little", "Sunset Drive 348", "Virginia Beach" , "0343 1234991" });
+ m_data.append({ "Geoffrey Richards", "University Lane 54", "Trussville" , "0423 2144944" });
+ m_data.append({ "Henrietta Chavez", "Via Volto San Luca 3", "Piobesi Torinese" , "0399 2826994" });
+ m_data.append({ "Harvey Chandler", "North Squaw Creek 11", "Madisonville" , "0343 1244492" });
+ m_data.append({ "Miguel Gomez", "Wild Rose Street 13", "Trussville" , "0343 9826996" });
+ m_data.append({ "Norma Rodriguez", " Glen Eagles Street 53", "Buffalo" , "0241 5826596" });
+ m_data.append({ "Shelia Ramirez", "East Miller Ave 68", "Pickerington" , "0346 4844556" });
+ m_data.append({ "Stephanie Moss", "Piazza Trieste e Trento 77", "Roata Chiusani" , "0363 0510490" });
+}
+
+int AddressModel::rowCount(const QModelIndex &) const
+{
+ return m_data.count();
+}
+
+QVariant AddressModel::data(const QModelIndex &index, int role) const
+{
+ if (index.row() < rowCount())
+ switch (role) {
+ case FullNameRole: return m_data.at(index.row()).fullName;
+ case AddressRole: return m_data.at(index.row()).address;
+ case CityRole: return m_data.at(index.row()).city;
+ case NumberRole: return m_data.at(index.row()).number;
+ default: return QVariant();
+
+ }
+ return QVariant();
+}
+
+QHash<int, QByteArray> AddressModel::roleNames() const
+{
+ static QHash<int, QByteArray> roleNames {
+ { FullNameRole, "fullName" },
+ { AddressRole, "address" },
+ { CityRole, "city" },
+ { NumberRole, "number" }
+ };
+ return roleNames;
+}
+
+void AddressModel::updateContact(int row,
+ const QString &fullName,
+ const QString &address,
+ const QString &city,
+ const QString &number)
+{
+ if (row >= 0 && row < rowCount()) {
+ m_data.replace(row, { fullName, address, city, number });
+ dataChanged(index(row, 0), index(row, 0), { FullNameRole, AddressRole, CityRole, NumberRole });
+ } else if (row < 0) {
+ beginInsertRows(QModelIndex(), rowCount() - 1, rowCount() - 1);
+ m_data.append({fullName, address, city, number});
+ endInsertRows();
+ dataChanged(index(rowCount() - 1, 0), index(rowCount() - 1, 0), { FullNameRole, AddressRole, CityRole, NumberRole });
+ }
+}
+
+void AddressModel::removeContact(int row)
+{
+ if (row >= 0 && row < rowCount()) {
+ beginRemoveRows(QModelIndex(), row, row);
+ m_data.removeAt(row);
+ endRemoveRows();
+ }
+}
+
+QString AddressModel::getFullName(int row) const
+{
+ if (row >= 0 && row < rowCount())
+ return m_data.at(row).fullName;
+ return QString();
+}
+
+QString AddressModel::getAddress(int row) const
+{
+ if (row >= 0 && row < rowCount())
+ return m_data.at(row).address;
+ return QString();
+}
+
+QString AddressModel::getCity(int row) const
+{
+ if (row >= 0 && row < rowCount())
+ return m_data.at(row).city;
+ return QString();
+}
+
+QString AddressModel::getNumber(int row) const
+{
+ if (row >= 0 && row < rowCount())
+ return m_data.at(row).number;
+ return QString();
+}
diff --git a/examples/quickcontrols2/contactlist/addressmodel.h b/examples/quickcontrols2/contactlist/addressmodel.h
new file mode 100644
index 00000000..04417b95
--- /dev/null
+++ b/examples/quickcontrols2/contactlist/addressmodel.h
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef ADDRESSMODEL_H
+#define ADDRESSMODEL_H
+
+#include <QAbstractListModel>
+
+class AddressModel : public QAbstractListModel
+{
+ Q_OBJECT
+
+public:
+ enum AdressModelRoles {
+ FullNameRole = Qt::DisplayRole,
+ AddressRole = Qt::UserRole,
+ CityRole,
+ NumberRole
+ };
+
+ Q_ENUM(AdressModelRoles)
+
+ AddressModel(QObject *parent = nullptr);
+
+ int rowCount(const QModelIndex & = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ QHash<int, QByteArray> roleNames() const;
+
+ Q_INVOKABLE QString getFullName(int row) const;
+ Q_INVOKABLE QString getAddress(int row) const;
+ Q_INVOKABLE QString getCity(int row) const;
+ Q_INVOKABLE QString getNumber(int row) const;
+
+ Q_INVOKABLE void updateContact(int row, const QString &fullName, const QString &address, const QString &city, const QString &number);
+ Q_INVOKABLE void removeContact(int row);
+
+private:
+ struct Data {
+ QString fullName;
+ QString address;
+ QString city;
+ QString number;
+ };
+
+ QList<Data> m_data;
+};
+
+#endif // ADDRESSMODEL_H
diff --git a/examples/quickcontrols2/contactlist/contactlist.pro b/examples/quickcontrols2/contactlist/contactlist.pro
new file mode 100644
index 00000000..8125d020
--- /dev/null
+++ b/examples/quickcontrols2/contactlist/contactlist.pro
@@ -0,0 +1,26 @@
+TEMPLATE = app
+TARGET = contactlist
+
+QT += quick quickcontrols2
+CONFIG += c++11
+
+HEADERS += \
+ addressmodel.h
+
+SOURCES += main.cpp \
+ addressmodel.cpp
+
+RESOURCES += \
+ $$files(*.qml) \
+
+# Additional import path used to resolve QML modules in Qt Creator's code model
+QML_IMPORT_PATH=$$PWD/imports
+
+# Additional import path used to resolve QML modules just for Qt Quick Designer
+QML_DESIGNER_IMPORT_PATH=$$PWD/designer
+
+OTHER_FILES += \
+ designer/Backend/*.qml
+
+target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/contactlist
+INSTALLS += target
diff --git a/examples/quickcontrols2/contactlist/contactlist.qml b/examples/quickcontrols2/contactlist/contactlist.qml
new file mode 100644
index 00000000..7ace67fa
--- /dev/null
+++ b/examples/quickcontrols2/contactlist/contactlist.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.7
+import QtQuick.Controls 2.1
+
+ApplicationWindow {
+ visible: true
+ width: 320
+ height: 480
+ title: qsTr("Contact List")
+
+ MainForm {
+ button.onClicked: dialog.addContact(listView.model)
+ anchors.fill: parent
+ }
+}
diff --git a/examples/quickcontrols2/contactlist/designer/Backend/AddressModel.qml b/examples/quickcontrols2/contactlist/designer/Backend/AddressModel.qml
new file mode 100644
index 00000000..b9570934
--- /dev/null
+++ b/examples/quickcontrols2/contactlist/designer/Backend/AddressModel.qml
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+
+ListModel {
+ ListElement {
+ address: "Chapel St. 368"
+ city: "Knoxville"
+ number: "0311 1823993"
+ fullName: "Angel Hogan"
+ }
+
+ ListElement {
+ address: "Annadale Lane 2"
+ city: "Clearwater"
+ number: "0368 1244494"
+ fullName: "Felicia Patton"
+ }
+
+ ListElement {
+ address: "Windsor Drive 34"
+ city: "Riverdale"
+ number: "0368 1244494"
+ fullName: "Grant Crawford"
+ }
+
+ ListElement {
+ address: "Sunset Drive 348"
+ city: "Virginia Beach"
+ number: "0351 7826892"
+ fullName: "Gretchen Little"
+ }
+
+ ListElement {
+ address: "University Lane 54"
+ city: "Trussville"
+ number: "0399 2826994"
+ fullName: "Geoffrey Richards"
+ }
+}
diff --git a/examples/quickcontrols2/contactlist/designer/Backend/qmldir b/examples/quickcontrols2/contactlist/designer/Backend/qmldir
new file mode 100644
index 00000000..45552843
--- /dev/null
+++ b/examples/quickcontrols2/contactlist/designer/Backend/qmldir
@@ -0,0 +1,2 @@
+module Backend
+AddressModel 1.0 AddressModel.qml
diff --git a/examples/quickcontrols2/contactlist/doc/images/qtquickcontrols2-contactlist.png b/examples/quickcontrols2/contactlist/doc/images/qtquickcontrols2-contactlist.png
new file mode 100644
index 00000000..642cf2dc
--- /dev/null
+++ b/examples/quickcontrols2/contactlist/doc/images/qtquickcontrols2-contactlist.png
Binary files differ
diff --git a/examples/quickcontrols2/contactlist/doc/src/qtquickcontrols2-contactlist.qdoc b/examples/quickcontrols2/contactlist/doc/src/qtquickcontrols2-contactlist.qdoc
new file mode 100644
index 00000000..93ef569d
--- /dev/null
+++ b/examples/quickcontrols2/contactlist/doc/src/qtquickcontrols2-contactlist.qdoc
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/*!
+ \example contactlist
+ \title Qt Quick Controls 2 - Contact List
+ \ingroup qtquickcontrols2-examples
+ \brief A QML app using Qt Quick Controls 2 and a C++ class that implements
+ a simple contact list.
+
+ The \e {Contact List Example} shows how to integrate a C++ backend in a way that
+ is compatible with Qt Quick Designer.
+ For the declarative parts of the UI, .ui.qml files are used that can be edited
+ visually in the Qt Quick Designer.
+
+ \section1 C++ Backend
+
+ \borderedimage image qtquickcontrols2-contactlist.png
+
+ The contact list application allows the user to add, edit, and remove contacts.
+ The actual implementation is done in C++ and exposed as a QAbstractListModel.
+
+ The AdressModel C++ class is registered under a namespace and later
+ imported and instantiated by \e MainForm.ui.qml. For more information about registering C++
+ classes as QML types, see \l {Defining QML Types from C++}.
+
+ \code
+ #include <QtQml/qqml.h>
+ ...
+ qmlRegisterType<AdressModel>("Backend", 1, 0, "AdressModel");
+ ...
+ \endcode
+
+ \section1 Designer Support
+
+ In the designer subdirectory, we create a plugin that replaces the AdressModel
+ in Qt Quick Designer. For this to work we add the following line to \e contactlist.pro.
+
+ \code
+ QML_DESIGNER_IMPORT_PATH=$$PWD/designer
+ \endcode
+
+ Because Qt Quick Designer cannot instantiate the AdressModel C++ class, we define
+ a mockup using a ListModel. This ensures that the ListView using the model shows something
+ in Qt Quick Designer.
+
+ \include examples-run.qdocinc
+*/
diff --git a/examples/quickcontrols2/contactlist/main.cpp b/examples/quickcontrols2/contactlist/main.cpp
new file mode 100644
index 00000000..9c75d7b3
--- /dev/null
+++ b/examples/quickcontrols2/contactlist/main.cpp
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "addressmodel.h"
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ qmlRegisterType<AddressModel>("Backend", 1, 0, "AddressModel");
+
+ QQmlApplicationEngine engine;
+ engine.addImportPath(":/imports");
+ engine.load(QUrl(QStringLiteral("qrc:/contactlist.qml")));
+
+ return app.exec();
+}
diff --git a/examples/quickcontrols2/quickcontrols2.pro b/examples/quickcontrols2/quickcontrols2.pro
index 6d732b17..458d10db 100644
--- a/examples/quickcontrols2/quickcontrols2.pro
+++ b/examples/quickcontrols2/quickcontrols2.pro
@@ -2,4 +2,5 @@ TEMPLATE = subdirs
SUBDIRS += \
gallery \
chattutorial \
- texteditor
+ texteditor \
+ contactlist