summaryrefslogtreecommitdiffstats
path: root/examples/quickcontrols/controls/uiforms/qml
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-05-10 21:11:23 +0200
committerLiang Qi <liang.qi@qt.io>2016-05-10 21:11:23 +0200
commitc6713e212ef0b97c45d6466b73220567e94a05f1 (patch)
tree8774d26bf05f2087c510d16da42bfd0dc59a54b1 /examples/quickcontrols/controls/uiforms/qml
parentce97d9c8ef4e6f8cb2166065b6732cad3cccf604 (diff)
parent0e00f9fa1cbdbdd2128f2ca31172d88f701ecb59 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: examples/quickcontrols/extras/flat/main.cpp src/controls/Private/qquickcontrolsettings.cpp Change-Id: I9eb9342a2ee994611f3cb18daab6dd89eb924ccc
Diffstat (limited to 'examples/quickcontrols/controls/uiforms/qml')
-rw-r--r--examples/quickcontrols/controls/uiforms/qml/CustomerModel.qml154
-rw-r--r--examples/quickcontrols/controls/uiforms/qml/History.qml86
-rw-r--r--examples/quickcontrols/controls/uiforms/qml/HistoryForm.ui.qml90
-rw-r--r--examples/quickcontrols/controls/uiforms/qml/Notes.qml86
-rw-r--r--examples/quickcontrols/controls/uiforms/qml/NotesForm.ui.qml95
-rw-r--r--examples/quickcontrols/controls/uiforms/qml/Settings.qml106
-rw-r--r--examples/quickcontrols/controls/uiforms/qml/SettingsForm.ui.qml269
7 files changed, 886 insertions, 0 deletions
diff --git a/examples/quickcontrols/controls/uiforms/qml/CustomerModel.qml b/examples/quickcontrols/controls/uiforms/qml/CustomerModel.qml
new file mode 100644
index 000000000..ac321b2ce
--- /dev/null
+++ b/examples/quickcontrols/controls/uiforms/qml/CustomerModel.qml
@@ -0,0 +1,154 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+pragma Singleton
+
+import QtQuick 2.0
+
+ListModel {
+ property QtObject selection
+ ListElement {
+ customerId: "15881123"
+ firstName: "Julia"
+ title: "Ms."
+ lastName: "Jefferson"
+ email: "Julia@example.com"
+ address: "Spandia Avenue, Suite 610"
+ city: "Toronto"
+ zipCode: "92334"
+ phoneNumber: "0803-033330"
+ notes: "Very demanding customer."
+ history: "21.4.2014|Order|coffee~23.4.2014|Order|poster~29.4.2014|Invoice|poster 40$~05.5.2014|Overdue Notice|poster 40$"
+ }
+
+ ListElement {
+ customerId: "29993496"
+ firstName: "Tim"
+ lastName: "Northington"
+ title: "Mr."
+ email: "Northington@example.com"
+ address: "North Fifth Street 55"
+ city: "San Jose"
+ zipCode: "95112"
+ phoneNumber: "09000-3330"
+ notes: "Very good customer."
+ history: "18.4.2014|Order|orange juice~23.4.2014|Order|chair~24.4.2014|Complaint|Chair is broken."
+ }
+
+ ListElement {
+ customerId: "37713567"
+ firstName: "Daniel"
+ lastName: "Krumm"
+ title: "Mr."
+ email: "Krumm@example.com"
+ address: "Waterfront 14"
+ city: "Berlin"
+ zipCode: "12334"
+ phoneNumber: "0708093330"
+ notes: "This customer has a lot of Complaintts."
+ history: "15.4.2014|Order|table~25.4.2014|Return|table~28.4.2014|Complaint|Table had wrong color."
+ }
+
+ ListElement {
+ customerId: "45817387"
+ firstName: "Sandra"
+ lastName: "Booth"
+ title: "Ms."
+ email: "Sandrab@example.com"
+ address: "Folsom Street 23"
+ city: "San Francisco"
+ zipCode: "94103"
+ phoneNumber: "0103436370"
+ notes: "This customer is not paying."
+ history: "22.4.2014|Order|coffee~23.4.2014|Order|smartphone~29.4.2014|Invoice|smartphone 200$~05.5.2014|Overdue Notice|smartphone 200$"
+ }
+
+ ListElement {
+ customerId: "588902396"
+ firstName: "Lora"
+ lastName: "Beckner"
+ title: "Ms."
+ email: "LoraB@example.com"
+ address: " W Wilson Apt 3"
+ city: "Los Angeles"
+ zipCode: "90086"
+ phoneNumber: "0903436360"
+ notes: "This customer usually pays late."
+ history: "17.4.2014|Order|soft drink~23.4.2014|Order|computer~29.4.2014|Invoice|computer 1200$~07.5.2014|Overdue Notice|computer 1200$"
+ }
+
+ ListElement {
+ customerId: "67873693"
+ firstName: "Daniel"
+ lastName: "Krumm"
+ title: "Mr."
+ email: "Krumm@example.com"
+ address: "Waterfront 14"
+ city: "Berlin"
+ zipCode: "12334"
+ phoneNumber: "0303033330"
+ notes: "This customer has a lot of Complaints."
+ history: "23.4.2014|Order|jacket~25.4.2014|Return|jacket~28.4.2014|Complaint|Jacket had wrong color."
+ }
+
+ ListElement {
+ customerId: "78885693"
+ firstName: "Vanessa"
+ lastName: "Newbury"
+ title: "Ms."
+ email: "VanessaN@example.com"
+ address: "Madison Ave. 277"
+ city: "New York"
+ zipCode: "10016"
+ phoneNumber: "0503053530"
+ notes: "Deliveries sometime do not arrive on time."
+ history: "19.4.2014|Order|coffee~23.4.2014|Order|bicycle~29.4.2014|Invoice|bicycle 500$~06.5.2014|Overdue Notice|bicycle 500$"
+ }
+}
diff --git a/examples/quickcontrols/controls/uiforms/qml/History.qml b/examples/quickcontrols/controls/uiforms/qml/History.qml
new file mode 100644
index 000000000..be7a5808b
--- /dev/null
+++ b/examples/quickcontrols/controls/uiforms/qml/History.qml
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** 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.2
+import QtQuick.Layouts 1.1
+import QtQuick.Controls 1.2
+import io.qt.example 1.0
+
+HistoryForm {
+ id: form
+
+ function readData() {
+ CustomerModel.selection.forEach(function (rowIndex) {
+
+ var history = CustomerModel.get(rowIndex).history
+ var entries = history.split("~")
+
+ form.tableView.model.clear()
+
+ var index
+ for (index = 0; index < entries.length; index++) {
+ var entry = entries[index]
+ var data = entry.split("|")
+ form.tableView.model.append({
+ date: data[0],
+ type: data[1],
+ text: data[2]
+ })
+ }
+ })
+ }
+
+ Connections {
+ target: CustomerModel.selection
+ onSelectionChanged: form.readData()
+ }
+
+ Component.onCompleted: readData()
+}
diff --git a/examples/quickcontrols/controls/uiforms/qml/HistoryForm.ui.qml b/examples/quickcontrols/controls/uiforms/qml/HistoryForm.ui.qml
new file mode 100644
index 000000000..94512cfff
--- /dev/null
+++ b/examples/quickcontrols/controls/uiforms/qml/HistoryForm.ui.qml
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** 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.2
+import QtQuick.Layouts 1.1
+import QtQuick.Controls 1.2
+
+Item {
+ id: content
+
+ width: 640
+ height: 480
+ property alias tableView: tableView
+
+ TableView {
+ id: tableView
+
+ property int columnWidth: width / 3
+
+ anchors.fill: parent
+
+ TableViewColumn {
+ role: "date"
+ title: qsTr("Date")
+ width: tableView.columnWidth
+ }
+
+ TableViewColumn {
+ role: "type"
+ title: qsTr("Type")
+ width: tableView.columnWidth
+ }
+
+ TableViewColumn {
+ role: "text"
+ title: qsTr("Description")
+ width: tableView.columnWidth
+ }
+
+ model: ListModel {
+ }
+ }
+}
diff --git a/examples/quickcontrols/controls/uiforms/qml/Notes.qml b/examples/quickcontrols/controls/uiforms/qml/Notes.qml
new file mode 100644
index 000000000..c7f326f7f
--- /dev/null
+++ b/examples/quickcontrols/controls/uiforms/qml/Notes.qml
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** 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.2
+import QtQuick.Layouts 1.1
+import QtQuick.Controls 1.2
+import io.qt.example 1.0
+
+NotesForm {
+ id: form
+
+ function readData() {
+ CustomerModel.selection.forEach(function (rowIndex) {
+ form.textArea.text = CustomerModel.get(rowIndex).notes
+ })
+
+ save.enabled = true
+ cancel.enabled = true
+ form.textArea.enabled = true
+ }
+
+ function writeData() {
+ CustomerModel.selection.forEach(function (rowIndex) {
+ var data = CustomerModel.get(rowIndex)
+ data.notes = form.textArea.text
+ CustomerModel.set(rowIndex, data)
+ })
+ }
+
+ cancel.onClicked: readData()
+ save.onClicked: writeData()
+
+ Connections {
+ target: CustomerModel.selection
+ onSelectionChanged: form.readData()
+ }
+
+ Component.onCompleted: readData()
+}
diff --git a/examples/quickcontrols/controls/uiforms/qml/NotesForm.ui.qml b/examples/quickcontrols/controls/uiforms/qml/NotesForm.ui.qml
new file mode 100644
index 000000000..e30669875
--- /dev/null
+++ b/examples/quickcontrols/controls/uiforms/qml/NotesForm.ui.qml
@@ -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$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Layouts 1.1
+import QtQuick.Controls 1.2
+
+Item {
+ id: content
+
+ property alias cancel: cancel
+ property alias save: save
+ property alias textArea: textArea
+
+ width: 640
+ height: 480
+
+ ColumnLayout {
+ anchors.rightMargin: 12
+ anchors.leftMargin: 12
+ anchors.bottomMargin: 12
+ anchors.topMargin: 12
+ anchors.fill: parent
+
+ TextArea {
+ id: textArea
+ x: 8
+ y: 8
+ width: 624
+ height: 320
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ }
+ RowLayout {
+ Layout.alignment: Qt.AlignTop | Qt.AlignRight
+ Button {
+ id: save
+ text: qsTr("Save")
+ enabled: false
+ }
+ Button {
+ id: cancel
+ text: qsTr("Cancel")
+ enabled: false
+ }
+ }
+ }
+}
diff --git a/examples/quickcontrols/controls/uiforms/qml/Settings.qml b/examples/quickcontrols/controls/uiforms/qml/Settings.qml
new file mode 100644
index 000000000..eefab2a15
--- /dev/null
+++ b/examples/quickcontrols/controls/uiforms/qml/Settings.qml
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** 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.2
+import QtQuick.Layouts 1.1
+import QtQuick.Controls 1.2
+import QtQuick.Dialogs 1.2
+import io.qt.example 1.0
+
+SettingsForm {
+ id: form
+ anchors.fill: parent
+
+ function readData() {
+ CustomerModel.selection.forEach(function (rowIndex) {
+ form.firstName.text = CustomerModel.get(rowIndex).firstName
+ form.lastName.text = CustomerModel.get(rowIndex).lastName
+ form.customerId.text = CustomerModel.get(rowIndex).customerId
+ form.email.text = CustomerModel.get(rowIndex).email
+ form.address.text = CustomerModel.get(rowIndex).address
+ form.phoneNumber.text = CustomerModel.get(rowIndex).phoneNumber
+ form.zipCode.text = CustomerModel.get(rowIndex).zipCode
+ form.city.text = CustomerModel.get(rowIndex).city
+ form.title.currentIndex = form.title.find(CustomerModel.get(rowIndex).title)
+ })
+
+ save.enabled = true
+ cancel.enabled = true
+ gridLayout.enabled = true
+ }
+
+ function writeData() {
+ CustomerModel.selection.forEach(function (rowIndex) {
+ var notes = CustomerModel.get(rowIndex).notes
+ CustomerModel.set(rowIndex, {
+ firstName: form.firstName.text,
+ lastName: form.lastName.text,
+ customerId: form.customerId.text,
+ email: form.firstName.email,
+ address: form.lastName.address,
+ phoneNumber: form.customerId.phoneNumber,
+ zipCode: form.customerId.zipCode,
+ city: form.customerId.city,
+ title: form.title.currentText,
+ notes: notes
+ })
+ })
+ }
+
+ cancel.onClicked: readData()
+ save.onClicked: writeData()
+
+ Connections {
+ target: CustomerModel.selection
+ onSelectionChanged: form.readData()
+ }
+
+ Component.onCompleted: readData()
+}
diff --git a/examples/quickcontrols/controls/uiforms/qml/SettingsForm.ui.qml b/examples/quickcontrols/controls/uiforms/qml/SettingsForm.ui.qml
new file mode 100644
index 000000000..00ce1ee1d
--- /dev/null
+++ b/examples/quickcontrols/controls/uiforms/qml/SettingsForm.ui.qml
@@ -0,0 +1,269 @@
+/****************************************************************************
+**
+** 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.2
+import QtQuick.Layouts 1.1
+import QtQuick.Controls 1.2
+
+Item {
+ id: content
+
+ width: 480
+ height: 480
+
+ property alias address: address
+ property alias gridLayout: gridLayout
+ property alias cancel: cancel
+ property alias save: save
+
+ property alias title: title
+ property alias zipCode: zipCode
+ property alias city: city
+ property alias phoneNumber: phoneNumber
+ property alias customerId: customerId
+ property alias email: email
+ property alias lastName: lastName
+ property alias firstName: firstName
+
+ GridLayout {
+ id: gridLayout
+
+ anchors.right: parent.right
+ anchors.left: parent.left
+ anchors.top: parent.top
+ anchors.rightMargin: 12
+ anchors.leftMargin: 12
+ anchors.topMargin: 12
+ columnSpacing: 8
+ rowSpacing: 8
+ rows: 8
+ columns: 7
+ enabled: false
+
+ Label {
+ id: label1
+ text: qsTr("Title")
+ Layout.columnSpan: 2
+ }
+
+ Label {
+ id: label2
+ text: qsTr("First Name")
+ Layout.columnSpan: 2
+ }
+
+ Item {
+ id: spacer10
+ Layout.preferredHeight: 14
+ Layout.preferredWidth: 14
+ }
+
+ Label {
+ id: label3
+ text: qsTr("Last Name")
+ }
+
+ Item {
+ id: spacer15
+ Layout.preferredHeight: 14
+ Layout.preferredWidth: 14
+ }
+
+ ComboBox {
+ id: title
+ Layout.columnSpan: 2
+ Layout.fillWidth: true
+ model: ["Mr.", "Ms."]
+ }
+
+ TextField {
+ id: firstName
+ Layout.minimumWidth: 140
+ Layout.fillWidth: true
+ Layout.columnSpan: 3
+ placeholderText: qsTr("first name")
+ }
+
+ TextField {
+ id: lastName
+ Layout.minimumWidth: 140
+ Layout.fillWidth: true
+ Layout.columnSpan: 2
+ placeholderText: qsTr("last name")
+ }
+
+ Label {
+ id: label4
+ text: qsTr("Phone Number")
+ Layout.columnSpan: 5
+ }
+
+ Label {
+ id: label5
+ text: qsTr("Email")
+ Layout.preferredHeight: 13
+ Layout.preferredWidth: 24
+ }
+
+ Item {
+ id: spacer16
+ Layout.preferredHeight: 14
+ Layout.preferredWidth: 14
+ }
+
+ TextField {
+ id: phoneNumber
+ Layout.fillWidth: true
+ Layout.columnSpan: 5
+ placeholderText: qsTr("phone number")
+ }
+
+ TextField {
+ id: email
+ Layout.fillWidth: true
+ Layout.columnSpan: 2
+ placeholderText: qsTr("email")
+ }
+
+ Label {
+ id: label6
+ text: qsTr("Address")
+ }
+
+ Item {
+ id: spacer3
+ Layout.columnSpan: 6
+ Layout.preferredHeight: 14
+ Layout.preferredWidth: 14
+ }
+
+ TextField {
+ id: address
+ Layout.fillWidth: true
+ Layout.columnSpan: 7
+ placeholderText: qsTr("address")
+ }
+
+ Label {
+ id: label7
+ text: qsTr("City")
+ }
+
+ Item {
+ id: spacer4
+ Layout.columnSpan: 4
+ Layout.preferredHeight: 14
+ Layout.preferredWidth: 14
+ }
+
+ Label {
+ id: label8
+ text: qsTr("Zip Code")
+ }
+
+ Item {
+ id: spacer18
+ Layout.preferredHeight: 14
+ Layout.preferredWidth: 14
+ }
+
+ TextField {
+ id: city
+ Layout.fillWidth: true
+ Layout.columnSpan: 5
+ placeholderText: qsTr("city")
+ }
+
+ TextField {
+ id: zipCode
+ Layout.fillWidth: true
+ Layout.columnSpan: 2
+ placeholderText: qsTr("zip code")
+ }
+
+ Label {
+ id: label9
+ text: qsTr("Customer Id")
+ }
+
+ Item {
+ id: spacer19
+ Layout.columnSpan: 6
+ Layout.preferredHeight: 14
+ Layout.preferredWidth: 14
+ }
+
+ TextField {
+ id: customerId
+ Layout.columnSpan: 7
+ Layout.fillWidth: true
+ placeholderText: qsTr("id")
+ }
+ }
+
+ RowLayout {
+ anchors.topMargin: 12
+ anchors.right: parent.right
+ anchors.rightMargin: 12
+ anchors.top: gridLayout.bottom
+
+ Button {
+ id: save
+ text: qsTr("Save")
+ enabled: false
+ }
+
+ Button {
+ id: cancel
+ text: qsTr("Cancel")
+ enabled: false
+ }
+ }
+}