summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorThomas Hartmann <Thomas.Hartmann@theqtcompany.com>2015-03-16 17:15:09 +0100
committerThomas Hartmann <Thomas.Hartmann@digia.com>2015-03-16 16:15:29 +0000
commitfff5ad57fc2ae90a519c4864f7d05968c68d08f4 (patch)
treeb502209aadcb69aea088c6ab97ce779a66c119c8 /examples
parentb4502bc87627e4cb06e5f373a550cf60fc50d5f3 (diff)
downloadqtquickcontrols-fff5ad57fc2ae90a519c4864f7d05968c68d08f4.tar.gz
Examples: Adding ui forms example
Change-Id: I36ee43ff94e72ca22af597cea11c13bdae683678 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/quick/controls/controls.pro3
-rw-r--r--examples/quick/controls/uiforms/MainForm.ui.qml98
-rw-r--r--examples/quick/controls/uiforms/main.cpp59
-rw-r--r--examples/quick/controls/uiforms/main.qml131
-rw-r--r--examples/quick/controls/uiforms/qml/CustomerModel.qml144
-rw-r--r--examples/quick/controls/uiforms/qml/History.qml76
-rw-r--r--examples/quick/controls/uiforms/qml/HistoryForm.ui.qml80
-rw-r--r--examples/quick/controls/uiforms/qml/Notes.qml76
-rw-r--r--examples/quick/controls/uiforms/qml/NotesForm.ui.qml85
-rw-r--r--examples/quick/controls/uiforms/qml/Settings.qml96
-rw-r--r--examples/quick/controls/uiforms/qml/SettingsForm.ui.qml259
-rw-r--r--examples/quick/controls/uiforms/uiforms.pro21
-rw-r--r--examples/quick/controls/uiforms/uiforms.qrc13
13 files changed, 1140 insertions, 1 deletions
diff --git a/examples/quick/controls/controls.pro b/examples/quick/controls/controls.pro
index ea8ce554..52ab8c45 100644
--- a/examples/quick/controls/controls.pro
+++ b/examples/quick/controls/controls.pro
@@ -5,7 +5,8 @@ SUBDIRS += \
tableview \
touch \
basiclayouts \
- styles
+ styles \
+ uiforms
qtHaveModule(widgets) {
SUBDIRS += texteditor filesystembrowser
diff --git a/examples/quick/controls/uiforms/MainForm.ui.qml b/examples/quick/controls/uiforms/MainForm.ui.qml
new file mode 100644
index 00000000..4649209f
--- /dev/null
+++ b/examples/quick/controls/uiforms/MainForm.ui.qml
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.Dialogs 1.1
+import QtQuick.Controls 1.2
+
+Item {
+ width: 800
+ height: 480
+ property alias tableView: tableView
+
+ SplitView {
+ id: splitView
+ anchors.fill: parent
+
+ TableView {
+ id: tableView
+
+ property int columnWidth: width / 3
+ Layout.minimumWidth: splitView.width / 3
+
+ TableViewColumn {
+ role: "customerId"
+ title: qsTr("Customer Id")
+ width: tableView.columnWidth
+ }
+
+ TableViewColumn {
+ role: "firstName"
+ title: qsTr("First Name")
+ width: tableView.columnWidth
+ }
+ TableViewColumn {
+ role: "lastName"
+ title: qsTr("Last Name")
+ width: tableView.columnWidth
+ }
+ }
+
+ TabView {
+ id: tabView
+
+ Layout.minimumWidth: 480
+
+ Tab {
+ title: qsTr("Customer Settings")
+ source: "qml/Settings.qml"
+ }
+ Tab {
+ title: qsTr("Customer Notes")
+ source: "qml/Notes.qml"
+ }
+ Tab {
+ title: qsTr("Customer History")
+ source: "qml/History.qml"
+ }
+ }
+ }
+}
diff --git a/examples/quick/controls/uiforms/main.cpp b/examples/quick/controls/uiforms/main.cpp
new file mode 100644
index 00000000..de92dd70
--- /dev/null
+++ b/examples/quick/controls/uiforms/main.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 "qtquickcontrolsapplication.h"
+#include <QtQml>
+#include <QtGui/QSurfaceFormat>
+
+int main(int argc, char *argv[])
+{
+ QtQuickControlsApplication app(argc, argv);
+ if (QCoreApplication::arguments().contains(QLatin1String("--coreprofile"))) {
+ QSurfaceFormat fmt;
+ fmt.setVersion(4, 4);
+ fmt.setProfile(QSurfaceFormat::CoreProfile);
+ QSurfaceFormat::setDefaultFormat(fmt);
+ }
+
+ qmlRegisterSingletonType(QUrl(QStringLiteral("qrc:/qml/CustomerModel.qml")), "io.qt.example", 1, 0, "CustomerModel");
+
+ QQmlApplicationEngine engine(QUrl("qrc:/main.qml"));
+ return app.exec();
+}
diff --git a/examples/quick/controls/uiforms/main.qml b/examples/quick/controls/uiforms/main.qml
new file mode 100644
index 00000000..da258022
--- /dev/null
+++ b/examples/quick/controls/uiforms/main.qml
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.Dialogs 1.1
+import QtQuick.Controls 1.2
+import io.qt.example 1.0
+import "qml"
+
+ApplicationWindow {
+ visible: true
+ title: "Qt Quick UI Forms"
+
+ MessageDialog {
+ id: aboutDialog
+ icon: StandardIcon.Information
+ title: qsTr("About")
+ text: "Qt Quick UI Forms"
+ informativeText: qsTr("This example demonstrates how to separate the implementation of an application from the UI using ui.qml files.")
+ }
+
+ Action {
+ id: copyAction
+ text: qsTr("&Copy")
+ shortcut: StandardKey.Copy
+ iconName: "edit-copy"
+ enabled: (!!activeFocusItem && !!activeFocusItem["copy"])
+ onTriggered: activeFocusItem.copy()
+ }
+
+ Action {
+ id: cutAction
+ text: qsTr("Cu&t")
+ shortcut: StandardKey.Cut
+ iconName: "edit-cut"
+ enabled: (!!activeFocusItem && !!activeFocusItem["cut"])
+ onTriggered: activeFocusItem.cut()
+ }
+
+ Action {
+ id: pasteAction
+ text: qsTr("&Paste")
+ shortcut: StandardKey.Paste
+ iconName: "edit-paste"
+ enabled: (!!activeFocusItem && !!activeFocusItem["paste"])
+ onTriggered: activeFocusItem.paste()
+ }
+
+ menuBar: MenuBar {
+ Menu {
+ title: qsTr("&File")
+ MenuItem {
+ text: qsTr("E&xit")
+ shortcut: StandardKey.Quit
+ onTriggered: Qt.quit()
+ }
+ }
+ Menu {
+ title: qsTr("&Edit")
+ MenuItem {
+ action: cutAction
+ }
+ MenuItem {
+ action: copyAction
+ }
+ MenuItem {
+ action: pasteAction
+ }
+ }
+ Menu {
+ title: qsTr("&Help")
+ MenuItem {
+ text: qsTr("About...")
+ onTriggered: aboutDialog.open()
+ }
+ }
+ }
+
+ MainForm {
+ id: mainForm
+
+ anchors.fill: parent
+
+ Layout.minimumWidth: 800
+ Layout.minimumHeight: 480
+ Layout.preferredWidth: 768
+ Layout.preferredHeight: 480
+
+ tableView.model: CustomerModel
+
+ Component.onCompleted: CustomerModel.selection = tableView.selection
+ }
+}
diff --git a/examples/quick/controls/uiforms/qml/CustomerModel.qml b/examples/quick/controls/uiforms/qml/CustomerModel.qml
new file mode 100644
index 00000000..70a9695d
--- /dev/null
+++ b/examples/quick/controls/uiforms/qml/CustomerModel.qml
@@ -0,0 +1,144 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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/quick/controls/uiforms/qml/History.qml b/examples/quick/controls/uiforms/qml/History.qml
new file mode 100644
index 00000000..336d717f
--- /dev/null
+++ b/examples/quick/controls/uiforms/qml/History.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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/quick/controls/uiforms/qml/HistoryForm.ui.qml b/examples/quick/controls/uiforms/qml/HistoryForm.ui.qml
new file mode 100644
index 00000000..9445b12f
--- /dev/null
+++ b/examples/quick/controls/uiforms/qml/HistoryForm.ui.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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/quick/controls/uiforms/qml/Notes.qml b/examples/quick/controls/uiforms/qml/Notes.qml
new file mode 100644
index 00000000..af506af3
--- /dev/null
+++ b/examples/quick/controls/uiforms/qml/Notes.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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/quick/controls/uiforms/qml/NotesForm.ui.qml b/examples/quick/controls/uiforms/qml/NotesForm.ui.qml
new file mode 100644
index 00000000..9552afcd
--- /dev/null
+++ b/examples/quick/controls/uiforms/qml/NotesForm.ui.qml
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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/quick/controls/uiforms/qml/Settings.qml b/examples/quick/controls/uiforms/qml/Settings.qml
new file mode 100644
index 00000000..658c62d3
--- /dev/null
+++ b/examples/quick/controls/uiforms/qml/Settings.qml
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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/quick/controls/uiforms/qml/SettingsForm.ui.qml b/examples/quick/controls/uiforms/qml/SettingsForm.ui.qml
new file mode 100644
index 00000000..5cafe0e7
--- /dev/null
+++ b/examples/quick/controls/uiforms/qml/SettingsForm.ui.qml
@@ -0,0 +1,259 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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
+ }
+ }
+}
diff --git a/examples/quick/controls/uiforms/uiforms.pro b/examples/quick/controls/uiforms/uiforms.pro
new file mode 100644
index 00000000..08b3d0c4
--- /dev/null
+++ b/examples/quick/controls/uiforms/uiforms.pro
@@ -0,0 +1,21 @@
+TEMPLATE = app
+TARGET = uiforms
+
+SOURCES += \
+ main.cpp
+
+RESOURCES += \
+ uiforms.qrc
+
+OTHER_FILES += \
+ main.qml \
+ MainForm.ui.qml \
+ qml/Settings.qml \
+ qml/History.qml \
+ qml/Notes.qml \
+ qml/SettingsForm.ui.qml \
+ qml/HistoryForm.ui.qml \
+ qml/NotesForm.ui.qml \
+ qml/CustomerModel.qml
+
+include(../shared/shared.pri)
diff --git a/examples/quick/controls/uiforms/uiforms.qrc b/examples/quick/controls/uiforms/uiforms.qrc
new file mode 100644
index 00000000..447bb039
--- /dev/null
+++ b/examples/quick/controls/uiforms/uiforms.qrc
@@ -0,0 +1,13 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>MainForm.ui.qml</file>
+ <file>qml/Settings.qml</file>
+ <file>qml/History.qml</file>
+ <file>qml/Notes.qml</file>
+ <file>qml/SettingsForm.ui.qml</file>
+ <file>qml/HistoryForm.ui.qml</file>
+ <file>qml/NotesForm.ui.qml</file>
+ <file>qml/CustomerModel.qml</file>
+ </qresource>
+</RCC>