summaryrefslogtreecommitdiff
path: root/examples/quickcontrols/controls
diff options
context:
space:
mode:
Diffstat (limited to 'examples/quickcontrols/controls')
-rw-r--r--examples/quickcontrols/controls/basiclayouts/basiclayouts.pro15
-rw-r--r--examples/quickcontrols/controls/basiclayouts/basiclayouts.qmlproject16
-rw-r--r--examples/quickcontrols/controls/basiclayouts/main.qml135
-rw-r--r--examples/quickcontrols/controls/basiclayouts/resources.qrc5
-rw-r--r--examples/quickcontrols/controls/basiclayouts/src/main.cpp51
-rw-r--r--examples/quickcontrols/controls/basiclayouts/src/src.pri2
-rw-r--r--examples/quickcontrols/controls/calendar/calendar.pro14
-rw-r--r--examples/quickcontrols/controls/calendar/images/eventindicator.pngbin0 -> 2914 bytes
-rw-r--r--examples/quickcontrols/controls/calendar/qml/main.qml216
-rw-r--r--examples/quickcontrols/controls/calendar/resources.qrc6
-rw-r--r--examples/quickcontrols/controls/calendar/src/event.cpp85
-rw-r--r--examples/quickcontrols/controls/calendar/src/event.h76
-rw-r--r--examples/quickcontrols/controls/calendar/src/main.cpp54
-rw-r--r--examples/quickcontrols/controls/calendar/src/sqleventmodel.cpp103
-rw-r--r--examples/quickcontrols/controls/calendar/src/sqleventmodel.h62
-rw-r--r--examples/quickcontrols/controls/calendar/src/src.pri9
-rw-r--r--examples/quickcontrols/controls/controls.pro20
-rw-r--r--examples/quickcontrols/controls/filesystembrowser/filesystembrowser.pro10
-rw-r--r--examples/quickcontrols/controls/filesystembrowser/main.cpp152
-rw-r--r--examples/quickcontrols/controls/filesystembrowser/main.qml129
-rw-r--r--examples/quickcontrols/controls/filesystembrowser/qml.qrc5
-rw-r--r--examples/quickcontrols/controls/gallery/gallery.pro23
-rw-r--r--examples/quickcontrols/controls/gallery/gallery.qrc12
-rw-r--r--examples/quickcontrols/controls/gallery/main.cpp58
-rw-r--r--examples/quickcontrols/controls/gallery/main.qml162
-rw-r--r--examples/quickcontrols/controls/gallery/qml/+android/UI.js45
-rw-r--r--examples/quickcontrols/controls/gallery/qml/+ios/UI.js45
-rw-r--r--examples/quickcontrols/controls/gallery/qml/+osx/UI.js45
-rw-r--r--examples/quickcontrols/controls/gallery/qml/ButtonPage.qml130
-rw-r--r--examples/quickcontrols/controls/gallery/qml/InputPage.qml116
-rw-r--r--examples/quickcontrols/controls/gallery/qml/ProgressPage.qml92
-rw-r--r--examples/quickcontrols/controls/gallery/qml/UI.js45
-rw-r--r--examples/quickcontrols/controls/shared/qtquickcontrolsapplication.h60
-rw-r--r--examples/quickcontrols/controls/shared/shared.pri7
-rw-r--r--examples/quickcontrols/controls/styles/images/bubble.pngbin0 -> 214 bytes
-rw-r--r--examples/quickcontrols/controls/styles/images/button-pressed.pngbin0 -> 3094 bytes
-rw-r--r--examples/quickcontrols/controls/styles/images/button.pngbin0 -> 3164 bytes
-rw-r--r--examples/quickcontrols/controls/styles/images/progress-background.pngbin0 -> 456 bytes
-rw-r--r--examples/quickcontrols/controls/styles/images/progress-fill.pngbin0 -> 507 bytes
-rw-r--r--examples/quickcontrols/controls/styles/images/slider-handle.pngbin0 -> 3523 bytes
-rw-r--r--examples/quickcontrols/controls/styles/images/tab.pngbin0 -> 9877 bytes
-rw-r--r--examples/quickcontrols/controls/styles/images/tab_selected.pngbin0 -> 10184 bytes
-rw-r--r--examples/quickcontrols/controls/styles/images/textfield.pngbin0 -> 3023 bytes
-rw-r--r--examples/quickcontrols/controls/styles/main.cpp53
-rw-r--r--examples/quickcontrols/controls/styles/main.qml397
-rw-r--r--examples/quickcontrols/controls/styles/styles.pro13
-rw-r--r--examples/quickcontrols/controls/styles/styles.qrc14
-rw-r--r--examples/quickcontrols/controls/tableview/main.qml188
-rw-r--r--examples/quickcontrols/controls/tableview/src/main.cpp59
-rw-r--r--examples/quickcontrols/controls/tableview/src/sortfilterproxymodel.cpp189
-rw-r--r--examples/quickcontrols/controls/tableview/src/sortfilterproxymodel.h111
-rw-r--r--examples/quickcontrols/controls/tableview/src/src.pri8
-rw-r--r--examples/quickcontrols/controls/tableview/tableview.pro14
-rw-r--r--examples/quickcontrols/controls/tableview/tableview.qrc5
-rw-r--r--examples/quickcontrols/controls/texteditor/example.html79
-rw-r--r--examples/quickcontrols/controls/texteditor/qml/ToolBarSeparator.qml61
-rw-r--r--examples/quickcontrols/controls/texteditor/qml/images/editcopy.pngbin0 -> 1468 bytes
-rw-r--r--examples/quickcontrols/controls/texteditor/qml/images/editcut.pngbin0 -> 1512 bytes
-rw-r--r--examples/quickcontrols/controls/texteditor/qml/images/editpaste.pngbin0 -> 1906 bytes
-rw-r--r--examples/quickcontrols/controls/texteditor/qml/images/editredo.pngbin0 -> 1752 bytes
-rw-r--r--examples/quickcontrols/controls/texteditor/qml/images/editundo.pngbin0 -> 1746 bytes
-rw-r--r--examples/quickcontrols/controls/texteditor/qml/images/exportpdf.pngbin0 -> 1215 bytes
-rw-r--r--examples/quickcontrols/controls/texteditor/qml/images/filenew.pngbin0 -> 1172 bytes
-rw-r--r--examples/quickcontrols/controls/texteditor/qml/images/fileopen.pngbin0 -> 2168 bytes
-rw-r--r--examples/quickcontrols/controls/texteditor/qml/images/fileprint.pngbin0 -> 2087 bytes
-rw-r--r--examples/quickcontrols/controls/texteditor/qml/images/filesave.pngbin0 -> 1206 bytes
-rw-r--r--examples/quickcontrols/controls/texteditor/qml/images/qt-logo.pngbin0 -> 3531 bytes
-rw-r--r--examples/quickcontrols/controls/texteditor/qml/images/textbold.pngbin0 -> 1611 bytes
-rw-r--r--examples/quickcontrols/controls/texteditor/qml/images/textcenter.pngbin0 -> 1404 bytes
-rw-r--r--examples/quickcontrols/controls/texteditor/qml/images/textitalic.pngbin0 -> 1164 bytes
-rw-r--r--examples/quickcontrols/controls/texteditor/qml/images/textjustify.pngbin0 -> 1257 bytes
-rw-r--r--examples/quickcontrols/controls/texteditor/qml/images/textleft.pngbin0 -> 1235 bytes
-rw-r--r--examples/quickcontrols/controls/texteditor/qml/images/textright.pngbin0 -> 1406 bytes
-rw-r--r--examples/quickcontrols/controls/texteditor/qml/images/textunder.pngbin0 -> 1183 bytes
-rw-r--r--examples/quickcontrols/controls/texteditor/qml/images/zoomin.pngbin0 -> 1696 bytes
-rw-r--r--examples/quickcontrols/controls/texteditor/qml/images/zoomout.pngbin0 -> 1662 bytes
-rw-r--r--examples/quickcontrols/controls/texteditor/qml/main.qml357
-rw-r--r--examples/quickcontrols/controls/texteditor/resources.qrc27
-rw-r--r--examples/quickcontrols/controls/texteditor/src/documenthandler.cpp335
-rw-r--r--examples/quickcontrols/controls/texteditor/src/documenthandler.h171
-rw-r--r--examples/quickcontrols/controls/texteditor/src/main.cpp53
-rw-r--r--examples/quickcontrols/controls/texteditor/src/src.pri9
-rw-r--r--examples/quickcontrols/controls/texteditor/texteditor.pro16
-rw-r--r--examples/quickcontrols/controls/touch/content/AndroidDelegate.qml88
-rw-r--r--examples/quickcontrols/controls/touch/content/ButtonPage.qml172
-rw-r--r--examples/quickcontrols/controls/touch/content/ListPage.qml78
-rw-r--r--examples/quickcontrols/controls/touch/content/ProgressBarPage.qml110
-rw-r--r--examples/quickcontrols/controls/touch/content/SliderPage.qml102
-rw-r--r--examples/quickcontrols/controls/touch/content/TabBarPage.qml98
-rw-r--r--examples/quickcontrols/controls/touch/content/TextInputPage.qml102
-rw-r--r--examples/quickcontrols/controls/touch/images/NOTICE.txt2
-rw-r--r--examples/quickcontrols/controls/touch/images/button_default.pngbin0 -> 1406 bytes
-rw-r--r--examples/quickcontrols/controls/touch/images/button_pressed.pngbin0 -> 1694 bytes
-rw-r--r--examples/quickcontrols/controls/touch/images/navigation_next_item.pngbin0 -> 1341 bytes
-rw-r--r--examples/quickcontrols/controls/touch/images/navigation_previous_item.pngbin0 -> 1343 bytes
-rw-r--r--examples/quickcontrols/controls/touch/images/tab_selected.pngbin0 -> 217 bytes
-rw-r--r--examples/quickcontrols/controls/touch/images/tabs_standard.pngbin0 -> 1230 bytes
-rw-r--r--examples/quickcontrols/controls/touch/images/textinput.pngbin0 -> 4132 bytes
-rw-r--r--examples/quickcontrols/controls/touch/images/toolbar.pngbin0 -> 1643 bytes
-rw-r--r--examples/quickcontrols/controls/touch/main.qml147
-rw-r--r--examples/quickcontrols/controls/touch/resources.qrc20
-rw-r--r--examples/quickcontrols/controls/touch/src/main.cpp51
-rw-r--r--examples/quickcontrols/controls/touch/src/src.pri2
-rw-r--r--examples/quickcontrols/controls/touch/touch.pro22
-rw-r--r--examples/quickcontrols/controls/touch/touch.qmlproject16
-rw-r--r--examples/quickcontrols/controls/uiforms/MainForm.ui.qml98
-rw-r--r--examples/quickcontrols/controls/uiforms/main.cpp61
-rw-r--r--examples/quickcontrols/controls/uiforms/main.qml131
-rw-r--r--examples/quickcontrols/controls/uiforms/qml/CustomerModel.qml144
-rw-r--r--examples/quickcontrols/controls/uiforms/qml/History.qml76
-rw-r--r--examples/quickcontrols/controls/uiforms/qml/HistoryForm.ui.qml80
-rw-r--r--examples/quickcontrols/controls/uiforms/qml/Notes.qml76
-rw-r--r--examples/quickcontrols/controls/uiforms/qml/NotesForm.ui.qml85
-rw-r--r--examples/quickcontrols/controls/uiforms/qml/Settings.qml96
-rw-r--r--examples/quickcontrols/controls/uiforms/qml/SettingsForm.ui.qml259
-rw-r--r--examples/quickcontrols/controls/uiforms/uiforms.pro24
-rw-r--r--examples/quickcontrols/controls/uiforms/uiforms.qrc13
117 files changed, 6317 insertions, 0 deletions
diff --git a/examples/quickcontrols/controls/basiclayouts/basiclayouts.pro b/examples/quickcontrols/controls/basiclayouts/basiclayouts.pro
new file mode 100644
index 00000000..202a899f
--- /dev/null
+++ b/examples/quickcontrols/controls/basiclayouts/basiclayouts.pro
@@ -0,0 +1,15 @@
+QT += qml quick
+TARGET = basiclayouts
+!no_desktop: QT += widgets
+
+include(src/src.pri)
+include(../shared/shared.pri)
+
+OTHER_FILES += \
+ main.qml
+
+RESOURCES += \
+ resources.qrc
+
+target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/controls/basiclayouts
+INSTALLS += target
diff --git a/examples/quickcontrols/controls/basiclayouts/basiclayouts.qmlproject b/examples/quickcontrols/controls/basiclayouts/basiclayouts.qmlproject
new file mode 100644
index 00000000..e5a8bf02
--- /dev/null
+++ b/examples/quickcontrols/controls/basiclayouts/basiclayouts.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "main.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/quickcontrols/controls/basiclayouts/main.qml b/examples/quickcontrols/controls/basiclayouts/main.qml
new file mode 100644
index 00000000..b6694b45
--- /dev/null
+++ b/examples/quickcontrols/controls/basiclayouts/main.qml
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** 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.Controls 1.2
+import QtQuick.Layouts 1.3
+
+ApplicationWindow {
+ visible: true
+ title: "Basic layouts"
+ property int margin: 11
+ width: mainLayout.implicitWidth + 2 * margin
+ height: mainLayout.implicitHeight + 2 * margin
+ minimumWidth: mainLayout.Layout.minimumWidth + 2 * margin
+ minimumHeight: mainLayout.Layout.minimumHeight + 2 * margin
+
+ ColumnLayout {
+ id: mainLayout
+ anchors.fill: parent
+ anchors.margins: margin
+ GroupBox {
+ id: rowBox
+ title: "Row layout"
+ Layout.fillWidth: true
+
+ RowLayout {
+ id: rowLayout
+ anchors.fill: parent
+ TextField {
+ placeholderText: "This wants to grow horizontally"
+ Layout.fillWidth: true
+ }
+ Button {
+ text: "Button"
+ }
+ }
+ }
+
+ GroupBox {
+ id: gridBox
+ title: "Grid layout"
+ Layout.fillWidth: true
+
+ GridLayout {
+ id: gridLayout
+ rows: 3
+ flow: GridLayout.TopToBottom
+ anchors.fill: parent
+
+ Label { text: "Line 1" }
+ Label { text: "Line 2" }
+ Label { text: "Line 3" }
+
+ TextField { }
+ TextField { }
+ TextField { }
+
+ TextArea {
+ text: "This widget spans over three rows in the GridLayout.\n"
+ + "All items in the GridLayout are implicitly positioned from top to bottom."
+ Layout.rowSpan: 3
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ }
+ }
+ }
+ TextArea {
+ id: t3
+ text: "This fills the whole cell"
+ Layout.minimumHeight: 30
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ }
+ GroupBox {
+ id: stackBox
+ title: "Stack layout"
+ implicitWidth: 200
+ implicitHeight: 60
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ StackLayout {
+ id: stackLayout
+ anchors.fill: parent
+
+ function advance() { currentIndex = (currentIndex + 1) % count }
+
+ Repeater {
+ id: stackRepeater
+ model: 5
+ Rectangle {
+ color: Qt.hsla((0.5 + index)/stackRepeater.count, 0.3, 0.7, 1)
+ Button { anchors.centerIn: parent; text: "Page " + (index + 1); onClicked: { stackLayout.advance() } }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/examples/quickcontrols/controls/basiclayouts/resources.qrc b/examples/quickcontrols/controls/basiclayouts/resources.qrc
new file mode 100644
index 00000000..3b111a90
--- /dev/null
+++ b/examples/quickcontrols/controls/basiclayouts/resources.qrc
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/">
+ <file>main.qml</file>
+</qresource>
+</RCC>
diff --git a/examples/quickcontrols/controls/basiclayouts/src/main.cpp b/examples/quickcontrols/controls/basiclayouts/src/main.cpp
new file mode 100644
index 00000000..e66387f7
--- /dev/null
+++ b/examples/quickcontrols/controls/basiclayouts/src/main.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** 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/QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QtQuickControlsApplication app(argc, argv);
+ QQmlApplicationEngine engine(QUrl("qrc:/main.qml"));
+ if (engine.rootObjects().isEmpty())
+ return -1;
+ return app.exec();
+}
diff --git a/examples/quickcontrols/controls/basiclayouts/src/src.pri b/examples/quickcontrols/controls/basiclayouts/src/src.pri
new file mode 100644
index 00000000..66d903ea
--- /dev/null
+++ b/examples/quickcontrols/controls/basiclayouts/src/src.pri
@@ -0,0 +1,2 @@
+SOURCES += \
+ $$PWD/main.cpp
diff --git a/examples/quickcontrols/controls/calendar/calendar.pro b/examples/quickcontrols/controls/calendar/calendar.pro
new file mode 100644
index 00000000..67960e27
--- /dev/null
+++ b/examples/quickcontrols/controls/calendar/calendar.pro
@@ -0,0 +1,14 @@
+QT += qml quick sql
+TARGET = calendar
+
+!contains(sql-drivers, sqlite): QTPLUGIN += qsqlite
+
+include(src/src.pri)
+include(../shared/shared.pri)
+
+OTHER_FILES += qml/main.qml
+
+RESOURCES += resources.qrc
+
+target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/controls/calendar
+INSTALLS += target
diff --git a/examples/quickcontrols/controls/calendar/images/eventindicator.png b/examples/quickcontrols/controls/calendar/images/eventindicator.png
new file mode 100644
index 00000000..1edffd02
--- /dev/null
+++ b/examples/quickcontrols/controls/calendar/images/eventindicator.png
Binary files differ
diff --git a/examples/quickcontrols/controls/calendar/qml/main.qml b/examples/quickcontrols/controls/calendar/qml/main.qml
new file mode 100644
index 00000000..46215e28
--- /dev/null
+++ b/examples/quickcontrols/controls/calendar/qml/main.qml
@@ -0,0 +1,216 @@
+/****************************************************************************
+**
+** 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.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles 1.1
+import org.qtproject.examples.calendar 1.0
+
+ApplicationWindow {
+ visible: true
+ width: 640
+ height: 400
+ minimumWidth: 400
+ minimumHeight: 300
+ color: "#f4f4f4"
+
+ title: "Calendar Example"
+
+ SystemPalette {
+ id: systemPalette
+ }
+
+ SqlEventModel {
+ id: eventModel
+ }
+
+ Flow {
+ id: row
+ anchors.fill: parent
+ anchors.margins: 20
+ spacing: 10
+ layoutDirection: Qt.RightToLeft
+
+ Calendar {
+ id: calendar
+ width: (parent.width > parent.height ? parent.width * 0.6 - parent.spacing : parent.width)
+ height: (parent.height > parent.width ? parent.height * 0.6 - parent.spacing : parent.height)
+ frameVisible: true
+ weekNumbersVisible: true
+ selectedDate: new Date(2014, 0, 1)
+ focus: true
+
+ style: CalendarStyle {
+ dayDelegate: Item {
+ readonly property color sameMonthDateTextColor: "#444"
+ readonly property color selectedDateColor: Qt.platform.os === "osx" ? "#3778d0" : systemPalette.highlight
+ readonly property color selectedDateTextColor: "white"
+ readonly property color differentMonthDateTextColor: "#bbb"
+ readonly property color invalidDatecolor: "#dddddd"
+
+ Rectangle {
+ anchors.fill: parent
+ border.color: "transparent"
+ color: styleData.date !== undefined && styleData.selected ? selectedDateColor : "transparent"
+ anchors.margins: styleData.selected ? -1 : 0
+ }
+
+ Image {
+ visible: eventModel.eventsForDate(styleData.date).length > 0
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.margins: -1
+ width: 12
+ height: width
+ source: "qrc:/images/eventindicator.png"
+ }
+
+ Label {
+ id: dayDelegateText
+ text: styleData.date.getDate()
+ anchors.centerIn: parent
+ color: {
+ var color = invalidDatecolor;
+ if (styleData.valid) {
+ // Date is within the valid range.
+ color = styleData.visibleMonth ? sameMonthDateTextColor : differentMonthDateTextColor;
+ if (styleData.selected) {
+ color = selectedDateTextColor;
+ }
+ }
+ color;
+ }
+ }
+ }
+ }
+ }
+
+ Component {
+ id: eventListHeader
+
+ Row {
+ id: eventDateRow
+ width: parent.width
+ height: eventDayLabel.height
+ spacing: 10
+
+ Label {
+ id: eventDayLabel
+ text: calendar.selectedDate.getDate()
+ font.pointSize: 35
+ }
+
+ Column {
+ height: eventDayLabel.height
+
+ Label {
+ readonly property var options: { weekday: "long" }
+ text: Qt.locale().standaloneDayName(calendar.selectedDate.getDay(), Locale.LongFormat)
+ font.pointSize: 18
+ }
+ Label {
+ text: Qt.locale().standaloneMonthName(calendar.selectedDate.getMonth())
+ + calendar.selectedDate.toLocaleDateString(Qt.locale(), " yyyy")
+ font.pointSize: 12
+ }
+ }
+ }
+ }
+
+ Rectangle {
+ width: (parent.width > parent.height ? parent.width * 0.4 - parent.spacing : parent.width)
+ height: (parent.height > parent.width ? parent.height * 0.4 - parent.spacing : parent.height)
+ border.color: Qt.darker(color, 1.2)
+
+ ListView {
+ id: eventsListView
+ spacing: 4
+ clip: true
+ header: eventListHeader
+ anchors.fill: parent
+ anchors.margins: 10
+ model: eventModel.eventsForDate(calendar.selectedDate)
+
+ delegate: Rectangle {
+ width: eventsListView.width
+ height: eventItemColumn.height
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ Image {
+ anchors.top: parent.top
+ anchors.topMargin: 4
+ width: 12
+ height: width
+ source: "qrc:/images/eventindicator.png"
+ }
+
+ Rectangle {
+ width: parent.width
+ height: 1
+ color: "#eee"
+ }
+
+ Column {
+ id: eventItemColumn
+ anchors.left: parent.left
+ anchors.leftMargin: 20
+ anchors.right: parent.right
+ height: timeLabel.height + nameLabel.height + 8
+
+ Label {
+ id: nameLabel
+ width: parent.width
+ wrapMode: Text.Wrap
+ text: modelData.name
+ }
+ Label {
+ id: timeLabel
+ width: parent.width
+ wrapMode: Text.Wrap
+ text: modelData.startDate.toLocaleTimeString(calendar.locale, Locale.ShortFormat)
+ color: "#aaa"
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/examples/quickcontrols/controls/calendar/resources.qrc b/examples/quickcontrols/controls/calendar/resources.qrc
new file mode 100644
index 00000000..9da283ba
--- /dev/null
+++ b/examples/quickcontrols/controls/calendar/resources.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/">
+ <file>qml/main.qml</file>
+ <file>images/eventindicator.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/quickcontrols/controls/calendar/src/event.cpp b/examples/quickcontrols/controls/calendar/src/event.cpp
new file mode 100644
index 00000000..e4c7dd78
--- /dev/null
+++ b/examples/quickcontrols/controls/calendar/src/event.cpp
@@ -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$
+**
+****************************************************************************/
+
+#include "event.h"
+
+Event::Event(QObject *parent) :
+ QObject(parent)
+{
+}
+
+QString Event::name() const
+{
+ return mName;
+}
+
+void Event::setName(const QString &name)
+{
+ if (name != mName) {
+ mName = name;
+ emit nameChanged(mName);
+ }
+}
+
+QDateTime Event::startDate() const
+{
+ return mStartDate;
+}
+
+void Event::setStartDate(const QDateTime &startDate)
+{
+ if (startDate != mStartDate) {
+ mStartDate = startDate;
+ emit startDateChanged(mStartDate);
+ }
+}
+
+QDateTime Event::endDate() const
+{
+ return mEndDate;
+}
+
+void Event::setEndDate(const QDateTime &endDate)
+{
+ if (endDate != mEndDate) {
+ mEndDate = endDate;
+ emit endDateChanged(mEndDate);
+ }
+}
diff --git a/examples/quickcontrols/controls/calendar/src/event.h b/examples/quickcontrols/controls/calendar/src/event.h
new file mode 100644
index 00000000..bfa11ad7
--- /dev/null
+++ b/examples/quickcontrols/controls/calendar/src/event.h
@@ -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$
+**
+****************************************************************************/
+
+#ifndef EVENT_H
+#define EVENT_H
+
+#include <QDateTime>
+#include <QObject>
+#include <QString>
+
+class Event : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+ Q_PROPERTY(QDateTime startDate READ startDate WRITE setStartDate NOTIFY startDateChanged)
+ Q_PROPERTY(QDateTime endDate READ endDate WRITE setEndDate NOTIFY endDateChanged)
+public:
+ explicit Event(QObject *parent = 0);
+
+ QString name() const;
+ void setName(const QString &name);
+
+ QDateTime startDate() const;
+ void setStartDate(const QDateTime &startDate);
+
+ QDateTime endDate() const;
+ void setEndDate(const QDateTime &endDate);
+signals:
+ void nameChanged(const QString &name);
+ void startDateChanged(const QDateTime &startDate);
+ void endDateChanged(const QDateTime &endDate);
+private:
+ QString mName;
+ QDateTime mStartDate;
+ QDateTime mEndDate;
+};
+
+#endif
diff --git a/examples/quickcontrols/controls/calendar/src/main.cpp b/examples/quickcontrols/controls/calendar/src/main.cpp
new file mode 100644
index 00000000..bab7e4b2
--- /dev/null
+++ b/examples/quickcontrols/controls/calendar/src/main.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** 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 <QtQml>
+
+#include "qtquickcontrolsapplication.h"
+#include "sqleventmodel.h"
+
+int main(int argc, char *argv[])
+{
+ QtQuickControlsApplication app(argc, argv);
+ qmlRegisterType<SqlEventModel>("org.qtproject.examples.calendar", 1, 0, "SqlEventModel");
+ QQmlApplicationEngine engine(QUrl("qrc:/qml/main.qml"));
+ if (engine.rootObjects().isEmpty())
+ return -1;
+ return app.exec();
+}
diff --git a/examples/quickcontrols/controls/calendar/src/sqleventmodel.cpp b/examples/quickcontrols/controls/calendar/src/sqleventmodel.cpp
new file mode 100644
index 00000000..92e558ef
--- /dev/null
+++ b/examples/quickcontrols/controls/calendar/src/sqleventmodel.cpp
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** 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 "sqleventmodel.h"
+
+#include <QDebug>
+#include <QFileInfo>
+#include <QSqlError>
+#include <QSqlQuery>
+
+SqlEventModel::SqlEventModel()
+{
+ createConnection();
+}
+
+QList<QObject*> SqlEventModel::eventsForDate(const QDate &date)
+{
+ const QString queryStr = QString::fromLatin1("SELECT * FROM Event WHERE '%1' >= startDate AND '%1' <= endDate").arg(date.toString("yyyy-MM-dd"));
+ QSqlQuery query(queryStr);
+ if (!query.exec())
+ qFatal("Query failed");
+
+ QList<QObject*> events;
+ while (query.next()) {
+ Event *event = new Event(this);
+ event->setName(query.value("name").toString());
+
+ QDateTime startDate;
+ startDate.setDate(query.value("startDate").toDate());
+ startDate.setTime(QTime(0, 0).addSecs(query.value("startTime").toInt()));
+ event->setStartDate(startDate);
+
+ QDateTime endDate;
+ endDate.setDate(query.value("endDate").toDate());
+ endDate.setTime(QTime(0, 0).addSecs(query.value("endTime").toInt()));
+ event->setEndDate(endDate);
+
+ events.append(event);
+ }
+
+ return events;
+}
+
+/*
+ Defines a helper function to open a connection to an
+ in-memory SQLITE database and to create a test table.
+*/
+void SqlEventModel::createConnection()
+{
+ QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
+ db.setDatabaseName(":memory:");
+ if (!db.open()) {
+ qFatal("Cannot open database");
+ return;
+ }
+
+ QSqlQuery query;
+ // We store the time as seconds because it's easier to query.
+ query.exec("create table Event (name TEXT, startDate DATE, startTime INT, endDate DATE, endTime INT)");
+ query.exec("insert into Event values('Grocery shopping', '2014-01-01', 36000, '2014-01-01', 39600)");
+ query.exec("insert into Event values('Ice skating', '2014-01-01', 57600, '2014-01-01', 61200)");
+ query.exec("insert into Event values('Doctor''s appointment', '2014-01-15', 57600, '2014-01-15', 63000)");
+ query.exec("insert into Event values('Conference', '2014-01-24', 32400, '2014-01-28', 61200)");
+
+ return;
+}
diff --git a/examples/quickcontrols/controls/calendar/src/sqleventmodel.h b/examples/quickcontrols/controls/calendar/src/sqleventmodel.h
new file mode 100644
index 00000000..e7a35c01
--- /dev/null
+++ b/examples/quickcontrols/controls/calendar/src/sqleventmodel.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef SQLEVENTMODEL_H
+#define SQLEVENTMODEL_H
+
+#include <QList>
+#include <QObject>
+
+#include "event.h"
+
+class SqlEventModel : public QObject
+{
+ Q_OBJECT
+
+public:
+ SqlEventModel();
+
+ Q_INVOKABLE QList<QObject*> eventsForDate(const QDate &date);
+
+private:
+ static void createConnection();
+};
+
+#endif
diff --git a/examples/quickcontrols/controls/calendar/src/src.pri b/examples/quickcontrols/controls/calendar/src/src.pri
new file mode 100644
index 00000000..50b2ea62
--- /dev/null
+++ b/examples/quickcontrols/controls/calendar/src/src.pri
@@ -0,0 +1,9 @@
+SOURCES += \
+ $$PWD/event.cpp \
+ $$PWD/main.cpp \
+ $$PWD/sqleventmodel.cpp
+
+
+HEADERS += \
+ $$PWD/event.h \
+ $$PWD/sqleventmodel.h
diff --git a/examples/quickcontrols/controls/controls.pro b/examples/quickcontrols/controls/controls.pro
new file mode 100644
index 00000000..02b0e094
--- /dev/null
+++ b/examples/quickcontrols/controls/controls.pro
@@ -0,0 +1,20 @@
+TEMPLATE = subdirs
+
+SUBDIRS += \
+ gallery \
+ tableview \
+ touch \
+ basiclayouts \
+ styles \
+ uiforms
+
+qtHaveModule(widgets) {
+ SUBDIRS += texteditor filesystembrowser
+}
+
+qtHaveModule(sql) {
+ SUBDIRS += calendar
+}
+
+EXAMPLE_FILES += \
+ shared
diff --git a/examples/quickcontrols/controls/filesystembrowser/filesystembrowser.pro b/examples/quickcontrols/controls/filesystembrowser/filesystembrowser.pro
new file mode 100644
index 00000000..fc14584c
--- /dev/null
+++ b/examples/quickcontrols/controls/filesystembrowser/filesystembrowser.pro
@@ -0,0 +1,10 @@
+TEMPLATE = app
+TARGET = filesystembrowser
+QT += qml quick widgets
+
+SOURCES += main.cpp
+
+RESOURCES += qml.qrc
+
+target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/controls/filesystembrowser
+INSTALLS += target
diff --git a/examples/quickcontrols/controls/filesystembrowser/main.cpp b/examples/quickcontrols/controls/filesystembrowser/main.cpp
new file mode 100644
index 00000000..e9c63c20
--- /dev/null
+++ b/examples/quickcontrols/controls/filesystembrowser/main.cpp
@@ -0,0 +1,152 @@
+/****************************************************************************
+**
+** 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 <QApplication>
+#include <QQmlApplicationEngine>
+#include <QtQml>
+#include <QFileSystemModel>
+#include <QDateTime>
+#include <QDesktopServices>
+#include <QUrl>
+
+static inline QString permissionString(const QFileInfo &fi)
+{
+ const QFile::Permissions permissions = fi.permissions();
+ QString result = QLatin1String("----------");
+ if (fi.isSymLink())
+ result[0] = QLatin1Char('l');
+ else if (fi.isDir())
+ result[0] = QLatin1Char('d');
+ if (permissions & QFileDevice::ReadUser)
+ result[1] = QLatin1Char('r');
+ if (permissions & QFileDevice::WriteUser)
+ result[2] = QLatin1Char('w');
+ if (permissions & QFileDevice::ExeUser)
+ result[3] = QLatin1Char('x');
+ if (permissions & QFileDevice::ReadGroup)
+ result[4] = QLatin1Char('r');
+ if (permissions & QFileDevice::WriteGroup)
+ result[5] = QLatin1Char('w');
+ if (permissions & QFileDevice::ExeGroup)
+ result[6] = QLatin1Char('x');
+ if (permissions & QFileDevice::ReadOther)
+ result[7] = QLatin1Char('r');
+ if (permissions & QFileDevice::WriteOther)
+ result[8] = QLatin1Char('w');
+ if (permissions & QFileDevice::ExeOther)
+ result[9] = QLatin1Char('x');
+ return result;
+}
+
+static inline QString sizeString(const QFileInfo &fi)
+{
+ if (!fi.isFile())
+ return QString();
+ const qint64 size = fi.size();
+ if (size > 1024 * 1024 * 10)
+ return QString::number(size / (1024 * 1024)) + QLatin1Char('M');
+ if (size > 1024 * 10)
+ return QString::number(size / 1024) + QLatin1Char('K');
+ return QString::number(size);
+}
+
+class DisplayFileSystemModel : public QFileSystemModel {
+ Q_OBJECT
+public:
+ explicit DisplayFileSystemModel(QObject *parent = Q_NULLPTR)
+ : QFileSystemModel(parent) {}
+
+ enum Roles {
+ SizeRole = Qt::UserRole + 4,
+ DisplayableFilePermissionsRole = Qt::UserRole + 5,
+ LastModifiedRole = Qt::UserRole + 6,
+ UrlStringRole = Qt::UserRole + 7
+ };
+ Q_ENUM(Roles)
+
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE
+ {
+ if (index.isValid() && role >= SizeRole) {
+ switch (role) {
+ case SizeRole:
+ return QVariant(sizeString(fileInfo(index)));
+ case DisplayableFilePermissionsRole:
+ return QVariant(permissionString(fileInfo(index)));
+ case LastModifiedRole:
+ return QVariant(fileInfo(index).lastModified().toString(Qt::SystemLocaleShortDate));
+ case UrlStringRole:
+ return QVariant(QUrl::fromLocalFile(filePath(index)).toString());
+ default:
+ break;
+ }
+ }
+ return QFileSystemModel::data(index, role);
+ }
+
+ QHash<int,QByteArray> roleNames() const Q_DECL_OVERRIDE
+ {
+ QHash<int, QByteArray> result = QFileSystemModel::roleNames();
+ result.insert(SizeRole, QByteArrayLiteral("size"));
+ result.insert(DisplayableFilePermissionsRole, QByteArrayLiteral("displayableFilePermissions"));
+ result.insert(LastModifiedRole, QByteArrayLiteral("lastModified"));
+ return result;
+ }
+};
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ QQmlApplicationEngine engine;
+ qmlRegisterUncreatableType<DisplayFileSystemModel>("io.qt.examples.quick.controls.filesystembrowser", 1, 0,
+ "FileSystemModel", "Cannot create a FileSystemModel instance.");
+ QFileSystemModel *fsm = new DisplayFileSystemModel(&engine);
+ fsm->setRootPath(QDir::homePath());
+ fsm->setResolveSymlinks(true);
+ engine.rootContext()->setContextProperty("fileSystemModel", fsm);
+ engine.rootContext()->setContextProperty("rootPathIndex", fsm->index(fsm->rootPath()));
+ engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
+ if (engine.rootObjects().isEmpty())
+ return -1;
+
+ return app.exec();
+}
+
+#include "main.moc"
diff --git a/examples/quickcontrols/controls/filesystembrowser/main.qml b/examples/quickcontrols/controls/filesystembrowser/main.qml
new file mode 100644
index 00000000..6e79ca61
--- /dev/null
+++ b/examples/quickcontrols/controls/filesystembrowser/main.qml
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** 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.Controls 1.5
+import QtQml.Models 2.2
+import io.qt.examples.quick.controls.filesystembrowser 1.0
+
+ApplicationWindow {
+ visible: true
+ width: 640
+ height: 480
+ title: qsTr("File System")
+
+ menuBar: MenuBar {
+ Menu {
+ title: qsTr("File")
+ MenuItem {
+ text: qsTr("Exit")
+ onTriggered: Qt.quit();
+ }
+ }
+ }
+
+ Row {
+ id: row
+ anchors.top: parent.top
+ anchors.topMargin: 12
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ ExclusiveGroup {
+ id: eg
+ }
+
+ Repeater {
+ model: [ "None", "Single", "Extended", "Multi", "Contig."]
+ Button {
+ text: modelData
+ exclusiveGroup: eg
+ checkable: true
+ checked: index === 1
+ onClicked: view.selectionMode = index
+ }
+ }
+ }
+
+ ItemSelectionModel {
+ id: sel
+ model: fileSystemModel
+ }
+
+ TreeView {
+ id: view
+ anchors.fill: parent
+ anchors.margins: 2 * 12 + row.height
+ model: fileSystemModel
+ rootIndex: rootPathIndex
+ selection: sel
+
+ TableViewColumn {
+ title: "Name"
+ role: "fileName"
+ resizable: true
+ }
+
+ TableViewColumn {
+ title: "Size"
+ role: "size"
+ resizable: true
+ horizontalAlignment : Text.AlignRight
+ width: 70
+ }
+
+ TableViewColumn {
+ title: "Permissions"
+ role: "displayableFilePermissions"
+ resizable: true
+ width: 100
+ }
+
+ TableViewColumn {
+ title: "Date Modified"
+ role: "lastModified"
+ resizable: true
+ }
+
+ onActivated : {
+ var url = fileSystemModel.data(index, FileSystemModel.UrlStringRole)
+ Qt.openUrlExternally(url)
+ }
+ }
+}
diff --git a/examples/quickcontrols/controls/filesystembrowser/qml.qrc b/examples/quickcontrols/controls/filesystembrowser/qml.qrc
new file mode 100644
index 00000000..5f6483ac
--- /dev/null
+++ b/examples/quickcontrols/controls/filesystembrowser/qml.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/quickcontrols/controls/gallery/gallery.pro b/examples/quickcontrols/controls/gallery/gallery.pro
new file mode 100644
index 00000000..5cba235d
--- /dev/null
+++ b/examples/quickcontrols/controls/gallery/gallery.pro
@@ -0,0 +1,23 @@
+TEMPLATE = app
+TARGET = gallery
+
+SOURCES += \
+ main.cpp
+
+RESOURCES += \
+ gallery.qrc
+
+OTHER_FILES += \
+ main.qml \
+ qml/ButtonPage.qml \
+ qml/InputPage.qml \
+ qml/ProgressPage.qml \
+ qml/UI.js \
+ qml/+android/UI.js \
+ qml/+ios/UI.js \
+ qml/+osx/UI.js
+
+include(../shared/shared.pri)
+
+target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/controls/gallery
+INSTALLS += target
diff --git a/examples/quickcontrols/controls/gallery/gallery.qrc b/examples/quickcontrols/controls/gallery/gallery.qrc
new file mode 100644
index 00000000..873c8b5c
--- /dev/null
+++ b/examples/quickcontrols/controls/gallery/gallery.qrc
@@ -0,0 +1,12 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>qml/ButtonPage.qml</file>
+ <file>qml/InputPage.qml</file>
+ <file>qml/ProgressPage.qml</file>
+ <file>qml/UI.js</file>
+ <file>qml/+android/UI.js</file>
+ <file>qml/+ios/UI.js</file>
+ <file>qml/+osx/UI.js</file>
+ </qresource>
+</RCC>
diff --git a/examples/quickcontrols/controls/gallery/main.cpp b/examples/quickcontrols/controls/gallery/main.cpp
new file mode 100644
index 00000000..ac3f447d
--- /dev/null
+++ b/examples/quickcontrols/controls/gallery/main.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** 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/QQmlApplicationEngine>
+#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);
+ }
+ QQmlApplicationEngine engine(QUrl("qrc:/main.qml"));
+ if (engine.rootObjects().isEmpty())
+ return -1;
+ return app.exec();
+}
diff --git a/examples/quickcontrols/controls/gallery/main.qml b/examples/quickcontrols/controls/gallery/main.qml
new file mode 100644
index 00000000..ab3d8d32
--- /dev/null
+++ b/examples/quickcontrols/controls/gallery/main.qml
@@ -0,0 +1,162 @@
+/****************************************************************************
+**
+** 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 "qml/UI.js" as UI
+import "qml"
+
+ApplicationWindow {
+ visible: true
+ title: "Qt Quick Controls Gallery"
+
+ width: 640
+ height: 480
+
+ MessageDialog {
+ id: aboutDialog
+ icon: StandardIcon.Information
+ title: "About"
+ text: "Qt Quick Controls Gallery"
+ informativeText: "This example demonstrates most of the available Qt Quick Controls."
+ }
+
+ Action {
+ id: copyAction
+ text: "&Copy"
+ shortcut: StandardKey.Copy
+ iconName: "edit-copy"
+ enabled: (!!activeFocusItem && !!activeFocusItem["copy"])
+ onTriggered: activeFocusItem.copy()
+ }
+
+ Action {
+ id: cutAction
+ text: "Cu&t"
+ shortcut: StandardKey.Cut
+ iconName: "edit-cut"
+ enabled: (!!activeFocusItem && !!activeFocusItem["cut"])
+ onTriggered: activeFocusItem.cut()
+ }
+
+ Action {
+ id: pasteAction
+ text: "&Paste"
+ shortcut: StandardKey.Paste
+ iconName: "edit-paste"
+ enabled: (!!activeFocusItem && !!activeFocusItem["paste"])
+ onTriggered: activeFocusItem.paste()
+ }
+
+ toolBar: ToolBar {
+ RowLayout {
+ anchors.fill: parent
+ anchors.margins: spacing
+ Label {
+ text: UI.label
+ }
+ Item { Layout.fillWidth: true }
+ CheckBox {
+ id: enabler
+ text: "Enabled"
+ checked: true
+ }
+ }
+ }
+
+ menuBar: MenuBar {
+ Menu {
+ title: "&File"
+ MenuItem {
+ text: "E&xit"
+ shortcut: StandardKey.Quit
+ onTriggered: Qt.quit()
+ }
+ }
+ Menu {
+ title: "&Edit"
+ visible: tabView.currentIndex == 2
+ MenuItem { action: cutAction }
+ MenuItem { action: copyAction }
+ MenuItem { action: pasteAction }
+ }
+ Menu {
+ title: "&Help"
+ MenuItem {
+ text: "About..."
+ onTriggered: aboutDialog.open()
+ }
+ }
+ }
+
+ TabView {
+ id: tabView
+
+ anchors.fill: parent
+ anchors.margins: UI.margin
+ tabPosition: UI.tabPosition
+
+ Layout.minimumWidth: 360
+ Layout.minimumHeight: 360
+ Layout.preferredWidth: 480
+ Layout.preferredHeight: 640
+
+ Tab {
+ title: "Buttons"
+ ButtonPage {
+ enabled: enabler.checked
+ }
+ }
+ Tab {
+ title: "Progress"
+ ProgressPage {
+ enabled: enabler.checked
+ }
+ }
+ Tab {
+ title: "Input"
+ InputPage {
+ enabled: enabler.checked
+ }
+ }
+ }
+}
diff --git a/examples/quickcontrols/controls/gallery/qml/+android/UI.js b/examples/quickcontrols/controls/gallery/qml/+android/UI.js
new file mode 100644
index 00000000..417b4581
--- /dev/null
+++ b/examples/quickcontrols/controls/gallery/qml/+android/UI.js
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** 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 library
+
+var margin = 0
+var tabPosition = Qt.BottomEdge
+var label = "Gallery"
diff --git a/examples/quickcontrols/controls/gallery/qml/+ios/UI.js b/examples/quickcontrols/controls/gallery/qml/+ios/UI.js
new file mode 100644
index 00000000..417b4581
--- /dev/null
+++ b/examples/quickcontrols/controls/gallery/qml/+ios/UI.js
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** 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 library
+
+var margin = 0
+var tabPosition = Qt.BottomEdge
+var label = "Gallery"
diff --git a/examples/quickcontrols/controls/gallery/qml/+osx/UI.js b/examples/quickcontrols/controls/gallery/qml/+osx/UI.js
new file mode 100644
index 00000000..ee439953
--- /dev/null
+++ b/examples/quickcontrols/controls/gallery/qml/+osx/UI.js
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** 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 library
+
+var margin = 12
+var tabPosition = Qt.TopEdge
+var label = ""
diff --git a/examples/quickcontrols/controls/gallery/qml/ButtonPage.qml b/examples/quickcontrols/controls/gallery/qml/ButtonPage.qml
new file mode 100644
index 00000000..b6db20de
--- /dev/null
+++ b/examples/quickcontrols/controls/gallery/qml/ButtonPage.qml
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** 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
+
+ScrollView {
+ id: page
+ implicitWidth: 640
+ implicitHeight: 200
+
+ horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
+
+ Item {
+ id: content
+
+ width: Math.max(page.viewport.width, grid.implicitWidth + 2 * grid.rowSpacing)
+ height: Math.max(page.viewport.height, grid.implicitHeight + 2 * grid.columnSpacing)
+
+ GridLayout {
+ id: grid
+
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.leftMargin: grid.rowSpacing
+ anchors.rightMargin: grid.rowSpacing
+ anchors.topMargin: grid.columnSpacing
+
+ columns: page.width < page.height ? 1 : 2
+
+ GroupBox {
+ title: "Button"
+ Layout.fillWidth: true
+ Layout.columnSpan: grid.columns
+ RowLayout {
+ anchors.fill: parent
+ Button { text: "OK"; isDefault: true }
+ Button { text: "Cancel" }
+ Item { Layout.fillWidth: true }
+ Button {
+ text: "Attach"
+ menu: Menu {
+ MenuItem { text: "Image" }
+ MenuItem { text: "Document" }
+ }
+ }
+ }
+ }
+
+ GroupBox {
+ title: "CheckBox"
+ Layout.fillWidth: true
+ ColumnLayout {
+ anchors.fill: parent
+ CheckBox { text: "E-mail"; checked: true }
+ CheckBox { text: "Calendar"; checked: true }
+ CheckBox { text: "Contacts" }
+ }
+ }
+
+ GroupBox {
+ title: "RadioButton"
+ Layout.fillWidth: true
+ ColumnLayout {
+ anchors.fill: parent
+ ExclusiveGroup { id: radioGroup }
+ RadioButton { text: "Portrait"; exclusiveGroup: radioGroup }
+ RadioButton { text: "Landscape"; exclusiveGroup: radioGroup }
+ RadioButton { text: "Automatic"; exclusiveGroup: radioGroup; checked: true }
+ }
+ }
+
+ GroupBox {
+ title: "Switch"
+ Layout.fillWidth: true
+ Layout.columnSpan: grid.columns
+ ColumnLayout {
+ anchors.fill: parent
+ RowLayout {
+ Label { text: "Wi-Fi"; Layout.fillWidth: true }
+ Switch { checked: true }
+ }
+ RowLayout {
+ Label { text: "Bluetooth"; Layout.fillWidth: true }
+ Switch { checked: false }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/examples/quickcontrols/controls/gallery/qml/InputPage.qml b/examples/quickcontrols/controls/gallery/qml/InputPage.qml
new file mode 100644
index 00000000..66042967
--- /dev/null
+++ b/examples/quickcontrols/controls/gallery/qml/InputPage.qml
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** 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
+
+ScrollView {
+ id: page
+ implicitWidth: 640
+ implicitHeight: 400
+
+ horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
+
+ Item {
+ id: content
+
+ width: Math.max(page.viewport.width, column.implicitWidth + 2 * column.spacing)
+ height: Math.max(page.viewport.height, column.implicitHeight + 2 * column.spacing)
+
+ ColumnLayout {
+ id: column
+
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.margins: column.spacing
+
+ GroupBox {
+ title: "TextField"
+ Layout.fillWidth: true
+ ColumnLayout {
+ anchors.fill: parent
+ TextField { placeholderText: "..."; Layout.fillWidth: true; z: 1 }
+ TextField { placeholderText: "Password"; echoMode: TextInput.Password; Layout.fillWidth: true }
+ }
+ }
+
+ GroupBox {
+ title: "ComboBox"
+ Layout.fillWidth: true
+ ColumnLayout {
+ anchors.fill: parent
+ ComboBox {
+ model: Qt.fontFamilies()
+ Layout.fillWidth: true
+ }
+ ComboBox {
+ editable: true
+ model: ListModel {
+ id: listModel
+ ListElement { text: "Apple" }
+ ListElement { text: "Banana" }
+ ListElement { text: "Coconut" }
+ ListElement { text: "Orange" }
+ }
+ onAccepted: {
+ if (find(currentText) === -1) {
+ listModel.append({text: editText})
+ currentIndex = find(editText)
+ }
+ }
+ Layout.fillWidth: true
+ }
+ }
+ }
+
+ GroupBox {
+ title: "SpinBox"
+ Layout.fillWidth: true
+ ColumnLayout {
+ anchors.fill: parent
+ SpinBox { value: 99; Layout.fillWidth: true; z: 1 }
+ SpinBox { decimals: 2; Layout.fillWidth: true }
+ }
+ }
+ }
+ }
+}
diff --git a/examples/quickcontrols/controls/gallery/qml/ProgressPage.qml b/examples/quickcontrols/controls/gallery/qml/ProgressPage.qml
new file mode 100644
index 00000000..416e936a
--- /dev/null
+++ b/examples/quickcontrols/controls/gallery/qml/ProgressPage.qml
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** 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
+
+ScrollView {
+ id: page
+ implicitWidth: 640
+ implicitHeight: 400
+
+ horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
+
+ Item {
+ id: content
+
+ width: Math.max(page.viewport.width, column.implicitWidth + 2 * column.spacing)
+ height: Math.max(page.viewport.height, column.implicitHeight + 2 * column.spacing)
+
+ ColumnLayout {
+ id: column
+
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.margins: column.spacing
+
+ GroupBox {
+ title: "ProgressBar"
+ Layout.fillWidth: true
+ ColumnLayout {
+ anchors.fill: parent
+ ProgressBar { indeterminate: true; Layout.fillWidth: true }
+ ProgressBar { value: slider.value; Layout.fillWidth: true }
+ }
+ }
+
+ GroupBox {
+ title: "Slider"
+ Layout.fillWidth: true
+ ColumnLayout {
+ anchors.fill: parent
+ Slider { id: slider; value: 0.5; Layout.fillWidth: true }
+ }
+ }
+
+ GroupBox {
+ title: "BusyIndicator"
+ Layout.fillWidth: true
+ BusyIndicator { running: true }
+ }
+ }
+ }
+}
diff --git a/examples/quickcontrols/controls/gallery/qml/UI.js b/examples/quickcontrols/controls/gallery/qml/UI.js
new file mode 100644
index 00000000..819c34ee
--- /dev/null
+++ b/examples/quickcontrols/controls/gallery/qml/UI.js
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** 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 library
+
+var margin = 2
+var tabPosition = Qt.TopEdge
+var label = ""
diff --git a/examples/quickcontrols/controls/shared/qtquickcontrolsapplication.h b/examples/quickcontrols/controls/shared/qtquickcontrolsapplication.h
new file mode 100644
index 00000000..5f22b483
--- /dev/null
+++ b/examples/quickcontrols/controls/shared/qtquickcontrolsapplication.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QTQUICKCONTROLSAPPLICATION_H
+#define QTQUICKCONTROLSAPPLICATION_H
+
+#ifdef QT_WIDGETS_LIB
+#include <QtWidgets/QApplication>
+#else
+#include <QtGui/QGuiApplication>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+#ifdef QT_WIDGETS_LIB
+#define QtQuickControlsApplication QApplication
+#else
+#define QtQuickControlsApplication QGuiApplication
+#endif
+
+QT_END_NAMESPACE
+
+#endif // QTQUICKCONTROLSAPPLICATION_H
diff --git a/examples/quickcontrols/controls/shared/shared.pri b/examples/quickcontrols/controls/shared/shared.pri
new file mode 100644
index 00000000..1d9e0592
--- /dev/null
+++ b/examples/quickcontrols/controls/shared/shared.pri
@@ -0,0 +1,7 @@
+QT += quick
+!no_desktop: QT += widgets
+
+INCLUDEPATH += $$PWD
+
+SOURCES += \
+ $$PWD/qtquickcontrolsapplication.h
diff --git a/examples/quickcontrols/controls/styles/images/bubble.png b/examples/quickcontrols/controls/styles/images/bubble.png
new file mode 100644
index 00000000..62aa1efe
--- /dev/null
+++ b/examples/quickcontrols/controls/styles/images/bubble.png
Binary files differ
diff --git a/examples/quickcontrols/controls/styles/images/button-pressed.png b/examples/quickcontrols/controls/styles/images/button-pressed.png
new file mode 100644
index 00000000..d64cdaa7
--- /dev/null
+++ b/examples/quickcontrols/controls/styles/images/button-pressed.png
Binary files differ
diff --git a/examples/quickcontrols/controls/styles/images/button.png b/examples/quickcontrols/controls/styles/images/button.png
new file mode 100644
index 00000000..8ab41cc8
--- /dev/null
+++ b/examples/quickcontrols/controls/styles/images/button.png
Binary files differ
diff --git a/examples/quickcontrols/controls/styles/images/progress-background.png b/examples/quickcontrols/controls/styles/images/progress-background.png
new file mode 100644
index 00000000..55a069df
--- /dev/null
+++ b/examples/quickcontrols/controls/styles/images/progress-background.png
Binary files differ
diff --git a/examples/quickcontrols/controls/styles/images/progress-fill.png b/examples/quickcontrols/controls/styles/images/progress-fill.png
new file mode 100644
index 00000000..b588c958
--- /dev/null
+++ b/examples/quickcontrols/controls/styles/images/progress-fill.png
Binary files differ
diff --git a/examples/quickcontrols/controls/styles/images/slider-handle.png b/examples/quickcontrols/controls/styles/images/slider-handle.png
new file mode 100644
index 00000000..ac4d4a0d
--- /dev/null
+++ b/examples/quickcontrols/controls/styles/images/slider-handle.png
Binary files differ
diff --git a/examples/quickcontrols/controls/styles/images/tab.png b/examples/quickcontrols/controls/styles/images/tab.png
new file mode 100644
index 00000000..74fefab7
--- /dev/null
+++ b/examples/quickcontrols/controls/styles/images/tab.png
Binary files differ
diff --git a/examples/quickcontrols/controls/styles/images/tab_selected.png b/examples/quickcontrols/controls/styles/images/tab_selected.png
new file mode 100644
index 00000000..665400cc
--- /dev/null
+++ b/examples/quickcontrols/controls/styles/images/tab_selected.png
Binary files differ
diff --git a/examples/quickcontrols/controls/styles/images/textfield.png b/examples/quickcontrols/controls/styles/images/textfield.png
new file mode 100644
index 00000000..1d4a38ab
--- /dev/null
+++ b/examples/quickcontrols/controls/styles/images/textfield.png
Binary files differ
diff --git a/examples/quickcontrols/controls/styles/main.cpp b/examples/quickcontrols/controls/styles/main.cpp
new file mode 100644
index 00000000..55c592e6
--- /dev/null
+++ b/examples/quickcontrols/controls/styles/main.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** 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 <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+ if (engine.rootObjects().isEmpty())
+ return -1;
+ return app.exec();
+}
diff --git a/examples/quickcontrols/controls/styles/main.qml b/examples/quickcontrols/controls/styles/main.qml
new file mode 100644
index 00000000..b2eefb86
--- /dev/null
+++ b/examples/quickcontrols/controls/styles/main.qml
@@ -0,0 +1,397 @@
+/****************************************************************************
+**
+** 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.Window 2.2
+import QtQuick.Layouts 1.1
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2
+import QtQuick.Particles 2.0
+
+Window {
+ id: window
+ width: 640
+ height: 480
+ visible: true
+ title: qsTr("Styles Example")
+
+ property int columnFactor: 5
+
+ GridLayout {
+ rowSpacing: 12
+ columnSpacing: 30
+ anchors.top: parent.top
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.margins: 30
+
+ Button {
+ text: "Button"
+ implicitWidth: window.width / columnFactor
+ }
+ Button {
+ text: "Button"
+ style: ButtonStyle {
+ background: BorderImage {
+ source: control.pressed ? "images/button-pressed.png" : "images/button.png"
+ border.left: 4 ; border.right: 4 ; border.top: 4 ; border.bottom: 4
+ }
+ }
+ implicitWidth: window.width / columnFactor
+ }
+ Button {
+ text: "Button"
+ style: buttonStyle
+ implicitWidth: window.width / columnFactor
+ }
+
+ TextField {
+ Layout.row: 1
+ implicitWidth: window.width / columnFactor
+ }
+ TextField {
+ style: TextFieldStyle {
+ background: BorderImage {
+ source: "images/textfield.png"
+ border.left: 4 ; border.right: 4 ; border.top: 4 ; border.bottom: 4
+ }
+ }
+ implicitWidth: window.width / columnFactor
+ }
+ TextField {
+ style: textFieldStyle
+ implicitWidth: window.width / columnFactor
+ }
+
+ Slider {
+ id: slider1
+ Layout.row: 2
+ value: 0.5
+ implicitWidth: window.width / columnFactor
+ }
+ Slider {
+ id: slider2
+ value: 0.5
+ implicitWidth: window.width / columnFactor
+ style: SliderStyle {
+ groove: BorderImage {
+ height: 6
+ border.top: 1
+ border.bottom: 1
+ source: "images/progress-background.png"
+ border.left: 6
+ border.right: 6
+ BorderImage {
+ anchors.verticalCenter: parent.verticalCenter
+ source: "images/progress-fill.png"
+ border.left: 5 ; border.top: 1
+ border.right: 5 ; border.bottom: 1
+ width: styleData.handlePosition
+ height: parent.height
+ }
+ }
+ handle: Item {
+ width: 13
+ height: 13
+ Image {
+ anchors.centerIn: parent
+ source: "images/slider-handle.png"
+ }
+ }
+ }
+ }
+ Slider {
+ id: slider3
+ value: 0.5
+ implicitWidth: window.width / columnFactor
+ style: sliderStyle
+ }
+
+ ProgressBar {
+ Layout.row: 3
+ value: slider1.value
+ implicitWidth: window.width / columnFactor
+ }
+ ProgressBar {
+ value: slider2.value
+ implicitWidth: window.width / columnFactor
+ style: progressBarStyle
+ }
+ ProgressBar {
+ value: slider3.value
+ implicitWidth: window.width / columnFactor
+ style: progressBarStyle2
+ }
+
+ CheckBox {
+ text: "CheckBox"
+ Layout.row: 4
+ implicitWidth: window.width / columnFactor
+ }
+
+ RadioButton {
+ text: "RadioButton"
+ implicitWidth: window.width / columnFactor
+ }
+
+ ComboBox {
+ model: ["Paris", "Oslo", "New York"]
+ implicitWidth: window.width / columnFactor
+ }
+
+ TabView {
+ Layout.row: 5
+ Layout.columnSpan: 3
+ Layout.fillWidth: true
+ implicitHeight: 30
+ Tab { title: "One" ; Item {} }
+ Tab { title: "Two" ; Item {} }
+ Tab { title: "Three" ; Item {} }
+ Tab { title: "Four" ; Item {} }
+ }
+
+ TabView {
+ Layout.row: 6
+ Layout.columnSpan: 3
+ Layout.fillWidth: true
+ implicitHeight: 30
+ Tab { title: "One" ; Item {}}
+ Tab { title: "Two" ; Item {}}
+ Tab { title: "Three" ; Item {}}
+ Tab { title: "Four" ; Item {}}
+ style: tabViewStyle
+ }
+ }
+
+ // Style delegates:
+
+ Component {
+ id: buttonStyle
+ ButtonStyle {
+
+ background: Rectangle {
+ implicitHeight: 22
+ implicitWidth: window.width / columnFactor
+ color: control.pressed ? "darkGray" : control.activeFocus ? "#cdd" : "#ccc"
+ antialiasing: true
+ border.color: "gray"
+ radius: height/2
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 1
+ color: "transparent"
+ antialiasing: true
+ visible: !control.pressed
+ border.color: "#aaffffff"
+ radius: height/2
+ }
+ }
+ }
+ }
+
+ Component {
+ id: textFieldStyle
+ TextFieldStyle {
+ background: Rectangle {
+ implicitWidth: window.width / columnFactor
+ color: "#f0f0f0"
+ antialiasing: true
+ border.color: "gray"
+ radius: height/2
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 1
+ color: "transparent"
+ antialiasing: true
+ border.color: "#aaffffff"
+ radius: height/2
+ }
+ }
+ }
+ }
+
+ Component {
+ id: sliderStyle
+ SliderStyle {
+ handle: Rectangle {
+ width: 18
+ height: 18
+ color: control.pressed ? "darkGray" : "lightGray"
+ border.color: "gray"
+ antialiasing: true
+ radius: height/2
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 1
+ color: "transparent"
+ antialiasing: true
+ border.color: "#eee"
+ radius: height/2
+ }
+ }
+
+ groove: Rectangle {
+ height: 8
+ implicitWidth: window.width / columnFactor
+ implicitHeight: 22
+
+ antialiasing: true
+ color: "#ccc"
+ border.color: "#777"
+ radius: height/2
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 1
+ color: "transparent"
+ antialiasing: true
+ border.color: "#66ffffff"
+ radius: height/2
+ }
+ }
+ }
+ }
+
+ Component {
+ id: progressBarStyle
+ ProgressBarStyle {
+ background: BorderImage {
+ source: "images/progress-background.png"
+ border.left: 2 ; border.right: 2 ; border.top: 2 ; border.bottom: 2
+ }
+ progress: Item {
+ clip: true
+ BorderImage {
+ anchors.fill: parent
+ anchors.rightMargin: (control.value < control.maximumValue) ? -4 : 0
+ source: "images/progress-fill.png"
+ border.left: 10 ; border.right: 10
+ Rectangle {
+ width: 1
+ color: "#a70"
+ opacity: 0.8
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 1
+ anchors.right: parent.right
+ visible: control.value < control.maximumValue
+ anchors.rightMargin: -parent.anchors.rightMargin
+ }
+ }
+ ParticleSystem { id: bubbles; running: visible }
+ ImageParticle {
+ id: fireball
+ system: bubbles
+ source: "images/bubble.png"
+ opacity: 0.7
+ }
+ Emitter {
+ system: bubbles
+ anchors.bottom: parent.bottom
+ anchors.margins: 4
+ anchors.bottomMargin: -4
+ anchors.left: parent.left
+ anchors.right: parent.right
+ size: 4
+ sizeVariation: 4
+ acceleration: PointDirection { y: -6; xVariation: 3 }
+ emitRate: 6 * control.value
+ lifeSpan: 3000
+ }
+ }
+ }
+ }
+
+ Component {
+ id: progressBarStyle2
+ ProgressBarStyle {
+ background: Rectangle {
+ implicitWidth: window.width / columnFactor
+ implicitHeight: 24
+ color: "#f0f0f0"
+ border.color: "gray"
+ }
+ progress: Rectangle {
+ color: "#ccc"
+ border.color: "gray"
+ Rectangle {
+ color: "transparent"
+ border.color: "#44ffffff"
+ anchors.fill: parent
+ anchors.margins: 1
+ }
+ }
+ }
+ }
+
+ Component {
+ id: tabViewStyle
+ TabViewStyle {
+ tabOverlap: 16
+ frameOverlap: 4
+ tabsMovable: true
+
+ frame: Rectangle {
+ gradient: Gradient {
+ GradientStop { color: "#e5e5e5" ; position: 0 }
+ GradientStop { color: "#e0e0e0" ; position: 1 }
+ }
+ border.color: "#898989"
+ Rectangle { anchors.fill: parent ; anchors.margins: 1 ; border.color: "white" ; color: "transparent" }
+ }
+ tab: Item {
+ property int totalOverlap: tabOverlap * (control.count - 1)
+ implicitWidth: Math.min ((styleData.availableWidth + totalOverlap)/control.count - 4, image.sourceSize.width)
+ implicitHeight: image.sourceSize.height
+ BorderImage {
+ id: image
+ anchors.fill: parent
+ source: styleData.selected ? "images/tab_selected.png" : "images/tab.png"
+ border.left: 30
+ smooth: false
+ border.right: 30
+ }
+ Text {
+ text: styleData.title
+ anchors.centerIn: parent
+ }
+ }
+ leftCorner: Item { implicitWidth: 12 }
+ }
+ }
+}
diff --git a/examples/quickcontrols/controls/styles/styles.pro b/examples/quickcontrols/controls/styles/styles.pro
new file mode 100644
index 00000000..b1b29951
--- /dev/null
+++ b/examples/quickcontrols/controls/styles/styles.pro
@@ -0,0 +1,13 @@
+TEMPLATE = app
+TARGET = styles
+QT += qml quick
+
+SOURCES += \
+ main.cpp
+RESOURCES += \
+ styles.qrc
+OTHER_FILES += \
+ main.qml
+
+target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/controls/styles
+INSTALLS += target
diff --git a/examples/quickcontrols/controls/styles/styles.qrc b/examples/quickcontrols/controls/styles/styles.qrc
new file mode 100644
index 00000000..d2300c6f
--- /dev/null
+++ b/examples/quickcontrols/controls/styles/styles.qrc
@@ -0,0 +1,14 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>images/bubble.png</file>
+ <file>images/button.png</file>
+ <file>images/button-pressed.png</file>
+ <file>images/progress-background.png</file>
+ <file>images/progress-fill.png</file>
+ <file>images/slider-handle.png</file>
+ <file>images/tab.png</file>
+ <file>images/tab_selected.png</file>
+ <file>images/textfield.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/quickcontrols/controls/tableview/main.qml b/examples/quickcontrols/controls/tableview/main.qml
new file mode 100644
index 00000000..1d99f4b9
--- /dev/null
+++ b/examples/quickcontrols/controls/tableview/main.qml
@@ -0,0 +1,188 @@
+/****************************************************************************
+**
+** 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 org.qtproject.example 1.0
+
+ApplicationWindow {
+ id: window
+ visible: true
+ title: "Table View Example"
+
+ toolBar: ToolBar {
+ TextField {
+ id: searchBox
+
+ placeholderText: "Search..."
+ inputMethodHints: Qt.ImhNoPredictiveText
+
+ width: window.width / 5 * 2
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+
+ TableView {
+ id: tableView
+
+ frameVisible: false
+ sortIndicatorVisible: true
+
+ anchors.fill: parent
+
+ Layout.minimumWidth: 400
+ Layout.minimumHeight: 240
+ Layout.preferredWidth: 600
+ Layout.preferredHeight: 400
+
+ TableViewColumn {
+ id: titleColumn
+ title: "Title"
+ role: "title"
+ movable: false
+ resizable: false
+ width: tableView.viewport.width - authorColumn.width
+ }
+
+ TableViewColumn {
+ id: authorColumn
+ title: "Author"
+ role: "author"
+ movable: false
+ resizable: false
+ width: tableView.viewport.width / 3
+ }
+
+ model: SortFilterProxyModel {
+ id: proxyModel
+ source: sourceModel.count > 0 ? sourceModel : null
+
+ sortOrder: tableView.sortIndicatorOrder
+ sortCaseSensitivity: Qt.CaseInsensitive
+ sortRole: sourceModel.count > 0 ? tableView.getColumn(tableView.sortIndicatorColumn).role : ""
+
+ filterString: "*" + searchBox.text + "*"
+ filterSyntax: SortFilterProxyModel.Wildcard
+ filterCaseSensitivity: Qt.CaseInsensitive
+ }
+
+ ListModel {
+ id: sourceModel
+ ListElement {
+ title: "Moby-Dick"
+ author: "Herman Melville"
+ }
+ ListElement {
+ title: "The Adventures of Tom Sawyer"
+ author: "Mark Twain"
+ }
+ ListElement {
+ title: "Cat’s Cradle"
+ author: "Kurt Vonnegut"
+ }
+ ListElement {
+ title: "Farenheit 451"
+ author: "Ray Bradbury"
+ }
+ ListElement {
+ title: "It"
+ author: "Stephen King"
+ }
+ ListElement {
+ title: "On the Road"
+ author: "Jack Kerouac"
+ }
+ ListElement {
+ title: "Of Mice and Men"
+ author: "John Steinbeck"
+ }
+ ListElement {
+ title: "Do Androids Dream of Electric Sheep?"
+ author: "Philip K. Dick"
+ }
+ ListElement {
+ title: "Uncle Tom’s Cabin"
+ author: "Harriet Beecher Stowe"
+ }
+ ListElement {
+ title: "The Call of the Wild"
+ author: "Jack London"
+ }
+ ListElement {
+ title: "The Old Man and the Sea"
+ author: "Ernest Hemingway"
+ }
+ ListElement {
+ title: "A Streetcar Named Desire"
+ author: "Tennessee Williams"
+ }
+ ListElement {
+ title: "Catch-22"
+ author: "Joseph Heller"
+ }
+ ListElement {
+ title: "One Flew Over the Cuckoo’s Nest"
+ author: "Ken Kesey"
+ }
+ ListElement {
+ title: "The Murders in the Rue Morgue"
+ author: "Edgar Allan Poe"
+ }
+ ListElement {
+ title: "Breakfast at Tiffany’s"
+ author: "Truman Capote"
+ }
+ ListElement {
+ title: "Death of a Salesman"
+ author: "Arthur Miller"
+ }
+ ListElement {
+ title: "Post Office"
+ author: "Charles Bukowski"
+ }
+ ListElement {
+ title: "Herbert West—Reanimator"
+ author: "H. P. Lovecraft"
+ }
+ }
+ }
+}
diff --git a/examples/quickcontrols/controls/tableview/src/main.cpp b/examples/quickcontrols/controls/tableview/src/main.cpp
new file mode 100644
index 00000000..dbba7f38
--- /dev/null
+++ b/examples/quickcontrols/controls/tableview/src/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 "sortfilterproxymodel.h"
+#include <QtQml/qqmlapplicationengine.h>
+#include <QtGui/qsurfaceformat.h>
+#include <QtQml/qqml.h>
+
+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);
+ }
+ qmlRegisterType<SortFilterProxyModel>("org.qtproject.example", 1, 0, "SortFilterProxyModel");
+ QQmlApplicationEngine engine(QUrl("qrc:/main.qml"));
+ return app.exec();
+}
diff --git a/examples/quickcontrols/controls/tableview/src/sortfilterproxymodel.cpp b/examples/quickcontrols/controls/tableview/src/sortfilterproxymodel.cpp
new file mode 100644
index 00000000..f362d5d3
--- /dev/null
+++ b/examples/quickcontrols/controls/tableview/src/sortfilterproxymodel.cpp
@@ -0,0 +1,189 @@
+/****************************************************************************
+**
+** 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 "sortfilterproxymodel.h"
+#include <QtDebug>
+#include <QtQml>
+
+SortFilterProxyModel::SortFilterProxyModel(QObject *parent) : QSortFilterProxyModel(parent), m_complete(false)
+{
+ connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SIGNAL(countChanged()));
+ connect(this, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SIGNAL(countChanged()));
+}
+
+int SortFilterProxyModel::count() const
+{
+ return rowCount();
+}
+
+QObject *SortFilterProxyModel::source() const
+{
+ return sourceModel();
+}
+
+void SortFilterProxyModel::setSource(QObject *source)
+{
+ setSourceModel(qobject_cast<QAbstractItemModel *>(source));
+}
+
+QByteArray SortFilterProxyModel::sortRole() const
+{
+ return m_sortRole;
+}
+
+void SortFilterProxyModel::setSortRole(const QByteArray &role)
+{
+ if (m_sortRole != role) {
+ m_sortRole = role;
+ if (m_complete)
+ QSortFilterProxyModel::setSortRole(roleKey(role));
+ }
+}
+
+void SortFilterProxyModel::setSortOrder(Qt::SortOrder order)
+{
+ QSortFilterProxyModel::sort(0, order);
+}
+
+QByteArray SortFilterProxyModel::filterRole() const
+{
+ return m_filterRole;
+}
+
+void SortFilterProxyModel::setFilterRole(const QByteArray &role)
+{
+ if (m_filterRole != role) {
+ m_filterRole = role;
+ if (m_complete)
+ QSortFilterProxyModel::setFilterRole(roleKey(role));
+ }
+}
+
+QString SortFilterProxyModel::filterString() const
+{
+ return filterRegExp().pattern();
+}
+
+void SortFilterProxyModel::setFilterString(const QString &filter)
+{
+ setFilterRegExp(QRegExp(filter, filterCaseSensitivity(), static_cast<QRegExp::PatternSyntax>(filterSyntax())));
+}
+
+SortFilterProxyModel::FilterSyntax SortFilterProxyModel::filterSyntax() const
+{
+ return static_cast<FilterSyntax>(filterRegExp().patternSyntax());
+}
+
+void SortFilterProxyModel::setFilterSyntax(SortFilterProxyModel::FilterSyntax syntax)
+{
+ setFilterRegExp(QRegExp(filterString(), filterCaseSensitivity(), static_cast<QRegExp::PatternSyntax>(syntax)));
+}
+
+QJSValue SortFilterProxyModel::get(int idx) const
+{
+ QJSEngine *engine = qmlEngine(this);
+ QJSValue value = engine->newObject();
+ if (idx >= 0 && idx < count()) {
+ QHash<int, QByteArray> roles = roleNames();
+ QHashIterator<int, QByteArray> it(roles);
+ while (it.hasNext()) {
+ it.next();
+ value.setProperty(QString::fromUtf8(it.value()), data(index(idx, 0), it.key()).toString());
+ }
+ }
+ return value;
+}
+
+void SortFilterProxyModel::classBegin()
+{
+}
+
+void SortFilterProxyModel::componentComplete()
+{
+ m_complete = true;
+ if (!m_sortRole.isEmpty())
+ QSortFilterProxyModel::setSortRole(roleKey(m_sortRole));
+ if (!m_filterRole.isEmpty())
+ QSortFilterProxyModel::setFilterRole(roleKey(m_filterRole));
+}
+
+int SortFilterProxyModel::roleKey(const QByteArray &role) const
+{
+ QHash<int, QByteArray> roles = roleNames();
+ QHashIterator<int, QByteArray> it(roles);
+ while (it.hasNext()) {
+ it.next();
+ if (it.value() == role)
+ return it.key();
+ }
+ return -1;
+}
+
+QHash<int, QByteArray> SortFilterProxyModel::roleNames() const
+{
+ if (QAbstractItemModel *source = sourceModel())
+ return source->roleNames();
+ return QHash<int, QByteArray>();
+}
+
+bool SortFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
+{
+ QRegExp rx = filterRegExp();
+ if (rx.isEmpty())
+ return true;
+ QAbstractItemModel *model = sourceModel();
+ if (filterRole().isEmpty()) {
+ QHash<int, QByteArray> roles = roleNames();
+ QHashIterator<int, QByteArray> it(roles);
+ while (it.hasNext()) {
+ it.next();
+ QModelIndex sourceIndex = model->index(sourceRow, 0, sourceParent);
+ QString key = model->data(sourceIndex, it.key()).toString();
+ if (key.contains(rx))
+ return true;
+ }
+ return false;
+ }
+ QModelIndex sourceIndex = model->index(sourceRow, 0, sourceParent);
+ if (!sourceIndex.isValid())
+ return true;
+ QString key = model->data(sourceIndex, roleKey(filterRole())).toString();
+ return key.contains(rx);
+}
diff --git a/examples/quickcontrols/controls/tableview/src/sortfilterproxymodel.h b/examples/quickcontrols/controls/tableview/src/sortfilterproxymodel.h
new file mode 100644
index 00000000..c4460b0f
--- /dev/null
+++ b/examples/quickcontrols/controls/tableview/src/sortfilterproxymodel.h
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef SORTFILTERPROXYMODEL_H
+#define SORTFILTERPROXYMODEL_H
+
+#include <QtCore/qsortfilterproxymodel.h>
+#include <QtQml/qqmlparserstatus.h>
+#include <QtQml/qjsvalue.h>
+
+class SortFilterProxyModel : public QSortFilterProxyModel, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+
+ Q_PROPERTY(int count READ count NOTIFY countChanged)
+ Q_PROPERTY(QObject *source READ source WRITE setSource)
+
+ Q_PROPERTY(QByteArray sortRole READ sortRole WRITE setSortRole)
+ Q_PROPERTY(Qt::SortOrder sortOrder READ sortOrder WRITE setSortOrder)
+
+ Q_PROPERTY(QByteArray filterRole READ filterRole WRITE setFilterRole)
+ Q_PROPERTY(QString filterString READ filterString WRITE setFilterString)
+ Q_PROPERTY(FilterSyntax filterSyntax READ filterSyntax WRITE setFilterSyntax)
+
+ Q_ENUMS(FilterSyntax)
+
+public:
+ explicit SortFilterProxyModel(QObject *parent = 0);
+
+ QObject *source() const;
+ void setSource(QObject *source);
+
+ QByteArray sortRole() const;
+ void setSortRole(const QByteArray &role);
+
+ void setSortOrder(Qt::SortOrder order);
+
+ QByteArray filterRole() const;
+ void setFilterRole(const QByteArray &role);
+
+ QString filterString() const;
+ void setFilterString(const QString &filter);
+
+ enum FilterSyntax {
+ RegExp,
+ Wildcard,
+ FixedString
+ };
+
+ FilterSyntax filterSyntax() const;
+ void setFilterSyntax(FilterSyntax syntax);
+
+ int count() const;
+ Q_INVOKABLE QJSValue get(int index) const;
+
+ void classBegin();
+ void componentComplete();
+
+signals:
+ void countChanged();
+
+protected:
+ int roleKey(const QByteArray &role) const;
+ QHash<int, QByteArray> roleNames() const;
+ bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
+
+private:
+ bool m_complete;
+ QByteArray m_sortRole;
+ QByteArray m_filterRole;
+};
+
+#endif // SORTFILTERPROXYMODEL_H
diff --git a/examples/quickcontrols/controls/tableview/src/src.pri b/examples/quickcontrols/controls/tableview/src/src.pri
new file mode 100644
index 00000000..491f851c
--- /dev/null
+++ b/examples/quickcontrols/controls/tableview/src/src.pri
@@ -0,0 +1,8 @@
+INCLUDEPATH += $$PWD
+
+HEADERS += \
+ $$PWD/sortfilterproxymodel.h
+
+SOURCES += \
+ $$PWD/main.cpp \
+ $$PWD/sortfilterproxymodel.cpp
diff --git a/examples/quickcontrols/controls/tableview/tableview.pro b/examples/quickcontrols/controls/tableview/tableview.pro
new file mode 100644
index 00000000..a956dc42
--- /dev/null
+++ b/examples/quickcontrols/controls/tableview/tableview.pro
@@ -0,0 +1,14 @@
+TEMPLATE = app
+TARGET = tableview
+
+RESOURCES += \
+ tableview.qrc
+
+OTHER_FILES += \
+ main.qml
+
+include(src/src.pri)
+include(../shared/shared.pri)
+
+target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/controls/tableview
+INSTALLS += target
diff --git a/examples/quickcontrols/controls/tableview/tableview.qrc b/examples/quickcontrols/controls/tableview/tableview.qrc
new file mode 100644
index 00000000..3b111a90
--- /dev/null
+++ b/examples/quickcontrols/controls/tableview/tableview.qrc
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/">
+ <file>main.qml</file>
+</qresource>
+</RCC>
diff --git a/examples/quickcontrols/controls/texteditor/example.html b/examples/quickcontrols/controls/texteditor/example.html
new file mode 100644
index 00000000..52bb507a
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/example.html
@@ -0,0 +1,79 @@
+<html><head><meta name="qrichtext" content="1" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>TextArea Example</title><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
+<p align="center" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:20pt; font-weight:600;">TextArea</span></p>
+<p align="justify" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">The TextArea control is an advanced editor that supports formatted rich text. It can be used to display HTML and other rich document formats. Internally, TextArea uses the QQuickTextDocument class to describe both the high-level structure of each document and the low-level formatting of paragraphs.</span></p>
+<p align="justify" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;">If you are viewing this document in the <span style=" font-style:italic;">Text Editor</span> example, you can edit this document to explore Qt's rich text editing features. We have included some comments in each of the following sections to encourage you to experiment. </p>
+<p style=" margin-top:16px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:18pt; font-weight:600;"><span style=" font-size:16pt;">Font and Paragraph Styles</span></p>
+<p align="justify" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">TextArea supports </span><span style=" font-size:11pt; font-weight:600;">bold</span><span style=" font-size:11pt;">, </span><span style=" font-size:11pt; font-style:italic;">italic</span><span style=" font-size:11pt;">, and </span><span style=" font-size:11pt; text-decoration: underline;">underlined</span><span style=" font-size:11pt;"> font styles, and can display </span><span style=" font-size:11pt; font-weight:600; color:#00007f;">multicolored</span>
+<span style=" font-size:11pt;"> </span><span style=" font-size:11pt; font-weight:600; color:#aa0000;">text</span><span style=" font-size:11pt;">. Font families such as</span><span style=" font-family:'Helvetica'; font-size:11pt; font-weight:600;"> Helvetica</span><span style=" font-size:11pt;"> and
+</span><span style=" font-family:'Courier'; font-size:11pt; font-weight:600;"> Courier</span><span style=" font-size:11pt;"> can also be used directly.<span style=" font-size:11pt; font-style:italic;"> If you place the cursor in a region of styled text, the corresponding controls in the tool bar will change to reflect the current style, font size and color.</span></p>
+<p align="justify" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;">Paragraphs can be formatted so that the text is left-aligned, right-aligned, centered, or fully justified.</p>
+<p align="center" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><span style=" font-style:italic;">Try changing the alignment of some text and resize the editor to see how the text layout changes.</span> </p>
+<p align="justify" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16pt; font-weight:600;">Lists</span></p>
+<p align="justify" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:16pt; font-weight:600;"><span style=" font-size:11pt; font-weight:400;">Different kinds of lists can be included in rich text documents. Standard bullet lists can be nested, using different symbols for each level of the list: </span></p>
+<ul style="-qt-list-indent: 1;"><li style=" font-size:11pt;" style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Disc symbols are typically used for top-level list items. </li></ul>
+<ul type=circle style="-qt-list-indent: 2;"><li style=" font-size:11pt;" style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Circle symbols can be used to distinguish between items in lower-level lists.</li></ul>
+<ul type=square style="-qt-list-indent: 3;"><li style=" font-size:11pt;" style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Square symbols provide a reasonable alternative to discs and circles. </li></ul>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;">Ordered lists can be used for tables of contents. Different characters can be used to enumerate items, and one can use both Roman and Arabic numerals in the same list structure: </p>
+<ol style="-qt-list-indent: 1;"><li style=" font-size:11pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Introduction</li>
+<li style=" font-size:11pt;" style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qt Tools </li></ol>
+<ol type=a style="-qt-list-indent: 2;"><li style=" font-size:11pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qt Assistant</li>
+<li style=" font-size:11pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qt Designer</li>
+<ol type=A style="-qt-list-indent: 3;"><li style=" font-size:11pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Form Editor</li>
+<li style=" font-size:11pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Component Architecture</li></ol>
+<li style=" font-size:11pt;" style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qt Linguist</li></ol>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;">The list will automatically be renumbered if you add or remove items. <span style=" font-style:italic;">Try adding new sections to the above list or removing existing item to see the numbers change.</span> </p>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"></p>
+<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><span style=" font-size:16pt; font-weight:600;">Images</span></p>
+<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:16pt; font-weight:600;"><span style=" font-size:11pt; font-weight:400;">Inline images are treated like ordinary ranges of characters in the text editor, so they flow with the surrounding text. Images can also be selected in the same way as text, making it easy to cut, copy, and paste them. </span></p>
+<p align="justify" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><img src="qrc:qml/images/qt-logo.png" /><span style=" font-style:italic;"> Try to select this image by clicking and dragging over it with the mouse, or use the text cursor to select it by holding down Shift and using the arrow keys. You can then cut or copy it, and paste it into different parts of this document.</span></p>
+<p align="justify" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><span style=" font-size:16pt; font-weight:600;">Tables</span></p>
+<p align="justify" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:16pt; font-weight:600;"><span style=" font-size:11pt; font-weight:400;">TextArea can arrange and format tables, supporting features such as row and column spans, text formatting within cells, and size constraints for columns. </span></p>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"></p>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"></p>
+<table border="1" align="center" width="90%" cellspacing="0" cellpadding="4">
+<tr>
+<td>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> </p></td>
+<td>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Development Tools </span></p></td>
+<td>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Programming Techniques </span></p></td>
+<td>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Graphical User Interfaces </span></p></td></tr>
+<tr>
+<td>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">9:00 - 11:00 </span></p></td>
+<td colspan="3">
+<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Introduction to <span style=" font-style:italic;">Qt </span></p></td></tr>
+<tr>
+<td>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">11:00 - 13:00 </span></p></td>
+<td>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Using <span style=" font-style:italic;">qmake</span> </p></td>
+<td>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Object-oriented Programming </p></td>
+<td>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Layouts in <span style=" font-style:italic;">Qt</span> </p></td></tr>
+<tr>
+<td>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">13:00 - 15:00 </span></p></td>
+<td>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Qt Designer</span> Tutorial </p></td>
+<td rowspan="2">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Extreme Programming </p></td>
+<td>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Writing Custom Styles </p></td></tr>
+<tr>
+<td>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">15:00 - 17:00 </span></p></td>
+<td>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Qt Linguist</span> and Internationalization </p></td>
+<td></td></tr></table>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"></p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt; font-style:italic;">Try adding text to the cells in the table and experiment with the alignment of the paragraphs.</p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><span style=" font-size:16pt; font-weight:600;">Undo and Redo</span></p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;">Full support for undo and redo operations is built into TextArea and the underlying rich text framework. Operations on a document can be packaged together to make editing easier for the user.</p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><span style=" font-style:italic;">Try making changes to this document and press Ctrl+Z to undo them. You can always recover the original contents of the document.</span> </p></body></html>
diff --git a/examples/quickcontrols/controls/texteditor/qml/ToolBarSeparator.qml b/examples/quickcontrols/controls/texteditor/qml/ToolBarSeparator.qml
new file mode 100644
index 00000000..a225e2ea
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/qml/ToolBarSeparator.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** 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
+
+Item {
+ width: 8
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.margins: 6
+ Rectangle {
+ width: 1
+ height: parent.height
+ anchors.horizontalCenter: parent.horizontalCenter
+ color: "#22000000"
+ }
+ Rectangle {
+ width: 1
+ height: parent.height
+ anchors.horizontalCenterOffset: 1
+ anchors.horizontalCenter: parent.horizontalCenter
+ color: "#33ffffff"
+ }
+}
diff --git a/examples/quickcontrols/controls/texteditor/qml/images/editcopy.png b/examples/quickcontrols/controls/texteditor/qml/images/editcopy.png
new file mode 100644
index 00000000..f5513644
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/qml/images/editcopy.png
Binary files differ
diff --git a/examples/quickcontrols/controls/texteditor/qml/images/editcut.png b/examples/quickcontrols/controls/texteditor/qml/images/editcut.png
new file mode 100644
index 00000000..a784fd57
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/qml/images/editcut.png
Binary files differ
diff --git a/examples/quickcontrols/controls/texteditor/qml/images/editpaste.png b/examples/quickcontrols/controls/texteditor/qml/images/editpaste.png
new file mode 100644
index 00000000..64c0b2d6
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/qml/images/editpaste.png
Binary files differ
diff --git a/examples/quickcontrols/controls/texteditor/qml/images/editredo.png b/examples/quickcontrols/controls/texteditor/qml/images/editredo.png
new file mode 100644
index 00000000..8875bf24
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/qml/images/editredo.png
Binary files differ
diff --git a/examples/quickcontrols/controls/texteditor/qml/images/editundo.png b/examples/quickcontrols/controls/texteditor/qml/images/editundo.png
new file mode 100644
index 00000000..a3bd5e0b
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/qml/images/editundo.png
Binary files differ
diff --git a/examples/quickcontrols/controls/texteditor/qml/images/exportpdf.png b/examples/quickcontrols/controls/texteditor/qml/images/exportpdf.png
new file mode 100644
index 00000000..ebb44e6b
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/qml/images/exportpdf.png
Binary files differ
diff --git a/examples/quickcontrols/controls/texteditor/qml/images/filenew.png b/examples/quickcontrols/controls/texteditor/qml/images/filenew.png
new file mode 100644
index 00000000..d3882c7b
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/qml/images/filenew.png
Binary files differ
diff --git a/examples/quickcontrols/controls/texteditor/qml/images/fileopen.png b/examples/quickcontrols/controls/texteditor/qml/images/fileopen.png
new file mode 100644
index 00000000..fc06c5ec
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/qml/images/fileopen.png
Binary files differ
diff --git a/examples/quickcontrols/controls/texteditor/qml/images/fileprint.png b/examples/quickcontrols/controls/texteditor/qml/images/fileprint.png
new file mode 100644
index 00000000..10ca56c8
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/qml/images/fileprint.png
Binary files differ
diff --git a/examples/quickcontrols/controls/texteditor/qml/images/filesave.png b/examples/quickcontrols/controls/texteditor/qml/images/filesave.png
new file mode 100644
index 00000000..b41ecf53
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/qml/images/filesave.png
Binary files differ
diff --git a/examples/quickcontrols/controls/texteditor/qml/images/qt-logo.png b/examples/quickcontrols/controls/texteditor/qml/images/qt-logo.png
new file mode 100644
index 00000000..be1bb106
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/qml/images/qt-logo.png
Binary files differ
diff --git a/examples/quickcontrols/controls/texteditor/qml/images/textbold.png b/examples/quickcontrols/controls/texteditor/qml/images/textbold.png
new file mode 100644
index 00000000..38400bd1
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/qml/images/textbold.png
Binary files differ
diff --git a/examples/quickcontrols/controls/texteditor/qml/images/textcenter.png b/examples/quickcontrols/controls/texteditor/qml/images/textcenter.png
new file mode 100644
index 00000000..2ef5b2ee
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/qml/images/textcenter.png
Binary files differ
diff --git a/examples/quickcontrols/controls/texteditor/qml/images/textitalic.png b/examples/quickcontrols/controls/texteditor/qml/images/textitalic.png
new file mode 100644
index 00000000..0170ee26
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/qml/images/textitalic.png
Binary files differ
diff --git a/examples/quickcontrols/controls/texteditor/qml/images/textjustify.png b/examples/quickcontrols/controls/texteditor/qml/images/textjustify.png
new file mode 100644
index 00000000..39cd6c1a
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/qml/images/textjustify.png
Binary files differ
diff --git a/examples/quickcontrols/controls/texteditor/qml/images/textleft.png b/examples/quickcontrols/controls/texteditor/qml/images/textleft.png
new file mode 100644
index 00000000..83a66d55
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/qml/images/textleft.png
Binary files differ
diff --git a/examples/quickcontrols/controls/texteditor/qml/images/textright.png b/examples/quickcontrols/controls/texteditor/qml/images/textright.png
new file mode 100644
index 00000000..e7c04645
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/qml/images/textright.png
Binary files differ
diff --git a/examples/quickcontrols/controls/texteditor/qml/images/textunder.png b/examples/quickcontrols/controls/texteditor/qml/images/textunder.png
new file mode 100644
index 00000000..968bac5e
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/qml/images/textunder.png
Binary files differ
diff --git a/examples/quickcontrols/controls/texteditor/qml/images/zoomin.png b/examples/quickcontrols/controls/texteditor/qml/images/zoomin.png
new file mode 100644
index 00000000..d46f5aff
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/qml/images/zoomin.png
Binary files differ
diff --git a/examples/quickcontrols/controls/texteditor/qml/images/zoomout.png b/examples/quickcontrols/controls/texteditor/qml/images/zoomout.png
new file mode 100644
index 00000000..46326566
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/qml/images/zoomout.png
Binary files differ
diff --git a/examples/quickcontrols/controls/texteditor/qml/main.qml b/examples/quickcontrols/controls/texteditor/qml/main.qml
new file mode 100644
index 00000000..42f5e7f9
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/qml/main.qml
@@ -0,0 +1,357 @@
+/****************************************************************************
+**
+** 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.Controls 1.2
+import QtQuick.Layouts 1.0
+import QtQuick.Dialogs 1.1
+import QtQuick.Window 2.1
+import org.qtproject.example 1.0
+
+ApplicationWindow {
+ visible: true
+ width: 640
+ height: 480
+ minimumWidth: 400
+ minimumHeight: 300
+
+ title: document.documentTitle + " - Text Editor Example"
+
+ MessageDialog {
+ id: aboutBox
+ title: "About Text"
+ text: "This is a basic text editor \nwritten with Qt Quick Controls"
+ icon: StandardIcon.Information
+ }
+
+ Action {
+ id: cutAction
+ text: "Cut"
+ shortcut: "ctrl+x"
+ iconSource: "images/editcut.png"
+ iconName: "edit-cut"
+ onTriggered: textArea.cut()
+ }
+
+ Action {
+ id: copyAction
+ text: "Copy"
+ shortcut: "Ctrl+C"
+ iconSource: "images/editcopy.png"
+ iconName: "edit-copy"
+ onTriggered: textArea.copy()
+ }
+
+ Action {
+ id: pasteAction
+ text: "Paste"
+ shortcut: "ctrl+v"
+ iconSource: "qrc:images/editpaste.png"
+ iconName: "edit-paste"
+ onTriggered: textArea.paste()
+ }
+
+ Action {
+ id: alignLeftAction
+ text: "&Left"
+ iconSource: "images/textleft.png"
+ iconName: "format-justify-left"
+ shortcut: "ctrl+l"
+ onTriggered: document.alignment = Qt.AlignLeft
+ checkable: true
+ checked: document.alignment == Qt.AlignLeft
+ }
+ Action {
+ id: alignCenterAction
+ text: "C&enter"
+ iconSource: "images/textcenter.png"
+ iconName: "format-justify-center"
+ onTriggered: document.alignment = Qt.AlignHCenter
+ checkable: true
+ checked: document.alignment == Qt.AlignHCenter
+ }
+ Action {
+ id: alignRightAction
+ text: "&Right"
+ iconSource: "images/textright.png"
+ iconName: "format-justify-right"
+ onTriggered: document.alignment = Qt.AlignRight
+ checkable: true
+ checked: document.alignment == Qt.AlignRight
+ }
+ Action {
+ id: alignJustifyAction
+ text: "&Justify"
+ iconSource: "images/textjustify.png"
+ iconName: "format-justify-fill"
+ onTriggered: document.alignment = Qt.AlignJustify
+ checkable: true
+ checked: document.alignment == Qt.AlignJustify
+ }
+
+ Action {
+ id: boldAction
+ text: "&Bold"
+ iconSource: "images/textbold.png"
+ iconName: "format-text-bold"
+ onTriggered: document.bold = !document.bold
+ checkable: true
+ checked: document.bold
+ }
+
+ Action {
+ id: italicAction
+ text: "&Italic"
+ iconSource: "images/textitalic.png"
+ iconName: "format-text-italic"
+ onTriggered: document.italic = !document.italic
+ checkable: true
+ checked: document.italic
+ }
+ Action {
+ id: underlineAction
+ text: "&Underline"
+ iconSource: "images/textunder.png"
+ iconName: "format-text-underline"
+ onTriggered: document.underline = !document.underline
+ checkable: true
+ checked: document.underline
+ }
+
+ FileDialog {
+ id: fileDialog
+ nameFilters: ["Text files (*.txt)", "HTML files (*.html, *.htm)"]
+ onAccepted: {
+ if (fileDialog.selectExisting)
+ document.fileUrl = fileUrl
+ else
+ document.saveAs(fileUrl, selectedNameFilter)
+ }
+ }
+
+ ColorDialog {
+ id: colorDialog
+ color: "black"
+ }
+
+ Action {
+ id: fileOpenAction
+ iconSource: "images/fileopen.png"
+ iconName: "document-open"
+ text: "Open"
+ onTriggered: {
+ fileDialog.selectExisting = true
+ fileDialog.open()
+ }
+ }
+
+ Action {
+ id: fileSaveAsAction
+ iconSource: "images/filesave.png"
+ iconName: "document-save"
+ text: "Save As…"
+ onTriggered: {
+ fileDialog.selectExisting = false
+ fileDialog.open()
+ }
+ }
+
+ menuBar: MenuBar {
+ Menu {
+ title: "&File"
+ MenuItem { action: fileOpenAction }
+ MenuItem { action: fileSaveAsAction }
+ MenuItem { text: "Quit"; onTriggered: Qt.quit() }
+ }
+ Menu {
+ title: "&Edit"
+ MenuItem { action: copyAction }
+ MenuItem { action: cutAction }
+ MenuItem { action: pasteAction }
+ }
+ Menu {
+ title: "F&ormat"
+ MenuItem { action: boldAction }
+ MenuItem { action: italicAction }
+ MenuItem { action: underlineAction }
+ MenuSeparator {}
+ MenuItem { action: alignLeftAction }
+ MenuItem { action: alignCenterAction }
+ MenuItem { action: alignRightAction }
+ MenuItem { action: alignJustifyAction }
+ MenuSeparator {}
+ MenuItem {
+ text: "&Color ..."
+ onTriggered: {
+ colorDialog.color = document.textColor
+ colorDialog.open()
+ }
+ }
+ }
+ Menu {
+ title: "&Help"
+ MenuItem { text: "About..." ; onTriggered: aboutBox.open() }
+ }
+ }
+
+ toolBar: ToolBar {
+ id: mainToolBar
+ width: parent.width
+ RowLayout {
+ anchors.fill: parent
+ spacing: 0
+ ToolButton { action: fileOpenAction }
+
+ ToolBarSeparator {}
+
+ ToolButton { action: copyAction }
+ ToolButton { action: cutAction }
+ ToolButton { action: pasteAction }
+
+ ToolBarSeparator {}
+
+ ToolButton { action: boldAction }
+ ToolButton { action: italicAction }
+ ToolButton { action: underlineAction }
+
+ ToolBarSeparator {}
+
+ ToolButton { action: alignLeftAction }
+ ToolButton { action: alignCenterAction }
+ ToolButton { action: alignRightAction }
+ ToolButton { action: alignJustifyAction }
+
+ ToolBarSeparator {}
+
+ ToolButton {
+ id: colorButton
+ property var color : document.textColor
+ Rectangle {
+ id: colorRect
+ anchors.fill: parent
+ anchors.margins: 8
+ color: Qt.darker(document.textColor, colorButton.pressed ? 1.4 : 1)
+ border.width: 1
+ border.color: Qt.darker(colorRect.color, 2)
+ }
+ onClicked: {
+ colorDialog.color = document.textColor
+ colorDialog.open()
+ }
+ }
+ Item { Layout.fillWidth: true }
+ }
+ }
+
+ ToolBar {
+ id: secondaryToolBar
+ width: parent.width
+
+ RowLayout {
+ anchors.fill: parent
+ ComboBox {
+ id: fontFamilyComboBox
+ implicitWidth: 150
+ model: Qt.fontFamilies()
+ property bool special : false
+ onActivated: {
+ if (special == false || index != 0) {
+ document.fontFamily = textAt(index)
+ }
+ }
+ }
+ SpinBox {
+ id: fontSizeSpinBox
+ activeFocusOnPress: false
+ implicitWidth: 50
+ value: 0
+ property bool valueGuard: true
+ onValueChanged: if (valueGuard) document.fontSize = value
+ }
+ Item { Layout.fillWidth: true }
+ }
+ }
+
+ TextArea {
+ Accessible.name: "document"
+ id: textArea
+ frameVisible: false
+ width: parent.width
+ anchors.top: secondaryToolBar.bottom
+ anchors.bottom: parent.bottom
+ baseUrl: "qrc:/"
+ text: document.text
+ textFormat: Qt.RichText
+ Component.onCompleted: forceActiveFocus()
+ }
+
+ MessageDialog {
+ id: errorDialog
+ }
+
+ DocumentHandler {
+ id: document
+ target: textArea
+ cursorPosition: textArea.cursorPosition
+ selectionStart: textArea.selectionStart
+ selectionEnd: textArea.selectionEnd
+ textColor: colorDialog.color
+ Component.onCompleted: document.fileUrl = "qrc:/example.html"
+ onFontSizeChanged: {
+ fontSizeSpinBox.valueGuard = false
+ fontSizeSpinBox.value = document.fontSize
+ fontSizeSpinBox.valueGuard = true
+ }
+ onFontFamilyChanged: {
+ var index = Qt.fontFamilies().indexOf(document.fontFamily)
+ if (index == -1) {
+ fontFamilyComboBox.currentIndex = 0
+ fontFamilyComboBox.special = true
+ } else {
+ fontFamilyComboBox.currentIndex = index
+ fontFamilyComboBox.special = false
+ }
+ }
+ onError: {
+ errorDialog.text = message
+ errorDialog.visible = true
+ }
+ }
+}
diff --git a/examples/quickcontrols/controls/texteditor/resources.qrc b/examples/quickcontrols/controls/texteditor/resources.qrc
new file mode 100644
index 00000000..27c7b921
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/resources.qrc
@@ -0,0 +1,27 @@
+<RCC>
+ <qresource prefix="/">
+ <file>qml/main.qml</file>
+ <file>qml/ToolBarSeparator.qml</file>
+ <file>qml/images/editcopy.png</file>
+ <file>qml/images/editcut.png</file>
+ <file>qml/images/editpaste.png</file>
+ <file>qml/images/editredo.png</file>
+ <file>qml/images/editundo.png</file>
+ <file>qml/images/exportpdf.png</file>
+ <file>qml/images/filenew.png</file>
+ <file>qml/images/fileopen.png</file>
+ <file>qml/images/fileprint.png</file>
+ <file>qml/images/filesave.png</file>
+ <file>qml/images/textbold.png</file>
+ <file>qml/images/textcenter.png</file>
+ <file>qml/images/textitalic.png</file>
+ <file>qml/images/textjustify.png</file>
+ <file>qml/images/textleft.png</file>
+ <file>qml/images/textright.png</file>
+ <file>qml/images/textunder.png</file>
+ <file>qml/images/zoomin.png</file>
+ <file>qml/images/zoomout.png</file>
+ <file>example.html</file>
+ <file>qml/images/qt-logo.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/quickcontrols/controls/texteditor/src/documenthandler.cpp b/examples/quickcontrols/controls/texteditor/src/documenthandler.cpp
new file mode 100644
index 00000000..2e03f747
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/src/documenthandler.cpp
@@ -0,0 +1,335 @@
+/****************************************************************************
+**
+** 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 "documenthandler.h"
+
+#include <QtGui/QTextDocument>
+#include <QtGui/QTextCursor>
+#include <QtGui/QFontDatabase>
+#include <QtCore/QFileInfo>
+
+DocumentHandler::DocumentHandler()
+ : m_target(0)
+ , m_doc(0)
+ , m_cursorPosition(-1)
+ , m_selectionStart(0)
+ , m_selectionEnd(0)
+{
+}
+
+void DocumentHandler::setTarget(QQuickItem *target)
+{
+ m_doc = 0;
+ m_target = target;
+ if (!m_target)
+ return;
+
+ QVariant doc = m_target->property("textDocument");
+ if (doc.canConvert<QQuickTextDocument*>()) {
+ QQuickTextDocument *qqdoc = doc.value<QQuickTextDocument*>();
+ if (qqdoc)
+ m_doc = qqdoc->textDocument();
+ }
+ emit targetChanged();
+}
+
+void DocumentHandler::setFileUrl(const QUrl &arg)
+{
+ if (m_fileUrl != arg) {
+ m_fileUrl = arg;
+ QString fileName = QQmlFile::urlToLocalFileOrQrc(arg);
+ if (QFile::exists(fileName)) {
+ QFile file(fileName);
+ if (file.open(QFile::ReadOnly)) {
+ QByteArray data = file.readAll();
+ QTextCodec *codec = QTextCodec::codecForHtml(data);
+ setText(codec->toUnicode(data));
+ if (m_doc)
+ m_doc->setModified(false);
+ if (fileName.isEmpty())
+ m_documentTitle = QStringLiteral("untitled.txt");
+ else
+ m_documentTitle = QFileInfo(fileName).fileName();
+
+ emit textChanged();
+ emit documentTitleChanged();
+
+ reset();
+ }
+ }
+ emit fileUrlChanged();
+ }
+}
+
+QString DocumentHandler::documentTitle() const
+{
+ return m_documentTitle;
+}
+
+void DocumentHandler::setDocumentTitle(QString arg)
+{
+ if (m_documentTitle != arg) {
+ m_documentTitle = arg;
+ emit documentTitleChanged();
+ }
+}
+
+void DocumentHandler::setText(const QString &arg)
+{
+ if (m_text != arg) {
+ m_text = arg;
+ emit textChanged();
+ }
+}
+
+void DocumentHandler::saveAs(const QUrl &arg, const QString &fileType)
+{
+ bool isHtml = fileType.contains(QLatin1String("htm"));
+ QLatin1String ext(isHtml ? ".html" : ".txt");
+ QString localPath = arg.toLocalFile();
+ if (!localPath.endsWith(ext))
+ localPath += ext;
+ QFile f(localPath);
+ if (!f.open(QFile::WriteOnly | QFile::Truncate | (isHtml ? QFile::NotOpen : QFile::Text))) {
+ emit error(tr("Cannot save: ") + f.errorString());
+ return;
+ }
+ f.write((isHtml ? m_doc->toHtml() : m_doc->toPlainText()).toLocal8Bit());
+ f.close();
+ setFileUrl(QUrl::fromLocalFile(localPath));
+}
+
+QUrl DocumentHandler::fileUrl() const
+{
+ return m_fileUrl;
+}
+
+QString DocumentHandler::text() const
+{
+ return m_text;
+}
+
+void DocumentHandler::setCursorPosition(int position)
+{
+ if (position == m_cursorPosition)
+ return;
+
+ m_cursorPosition = position;
+
+ reset();
+}
+
+void DocumentHandler::reset()
+{
+ emit fontFamilyChanged();
+ emit alignmentChanged();
+ emit boldChanged();
+ emit italicChanged();
+ emit underlineChanged();
+ emit fontSizeChanged();
+ emit textColorChanged();
+}
+
+QTextCursor DocumentHandler::textCursor() const
+{
+ QTextCursor cursor = QTextCursor(m_doc);
+ if (m_selectionStart != m_selectionEnd) {
+ cursor.setPosition(m_selectionStart);
+ cursor.setPosition(m_selectionEnd, QTextCursor::KeepAnchor);
+ } else {
+ cursor.setPosition(m_cursorPosition);
+ }
+ return cursor;
+}
+
+void DocumentHandler::mergeFormatOnWordOrSelection(const QTextCharFormat &format)
+{
+ QTextCursor cursor = textCursor();
+ if (!cursor.hasSelection())
+ cursor.select(QTextCursor::WordUnderCursor);
+ cursor.mergeCharFormat(format);
+}
+
+void DocumentHandler::setSelectionStart(int position)
+{
+ m_selectionStart = position;
+}
+
+void DocumentHandler::setSelectionEnd(int position)
+{
+ m_selectionEnd = position;
+}
+
+void DocumentHandler::setAlignment(Qt::Alignment a)
+{
+ QTextBlockFormat fmt;
+ fmt.setAlignment((Qt::Alignment) a);
+ QTextCursor cursor = QTextCursor(m_doc);
+ cursor.setPosition(m_selectionStart, QTextCursor::MoveAnchor);
+ cursor.setPosition(m_selectionEnd, QTextCursor::KeepAnchor);
+ cursor.mergeBlockFormat(fmt);
+ emit alignmentChanged();
+}
+
+Qt::Alignment DocumentHandler::alignment() const
+{
+ QTextCursor cursor = textCursor();
+ if (cursor.isNull())
+ return Qt::AlignLeft;
+ return textCursor().blockFormat().alignment();
+}
+
+bool DocumentHandler::bold() const
+{
+ QTextCursor cursor = textCursor();
+ if (cursor.isNull())
+ return false;
+ return textCursor().charFormat().fontWeight() == QFont::Bold;
+}
+
+bool DocumentHandler::italic() const
+{
+ QTextCursor cursor = textCursor();
+ if (cursor.isNull())
+ return false;
+ return textCursor().charFormat().fontItalic();
+}
+
+bool DocumentHandler::underline() const
+{
+ QTextCursor cursor = textCursor();
+ if (cursor.isNull())
+ return false;
+ return textCursor().charFormat().fontUnderline();
+}
+
+void DocumentHandler::setBold(bool arg)
+{
+ QTextCharFormat fmt;
+ fmt.setFontWeight(arg ? QFont::Bold : QFont::Normal);
+ mergeFormatOnWordOrSelection(fmt);
+ emit boldChanged();
+}
+
+void DocumentHandler::setItalic(bool arg)
+{
+ QTextCharFormat fmt;
+ fmt.setFontItalic(arg);
+ mergeFormatOnWordOrSelection(fmt);
+ emit italicChanged();
+}
+
+void DocumentHandler::setUnderline(bool arg)
+{
+ QTextCharFormat fmt;
+ fmt.setFontUnderline(arg);
+ mergeFormatOnWordOrSelection(fmt);
+ emit underlineChanged();
+}
+
+int DocumentHandler::fontSize() const
+{
+ QTextCursor cursor = textCursor();
+ if (cursor.isNull())
+ return 0;
+ QTextCharFormat format = cursor.charFormat();
+ return format.font().pointSize();
+}
+
+void DocumentHandler::setFontSize(int arg)
+{
+ QTextCursor cursor = textCursor();
+ if (cursor.isNull())
+ return;
+ QTextCharFormat format;
+ format.setFontPointSize(arg);
+ mergeFormatOnWordOrSelection(format);
+ emit fontSizeChanged();
+}
+
+QColor DocumentHandler::textColor() const
+{
+ QTextCursor cursor = textCursor();
+ if (cursor.isNull())
+ return QColor(Qt::black);
+ QTextCharFormat format = cursor.charFormat();
+ return format.foreground().color();
+}
+
+void DocumentHandler::setTextColor(const QColor &c)
+{
+ QTextCursor cursor = textCursor();
+ if (cursor.isNull())
+ return;
+ QTextCharFormat format;
+ format.setForeground(QBrush(c));
+ mergeFormatOnWordOrSelection(format);
+ emit textColorChanged();
+}
+
+QString DocumentHandler::fontFamily() const
+{
+ QTextCursor cursor = textCursor();
+ if (cursor.isNull())
+ return QString();
+ QTextCharFormat format = cursor.charFormat();
+ return format.font().family();
+}
+
+void DocumentHandler::setFontFamily(const QString &arg)
+{
+ QTextCursor cursor = textCursor();
+ if (cursor.isNull())
+ return;
+ QTextCharFormat format;
+ format.setFontFamily(arg);
+ mergeFormatOnWordOrSelection(format);
+ emit fontFamilyChanged();
+}
+
+QStringList DocumentHandler::defaultFontSizes() const
+{
+ // uhm... this is quite ugly
+ QStringList sizes;
+ QFontDatabase db;
+ foreach (int size, db.standardSizes())
+ sizes.append(QString::number(size));
+ return sizes;
+}
diff --git a/examples/quickcontrols/controls/texteditor/src/documenthandler.h b/examples/quickcontrols/controls/texteditor/src/documenthandler.h
new file mode 100644
index 00000000..f2bd4eea
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/src/documenthandler.h
@@ -0,0 +1,171 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef DOCUMENTHANDLER_H
+#define DOCUMENTHANDLER_H
+
+#include <QQuickTextDocument>
+
+#include <QtGui/QTextCharFormat>
+#include <QtCore/QTextCodec>
+
+#include <qqmlfile.h>
+
+QT_BEGIN_NAMESPACE
+class QTextDocument;
+QT_END_NAMESPACE
+
+class DocumentHandler : public QObject
+{
+ Q_OBJECT
+
+ Q_ENUMS(HAlignment)
+
+ Q_PROPERTY(QQuickItem *target READ target WRITE setTarget NOTIFY targetChanged)
+ Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged)
+ Q_PROPERTY(int selectionStart READ selectionStart WRITE setSelectionStart NOTIFY selectionStartChanged)
+ Q_PROPERTY(int selectionEnd READ selectionEnd WRITE setSelectionEnd NOTIFY selectionEndChanged)
+
+ Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor NOTIFY textColorChanged)
+ Q_PROPERTY(QString fontFamily READ fontFamily WRITE setFontFamily NOTIFY fontFamilyChanged)
+ Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged)
+
+ Q_PROPERTY(bool bold READ bold WRITE setBold NOTIFY boldChanged)
+ Q_PROPERTY(bool italic READ italic WRITE setItalic NOTIFY italicChanged)
+ Q_PROPERTY(bool underline READ underline WRITE setUnderline NOTIFY underlineChanged)
+
+ Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged)
+
+ Q_PROPERTY(QStringList defaultFontSizes READ defaultFontSizes NOTIFY defaultFontSizesChanged)
+
+ Q_PROPERTY(QUrl fileUrl READ fileUrl WRITE setFileUrl NOTIFY fileUrlChanged)
+ Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
+ Q_PROPERTY(QString documentTitle READ documentTitle WRITE setDocumentTitle NOTIFY documentTitleChanged)
+
+public:
+ DocumentHandler();
+
+ QQuickItem *target() { return m_target; }
+
+ void setTarget(QQuickItem *target);
+
+ void setCursorPosition(int position);
+ void setSelectionStart(int position);
+ void setSelectionEnd(int position);
+
+ int cursorPosition() const { return m_cursorPosition; }
+ int selectionStart() const { return m_selectionStart; }
+ int selectionEnd() const { return m_selectionEnd; }
+
+ QString fontFamily() const;
+
+ QColor textColor() const;
+
+ Qt::Alignment alignment() const;
+ void setAlignment(Qt::Alignment a);
+
+ bool bold() const;
+ bool italic() const;
+ bool underline() const;
+ int fontSize() const;
+
+ QStringList defaultFontSizes() const;
+ QUrl fileUrl() const;
+ QString text() const;
+
+ QString documentTitle() const;
+
+public Q_SLOTS:
+ void setBold(bool arg);
+ void setItalic(bool arg);
+ void setUnderline(bool arg);
+ void setFontSize(int arg);
+ void setTextColor(const QColor &arg);
+ void setFontFamily(const QString &arg);
+
+ void setFileUrl(const QUrl &arg);
+ void setText(const QString &arg);
+ void saveAs(const QUrl &arg, const QString &fileType);
+
+ void setDocumentTitle(QString arg);
+
+Q_SIGNALS:
+ void targetChanged();
+ void cursorPositionChanged();
+ void selectionStartChanged();
+ void selectionEndChanged();
+
+ void fontFamilyChanged();
+ void textColorChanged();
+ void alignmentChanged();
+
+ void boldChanged();
+ void italicChanged();
+ void underlineChanged();
+
+ void fontSizeChanged();
+ void defaultFontSizesChanged();
+
+ void fileUrlChanged();
+
+ void textChanged();
+ void documentTitleChanged();
+ void error(QString message);
+
+private:
+ void reset();
+ QTextCursor textCursor() const;
+ void mergeFormatOnWordOrSelection(const QTextCharFormat &format);
+
+ QQuickItem *m_target;
+ QTextDocument *m_doc;
+
+ int m_cursorPosition;
+ int m_selectionStart;
+ int m_selectionEnd;
+
+ QFont m_font;
+ int m_fontSize;
+ QUrl m_fileUrl;
+ QString m_text;
+ QString m_documentTitle;
+};
+
+#endif
diff --git a/examples/quickcontrols/controls/texteditor/src/main.cpp b/examples/quickcontrols/controls/texteditor/src/main.cpp
new file mode 100644
index 00000000..1ef76e3a
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/src/main.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** 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 "documenthandler.h"
+#include <QtQml/QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QtQuickControlsApplication app(argc, argv);
+ qmlRegisterType<DocumentHandler>("org.qtproject.example", 1, 0, "DocumentHandler");
+ QQmlApplicationEngine engine(QUrl("qrc:/qml/main.qml"));
+ if (engine.rootObjects().isEmpty())
+ return -1;
+ return app.exec();
+}
diff --git a/examples/quickcontrols/controls/texteditor/src/src.pri b/examples/quickcontrols/controls/texteditor/src/src.pri
new file mode 100644
index 00000000..2b89cd62
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/src/src.pri
@@ -0,0 +1,9 @@
+SOURCES += \
+ $$PWD/documenthandler.cpp \
+ $$PWD/main.cpp
+
+
+HEADERS += \
+ $$PWD/documenthandler.h
+
+
diff --git a/examples/quickcontrols/controls/texteditor/texteditor.pro b/examples/quickcontrols/controls/texteditor/texteditor.pro
new file mode 100644
index 00000000..f5255255
--- /dev/null
+++ b/examples/quickcontrols/controls/texteditor/texteditor.pro
@@ -0,0 +1,16 @@
+QT += qml quick
+TARGET = texteditor
+!no_desktop: QT += widgets
+
+include(src/src.pri)
+include(../shared/shared.pri)
+
+OTHER_FILES += \
+ qml/main.qml \
+ qml/ToolBarSeparator.qml
+
+RESOURCES += \
+ resources.qrc
+
+target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/controls/texteditor
+INSTALLS += target
diff --git a/examples/quickcontrols/controls/touch/content/AndroidDelegate.qml b/examples/quickcontrols/controls/touch/content/AndroidDelegate.qml
new file mode 100644
index 00000000..07f28833
--- /dev/null
+++ b/examples/quickcontrols/controls/touch/content/AndroidDelegate.qml
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** 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
+
+Item {
+ id: root
+ width: parent.width
+ height: 88
+
+ property alias text: textitem.text
+ signal clicked
+
+ Rectangle {
+ anchors.fill: parent
+ color: "#11ffffff"
+ visible: mouse.pressed
+ }
+
+ Text {
+ id: textitem
+ color: "white"
+ font.pixelSize: 32
+ text: modelData
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.leftMargin: 30
+ }
+
+ Rectangle {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.margins: 15
+ height: 1
+ color: "#424246"
+ }
+
+ Image {
+ anchors.right: parent.right
+ anchors.rightMargin: 20
+ anchors.verticalCenter: parent.verticalCenter
+ source: "../images/navigation_next_item.png"
+ }
+
+ MouseArea {
+ id: mouse
+ anchors.fill: parent
+ onClicked: root.clicked()
+
+ }
+}
diff --git a/examples/quickcontrols/controls/touch/content/ButtonPage.qml b/examples/quickcontrols/controls/touch/content/ButtonPage.qml
new file mode 100644
index 00000000..3888e30d
--- /dev/null
+++ b/examples/quickcontrols/controls/touch/content/ButtonPage.qml
@@ -0,0 +1,172 @@
+/****************************************************************************
+**
+** 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.Controls 1.2
+import QtQuick.Controls.Styles 1.1
+
+Item {
+ width: parent.width
+ height: parent.height
+
+ property real progress: 0
+ SequentialAnimation on progress {
+ loops: Animation.Infinite
+ running: true
+ NumberAnimation {
+ from: 0
+ to: 1
+ duration: 3000
+ }
+ NumberAnimation {
+ from: 1
+ to: 0
+ duration: 3000
+ }
+ }
+
+ Column {
+ spacing: 40
+ anchors.centerIn: parent
+
+ Button {
+ text: "Press me"
+ style: touchStyle
+ }
+
+ Button {
+ style: touchStyle
+ text: "Press me too"
+ }
+
+ Button {
+ anchors.margins: 20
+ style: touchStyle
+ text: "Don't press me"
+ onClicked: if (stackView) stackView.pop()
+ }
+
+ Row {
+ spacing: 20
+ Switch {
+ style: switchStyle
+ }
+ Switch {
+ style: switchStyle
+ }
+ }
+
+ }
+
+ Component {
+ id: touchStyle
+ ButtonStyle {
+ panel: Item {
+ implicitHeight: 50
+ implicitWidth: 320
+ BorderImage {
+ anchors.fill: parent
+ antialiasing: true
+ border.bottom: 8
+ border.top: 8
+ border.left: 8
+ border.right: 8
+ anchors.margins: control.pressed ? -4 : 0
+ source: control.pressed ? "../images/button_pressed.png" : "../images/button_default.png"
+ Text {
+ text: control.text
+ anchors.centerIn: parent
+ color: "white"
+ font.pixelSize: 23
+ renderType: Text.NativeRendering
+ }
+ }
+ }
+ }
+ }
+
+ Component {
+ id: switchStyle
+ SwitchStyle {
+
+ groove: Rectangle {
+ implicitHeight: 50
+ implicitWidth: 152
+ Rectangle {
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ width: parent.width/2 - 2
+ height: 20
+ anchors.margins: 2
+ color: control.checked ? "#468bb7" : "#222"
+ Behavior on color {ColorAnimation {}}
+ Text {
+ font.pixelSize: 23
+ color: "white"
+ anchors.centerIn: parent
+ text: "ON"
+ }
+ }
+ Item {
+ width: parent.width/2
+ height: parent.height
+ anchors.right: parent.right
+ Text {
+ font.pixelSize: 23
+ color: "white"
+ anchors.centerIn: parent
+ text: "OFF"
+ }
+ }
+ color: "#222"
+ border.color: "#444"
+ border.width: 2
+ }
+ handle: Rectangle {
+ width: parent.parent.width/2
+ height: control.height
+ color: "#444"
+ border.color: "#555"
+ border.width: 2
+ }
+ }
+ }
+}
diff --git a/examples/quickcontrols/controls/touch/content/ListPage.qml b/examples/quickcontrols/controls/touch/content/ListPage.qml
new file mode 100644
index 00000000..f12b0c12
--- /dev/null
+++ b/examples/quickcontrols/controls/touch/content/ListPage.qml
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** 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.Controls 1.2
+import QtQuick.Controls.Styles 1.1
+
+ScrollView {
+ width: parent.width
+ height: parent.height
+
+ flickableItem.interactive: true
+
+ ListView {
+ anchors.fill: parent
+ model: 100
+ delegate: AndroidDelegate {
+ text: "Item #" + modelData
+ }
+ }
+
+ style: ScrollViewStyle {
+ transientScrollBars: true
+ handle: Item {
+ implicitWidth: 14
+ implicitHeight: 26
+ Rectangle {
+ color: "#424246"
+ anchors.fill: parent
+ anchors.topMargin: 6
+ anchors.leftMargin: 4
+ anchors.rightMargin: 4
+ anchors.bottomMargin: 6
+ }
+ }
+ scrollBarBackground: Item {
+ implicitWidth: 14
+ implicitHeight: 26
+ }
+ }
+}
diff --git a/examples/quickcontrols/controls/touch/content/ProgressBarPage.qml b/examples/quickcontrols/controls/touch/content/ProgressBarPage.qml
new file mode 100644
index 00000000..5190b4bb
--- /dev/null
+++ b/examples/quickcontrols/controls/touch/content/ProgressBarPage.qml
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** 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.Controls 1.2
+import QtQuick.Controls.Styles 1.1
+
+Item {
+ width: parent.width
+ height: parent.height
+
+ property real progress: 0
+ SequentialAnimation on progress {
+ loops: Animation.Infinite
+ running: true
+ NumberAnimation {
+ from: 0
+ to: 1
+ duration: 3000
+ }
+ NumberAnimation {
+ from: 1
+ to: 0
+ duration: 3000
+ }
+ }
+
+ Column {
+ spacing: 40
+ anchors.centerIn: parent
+
+ ProgressBar {
+ anchors.margins: 20
+ style: touchStyle
+ width: 400
+ value: progress
+ }
+
+ ProgressBar {
+ anchors.margins: 20
+ style: touchStyle
+ width: 400
+ value: 1 - progress
+ }
+
+ ProgressBar {
+ anchors.margins: 20
+ style: touchStyle
+ value: 1
+ width: 400
+ }
+
+ }
+
+ Component {
+ id: touchStyle
+ ProgressBarStyle {
+ panel: Rectangle {
+ implicitHeight: 15
+ implicitWidth: 400
+ color: "#444"
+ opacity: 0.8
+ Rectangle {
+ antialiasing: true
+ radius: 1
+ color: "#468bb7"
+ height: parent.height
+ width: parent.width * control.value / control.maximumValue
+ }
+ }
+ }
+ }
+}
diff --git a/examples/quickcontrols/controls/touch/content/SliderPage.qml b/examples/quickcontrols/controls/touch/content/SliderPage.qml
new file mode 100644
index 00000000..4f4e2ee8
--- /dev/null
+++ b/examples/quickcontrols/controls/touch/content/SliderPage.qml
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** 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.Controls 1.2
+import QtQuick.Controls.Styles 1.1
+
+Item {
+ width: parent.width
+ height: parent.height
+
+ Column {
+ spacing: 12
+ anchors.centerIn: parent
+
+ Slider {
+ anchors.margins: 20
+ style: touchStyle
+ value: 0
+ }
+ Slider {
+ anchors.margins: 20
+ style: touchStyle
+ value: 0.5
+ }
+ Slider {
+ anchors.margins: 20
+ style: touchStyle
+ value: 1.0
+ }
+
+ }
+
+ Component {
+ id: touchStyle
+ SliderStyle {
+ handle: Rectangle {
+ width: 30
+ height: 30
+ radius: height
+ antialiasing: true
+ color: Qt.lighter("#468bb7", 1.2)
+ }
+
+ groove: Item {
+ implicitHeight: 50
+ implicitWidth: 400
+ Rectangle {
+ height: 8
+ width: parent.width
+ anchors.verticalCenter: parent.verticalCenter
+ color: "#444"
+ opacity: 0.8
+ Rectangle {
+ antialiasing: true
+ radius: 1
+ color: "#468bb7"
+ height: parent.height
+ width: parent.width * control.value / control.maximumValue
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/examples/quickcontrols/controls/touch/content/TabBarPage.qml b/examples/quickcontrols/controls/touch/content/TabBarPage.qml
new file mode 100644
index 00000000..a27bb206
--- /dev/null
+++ b/examples/quickcontrols/controls/touch/content/TabBarPage.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.Controls 1.2
+import QtQuick.Controls.Styles 1.1
+
+Item {
+ width: parent.width
+ height: parent.height
+
+ TabView {
+ anchors.fill: parent
+ style: touchStyle
+ Tab {
+ title: "Buttons"
+ ButtonPage{ visible: true }
+ }
+ Tab {
+ title: "Sliders"
+ SliderPage{ visible: true }
+ }
+ Tab {
+ title: "Progress"
+ ProgressBarPage{ visible: true }
+ }
+ }
+
+ Component {
+ id: touchStyle
+ TabViewStyle {
+ tabsAlignment: Qt.AlignVCenter
+ tabOverlap: 0
+ frame: Item { }
+ tab: Item {
+ implicitWidth: control.width/control.count
+ implicitHeight: 50
+ BorderImage {
+ anchors.fill: parent
+ border.bottom: 8
+ border.top: 8
+ source: styleData.selected ? "../images/tab_selected.png":"../images/tabs_standard.png"
+ Text {
+ anchors.centerIn: parent
+ color: "white"
+ text: styleData.title.toUpperCase()
+ font.pixelSize: 16
+ }
+ Rectangle {
+ visible: index > 0
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.margins: 10
+ width:1
+ color: "#3a3a3a"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/examples/quickcontrols/controls/touch/content/TextInputPage.qml b/examples/quickcontrols/controls/touch/content/TextInputPage.qml
new file mode 100644
index 00000000..3c4dc4ad
--- /dev/null
+++ b/examples/quickcontrols/controls/touch/content/TextInputPage.qml
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** 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.Controls 1.2
+import QtQuick.Controls.Styles 1.1
+
+Item {
+ width: parent.width
+ height: parent.height
+
+ property real progress: 0
+ SequentialAnimation on progress {
+ loops: Animation.Infinite
+ running: true
+ NumberAnimation {
+ from: 0
+ to: 1
+ duration: 3000
+ }
+ NumberAnimation {
+ from: 1
+ to: 0
+ duration: 3000
+ }
+ }
+
+ Column {
+ spacing: 40
+ anchors.centerIn: parent
+
+ TextField {
+ anchors.margins: 20
+ text: "Text input"
+ style: touchStyle
+ }
+
+ TextField {
+ anchors.margins: 20
+ text: "Readonly Text input"
+ style: touchStyle
+ readOnly: true
+ }
+ }
+ Component {
+ id: touchStyle
+
+ TextFieldStyle {
+ textColor: "white"
+ font.pixelSize: 28
+ background: Item {
+ implicitHeight: 50
+ implicitWidth: 320
+ BorderImage {
+ source: "../images/textinput.png"
+ border.left: 8
+ border.right: 8
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ }
+ }
+ }
+ }
+}
diff --git a/examples/quickcontrols/controls/touch/images/NOTICE.txt b/examples/quickcontrols/controls/touch/images/NOTICE.txt
new file mode 100644
index 00000000..93a9afc8
--- /dev/null
+++ b/examples/quickcontrols/controls/touch/images/NOTICE.txt
@@ -0,0 +1,2 @@
+Notice some of these images are derived from Google applications resources. They were provided under the following license:
+You may use the materials in this directory without restriction to develop your apps and to use in your apps.
diff --git a/examples/quickcontrols/controls/touch/images/button_default.png b/examples/quickcontrols/controls/touch/images/button_default.png
new file mode 100644
index 00000000..6d6cfd9a
--- /dev/null
+++ b/examples/quickcontrols/controls/touch/images/button_default.png
Binary files differ
diff --git a/examples/quickcontrols/controls/touch/images/button_pressed.png b/examples/quickcontrols/controls/touch/images/button_pressed.png
new file mode 100644
index 00000000..ab78b6ea
--- /dev/null
+++ b/examples/quickcontrols/controls/touch/images/button_pressed.png
Binary files differ
diff --git a/examples/quickcontrols/controls/touch/images/navigation_next_item.png b/examples/quickcontrols/controls/touch/images/navigation_next_item.png
new file mode 100644
index 00000000..6665c9d8
--- /dev/null
+++ b/examples/quickcontrols/controls/touch/images/navigation_next_item.png
Binary files differ
diff --git a/examples/quickcontrols/controls/touch/images/navigation_previous_item.png b/examples/quickcontrols/controls/touch/images/navigation_previous_item.png
new file mode 100644
index 00000000..f8be0119
--- /dev/null
+++ b/examples/quickcontrols/controls/touch/images/navigation_previous_item.png
Binary files differ
diff --git a/examples/quickcontrols/controls/touch/images/tab_selected.png b/examples/quickcontrols/controls/touch/images/tab_selected.png
new file mode 100644
index 00000000..2345f7a8
--- /dev/null
+++ b/examples/quickcontrols/controls/touch/images/tab_selected.png
Binary files differ
diff --git a/examples/quickcontrols/controls/touch/images/tabs_standard.png b/examples/quickcontrols/controls/touch/images/tabs_standard.png
new file mode 100644
index 00000000..7140ab7b
--- /dev/null
+++ b/examples/quickcontrols/controls/touch/images/tabs_standard.png
Binary files differ
diff --git a/examples/quickcontrols/controls/touch/images/textinput.png b/examples/quickcontrols/controls/touch/images/textinput.png
new file mode 100644
index 00000000..b0256db2
--- /dev/null
+++ b/examples/quickcontrols/controls/touch/images/textinput.png
Binary files differ
diff --git a/examples/quickcontrols/controls/touch/images/toolbar.png b/examples/quickcontrols/controls/touch/images/toolbar.png
new file mode 100644
index 00000000..e9eba4c7
--- /dev/null
+++ b/examples/quickcontrols/controls/touch/images/toolbar.png
Binary files differ
diff --git a/examples/quickcontrols/controls/touch/main.qml b/examples/quickcontrols/controls/touch/main.qml
new file mode 100644
index 00000000..5138fa0c
--- /dev/null
+++ b/examples/quickcontrols/controls/touch/main.qml
@@ -0,0 +1,147 @@
+/****************************************************************************
+**
+** 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.Controls 1.2
+import "content"
+
+ApplicationWindow {
+ visible: true
+ width: 800
+ height: 1280
+
+ Rectangle {
+ color: "#212126"
+ anchors.fill: parent
+ }
+
+ toolBar: BorderImage {
+ border.bottom: 8
+ source: "images/toolbar.png"
+ width: parent.width
+ height: 100
+
+ Rectangle {
+ id: backButton
+ width: opacity ? 60 : 0
+ anchors.left: parent.left
+ anchors.leftMargin: 20
+ opacity: stackView.depth > 1 ? 1 : 0
+ anchors.verticalCenter: parent.verticalCenter
+ antialiasing: true
+ height: 60
+ radius: 4
+ color: backmouse.pressed ? "#222" : "transparent"
+ Behavior on opacity { NumberAnimation{} }
+ Image {
+ anchors.verticalCenter: parent.verticalCenter
+ source: "images/navigation_previous_item.png"
+ }
+ MouseArea {
+ id: backmouse
+ anchors.fill: parent
+ anchors.margins: -10
+ onClicked: stackView.pop()
+ }
+ }
+
+ Text {
+ font.pixelSize: 42
+ Behavior on x { NumberAnimation{ easing.type: Easing.OutCubic} }
+ x: backButton.x + backButton.width + 20
+ anchors.verticalCenter: parent.verticalCenter
+ color: "white"
+ text: "Widget Gallery"
+ }
+ }
+
+ ListModel {
+ id: pageModel
+ ListElement {
+ title: "Buttons"
+ page: "content/ButtonPage.qml"
+ }
+ ListElement {
+ title: "Sliders"
+ page: "content/SliderPage.qml"
+ }
+ ListElement {
+ title: "ProgressBar"
+ page: "content/ProgressBarPage.qml"
+ }
+ ListElement {
+ title: "Tabs"
+ page: "content/TabBarPage.qml"
+ }
+ ListElement {
+ title: "TextInput"
+ page: "content/TextInputPage.qml"
+ }
+ ListElement {
+ title: "List"
+ page: "content/ListPage.qml"
+ }
+ }
+
+ StackView {
+ id: stackView
+ anchors.fill: parent
+ // Implements back key navigation
+ focus: true
+ Keys.onReleased: if (event.key === Qt.Key_Back && stackView.depth > 1) {
+ stackView.pop();
+ event.accepted = true;
+ }
+
+ initialItem: Item {
+ width: parent.width
+ height: parent.height
+ ListView {
+ model: pageModel
+ anchors.fill: parent
+ delegate: AndroidDelegate {
+ text: title
+ onClicked: stackView.push(Qt.resolvedUrl(page))
+ }
+ }
+ }
+ }
+
+}
diff --git a/examples/quickcontrols/controls/touch/resources.qrc b/examples/quickcontrols/controls/touch/resources.qrc
new file mode 100644
index 00000000..e64a063f
--- /dev/null
+++ b/examples/quickcontrols/controls/touch/resources.qrc
@@ -0,0 +1,20 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/">
+ <file>main.qml</file>
+ <file>content/AndroidDelegate.qml</file>
+ <file>content/ButtonPage.qml</file>
+ <file>content/ListPage.qml</file>
+ <file>content/ProgressBarPage.qml</file>
+ <file>content/SliderPage.qml</file>
+ <file>content/TabBarPage.qml</file>
+ <file>content/TextInputPage.qml</file>
+ <file>images/button_default.png</file>
+ <file>images/button_pressed.png</file>
+ <file>images/navigation_next_item.png</file>
+ <file>images/navigation_previous_item.png</file>
+ <file>images/tab_selected.png</file>
+ <file>images/tabs_standard.png</file>
+ <file>images/textinput.png</file>
+ <file>images/toolbar.png</file>
+</qresource>
+</RCC>
diff --git a/examples/quickcontrols/controls/touch/src/main.cpp b/examples/quickcontrols/controls/touch/src/main.cpp
new file mode 100644
index 00000000..e66387f7
--- /dev/null
+++ b/examples/quickcontrols/controls/touch/src/main.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** 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/QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QtQuickControlsApplication app(argc, argv);
+ QQmlApplicationEngine engine(QUrl("qrc:/main.qml"));
+ if (engine.rootObjects().isEmpty())
+ return -1;
+ return app.exec();
+}
diff --git a/examples/quickcontrols/controls/touch/src/src.pri b/examples/quickcontrols/controls/touch/src/src.pri
new file mode 100644
index 00000000..66d903ea
--- /dev/null
+++ b/examples/quickcontrols/controls/touch/src/src.pri
@@ -0,0 +1,2 @@
+SOURCES += \
+ $$PWD/main.cpp
diff --git a/examples/quickcontrols/controls/touch/touch.pro b/examples/quickcontrols/controls/touch/touch.pro
new file mode 100644
index 00000000..111c2845
--- /dev/null
+++ b/examples/quickcontrols/controls/touch/touch.pro
@@ -0,0 +1,22 @@
+QT += qml quick
+TARGET = touch
+!no_desktop: QT += widgets
+
+include(src/src.pri)
+include(../shared/shared.pri)
+
+OTHER_FILES += \
+ main.qml \
+ content/AndroidDelegate.qml \
+ content/ButtonPage.qml \
+ content/ListPage.qml \
+ content/ProgressBarPage.qml \
+ content/SliderPage.qml \
+ content/TabBarPage.qml \
+ content/TextInputPage.qml
+
+RESOURCES += \
+ resources.qrc
+
+target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/controls/touch
+INSTALLS += target
diff --git a/examples/quickcontrols/controls/touch/touch.qmlproject b/examples/quickcontrols/controls/touch/touch.qmlproject
new file mode 100644
index 00000000..e5a8bf02
--- /dev/null
+++ b/examples/quickcontrols/controls/touch/touch.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "main.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/quickcontrols/controls/uiforms/MainForm.ui.qml b/examples/quickcontrols/controls/uiforms/MainForm.ui.qml
new file mode 100644
index 00000000..4649209f
--- /dev/null
+++ b/examples/quickcontrols/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/quickcontrols/controls/uiforms/main.cpp b/examples/quickcontrols/controls/uiforms/main.cpp
new file mode 100644
index 00000000..6a15842a
--- /dev/null
+++ b/examples/quickcontrols/controls/uiforms/main.cpp
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** 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"));
+ if (engine.rootObjects().isEmpty())
+ return -1;
+ return app.exec();
+}
diff --git a/examples/quickcontrols/controls/uiforms/main.qml b/examples/quickcontrols/controls/uiforms/main.qml
new file mode 100644
index 00000000..da258022
--- /dev/null
+++ b/examples/quickcontrols/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/quickcontrols/controls/uiforms/qml/CustomerModel.qml b/examples/quickcontrols/controls/uiforms/qml/CustomerModel.qml
new file mode 100644
index 00000000..70a9695d
--- /dev/null
+++ b/examples/quickcontrols/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/quickcontrols/controls/uiforms/qml/History.qml b/examples/quickcontrols/controls/uiforms/qml/History.qml
new file mode 100644
index 00000000..336d717f
--- /dev/null
+++ b/examples/quickcontrols/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/quickcontrols/controls/uiforms/qml/HistoryForm.ui.qml b/examples/quickcontrols/controls/uiforms/qml/HistoryForm.ui.qml
new file mode 100644
index 00000000..9445b12f
--- /dev/null
+++ b/examples/quickcontrols/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/quickcontrols/controls/uiforms/qml/Notes.qml b/examples/quickcontrols/controls/uiforms/qml/Notes.qml
new file mode 100644
index 00000000..af506af3
--- /dev/null
+++ b/examples/quickcontrols/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/quickcontrols/controls/uiforms/qml/NotesForm.ui.qml b/examples/quickcontrols/controls/uiforms/qml/NotesForm.ui.qml
new file mode 100644
index 00000000..9552afcd
--- /dev/null
+++ b/examples/quickcontrols/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/quickcontrols/controls/uiforms/qml/Settings.qml b/examples/quickcontrols/controls/uiforms/qml/Settings.qml
new file mode 100644
index 00000000..658c62d3
--- /dev/null
+++ b/examples/quickcontrols/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/quickcontrols/controls/uiforms/qml/SettingsForm.ui.qml b/examples/quickcontrols/controls/uiforms/qml/SettingsForm.ui.qml
new file mode 100644
index 00000000..5cafe0e7
--- /dev/null
+++ b/examples/quickcontrols/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/quickcontrols/controls/uiforms/uiforms.pro b/examples/quickcontrols/controls/uiforms/uiforms.pro
new file mode 100644
index 00000000..8b8a8a96
--- /dev/null
+++ b/examples/quickcontrols/controls/uiforms/uiforms.pro
@@ -0,0 +1,24 @@
+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)
+
+target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/controls/uiforms
+INSTALLS += target
diff --git a/examples/quickcontrols/controls/uiforms/uiforms.qrc b/examples/quickcontrols/controls/uiforms/uiforms.qrc
new file mode 100644
index 00000000..447bb039
--- /dev/null
+++ b/examples/quickcontrols/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>