summaryrefslogtreecommitdiffstats
path: root/examples/quickcontrols
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2016-04-21 10:46:55 +0200
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2016-04-28 19:01:10 +0000
commitc943543b84129bd82c17858d5eb91486af78111c (patch)
tree177071b5ef7c18cb01b0c61b48705e8e72885699 /examples/quickcontrols
parente730a8c6a54807e9688651723de27100931ce08a (diff)
fix example installs
this includes renaming the first-level subdir of examples/. Change-Id: Idf14164533c247e5c0cc5acdb405ac97f7c33ac5 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'examples/quickcontrols')
-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
-rw-r--r--examples/quickcontrols/dialogs/dialogs.pro4
-rw-r--r--examples/quickcontrols/dialogs/systemdialogs/ColorDialogs.qml144
-rw-r--r--examples/quickcontrols/dialogs/systemdialogs/CustomDialogs.qml339
-rw-r--r--examples/quickcontrols/dialogs/systemdialogs/FileDialogs.qml186
-rw-r--r--examples/quickcontrols/dialogs/systemdialogs/FontDialogs.qml153
-rw-r--r--examples/quickcontrols/dialogs/systemdialogs/MessageDialogs.qml326
-rw-r--r--examples/quickcontrols/dialogs/systemdialogs/doc/images/systemdialogs-example.jpgbin0 -> 47413 bytes
-rw-r--r--examples/quickcontrols/dialogs/systemdialogs/doc/src/systemdialogs.qdoc49
-rw-r--r--examples/quickcontrols/dialogs/systemdialogs/main.cpp59
-rw-r--r--examples/quickcontrols/dialogs/systemdialogs/systemdialogs.pro19
-rw-r--r--examples/quickcontrols/dialogs/systemdialogs/systemdialogs.qml75
-rw-r--r--examples/quickcontrols/dialogs/systemdialogs/systemdialogs.qrc10
-rw-r--r--examples/quickcontrols/extras/dashboard/dashboard.pro21
-rw-r--r--examples/quickcontrols/extras/dashboard/dashboard.qrc13
-rw-r--r--examples/quickcontrols/extras/dashboard/fonts/DejaVuSans.ttfbin0 -> 720856 bytes
-rw-r--r--examples/quickcontrols/extras/dashboard/fonts/LICENSE99
-rw-r--r--examples/quickcontrols/extras/dashboard/images/fuel-icon.pngbin0 -> 409 bytes
-rw-r--r--examples/quickcontrols/extras/dashboard/images/temperature-icon.pngbin0 -> 3302 bytes
-rw-r--r--examples/quickcontrols/extras/dashboard/main.cpp57
-rw-r--r--examples/quickcontrols/extras/dashboard/qml/DashboardGaugeStyle.qml164
-rw-r--r--examples/quickcontrols/extras/dashboard/qml/IconGaugeStyle.qml124
-rw-r--r--examples/quickcontrols/extras/dashboard/qml/TachometerStyle.qml116
-rw-r--r--examples/quickcontrols/extras/dashboard/qml/TurnIndicator.qml104
-rw-r--r--examples/quickcontrols/extras/dashboard/qml/ValueSource.qml320
-rw-r--r--examples/quickcontrols/extras/dashboard/qml/dashboard.qml174
-rw-r--r--examples/quickcontrols/extras/extras.pro5
-rw-r--r--examples/quickcontrols/extras/flat/Content.qml706
-rw-r--r--examples/quickcontrols/extras/flat/SettingsIcon.qml118
-rw-r--r--examples/quickcontrols/extras/flat/flat.pro19
-rw-r--r--examples/quickcontrols/extras/flat/flat.qrc16
-rw-r--r--examples/quickcontrols/extras/flat/images/piemenu-bw-normal.pngbin0 -> 1716 bytes
-rw-r--r--examples/quickcontrols/extras/flat/images/piemenu-bw-pressed.pngbin0 -> 1394 bytes
-rw-r--r--examples/quickcontrols/extras/flat/images/piemenu-image-bw.jpgbin0 -> 1065560 bytes
-rw-r--r--examples/quickcontrols/extras/flat/images/piemenu-image-rgb.jpgbin0 -> 1152261 bytes
-rw-r--r--examples/quickcontrols/extras/flat/images/piemenu-image-sepia.jpgbin0 -> 1513238 bytes
-rw-r--r--examples/quickcontrols/extras/flat/images/piemenu-rgb-normal.pngbin0 -> 1665 bytes
-rw-r--r--examples/quickcontrols/extras/flat/images/piemenu-rgb-pressed.pngbin0 -> 1571 bytes
-rw-r--r--examples/quickcontrols/extras/flat/images/piemenu-sepia-normal.pngbin0 -> 1410 bytes
-rw-r--r--examples/quickcontrols/extras/flat/images/piemenu-sepia-pressed.pngbin0 -> 1386 bytes
-rw-r--r--examples/quickcontrols/extras/flat/main.cpp62
-rw-r--r--examples/quickcontrols/extras/flat/main.qml479
-rw-r--r--examples/quickcontrols/extras/gallery/fonts/LICENSE.txt202
-rw-r--r--examples/quickcontrols/extras/gallery/fonts/OpenSans-Regular.ttfbin0 -> 217360 bytes
-rw-r--r--examples/quickcontrols/extras/gallery/gallery.pro34
-rw-r--r--examples/quickcontrols/extras/gallery/gallery.qrc36
-rw-r--r--examples/quickcontrols/extras/gallery/images/background-light.pngbin0 -> 46832 bytes
-rw-r--r--examples/quickcontrols/extras/gallery/images/background.pngbin0 -> 45497 bytes
-rw-r--r--examples/quickcontrols/extras/gallery/images/center-light.pngbin0 -> 2113 bytes
-rw-r--r--examples/quickcontrols/extras/gallery/images/center.pngbin0 -> 2260 bytes
-rw-r--r--examples/quickcontrols/extras/gallery/images/icon-back.pngbin0 -> 614 bytes
-rw-r--r--examples/quickcontrols/extras/gallery/images/icon-go.pngbin0 -> 1435 bytes
-rw-r--r--examples/quickcontrols/extras/gallery/images/icon-settings.pngbin0 -> 1786 bytes
-rw-r--r--examples/quickcontrols/extras/gallery/images/info.pngbin0 -> 709 bytes
-rw-r--r--examples/quickcontrols/extras/gallery/images/needle-light.pngbin0 -> 2105 bytes
-rw-r--r--examples/quickcontrols/extras/gallery/images/needle.pngbin0 -> 4891 bytes
-rw-r--r--examples/quickcontrols/extras/gallery/images/qt-logo.pngbin0 -> 5149 bytes
-rw-r--r--examples/quickcontrols/extras/gallery/images/zoom_in.pngbin0 -> 829 bytes
-rw-r--r--examples/quickcontrols/extras/gallery/images/zoom_out.pngbin0 -> 779 bytes
-rw-r--r--examples/quickcontrols/extras/gallery/main.cpp51
-rw-r--r--examples/quickcontrols/extras/gallery/qml/BlackButtonBackground.qml71
-rw-r--r--examples/quickcontrols/extras/gallery/qml/BlackButtonStyle.qml97
-rw-r--r--examples/quickcontrols/extras/gallery/qml/CircularGaugeDarkStyle.qml96
-rw-r--r--examples/quickcontrols/extras/gallery/qml/CircularGaugeDefaultStyle.qml46
-rw-r--r--examples/quickcontrols/extras/gallery/qml/CircularGaugeLightStyle.qml97
-rw-r--r--examples/quickcontrols/extras/gallery/qml/CircularGaugeView.qml230
-rw-r--r--examples/quickcontrols/extras/gallery/qml/ControlLabel.qml49
-rw-r--r--examples/quickcontrols/extras/gallery/qml/ControlView.qml188
-rw-r--r--examples/quickcontrols/extras/gallery/qml/ControlViewToolbar.qml91
-rw-r--r--examples/quickcontrols/extras/gallery/qml/CustomizerLabel.qml48
-rw-r--r--examples/quickcontrols/extras/gallery/qml/CustomizerSlider.qml75
-rw-r--r--examples/quickcontrols/extras/gallery/qml/CustomizerSwitch.qml46
-rw-r--r--examples/quickcontrols/extras/gallery/qml/FlickableMoreIndicator.qml76
-rw-r--r--examples/quickcontrols/extras/gallery/qml/PieMenuControlView.qml187
-rw-r--r--examples/quickcontrols/extras/gallery/qml/PieMenuDarkStyle.qml46
-rw-r--r--examples/quickcontrols/extras/gallery/qml/PieMenuDefaultStyle.qml44
-rw-r--r--examples/quickcontrols/extras/gallery/qml/StylePicker.qml98
-rw-r--r--examples/quickcontrols/extras/gallery/qml/gallery.qml439
-rw-r--r--examples/quickcontrols/quickcontrols.pro5
195 files changed, 12630 insertions, 0 deletions
diff --git a/examples/quickcontrols/controls/basiclayouts/basiclayouts.pro b/examples/quickcontrols/controls/basiclayouts/basiclayouts.pro
new file mode 100644
index 000000000..202a899fa
--- /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 000000000..e5a8bf02c
--- /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 000000000..b6694b454
--- /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 000000000..3b111a907
--- /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 000000000..e66387f7b
--- /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 000000000..66d903eac
--- /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 000000000..67960e275
--- /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 000000000..1edffd02d
--- /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 000000000..46215e28d
--- /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 000000000..9da283ba3
--- /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 000000000..e4c7dd787
--- /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 000000000..bfa11ad72
--- /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 000000000..bab7e4b26
--- /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 000000000..92e558ef3
--- /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 000000000..e7a35c011
--- /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 000000000..50b2ea620
--- /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 000000000..02b0e094b
--- /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 000000000..fc14584cd
--- /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 000000000..e9c63c208
--- /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 000000000..6e79ca618
--- /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 000000000..5f6483ac3
--- /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 000000000..5cba235da
--- /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 000000000..873c8b5ca
--- /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 000000000..ac3f447d3
--- /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 000000000..ab3d8d32a
--- /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 000000000..417b4581e
--- /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 000000000..417b4581e
--- /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 000000000..ee439953c
--- /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 000000000..b6db20de4
--- /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 000000000..660429671
--- /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 000000000..416e936ae
--- /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 000000000..819c34eec
--- /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 000000000..5f22b483f
--- /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 000000000..1d9e0592f
--- /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 000000000..62aa1efe5
--- /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 000000000..d64cdaa78
--- /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 000000000..8ab41cc80
--- /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 000000000..55a069dfc
--- /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 000000000..b588c9586
--- /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 000000000..ac4d4a0d9
--- /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 000000000..74fefab78
--- /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 000000000..665400ccf
--- /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 000000000..1d4a38ab3
--- /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 000000000..55c592e6e
--- /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 000000000..b2eefb862
--- /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 000000000..b1b29951d
--- /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 000000000..d2300c6fa
--- /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 000000000..1d99f4b93
--- /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 000000000..dbba7f38c
--- /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 000000000..f362d5d3d
--- /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 000000000..c4460b0f1
--- /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 000000000..491f851c9
--- /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 000000000..a956dc428
--- /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 000000000..3b111a907
--- /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 000000000..52bb507a1
--- /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 000000000..a225e2eaa
--- /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 000000000..f55136446
--- /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 000000000..a784fd570
--- /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 000000000..64c0b2d6a
--- /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 000000000..8875bf246
--- /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 000000000..a3bd5e0bf
--- /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 000000000..ebb44e6b8
--- /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 000000000..d3882c7b3
--- /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 000000000..fc06c5ec6
--- /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 000000000..10ca56c82
--- /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 000000000..b41ecf531
--- /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 000000000..be1bb1060
--- /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 000000000..38400bd1f
--- /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 000000000..2ef5b2ee6
--- /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 000000000..0170ee26a
--- /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 000000000..39cd6c1a9
--- /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 000000000..83a66d553
--- /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 000000000..e7c04645c
--- /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 000000000..968bac5e9
--- /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 000000000..d46f5aff0
--- /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 000000000..46326566d
--- /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 000000000..42f5e7f94
--- /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 000000000..27c7b9215
--- /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 000000000..2e03f7471
--- /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 000000000..f2bd4eead
--- /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 000000000..1ef76e3a0
--- /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 000000000..2b89cd629
--- /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 000000000..f52552555
--- /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 000000000..07f288337
--- /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 000000000..3888e30d5
--- /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 000000000..f12b0c12b
--- /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 000000000..5190b4bba
--- /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 000000000..4f4e2ee82
--- /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 000000000..a27bb2069
--- /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 000000000..3c4dc4ade
--- /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 000000000..93a9afc8c
--- /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 000000000..6d6cfd9ad
--- /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 000000000..ab78b6ea3
--- /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 000000000..6665c9d85
--- /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 000000000..f8be01197
--- /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 000000000..2345f7a8e
--- /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 000000000..7140ab7b7
--- /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 000000000..b0256db2c
--- /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 000000000..e9eba4c74
--- /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 000000000..5138fa0ca
--- /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 000000000..e64a063f1
--- /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 000000000..e66387f7b
--- /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 000000000..66d903eac
--- /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 000000000..111c28459
--- /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 000000000..e5a8bf02c
--- /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 000000000..4649209f4
--- /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 000000000..6a15842a9
--- /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 000000000..da2580225
--- /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 000000000..70a9695dd
--- /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 000000000..336d717ff
--- /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 000000000..9445b12fb
--- /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 000000000..af506af31
--- /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 000000000..9552afcd0
--- /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 000000000..658c62d3c
--- /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 000000000..5cafe0e7a
--- /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 000000000..8b8a8a965
--- /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 000000000..447bb039d
--- /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>
diff --git a/examples/quickcontrols/dialogs/dialogs.pro b/examples/quickcontrols/dialogs/dialogs.pro
new file mode 100644
index 000000000..538e75686
--- /dev/null
+++ b/examples/quickcontrols/dialogs/dialogs.pro
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+
+SUBDIRS = \
+ systemdialogs
diff --git a/examples/quickcontrols/dialogs/systemdialogs/ColorDialogs.qml b/examples/quickcontrols/dialogs/systemdialogs/ColorDialogs.qml
new file mode 100644
index 000000000..90cbccf44
--- /dev/null
+++ b/examples/quickcontrols/dialogs/systemdialogs/ColorDialogs.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$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Dialogs 1.1
+
+Item {
+ width: 320
+ height: 240
+ SystemPalette { id: palette }
+ clip: true
+
+ //! [colordialog]
+ ColorDialog {
+ id: colorDialog
+ visible: colorDialogVisible.checked
+ modality: colorDialogModal.checked ? Qt.WindowModal : Qt.NonModal
+ title: "Choose a color"
+ color: "green"
+ showAlphaChannel: colorDialogAlpha.checked
+ onAccepted: { console.log("Accepted: " + color) }
+ onRejected: { console.log("Rejected") }
+ }
+ //! [colordialog]
+
+ Column {
+ anchors.fill: parent
+ anchors.margins: 12
+ spacing: 8
+ Label {
+ font.bold: true
+ text: "Color dialog properties:"
+ }
+ CheckBox {
+ id: colorDialogModal
+ text: "Modal"
+ checked: true
+ Binding on checked { value: colorDialog.modality != Qt.NonModal }
+ }
+ CheckBox {
+ id: colorDialogAlpha
+ text: "Show alpha channel"
+ Binding on checked { value: colorDialog.showAlphaChannel }
+ }
+ CheckBox {
+ id: colorDialogVisible
+ text: "Visible"
+ Binding on checked { value: colorDialog.visible }
+ }
+ Row {
+ id: colorRow
+ spacing: parent.spacing
+ height: colorLabel.implicitHeight * 2.0
+ Rectangle {
+ color: colorDialog.color
+ height: parent.height
+ width: height * 2
+ border.color: "black"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: colorDialog.open()
+ }
+ }
+ Label {
+ id: colorLabel
+ text: "<b>current color:</b> " + colorDialog.color
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+ }
+
+ Rectangle {
+ anchors {
+ left: parent.left
+ right: parent.right
+ bottom: parent.bottom
+ }
+ height: buttonRow.height * 1.2
+ color: Qt.darker(palette.window, 1.1)
+ border.color: Qt.darker(palette.window, 1.3)
+ Row {
+ id: buttonRow
+ spacing: 6
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.leftMargin: 12
+ height: implicitHeight
+ width: parent.width
+ Button {
+ text: "Open"
+ anchors.verticalCenter: parent.verticalCenter
+ onClicked: colorDialog.open()
+ }
+ Button {
+ text: "Close"
+ anchors.verticalCenter: parent.verticalCenter
+ onClicked: colorDialog.close()
+ }
+ Button {
+ text: "set to green"
+ anchors.verticalCenter: parent.verticalCenter
+ onClicked: colorDialog.color = "green"
+ }
+ }
+ }
+}
diff --git a/examples/quickcontrols/dialogs/systemdialogs/CustomDialogs.qml b/examples/quickcontrols/dialogs/systemdialogs/CustomDialogs.qml
new file mode 100644
index 000000000..c1022fbba
--- /dev/null
+++ b/examples/quickcontrols/dialogs/systemdialogs/CustomDialogs.qml
@@ -0,0 +1,339 @@
+/****************************************************************************
+**
+** 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.3
+import QtQuick.Controls 1.2
+import QtQuick.Dialogs 1.2
+import QtQuick.Layouts 1.1
+import QtQuick.Window 2.0
+
+Item {
+ id: root
+ width: 580
+ height: 400
+ SystemPalette { id: palette }
+ clip: true
+
+ //! [dialog]
+ Dialog {
+ id: helloDialog
+ modality: dialogModal.checked ? Qt.WindowModal : Qt.NonModal
+ title: customizeTitle.checked ? windowTitleField.text : "Hello"
+ onButtonClicked: console.log("clicked button " + clickedButton)
+ onAccepted: lastChosen.text = "Accepted " +
+ (clickedButton == StandardButton.Ok ? "(OK)" : (clickedButton == StandardButton.Retry ? "(Retry)" : "(Ignore)"))
+ onRejected: lastChosen.text = "Rejected " +
+ (clickedButton == StandardButton.Close ? "(Close)" : (clickedButton == StandardButton.Abort ? "(Abort)" : "(Cancel)"))
+ onHelp: lastChosen.text = "Yelped for help!"
+ onYes: lastChosen.text = (clickedButton == StandardButton.Yes ? "Yeessss!!" : "Yes, now and always")
+ onNo: lastChosen.text = (clickedButton == StandardButton.No ? "Oh No." : "No, no, a thousand times no!")
+ onApply: lastChosen.text = "Apply"
+ onReset: lastChosen.text = "Reset"
+
+ Label {
+ text: "Hello world!"
+ }
+ }
+ //! [dialog]
+
+ Dialog {
+ id: spinboxDialog
+ modality: dialogModal.checked ? Qt.WindowModal : Qt.NonModal
+ title: customizeTitle.checked ? windowTitleField.text : "Spinbox"
+ onHelp: {
+ lastChosen.text = "No help available, sorry. Please answer the question."
+ visible = true
+ }
+ onButtonClicked: {
+ if (clickedButton === StandardButton.Ok && answer.value == 11.0)
+ lastChosen.text = "You are correct!"
+ else
+ lastChosen.text = "Having failed to give the correct answer, you shall not pass!"
+ }
+
+ ColumnLayout {
+ id: column
+ width: parent ? parent.width : 100
+ Label {
+ text: "<b>What</b> is the average airspeed velocity of an unladen European swallow?"
+ Layout.columnSpan: 2
+ Layout.fillWidth: true
+ wrapMode: Text.WordWrap
+ }
+ RowLayout {
+ Layout.alignment: Qt.AlignHCenter
+ SpinBox {
+ id: answer
+ onEditingFinished: spinboxDialog.click(StandardButton.Ok)
+ }
+ Label {
+ text: "m/s"
+ Layout.alignment: Qt.AlignBaseline | Qt.AlignLeft
+ }
+ }
+ }
+ }
+
+ Dialog {
+ id: dateDialog
+ modality: dialogModal.checked ? Qt.WindowModal : Qt.NonModal
+ title: customizeTitle.checked ? windowTitleField.text : "Choose a date"
+ onButtonClicked: console.log("clicked button " + clickedButton)
+ onAccepted: {
+ if (clickedButton == StandardButton.Ok)
+ lastChosen.text = "Accepted " + calendar.selectedDate.toLocaleDateString()
+ else
+ lastChosen.text = (clickedButton == StandardButton.Retry ? "(Retry)" : "(Ignore)")
+ }
+ onRejected: lastChosen.text = "Rejected"
+
+ Calendar {
+ id: calendar
+ width: parent ? parent.width : implicitWidth
+ onDoubleClicked: dateDialog.click(StandardButton.Ok)
+ }
+ }
+
+ Dialog {
+ id: filledDialog
+ modality: dialogModal.checked ? Qt.WindowModal : Qt.NonModal
+ title: customizeTitle.checked ? windowTitleField.text : "Customized content"
+ onRejected: lastChosen.text = "Rejected"
+ onAccepted: lastChosen.text = "Accepted " +
+ (clickedButton === StandardButton.Retry ? "(Retry)" : "(OK)")
+ onButtonClicked: if (clickedButton === StandardButton.Retry) lastChosen.text = "Retry"
+ contentItem: Rectangle {
+ color: "lightskyblue"
+ implicitWidth: 400
+ implicitHeight: 100
+ Label {
+ text: "Hello blue sky!"
+ color: "navy"
+ anchors.centerIn: parent
+ }
+ Keys.onPressed: if (event.key === Qt.Key_R && (event.modifiers & Qt.ControlModifier)) filledDialog.click(StandardButton.Retry)
+ Keys.onEnterPressed: filledDialog.accept()
+ Keys.onEscapePressed: filledDialog.reject()
+ Keys.onBackPressed: filledDialog.reject() // especially necessary on Android
+ }
+ }
+
+ ColumnLayout {
+ anchors.fill: parent
+ anchors.margins: 12
+ spacing: 8
+ Label {
+ font.bold: true
+ text: "Message dialog properties:"
+ }
+ CheckBox {
+ id: dialogModal
+ text: "Modal"
+ Binding on checked { value: helloDialog.modality != Qt.NonModal }
+ }
+ RowLayout {
+ CheckBox {
+ id: customizeTitle
+ text: "Window Title"
+ Layout.alignment: Qt.AlignBaseline
+ checked: true
+ }
+ TextField {
+ id: windowTitleField
+ Layout.alignment: Qt.AlignBaseline
+ Layout.fillWidth: true
+ text: "Custom Dialog"
+ }
+ }
+ Label {
+ text: "Buttons:"
+ }
+ Flow {
+ spacing: 8
+ Layout.fillWidth: true
+ property bool updating: false
+ function updateButtons(button, checked) {
+ if (updating) return
+ updating = true
+ var buttons = 0
+ for (var i = 0; i < children.length; ++i)
+ if (children[i].checked)
+ buttons |= children[i].button
+ if (!buttons)
+ buttons = StandardButton.Ok
+ helloDialog.standardButtons = buttons
+ spinboxDialog.standardButtons = buttons
+ dateDialog.standardButtons = buttons
+ updating = false
+ }
+
+ CheckBox {
+ text: "Help"
+ property int button: StandardButton.Help
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+
+ CheckBox {
+ text: "Abort"
+ property int button: StandardButton.Abort
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+
+ CheckBox {
+ text: "Close"
+ property int button: StandardButton.Close
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+
+ CheckBox {
+ text: "Cancel"
+ property int button: StandardButton.Cancel
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+
+ CheckBox {
+ text: "NoToAll"
+ property int button: StandardButton.NoToAll
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+
+ CheckBox {
+ text: "No"
+ property int button: StandardButton.No
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+
+ CheckBox {
+ text: "YesToAll"
+ property int button: StandardButton.YesToAll
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+
+ CheckBox {
+ text: "Yes"
+ property int button: StandardButton.Yes
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+
+ CheckBox {
+ text: "Ignore"
+ property int button: StandardButton.Ignore
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+
+ CheckBox {
+ text: "Retry"
+ property int button: StandardButton.Retry
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+
+ CheckBox {
+ text: "Apply"
+ property int button: StandardButton.Apply
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+
+ CheckBox {
+ text: "Reset"
+ property int button: StandardButton.Reset
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+
+ CheckBox {
+ text: "Restore Defaults"
+ property int button: StandardButton.RestoreDefaults
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+
+ CheckBox {
+ text: "OK"
+ checked: true
+ property int button: StandardButton.Ok
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+
+ Component.onCompleted: updateButtons()
+ }
+ Label {
+ id: lastChosen
+ }
+ Item { Layout.fillHeight: true }
+ }
+
+ Rectangle {
+ id: bottomBar
+ anchors {
+ left: parent.left
+ right: parent.right
+ bottom: parent.bottom
+ }
+ height: buttonRow.height * 1.2
+ color: Qt.darker(palette.window, 1.1)
+ border.color: Qt.darker(palette.window, 1.3)
+ Row {
+ id: buttonRow
+ spacing: 6
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.leftMargin: 12
+ width: parent.width
+ Button {
+ text: "Hello World"
+ anchors.verticalCenter: parent.verticalCenter
+ onClicked: helloDialog.open()
+ }
+ Button {
+ text: "Input"
+ anchors.verticalCenter: parent.verticalCenter
+ onClicked: spinboxDialog.open()
+ }
+ Button {
+ text: "Date"
+ anchors.verticalCenter: parent.verticalCenter
+ onClicked: dateDialog.open()
+ }
+ Button {
+ text: "No buttons or margins"
+ anchors.verticalCenter: parent.verticalCenter
+ onClicked: filledDialog.open()
+ }
+ }
+ }
+}
diff --git a/examples/quickcontrols/dialogs/systemdialogs/FileDialogs.qml b/examples/quickcontrols/dialogs/systemdialogs/FileDialogs.qml
new file mode 100644
index 000000000..57e474ce2
--- /dev/null
+++ b/examples/quickcontrols/dialogs/systemdialogs/FileDialogs.qml
@@ -0,0 +1,186 @@
+/****************************************************************************
+**
+** 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.Dialogs 1.1
+import QtQuick.Layouts 1.1
+import QtQuick.Window 2.0
+
+Item {
+ width: 580
+ height: 400
+ SystemPalette { id: palette }
+ clip: true
+
+ //! [filedialog]
+ FileDialog {
+ id: fileDialog
+ visible: fileDialogVisible.checked
+ modality: fileDialogModal.checked ? Qt.WindowModal : Qt.NonModal
+ title: fileDialogSelectFolder.checked ? "Choose a folder" :
+ (fileDialogSelectMultiple.checked ? "Choose some files" : "Choose a file")
+ selectExisting: fileDialogSelectExisting.checked
+ selectMultiple: fileDialogSelectMultiple.checked
+ selectFolder: fileDialogSelectFolder.checked
+ nameFilters: [ "Image files (*.png *.jpg)", "All files (*)" ]
+ selectedNameFilter: "All files (*)"
+ sidebarVisible: fileDialogSidebarVisible.checked
+ onAccepted: {
+ console.log("Accepted: " + fileUrls)
+ if (fileDialogOpenFiles.checked)
+ for (var i = 0; i < fileUrls.length; ++i)
+ Qt.openUrlExternally(fileUrls[i])
+ }
+ onRejected: { console.log("Rejected") }
+ }
+ //! [filedialog]
+
+ ScrollView {
+ id: scrollView
+ anchors {
+ left: parent.left
+ right: parent.right
+ top: parent.top
+ bottom: bottomBar.top
+ leftMargin: 12
+ }
+ ColumnLayout {
+ spacing: 8
+ Item { Layout.preferredHeight: 4 } // padding
+ Label {
+ font.bold: true
+ text: "File dialog properties:"
+ }
+ CheckBox {
+ id: fileDialogModal
+ text: "Modal"
+ checked: true
+ Binding on checked { value: fileDialog.modality != Qt.NonModal }
+ }
+ CheckBox {
+ id: fileDialogSelectFolder
+ text: "Select Folder"
+ Binding on checked { value: fileDialog.selectFolder }
+ }
+ CheckBox {
+ id: fileDialogSelectExisting
+ text: "Select Existing Files"
+ checked: true
+ Binding on checked { value: fileDialog.selectExisting }
+ }
+ CheckBox {
+ id: fileDialogSelectMultiple
+ text: "Select Multiple Files"
+ Binding on checked { value: fileDialog.selectMultiple }
+ }
+ CheckBox {
+ id: fileDialogOpenFiles
+ text: "Open Files After Accepting"
+ }
+ CheckBox {
+ id: fileDialogSidebarVisible
+ text: "Show Sidebar"
+ checked: fileDialog.sidebarVisible
+ Binding on checked { value: fileDialog.sidebarVisible }
+ }
+ CheckBox {
+ id: fileDialogVisible
+ text: "Visible"
+ Binding on checked { value: fileDialog.visible }
+ }
+ Label {
+ text: "<b>current view folder:</b> " + fileDialog.folder
+ }
+ Label {
+ text: "<b>name filters:</b> {" + fileDialog.nameFilters + "}"
+ }
+ Label {
+ text: "<b>current filter:</b>" + fileDialog.selectedNameFilter
+ }
+ Label {
+ text: "<b>chosen files:</b> " + fileDialog.fileUrls
+ }
+ Label {
+ text: "<b>chosen single path:</b> " + fileDialog.fileUrl
+ }
+ }
+ }
+
+ Rectangle {
+ id: bottomBar
+ anchors {
+ left: parent.left
+ right: parent.right
+ bottom: parent.bottom
+ }
+ height: buttonRow.height * 1.2
+ color: Qt.darker(palette.window, 1.1)
+ border.color: Qt.darker(palette.window, 1.3)
+ Row {
+ id: buttonRow
+ spacing: 6
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.leftMargin: 12
+ height: implicitHeight
+ width: parent.width
+ Button {
+ text: "Open"
+ anchors.verticalCenter: parent.verticalCenter
+ onClicked: fileDialog.open()
+ }
+ Button {
+ text: "Pictures"
+ tooltip: "go to my Pictures directory"
+ anchors.verticalCenter: parent.verticalCenter
+ enabled: fileDialog.shortcuts.hasOwnProperty("pictures")
+ onClicked: fileDialog.folder = fileDialog.shortcuts.pictures
+ }
+ Button {
+ text: "Home"
+ tooltip: "go to my home directory"
+ anchors.verticalCenter: parent.verticalCenter
+ enabled: fileDialog.shortcuts.hasOwnProperty("home")
+ onClicked: fileDialog.folder = fileDialog.shortcuts.home
+ }
+ }
+ }
+}
diff --git a/examples/quickcontrols/dialogs/systemdialogs/FontDialogs.qml b/examples/quickcontrols/dialogs/systemdialogs/FontDialogs.qml
new file mode 100644
index 000000000..60881dd92
--- /dev/null
+++ b/examples/quickcontrols/dialogs/systemdialogs/FontDialogs.qml
@@ -0,0 +1,153 @@
+/****************************************************************************
+**
+** 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.Dialogs 1.1
+
+Item {
+ width: 320
+ height: 360
+ SystemPalette { id: palette }
+ clip: true
+
+ FontDialog {
+ id: fontDialog
+ visible: fontDialogVisible.checked
+ modality: fontDialogModal.checked ? Qt.WindowModal : Qt.NonModal
+ scalableFonts: fontDialogScalableFonts.checked
+ nonScalableFonts: fontDialogNonScalableFonts.checked
+ monospacedFonts: fontDialogMonospacedFonts.checked
+ proportionalFonts: fontDialogProportionalFonts.checked
+ title: "Choose a font"
+ font: Qt.font({ family: "Arial", pointSize: 24, weight: Font.Normal })
+ currentFont: Qt.font({ family: "Arial", pointSize: 24, weight: Font.Normal })
+ onCurrentFontChanged: { console.log("CurrentFontChanged: " + currentFont) }
+ onAccepted: { console.log("Accepted: " + font) }
+ onRejected: { console.log("Rejected") }
+ }
+
+ Column {
+ id: optionsColumn
+ anchors.fill: parent
+ anchors.margins: 12
+ spacing: 8
+ Label {
+ font.bold: true
+ text: "Font dialog properties:"
+ }
+ CheckBox {
+ id: fontDialogModal
+ text: "Modal"
+ checked: true
+ Binding on checked { value: fontDialog.modality != Qt.NonModal }
+ }
+ CheckBox {
+ id: fontDialogScalableFonts
+ text: "Scalable fonts"
+ Binding on checked { value: fontDialog.scalableFonts }
+ }
+ CheckBox {
+ id: fontDialogNonScalableFonts
+ text: "Non scalable fonts"
+ Binding on checked { value: fontDialog.nonScalableFonts }
+ }
+ CheckBox {
+ id: fontDialogMonospacedFonts
+ text: "Monospaced fonts"
+ Binding on checked { value: fontDialog.monospacedFonts }
+ }
+ CheckBox {
+ id: fontDialogProportionalFonts
+ text: "Proportional fonts"
+ Binding on checked { value: fontDialog.proportionalFonts }
+ }
+ CheckBox {
+ id: fontDialogVisible
+ text: "Visible"
+ Binding on checked { value: fontDialog.visible }
+ }
+ Label {
+ text: "Current font:"
+ }
+ Label {
+ id: fontLabel
+ text: "<b>" + fontDialog.font.family + " - " + fontDialog.font.pointSize + "</b>"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: fontDialog.open()
+ }
+ }
+ }
+
+ Rectangle {
+ anchors {
+ left: parent.left
+ right: parent.right
+ bottom: parent.bottom
+ }
+ height: buttonRow.height * 1.2
+ color: Qt.darker(palette.window, 1.1)
+ border.color: Qt.darker(palette.window, 1.3)
+ Row {
+ id: buttonRow
+ spacing: 6
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.leftMargin: 12
+ width: parent.width
+ Button {
+ text: "Open"
+ anchors.verticalCenter: parent.verticalCenter
+ onClicked: fontDialog.open()
+ }
+ Button {
+ text: "Close"
+ anchors.verticalCenter: parent.verticalCenter
+ onClicked: fontDialog.close()
+ }
+ Button {
+ text: "set to default"
+ anchors.verticalCenter: parent.verticalCenter
+ onClicked: fontDialog.font = Qt.font({ family: "Arial", pointSize: 24, weight: Font.Normal })
+ }
+ }
+ }
+}
diff --git a/examples/quickcontrols/dialogs/systemdialogs/MessageDialogs.qml b/examples/quickcontrols/dialogs/systemdialogs/MessageDialogs.qml
new file mode 100644
index 000000000..2f9205b7a
--- /dev/null
+++ b/examples/quickcontrols/dialogs/systemdialogs/MessageDialogs.qml
@@ -0,0 +1,326 @@
+/****************************************************************************
+**
+** 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.Dialogs 1.1
+import QtQuick.Layouts 1.1
+import QtQuick.Window 2.0
+
+Item {
+ id: root
+ width: 580
+ height: 400
+ SystemPalette { id: palette }
+ clip: true
+
+ //! [messagedialog]
+ MessageDialog {
+ id: messageDialog
+ visible: messageDialogVisible.checked
+ modality: messageDialogModal.checked ? Qt.WindowModal : Qt.NonModal
+ title: windowTitleField.text
+ text: customizeText.checked ? textField.text : ""
+ informativeText: customizeInformativeText.checked ? informativeTextField.text : ""
+ detailedText: customizeDetailedText.checked ? detailedTextField.text : ""
+ onButtonClicked: console.log("clicked button " + clickedButton)
+ onAccepted: lastChosen.text = "Accepted " +
+ (clickedButton == StandardButton.Ok ? "(OK)" : (clickedButton == StandardButton.Retry ? "(Retry)" : "(Ignore)"))
+ onRejected: lastChosen.text = "Rejected " +
+ (clickedButton == StandardButton.Close ? "(Close)" : (clickedButton == StandardButton.Abort ? "(Abort)" : "(Cancel)"))
+ onHelp: lastChosen.text = "Yelped for help!"
+ onYes: lastChosen.text = (clickedButton == StandardButton.Yes ? "Yeessss!!" : "Yes, now and always")
+ onNo: lastChosen.text = (clickedButton == StandardButton.No ? "Oh No." : "No, no, a thousand times no!")
+ onApply: lastChosen.text = "Apply"
+ onReset: lastChosen.text = "Reset"
+ }
+ //! [messagedialog]
+
+ ScrollView {
+ id: scrollView
+ anchors {
+ left: parent.left
+ right: parent.right
+ top: parent.top
+ bottom: bottomBar.top
+ leftMargin: 12
+ }
+ ColumnLayout {
+ spacing: 8
+ Item { Layout.preferredHeight: 4 } // padding
+ Label {
+ font.bold: true
+ text: "Message dialog properties:"
+ }
+ CheckBox {
+ id: messageDialogModal
+ text: "Modal"
+ checked: true
+ Binding on checked { value: messageDialog.modality != Qt.NonModal }
+ }
+ RowLayout {
+ CheckBox {
+ id: customizeTitle
+ text: "Window Title"
+ Layout.alignment: Qt.AlignBaseline
+ checked: true
+ }
+ TextField {
+ id: windowTitleField
+ Layout.alignment: Qt.AlignBaseline
+ Layout.fillWidth: true
+ text: "Alert"
+ }
+ }
+ Label { text: "Icon:" }
+ Flow {
+ spacing: 8
+ Layout.fillWidth: true
+ property bool updating: false
+ function updateIcon(icon, checked) {
+ if (updating) return
+ updating = true
+ messageDialog.icon = (checked ? icon : StandardIcon.NoIcon)
+ for (var i = 0; i < children.length; ++i)
+ if (children[i].icon !== icon)
+ children[i].checked = false
+ updating = false
+ }
+
+ CheckBox {
+ id: iconInformation
+ text: "Information"
+ property int icon: StandardIcon.Information
+ onCheckedChanged: parent.updateIcon(icon, checked)
+ }
+
+ CheckBox {
+ id: iconWarning
+ text: "Warning"
+ checked: true
+ property int icon: StandardIcon.Warning
+ onCheckedChanged: parent.updateIcon(icon, checked)
+ Component.onCompleted: parent.updateIcon(icon, true)
+ }
+
+ CheckBox {
+ id: iconCritical
+ text: "Critical"
+ property int icon: StandardIcon.Critical
+ onCheckedChanged: parent.updateIcon(icon, checked)
+ }
+
+ CheckBox {
+ id: iconQuestion
+ text: "Question"
+ property int icon: StandardIcon.Question
+ onCheckedChanged: parent.updateIcon(icon, checked)
+ }
+ }
+
+ RowLayout {
+ CheckBox {
+ id: customizeText
+ text: "Primary Text"
+ Layout.alignment: Qt.AlignBaseline
+ checked: true
+ }
+ TextField {
+ id: textField
+ Layout.alignment: Qt.AlignBaseline
+ Layout.fillWidth: true
+ text: "Attention Please"
+ }
+ }
+ RowLayout {
+ CheckBox {
+ id: customizeInformativeText
+ text: "Informative Text"
+ Layout.alignment: Qt.AlignBaseline
+ checked: true
+ }
+ TextField {
+ id: informativeTextField
+ Layout.alignment: Qt.AlignBaseline
+ Layout.fillWidth: true
+ text: "Be alert!"
+ }
+ }
+ Label { text: "Buttons:" }
+ Flow {
+ spacing: 8
+ Layout.fillWidth: true
+ Layout.preferredWidth: root.width - 30
+ property bool updating: false
+ function updateButtons(button, checked) {
+ if (updating) return
+ updating = true
+ var buttons = 0
+ for (var i = 0; i < children.length; ++i)
+ if (children[i].checked)
+ buttons |= children[i].button
+ if (!buttons)
+ buttons = StandardButton.Ok
+ messageDialog.standardButtons = buttons
+ updating = false
+ }
+
+ CheckBox {
+ text: "Help"
+ property int button: StandardButton.Help
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+
+ CheckBox {
+ text: "Abort"
+ property int button: StandardButton.Abort
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+
+ CheckBox {
+ text: "Close"
+ property int button: StandardButton.Close
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+
+ CheckBox {
+ text: "Cancel"
+ property int button: StandardButton.Cancel
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+
+ CheckBox {
+ text: "NoToAll"
+ property int button: StandardButton.NoToAll
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+
+ CheckBox {
+ text: "No"
+ property int button: StandardButton.No
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+
+ CheckBox {
+ text: "YesToAll"
+ property int button: StandardButton.YesToAll
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+
+ CheckBox {
+ text: "Yes"
+ property int button: StandardButton.Yes
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+
+ CheckBox {
+ text: "Ignore"
+ property int button: StandardButton.Ignore
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+
+ CheckBox {
+ text: "Retry"
+ property int button: StandardButton.Retry
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+
+ CheckBox {
+ text: "OK"
+ checked: true
+ property int button: StandardButton.Ok
+ onCheckedChanged: parent.updateButtons(button, checked)
+ }
+ }
+ RowLayout {
+ CheckBox {
+ id: customizeDetailedText
+ text: "Detailed Text"
+ Layout.alignment: Qt.AlignBaseline
+ checked: true
+ }
+ TextField {
+ id: detailedTextField
+ Layout.alignment: Qt.AlignBaseline
+ Layout.fillWidth: true
+ text: "The world needs more lerts."
+ }
+ }
+ CheckBox {
+ id: messageDialogVisible
+ text: "Visible"
+ Binding on checked { value: messageDialog.visible }
+ }
+ Label {
+ id: lastChosen
+ }
+ }
+ }
+
+ Rectangle {
+ id: bottomBar
+ anchors {
+ left: parent.left
+ right: parent.right
+ bottom: parent.bottom
+ }
+ height: buttonRow.height * 1.2
+ color: Qt.darker(palette.window, 1.1)
+ border.color: Qt.darker(palette.window, 1.3)
+ Row {
+ id: buttonRow
+ spacing: 6
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.leftMargin: 12
+ width: parent.width
+ Button {
+ text: "Open"
+ anchors.verticalCenter: parent.verticalCenter
+ onClicked: messageDialog.open()
+ }
+ Button {
+ text: "Close"
+ anchors.verticalCenter: parent.verticalCenter
+ onClicked: messageDialog.close()
+ }
+ }
+ }
+}
diff --git a/examples/quickcontrols/dialogs/systemdialogs/doc/images/systemdialogs-example.jpg b/examples/quickcontrols/dialogs/systemdialogs/doc/images/systemdialogs-example.jpg
new file mode 100644
index 000000000..4517a3930
--- /dev/null
+++ b/examples/quickcontrols/dialogs/systemdialogs/doc/images/systemdialogs-example.jpg
Binary files differ
diff --git a/examples/quickcontrols/dialogs/systemdialogs/doc/src/systemdialogs.qdoc b/examples/quickcontrols/dialogs/systemdialogs/doc/src/systemdialogs.qdoc
new file mode 100644
index 000000000..b9f05de71
--- /dev/null
+++ b/examples/quickcontrols/dialogs/systemdialogs/doc/src/systemdialogs.qdoc
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \title Qt Quick System Dialog Examples
+ \example systemdialogs
+ \brief This example demonstrates the system dialog types in QML
+ \image systemdialogs-example.jpg
+ \ingroup qtquickdialog_examples
+
+ This example demonstrates the system dialogs in the \l{Qt Quick Dialogs}
+ module. The appearance and behavior is platform-dependent.
+
+ A \l FileDialog is used to choose a single file, multiple files or a
+ single directory, depending on how it is configured.
+ \snippet systemdialogs/FileDialogs.qml filedialog
+
+ A \l ColorDialog is used to choose a color, with or without alpha (transparency)
+ depending on how it is configured.
+ \snippet systemdialogs/ColorDialogs.qml colordialog
+
+ The example can be built as a standalone executable, but each
+ type of dialog is demonstrated in a separate QML file which can
+ also be run separately with qmlscene.
+*/
diff --git a/examples/quickcontrols/dialogs/systemdialogs/main.cpp b/examples/quickcontrols/dialogs/systemdialogs/main.cpp
new file mode 100644
index 000000000..5f65ce040
--- /dev/null
+++ b/examples/quickcontrols/dialogs/systemdialogs/main.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qtquickcontrolsapplication.h"
+#include <QtQml/QQmlApplicationEngine>
+#include <QtGui/QSurfaceFormat>
+#include <QtQuick/QQuickWindow>
+
+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:/dialogs/systemdialogs/systemdialogs.qml"));
+ if (engine.rootObjects().isEmpty())
+ return -1;
+ return app.exec();
+}
diff --git a/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.pro b/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.pro
new file mode 100644
index 000000000..099e3773f
--- /dev/null
+++ b/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.pro
@@ -0,0 +1,19 @@
+QT += qml quick
+!no_desktop: QT += widgets
+
+QT += quick qml
+SOURCES += main.cpp
+include(../../controls/shared/shared.pri)
+
+OTHER_FILES += \
+ systemdialogs.qml \
+ FileDialogs.qml \
+ ColorDialogs.qml \
+ FontDialogs.qml \
+ MessageDialogs.qml \
+ CustomDialogs.qml
+
+target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/dialogs/systemdialogs
+INSTALLS += target
+
+RESOURCES += systemdialogs.qrc
diff --git a/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.qml b/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.qml
new file mode 100644
index 000000000..f1b215c74
--- /dev/null
+++ b/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** 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
+
+ApplicationWindow {
+ visible: true
+ title: "System Dialogs Gallery"
+ width: 580
+ height: 480
+
+ TabView {
+ anchors.fill: parent
+ anchors.margins: 8
+ Tab {
+ id: controlPage
+ title: "File"
+ FileDialogs { }
+ }
+ Tab {
+ title: "Color"
+ ColorDialogs { }
+ }
+ Tab {
+ title: "Font"
+ FontDialogs { anchors.fill: parent }
+ }
+ Tab {
+ title: "Message"
+ MessageDialogs { anchors.fill:parent }
+ }
+ Tab {
+ title: "Custom"
+ CustomDialogs { anchors.fill:parent }
+ }
+ }
+}
diff --git a/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.qrc b/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.qrc
new file mode 100644
index 000000000..afd81bfee
--- /dev/null
+++ b/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.qrc
@@ -0,0 +1,10 @@
+<RCC>
+ <qresource prefix="/dialogs/systemdialogs">
+ <file>systemdialogs.qml</file>
+ <file>FileDialogs.qml</file>
+ <file>ColorDialogs.qml</file>
+ <file>FontDialogs.qml</file>
+ <file>MessageDialogs.qml</file>
+ <file>CustomDialogs.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/quickcontrols/extras/dashboard/dashboard.pro b/examples/quickcontrols/extras/dashboard/dashboard.pro
new file mode 100644
index 000000000..eb3ee51be
--- /dev/null
+++ b/examples/quickcontrols/extras/dashboard/dashboard.pro
@@ -0,0 +1,21 @@
+TEMPLATE = app
+TARGET = dashboard
+INCLUDEPATH += .
+QT += quick
+
+SOURCES += \
+ main.cpp
+
+RESOURCES += \
+ dashboard.qrc
+
+OTHER_FILES += \
+ qml/dashboard.qml \
+ qml/DashboardGaugeStyle.qml \
+ qml/IconGaugeStyle.qml \
+ qml/TachometerStyle.qml \
+ qml/TurnIndicator.qml \
+ qml/ValueSource.qml
+
+target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/extras/dashboard
+INSTALLS += target
diff --git a/examples/quickcontrols/extras/dashboard/dashboard.qrc b/examples/quickcontrols/extras/dashboard/dashboard.qrc
new file mode 100644
index 000000000..605e1678b
--- /dev/null
+++ b/examples/quickcontrols/extras/dashboard/dashboard.qrc
@@ -0,0 +1,13 @@
+<RCC>
+ <qresource prefix="/">
+ <file>fonts/DejaVuSans.ttf</file>
+ <file>images/fuel-icon.png</file>
+ <file>images/temperature-icon.png</file>
+ <file>qml/dashboard.qml</file>
+ <file>qml/DashboardGaugeStyle.qml</file>
+ <file>qml/IconGaugeStyle.qml</file>
+ <file>qml/TachometerStyle.qml</file>
+ <file>qml/TurnIndicator.qml</file>
+ <file>qml/ValueSource.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/quickcontrols/extras/dashboard/fonts/DejaVuSans.ttf b/examples/quickcontrols/extras/dashboard/fonts/DejaVuSans.ttf
new file mode 100644
index 000000000..19ed0b468
--- /dev/null
+++ b/examples/quickcontrols/extras/dashboard/fonts/DejaVuSans.ttf
Binary files differ
diff --git a/examples/quickcontrols/extras/dashboard/fonts/LICENSE b/examples/quickcontrols/extras/dashboard/fonts/LICENSE
new file mode 100644
index 000000000..254e2cc42
--- /dev/null
+++ b/examples/quickcontrols/extras/dashboard/fonts/LICENSE
@@ -0,0 +1,99 @@
+Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
+Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)
+
+Bitstream Vera Fonts Copyright
+------------------------------
+
+Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
+a trademark of Bitstream, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of the fonts accompanying this license ("Fonts") and associated
+documentation files (the "Font Software"), to reproduce and distribute the
+Font Software, including without limitation the rights to use, copy, merge,
+publish, distribute, and/or sell copies of the Font Software, and to permit
+persons to whom the Font Software is furnished to do so, subject to the
+following conditions:
+
+The above copyright and trademark notices and this permission notice shall
+be included in all copies of one or more of the Font Software typefaces.
+
+The Font Software may be modified, altered, or added to, and in particular
+the designs of glyphs or characters in the Fonts may be modified and
+additional glyphs or characters may be added to the Fonts, only if the fonts
+are renamed to names not containing either the words "Bitstream" or the word
+"Vera".
+
+This License becomes null and void to the extent applicable to Fonts or Font
+Software that has been modified and is distributed under the "Bitstream
+Vera" names.
+
+The Font Software may be sold as part of a larger software package but no
+copy of one or more of the Font Software typefaces may be sold by itself.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
+TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
+FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
+ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
+FONT SOFTWARE.
+
+Except as contained in this notice, the names of Gnome, the Gnome
+Foundation, and Bitstream Inc., shall not be used in advertising or
+otherwise to promote the sale, use or other dealings in this Font Software
+without prior written authorization from the Gnome Foundation or Bitstream
+Inc., respectively. For further information, contact: fonts at gnome dot
+org.
+
+Arev Fonts Copyright
+------------------------------
+
+Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the fonts accompanying this license ("Fonts") and
+associated documentation files (the "Font Software"), to reproduce
+and distribute the modifications to the Bitstream Vera Font Software,
+including without limitation the rights to use, copy, merge, publish,
+distribute, and/or sell copies of the Font Software, and to permit
+persons to whom the Font Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright and trademark notices and this permission notice
+shall be included in all copies of one or more of the Font Software
+typefaces.
+
+The Font Software may be modified, altered, or added to, and in
+particular the designs of glyphs or characters in the Fonts may be
+modified and additional glyphs or characters may be added to the
+Fonts, only if the fonts are renamed to names not containing either
+the words "Tavmjong Bah" or the word "Arev".
+
+This License becomes null and void to the extent applicable to Fonts
+or Font Software that has been modified and is distributed under the
+"Tavmjong Bah Arev" names.
+
+The Font Software may be sold as part of a larger software package but
+no copy of one or more of the Font Software typefaces may be sold by
+itself.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
+TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
+
+Except as contained in this notice, the name of Tavmjong Bah shall not
+be used in advertising or otherwise to promote the sale, use or other
+dealings in this Font Software without prior written authorization
+from Tavmjong Bah. For further information, contact: tavmjong @ free
+. fr.
+
+$Id: LICENSE 2133 2007-11-28 02:46:28Z lechimp $
diff --git a/examples/quickcontrols/extras/dashboard/images/fuel-icon.png b/examples/quickcontrols/extras/dashboard/images/fuel-icon.png
new file mode 100644
index 000000000..70da758c2
--- /dev/null
+++ b/examples/quickcontrols/extras/dashboard/images/fuel-icon.png
Binary files differ
diff --git a/examples/quickcontrols/extras/dashboard/images/temperature-icon.png b/examples/quickcontrols/extras/dashboard/images/temperature-icon.png
new file mode 100644
index 000000000..5a4334e01
--- /dev/null
+++ b/examples/quickcontrols/extras/dashboard/images/temperature-icon.png
Binary files differ
diff --git a/examples/quickcontrols/extras/dashboard/main.cpp b/examples/quickcontrols/extras/dashboard/main.cpp
new file mode 100644
index 000000000..74ea07720
--- /dev/null
+++ b/examples/quickcontrols/extras/dashboard/main.cpp
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** 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 <QtGui/QGuiApplication>
+#include <QtQml/QQmlApplicationEngine>
+#include <QtGui/QFont>
+#include <QtGui/QFontDatabase>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QFontDatabase::addApplicationFont(":/fonts/DejaVuSans.ttf");
+ app.setFont(QFont("DejaVu Sans"));
+
+ QQmlApplicationEngine engine(QUrl("qrc:/qml/dashboard.qml"));
+ if (engine.rootObjects().isEmpty())
+ return -1;
+ return app.exec();
+}
diff --git a/examples/quickcontrols/extras/dashboard/qml/DashboardGaugeStyle.qml b/examples/quickcontrols/extras/dashboard/qml/DashboardGaugeStyle.qml
new file mode 100644
index 000000000..598fce563
--- /dev/null
+++ b/examples/quickcontrols/extras/dashboard/qml/DashboardGaugeStyle.qml
@@ -0,0 +1,164 @@
+/****************************************************************************
+**
+** 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.Styles 1.4
+
+CircularGaugeStyle {
+ tickmarkInset: toPixels(0.04)
+ minorTickmarkInset: tickmarkInset
+ labelStepSize: 20
+ labelInset: toPixels(0.23)
+
+ property real xCenter: outerRadius
+ property real yCenter: outerRadius
+ property real needleLength: outerRadius - tickmarkInset * 1.25
+ property real needleTipWidth: toPixels(0.02)
+ property real needleBaseWidth: toPixels(0.06)
+ property bool halfGauge: false
+
+ function toPixels(percentage) {
+ return percentage * outerRadius;
+ }
+
+ function degToRad(degrees) {
+ return degrees * (Math.PI / 180);
+ }
+
+ function radToDeg(radians) {
+ return radians * (180 / Math.PI);
+ }
+
+ function paintBackground(ctx) {
+ if (halfGauge) {
+ ctx.beginPath();
+ ctx.rect(0, 0, ctx.canvas.width, ctx.canvas.height / 2);
+ ctx.clip();
+ }
+
+ ctx.beginPath();
+ ctx.fillStyle = "black";
+ ctx.ellipse(0, 0, ctx.canvas.width, ctx.canvas.height);
+ ctx.fill();
+
+ ctx.beginPath();
+ ctx.lineWidth = tickmarkInset;
+ ctx.strokeStyle = "black";
+ ctx.arc(xCenter, yCenter, outerRadius - ctx.lineWidth / 2, outerRadius - ctx.lineWidth / 2, 0, Math.PI * 2);
+ ctx.stroke();
+
+ ctx.beginPath();
+ ctx.lineWidth = tickmarkInset / 2;
+ ctx.strokeStyle = "#222";
+ ctx.arc(xCenter, yCenter, outerRadius - ctx.lineWidth / 2, outerRadius - ctx.lineWidth / 2, 0, Math.PI * 2);
+ ctx.stroke();
+
+ ctx.beginPath();
+ var gradient = ctx.createRadialGradient(xCenter, yCenter, outerRadius * 0.8, xCenter, yCenter, outerRadius);
+ gradient.addColorStop(0, Qt.rgba(1, 1, 1, 0));
+ gradient.addColorStop(0.7, Qt.rgba(1, 1, 1, 0.13));
+ gradient.addColorStop(1, Qt.rgba(1, 1, 1, 1));
+ ctx.fillStyle = gradient;
+ ctx.arc(xCenter, yCenter, outerRadius - tickmarkInset, outerRadius - tickmarkInset, 0, Math.PI * 2);
+ ctx.fill();
+ }
+
+ background: Canvas {
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+ paintBackground(ctx);
+ }
+
+ Text {
+ id: speedText
+ font.pixelSize: toPixels(0.3)
+ text: kphInt
+ color: "white"
+ horizontalAlignment: Text.AlignRight
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: parent.verticalCenter
+ anchors.topMargin: toPixels(0.1)
+
+ readonly property int kphInt: control.value
+ }
+ Text {
+ text: "km/h"
+ color: "white"
+ font.pixelSize: toPixels(0.09)
+ anchors.top: speedText.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+
+ needle: Canvas {
+ implicitWidth: needleBaseWidth
+ implicitHeight: needleLength
+
+ property real xCenter: width / 2
+ property real yCenter: height / 2
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ ctx.beginPath();
+ ctx.moveTo(xCenter, height);
+ ctx.lineTo(xCenter - needleBaseWidth / 2, height - needleBaseWidth / 2);
+ ctx.lineTo(xCenter - needleTipWidth / 2, 0);
+ ctx.lineTo(xCenter, yCenter - needleLength);
+ ctx.lineTo(xCenter, 0);
+ ctx.closePath();
+ ctx.fillStyle = Qt.rgba(0.66, 0, 0, 0.66);
+ ctx.fill();
+
+ ctx.beginPath();
+ ctx.moveTo(xCenter, height)
+ ctx.lineTo(width, height - needleBaseWidth / 2);
+ ctx.lineTo(xCenter + needleTipWidth / 2, 0);
+ ctx.lineTo(xCenter, 0);
+ ctx.closePath();
+ ctx.fillStyle = Qt.lighter(Qt.rgba(0.66, 0, 0, 0.66));
+ ctx.fill();
+ }
+ }
+
+ foreground: null
+}
diff --git a/examples/quickcontrols/extras/dashboard/qml/IconGaugeStyle.qml b/examples/quickcontrols/extras/dashboard/qml/IconGaugeStyle.qml
new file mode 100644
index 000000000..0c3d93204
--- /dev/null
+++ b/examples/quickcontrols/extras/dashboard/qml/IconGaugeStyle.qml
@@ -0,0 +1,124 @@
+/****************************************************************************
+**
+** 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.Styles 1.4
+import QtQuick.Extras 1.4
+
+DashboardGaugeStyle {
+ id: fuelGaugeStyle
+ minimumValueAngle: -60
+ maximumValueAngle: 60
+ tickmarkStepSize: 1
+ labelStepSize: 1
+ labelInset: toPixels(-0.25)
+ minorTickmarkCount: 3
+
+ needleLength: toPixels(0.85)
+ needleBaseWidth: toPixels(0.08)
+ needleTipWidth: toPixels(0.03)
+
+ halfGauge: true
+
+ property string icon: ""
+ property color minWarningColor: "transparent"
+ property color maxWarningColor: "transparent"
+ readonly property real minWarningStartAngle: minimumValueAngle - 90
+ readonly property real maxWarningStartAngle: maximumValueAngle - 90
+
+ tickmark: Rectangle {
+ implicitWidth: toPixels(0.06)
+ antialiasing: true
+ implicitHeight: toPixels(0.2)
+ color: "#c8c8c8"
+ }
+
+ minorTickmark: Rectangle {
+ implicitWidth: toPixels(0.03)
+ antialiasing: true
+ implicitHeight: toPixels(0.15)
+ color: "#c8c8c8"
+ }
+
+ background: Item {
+ Canvas {
+ anchors.fill: parent
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ paintBackground(ctx);
+
+ if (minWarningColor != "transparent") {
+ ctx.beginPath();
+ ctx.lineWidth = fuelGaugeStyle.toPixels(0.08);
+ ctx.strokeStyle = minWarningColor;
+ ctx.arc(outerRadius, outerRadius,
+ // Start the line in from the decorations, and account for the width of the line itself.
+ outerRadius - tickmarkInset - ctx.lineWidth / 2,
+ degToRad(minWarningStartAngle),
+ degToRad(minWarningStartAngle + angleRange / (minorTickmarkCount + 1)), false);
+ ctx.stroke();
+ }
+ if (maxWarningColor != "transparent") {
+ ctx.beginPath();
+ ctx.lineWidth = fuelGaugeStyle.toPixels(0.08);
+ ctx.strokeStyle = maxWarningColor;
+ ctx.arc(outerRadius, outerRadius,
+ // Start the line in from the decorations, and account for the width of the line itself.
+ outerRadius - tickmarkInset - ctx.lineWidth / 2,
+ degToRad(maxWarningStartAngle - angleRange / (minorTickmarkCount + 1)),
+ degToRad(maxWarningStartAngle), false);
+ ctx.stroke();
+ }
+ }
+ }
+
+ Image {
+ source: icon
+ anchors.bottom: parent.verticalCenter
+ anchors.bottomMargin: toPixels(0.3)
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: toPixels(0.3)
+ height: width
+ fillMode: Image.PreserveAspectFit
+ }
+ }
+}
diff --git a/examples/quickcontrols/extras/dashboard/qml/TachometerStyle.qml b/examples/quickcontrols/extras/dashboard/qml/TachometerStyle.qml
new file mode 100644
index 000000000..a0f7b6b9a
--- /dev/null
+++ b/examples/quickcontrols/extras/dashboard/qml/TachometerStyle.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.Controls.Styles 1.4
+import QtQuick.Extras 1.4
+
+DashboardGaugeStyle {
+ id: tachometerStyle
+ tickmarkStepSize: 1
+ labelStepSize: 1
+ needleLength: toPixels(0.85)
+ needleBaseWidth: toPixels(0.08)
+ needleTipWidth: toPixels(0.03)
+
+ tickmark: Rectangle {
+ implicitWidth: toPixels(0.03)
+ antialiasing: true
+ implicitHeight: toPixels(0.08)
+ color: styleData.index === 7 || styleData.index === 8 ? Qt.rgba(0.5, 0, 0, 1) : "#c8c8c8"
+ }
+
+ minorTickmark: null
+
+ tickmarkLabel: Text {
+ font.pixelSize: Math.max(6, toPixels(0.12))
+ text: styleData.value
+ color: styleData.index === 7 || styleData.index === 8 ? Qt.rgba(0.5, 0, 0, 1) : "#c8c8c8"
+ antialiasing: true
+ }
+
+ background: Canvas {
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+ paintBackground(ctx);
+
+ ctx.beginPath();
+ ctx.lineWidth = tachometerStyle.toPixels(0.08);
+ ctx.strokeStyle = Qt.rgba(0.5, 0, 0, 1);
+ var warningCircumference = maximumValueAngle - minimumValueAngle * 0.1;
+ var startAngle = maximumValueAngle - 90;
+ ctx.arc(outerRadius, outerRadius,
+ // Start the line in from the decorations, and account for the width of the line itself.
+ outerRadius - tickmarkInset - ctx.lineWidth / 2,
+ degToRad(startAngle - angleRange / 8 + angleRange * 0.015),
+ degToRad(startAngle - angleRange * 0.015), false);
+ ctx.stroke();
+ }
+
+ Text {
+ id: rpmText
+ font.pixelSize: tachometerStyle.toPixels(0.3)
+ text: rpmInt
+ color: "white"
+ horizontalAlignment: Text.AlignRight
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: parent.verticalCenter
+ anchors.topMargin: 20
+
+ readonly property int rpmInt: valueSource.rpm
+ }
+ Text {
+ text: "x1000"
+ color: "white"
+ font.pixelSize: tachometerStyle.toPixels(0.1)
+ anchors.top: parent.top
+ anchors.topMargin: parent.height / 4
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ Text {
+ text: "RPM"
+ color: "white"
+ font.pixelSize: tachometerStyle.toPixels(0.1)
+ anchors.top: rpmText.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+}
diff --git a/examples/quickcontrols/extras/dashboard/qml/TurnIndicator.qml b/examples/quickcontrols/extras/dashboard/qml/TurnIndicator.qml
new file mode 100644
index 000000000..cf9c41db3
--- /dev/null
+++ b/examples/quickcontrols/extras/dashboard/qml/TurnIndicator.qml
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** 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 {
+ // This enum is actually keyboard-related, but it serves its purpose
+ // as an indication of direction for us.
+ property int direction: Qt.LeftArrow
+ property bool on: false
+
+ property bool flashing: false
+
+ scale: direction === Qt.LeftArrow ? 1 : -1
+
+ Timer {
+ id: flashTimer
+ interval: 500
+ running: on
+ repeat: true
+ onTriggered: flashing = !flashing
+ }
+
+ function paintOutlinePath(ctx) {
+ ctx.beginPath();
+ ctx.moveTo(0, height * 0.5);
+ ctx.lineTo(0.6 * width, 0);
+ ctx.lineTo(0.6 * width, height * 0.28);
+ ctx.lineTo(width, height * 0.28);
+ ctx.lineTo(width, height * 0.72);
+ ctx.lineTo(0.6 * width, height * 0.72);
+ ctx.lineTo(0.6 * width, height);
+ ctx.lineTo(0, height * 0.5);
+ }
+
+ Canvas {
+ id: backgroundCanvas
+ anchors.fill: parent
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ paintOutlinePath(ctx);
+
+ ctx.lineWidth = 1;
+ ctx.strokeStyle = "black";
+ ctx.stroke();
+ }
+ }
+
+ Canvas {
+ id: foregroundCanvas
+ anchors.fill: parent
+ visible: on && flashing
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ paintOutlinePath(ctx);
+
+ ctx.fillStyle = "green";
+ ctx.fill();
+ }
+ }
+}
diff --git a/examples/quickcontrols/extras/dashboard/qml/ValueSource.qml b/examples/quickcontrols/extras/dashboard/qml/ValueSource.qml
new file mode 100644
index 000000000..39d35966a
--- /dev/null
+++ b/examples/quickcontrols/extras/dashboard/qml/ValueSource.qml
@@ -0,0 +1,320 @@
+/****************************************************************************
+**
+** 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: valueSource
+ property real kph: 0
+ property real rpm: 1
+ property real fuel: 0.85
+ property string gear: {
+ var g;
+ if (kph == 0) {
+ return "P";
+ }
+ if (kph < 30) {
+ return "1";
+ }
+ if (kph < 50) {
+ return "2";
+ }
+ if (kph < 80) {
+ return "3";
+ }
+ if (kph < 120) {
+ return "4";
+ }
+ if (kph < 160) {
+ return "5";
+ }
+ }
+ property int turnSignal: gear == "P" && !start ? randomDirection() : -1
+ property real temperature: 0.6
+ property bool start: true
+
+ function randomDirection() {
+ return Math.random() > 0.5 ? Qt.LeftArrow : Qt.RightArrow;
+ }
+
+ SequentialAnimation {
+ running: true
+ loops: 1
+
+ // We want a small pause at the beginning, but we only want it to happen once.
+ PauseAnimation {
+ duration: 1000
+ }
+
+ PropertyAction {
+ target: valueSource
+ property: "start"
+ value: false
+ }
+
+ SequentialAnimation {
+ loops: Animation.Infinite
+
+ ParallelAnimation {
+ NumberAnimation {
+ target: valueSource
+ property: "kph"
+ easing.type: Easing.InOutSine
+ from: 0
+ to: 30
+ duration: 3000
+ }
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ from: 1
+ to: 6.1
+ duration: 3000
+ }
+ }
+ ParallelAnimation {
+ // We changed gears so we lost a bit of speed.
+ NumberAnimation {
+ target: valueSource
+ property: "kph"
+ easing.type: Easing.InOutSine
+ from: 30
+ to: 26
+ duration: 600
+ }
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ from: 6
+ to: 2.4
+ duration: 600
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation {
+ target: valueSource
+ property: "kph"
+ easing.type: Easing.InOutSine
+ to: 60
+ duration: 3000
+ }
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ to: 5.6
+ duration: 3000
+ }
+ }
+ ParallelAnimation {
+ // We changed gears so we lost a bit of speed.
+ NumberAnimation {
+ target: valueSource
+ property: "kph"
+ easing.type: Easing.InOutSine
+ to: 56
+ duration: 600
+ }
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ to: 2.3
+ duration: 600
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation {
+ target: valueSource
+ property: "kph"
+ easing.type: Easing.InOutSine
+ to: 100
+ duration: 3000
+ }
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ to: 5.1
+ duration: 3000
+ }
+ }
+ ParallelAnimation {
+ // We changed gears so we lost a bit of speed.
+ NumberAnimation {
+ target: valueSource
+ property: "kph"
+ easing.type: Easing.InOutSine
+ to: 96
+ duration: 600
+ }
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ to: 2.2
+ duration: 600
+ }
+ }
+
+ ParallelAnimation {
+ NumberAnimation {
+ target: valueSource
+ property: "kph"
+ easing.type: Easing.InOutSine
+ to: 140
+ duration: 3000
+ }
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ to: 6.2
+ duration: 3000
+ }
+ }
+
+ // Start downshifting.
+
+ // Fifth to fourth gear.
+ ParallelAnimation {
+ NumberAnimation {
+ target: valueSource
+ property: "kph"
+ easing.type: Easing.Linear
+ to: 100
+ duration: 5000
+ }
+
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ to: 3.1
+ duration: 5000
+ }
+ }
+
+ // Fourth to third gear.
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ to: 5.5
+ duration: 600
+ }
+
+ ParallelAnimation {
+ NumberAnimation {
+ target: valueSource
+ property: "kph"
+ easing.type: Easing.InOutSine
+ to: 60
+ duration: 5000
+ }
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ to: 2.6
+ duration: 5000
+ }
+ }
+
+ // Third to second gear.
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ to: 6.3
+ duration: 600
+ }
+
+ ParallelAnimation {
+ NumberAnimation {
+ target: valueSource
+ property: "kph"
+ easing.type: Easing.InOutSine
+ to: 30
+ duration: 5000
+ }
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ to: 2.6
+ duration: 5000
+ }
+ }
+
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ to: 6.5
+ duration: 600
+ }
+
+ // Second to first gear.
+ ParallelAnimation {
+ NumberAnimation {
+ target: valueSource
+ property: "kph"
+ easing.type: Easing.InOutSine
+ to: 0
+ duration: 5000
+ }
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ to: 1
+ duration: 4500
+ }
+ }
+
+ PauseAnimation {
+ duration: 5000
+ }
+ }
+ }
+}
diff --git a/examples/quickcontrols/extras/dashboard/qml/dashboard.qml b/examples/quickcontrols/extras/dashboard/qml/dashboard.qml
new file mode 100644
index 000000000..756d96a50
--- /dev/null
+++ b/examples/quickcontrols/extras/dashboard/qml/dashboard.qml
@@ -0,0 +1,174 @@
+/****************************************************************************
+**
+** 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.1
+import QtQuick.Controls 1.4
+import QtQuick.Controls.Styles 1.4
+import QtQuick.Extras 1.4
+
+Window {
+ id: root
+ visible: true
+ width: 1024
+ height: 600
+
+ color: "#161616"
+ title: "Qt Quick Extras Demo"
+
+ ValueSource {
+ id: valueSource
+ }
+
+ // Dashboards are typically in a landscape orientation, so we need to ensure
+ // our height is never greater than our width.
+ Item {
+ id: container
+ width: root.width
+ height: Math.min(root.width, root.height)
+ anchors.centerIn: parent
+
+ Row {
+ id: gaugeRow
+ spacing: container.width * 0.02
+ anchors.centerIn: parent
+
+ TurnIndicator {
+ id: leftIndicator
+ anchors.verticalCenter: parent.verticalCenter
+ width: height
+ height: container.height * 0.1 - gaugeRow.spacing
+
+ direction: Qt.LeftArrow
+ on: valueSource.turnSignal == Qt.LeftArrow
+ }
+
+ Item {
+ width: height
+ height: container.height * 0.25 - gaugeRow.spacing
+ anchors.verticalCenter: parent.verticalCenter
+
+ CircularGauge {
+ id: fuelGauge
+ value: valueSource.fuel
+ maximumValue: 1
+ y: parent.height / 2 - height / 2 - container.height * 0.01
+ width: parent.width
+ height: parent.height * 0.7
+
+ style: IconGaugeStyle {
+ id: fuelGaugeStyle
+
+ icon: "qrc:/images/fuel-icon.png"
+ minWarningColor: Qt.rgba(0.5, 0, 0, 1)
+
+ tickmarkLabel: Text {
+ color: "white"
+ visible: styleData.value === 0 || styleData.value === 1
+ font.pixelSize: fuelGaugeStyle.toPixels(0.225)
+ text: styleData.value === 0 ? "E" : (styleData.value === 1 ? "F" : "")
+ }
+ }
+ }
+
+ CircularGauge {
+ value: valueSource.temperature
+ maximumValue: 1
+ width: parent.width
+ height: parent.height * 0.7
+ y: parent.height / 2 + container.height * 0.01
+
+ style: IconGaugeStyle {
+ id: tempGaugeStyle
+
+ icon: "qrc:/images/temperature-icon.png"
+ maxWarningColor: Qt.rgba(0.5, 0, 0, 1)
+
+ tickmarkLabel: Text {
+ color: "white"
+ visible: styleData.value === 0 || styleData.value === 1
+ font.pixelSize: tempGaugeStyle.toPixels(0.225)
+ text: styleData.value === 0 ? "C" : (styleData.value === 1 ? "H" : "")
+ }
+ }
+ }
+ }
+
+ CircularGauge {
+ id: speedometer
+ value: valueSource.kph
+ anchors.verticalCenter: parent.verticalCenter
+ maximumValue: 280
+ // We set the width to the height, because the height will always be
+ // the more limited factor. Also, all circular controls letterbox
+ // their contents to ensure that they remain circular. However, we
+ // don't want to extra space on the left and right of our gauges,
+ // because they're laid out horizontally, and that would create
+ // large horizontal gaps between gauges on wide screens.
+ width: height
+ height: container.height * 0.5
+
+ style: DashboardGaugeStyle {}
+ }
+
+ CircularGauge {
+ id: tachometer
+ width: height
+ height: container.height * 0.25 - gaugeRow.spacing
+ value: valueSource.rpm
+ maximumValue: 8
+ anchors.verticalCenter: parent.verticalCenter
+
+ style: TachometerStyle {}
+ }
+
+ TurnIndicator {
+ id: rightIndicator
+ anchors.verticalCenter: parent.verticalCenter
+ width: height
+ height: container.height * 0.1 - gaugeRow.spacing
+
+ direction: Qt.RightArrow
+ on: valueSource.turnSignal == Qt.RightArrow
+ }
+
+ }
+ }
+}
diff --git a/examples/quickcontrols/extras/extras.pro b/examples/quickcontrols/extras/extras.pro
new file mode 100644
index 000000000..7f7b72156
--- /dev/null
+++ b/examples/quickcontrols/extras/extras.pro
@@ -0,0 +1,5 @@
+TEMPLATE = subdirs
+SUBDIRS += \
+ gallery \
+ dashboard \
+ flat
diff --git a/examples/quickcontrols/extras/flat/Content.qml b/examples/quickcontrols/extras/flat/Content.qml
new file mode 100644
index 000000000..2969f7305
--- /dev/null
+++ b/examples/quickcontrols/extras/flat/Content.qml
@@ -0,0 +1,706 @@
+/****************************************************************************
+**
+** 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.4
+import QtQuick.Layouts 1.1
+import QtQuick.Controls 1.4
+import QtQuick.Controls.Styles.Flat 1.0 as Flat
+import QtQuick.Extras 1.4
+import QtQuick.XmlListModel 2.0
+
+Item {
+ anchors.fill: parent
+
+ Text {
+ id: text
+ visible: false
+ }
+
+ FontMetrics {
+ id: fontMetrics
+ font.family: Flat.FlatStyle.fontFamily
+ }
+
+ readonly property int layoutSpacing: Math.round(5 * Flat.FlatStyle.scaleFactor)
+
+ property var componentModel: [
+ { name: "Buttons", component: buttonsComponent },
+ { name: "Calendar", component: calendarComponent },
+ { name: "DelayButton", component: delayButtonComponent },
+ { name: "Dial", component: dialComponent },
+ { name: "Input", component: inputComponent },
+ { name: "PieMenu", component: pieMenuComponent },
+ { name: "Progress", component: progressComponent },
+ { name: "TableView", component: tableViewComponent },
+ { name: "TextArea", component: textAreaComponent },
+ { name: "Tumbler", component: tumblerComponent }
+ ]
+
+ Loader {
+ id: componentLoader
+ anchors.fill: parent
+ sourceComponent: componentModel[controlData.componentIndex].component
+ }
+
+ property Component buttonsComponent: ScrollView {
+ id: scrollView
+ horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
+
+ Flickable {
+ anchors.fill: parent
+ contentWidth: viewport.width
+ contentHeight: buttoncolumn.implicitHeight + textMargins * 1.5
+ ColumnLayout {
+ id: buttoncolumn
+ anchors.fill: parent
+ anchors.margins: textMargins
+ anchors.topMargin: textMargins / 2
+ spacing: textMargins / 2
+ enabled: !settingsData.allDisabled
+
+ GroupBox {
+ title: "Button"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ GridLayout {
+ columns: Math.max(1, Math.floor(scrollView.width / button.implicitWidth - 0.5))
+ Button {
+ id: button
+ text: "Normal"
+ }
+ Button {
+ text: "Default"
+ isDefault: true
+ }
+ Button {
+ text: "Checkable"
+ checkable: true
+ }
+ Button {
+ text: "Menu"
+ menu: Menu {
+ MenuItem { text: "Normal"; shortcut: "Ctrl+N" }
+ MenuSeparator { }
+ MenuItem { text: "Checkable 1"; checkable: true; checked: true }
+ MenuItem { text: "Checkable 2"; checkable: true; checked: true }
+ MenuSeparator { }
+ }
+ visible: Qt.application.supportsMultipleWindows
+ }
+ }
+ }
+
+ GroupBox {
+ title: "RadioButton"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ ExclusiveGroup { id: radiobuttongroup }
+ ColumnLayout {
+ anchors.fill: parent
+ Repeater {
+ model: ["First", "Second", "Third"]
+ RadioButton {
+ text: modelData
+ checked: index === 0
+ exclusiveGroup: radiobuttongroup
+ Layout.fillWidth: true
+ }
+ }
+ }
+ }
+
+ GroupBox {
+ title: "CheckBox"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ ColumnLayout {
+ anchors.fill: parent
+ Repeater {
+ model: ["First", "Second", "Third"]
+ CheckBox {
+ text: modelData
+ checked: index === 0
+ Layout.fillWidth: true
+ }
+ }
+ }
+ }
+
+ GroupBox {
+ title: "Switch"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ ColumnLayout {
+ anchors.fill: parent
+ Repeater {
+ model: ["First", "Second", "Third"]
+ RowLayout {
+ spacing: layoutSpacing * 2
+ Label {
+ text: modelData
+ font.family: Flat.FlatStyle.fontFamily
+ renderType: Text.QtRendering
+ Layout.preferredWidth: fontMetrics.advanceWidth("Second")
+ }
+ Switch { checked: index == 0 }
+ }
+ }
+ }
+ }
+
+ GroupBox {
+ title: "ToggleButton"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ GridLayout {
+ columns: Math.max(1, !!children[0] ? Math.floor(scrollView.width / children[0].implicitWidth - 0.5) : children.length)
+ ToggleButton {
+ text: "Pump 1"
+ checked: true
+ }
+ ToggleButton {
+ text: "Pump 2"
+ checked: false
+ }
+ }
+ }
+
+ GroupBox {
+ title: "StatusIndicator"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ GridLayout {
+ columns: Math.max(1, Math.floor(scrollView.width / recordButton.implicitWidth - 0.5))
+ columnSpacing: layoutSpacing * 4
+
+ Button {
+ id: recordButton
+ text: "Record"
+ Layout.alignment: Qt.AlignTop
+ onClicked: recordStatusIndicator.active = !recordStatusIndicator.active
+
+ StatusIndicator {
+ id: recordStatusIndicator
+ active: false
+ anchors.left: parent.left
+ anchors.leftMargin: Math.max(6, Math.round(text.implicitHeight * 0.4))
+ anchors.verticalCenter: parent.verticalCenter
+ rotation: 90
+ }
+ }
+ ColumnLayout {
+ Repeater {
+ model: 3
+ delegate: RowLayout {
+ Layout.alignment: Qt.AlignCenter
+ StatusIndicator {
+ active: true
+ color: "#f09116"
+ }
+ Label {
+ text: "Camera " + (index + 1)
+ font.family: Flat.FlatStyle.fontFamily
+ renderType: Text.QtRendering
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ property Component progressComponent: ScrollView {
+ id: scrollView
+ horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
+ Flickable {
+ anchors.fill: parent
+ contentWidth: viewport.width
+ contentHeight: progresscolumn.implicitHeight + textMargins * 1.5
+ ColumnLayout {
+ id: progresscolumn
+ anchors.fill: parent
+ anchors.leftMargin: textMargins
+ anchors.rightMargin: textMargins
+ anchors.bottomMargin: textMargins
+ anchors.topMargin: textMargins / 2
+ spacing: textMargins / 2
+ enabled: !settingsData.allDisabled
+
+ GroupBox {
+ title: "BusyIndicator"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ BusyIndicator {
+ id: busyindicator
+ anchors.centerIn: parent
+ running: scrollView.visible
+ }
+ }
+
+ GroupBox {
+ title: "ProgressBar"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ ColumnLayout {
+ anchors.fill: parent
+ ProgressBar {
+ value: slider.value
+ maximumValue: slider.maximumValue
+ Layout.fillWidth: true
+ }
+ ProgressBar {
+ indeterminate: true
+ value: slider.value
+ maximumValue: slider.maximumValue
+ Layout.fillWidth: true
+ }
+ }
+ }
+
+ GroupBox {
+ title: "Slider"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ ColumnLayout {
+ anchors.fill: parent
+ Slider {
+ id: slider
+ // TODO: can't use maximumValue / 2 here, otherwise the gauges
+ // initially show up as empty; find out why.
+ value: 50
+ // If we use the default value of 1 here, we run into QTBUG-42358,
+ // even though that report specifically uses 100 as an example...
+ maximumValue: 100
+ Layout.fillWidth: true
+ }
+ }
+ }
+
+ GroupBox {
+ title: "Gauge"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ Gauge {
+ id: gauge
+ value: slider.value * 1.4
+ orientation: window.width < window.height ? Qt.Vertical : Qt.Horizontal
+ minimumValue: slider.minimumValue * 1.4
+ maximumValue: slider.maximumValue * 1.4
+ tickmarkStepSize: 20
+
+ anchors.centerIn: parent
+ }
+ }
+
+ GroupBox {
+ title: "CircularGauge"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ Layout.minimumWidth: 0
+ CircularGauge {
+ id: circularGauge
+ value: slider.value * 3.2
+ minimumValue: slider.minimumValue * 3.2
+ maximumValue: slider.maximumValue * 3.2
+
+ anchors.centerIn: parent
+ width: Math.min(implicitWidth, parent.width)
+ height: Math.min(implicitHeight, parent.height)
+
+ style: Flat.CircularGaugeStyle {
+ tickmarkStepSize: 20
+ labelStepSize: 40
+ minorTickmarkCount: 2
+ }
+
+ Column {
+ anchors.centerIn: parent
+
+ Label {
+ text: Math.floor(circularGauge.value)
+ anchors.horizontalCenter: parent.horizontalCenter
+ renderType: Text.QtRendering
+ font.pixelSize: unitLabel.font.pixelSize * 2
+ font.family: Flat.FlatStyle.fontFamily
+ font.weight: Font.Light
+ }
+ Label {
+ id: unitLabel
+ text: "km/h"
+ renderType: Text.QtRendering
+ font.family: Flat.FlatStyle.fontFamily
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ property Component inputComponent: ScrollView {
+ id: scrollView
+ horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
+ Flickable {
+ anchors.fill: parent
+ contentWidth: viewport.width
+ contentHeight: inputcolumn.implicitHeight + textMargins * 1.5
+ ColumnLayout {
+ id: inputcolumn
+ anchors.fill: parent
+ anchors.margins: textMargins
+ spacing: textMargins / 2
+ enabled: !settingsData.allDisabled
+
+ GroupBox {
+ title: "TextField"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ ColumnLayout {
+ anchors.fill: parent
+ TextField {
+ z: 1
+ placeholderText: "TextField"
+ Layout.fillWidth: true
+ }
+ TextField {
+ placeholderText: "Password"
+ echoMode: TextInput.Password // TODO: PasswordEchoOnEdit
+ Layout.fillWidth: true
+ }
+ }
+ }
+
+ GroupBox {
+ title: "ComboBox"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ visible: Qt.application.supportsMultipleWindows
+ ColumnLayout {
+ anchors.fill: parent
+ ComboBox {
+ model: ["Option 1", "Option 2", "Option 3"]
+ Layout.fillWidth: true
+ }
+ ComboBox {
+ editable: true
+ model: ListModel {
+ id: combomodel
+ ListElement { text: "Option 1" }
+ ListElement { text: "Option 2" }
+ ListElement { text: "Option 3" }
+ }
+ onAccepted: {
+ if (find(currentText) === -1) {
+ combomodel.append({text: editText})
+ currentIndex = find(editText)
+ }
+ }
+ Layout.fillWidth: true
+ }
+ }
+ }
+
+ GroupBox {
+ title: "SpinBox"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ GridLayout {
+ anchors.fill: parent
+ columns: Math.max(1, Math.floor(scrollView.width / spinbox.implicitWidth - 0.5))
+ SpinBox {
+ id: spinbox
+ Layout.fillWidth: true
+ }
+ SpinBox {
+ decimals: 1
+ Layout.fillWidth: true
+ }
+ }
+ }
+ }
+ }
+ }
+
+ Component {
+ id: tableViewComponent
+ TableView {
+ id: view
+ enabled: !settingsData.allDisabled
+ TableViewColumn {
+ role: "title"
+ title: "Title"
+ width: view.width / 2
+ resizable: false
+ movable: false
+ }
+ TableViewColumn {
+ role: "author"
+ title: "Author"
+ width: view.width / 2
+ resizable: false
+ movable: false
+ }
+
+ frameVisible: false
+ backgroundVisible: true
+ alternatingRowColors: false
+ model: ListModel {
+ 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"
+ }
+ }
+ }
+ }
+ Component {
+ id: calendarComponent
+ Item {
+ enabled: !settingsData.allDisabled
+ Calendar {
+ anchors.centerIn: parent
+ weekNumbersVisible: true
+ frameVisible: settingsData.frames
+ }
+ }
+ }
+ Component {
+ id: textAreaComponent
+ TextArea {
+ enabled: !settingsData.allDisabled
+ frameVisible: false
+ flickableItem.flickableDirection: Flickable.VerticalFlick
+ text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum quis justo a sem faucibus mattis nec vitae nisi. Fusce fringilla nulla a tellus vehicula sodales. Etiam volutpat suscipit erat vitae adipiscing. Sed vestibulum massa nisl, eget posuere urna porta ac. Morbi at nunc ligula. Cras et mauris aliquet ligula sodales suscipit eget imperdiet augue. Ut eget dui eu magna malesuada imperdiet. Donec imperdiet urna eu consequat ornare. Cras at metus tristique, ullamcorper nisl ut, faucibus mauris. Fusce in euismod arcu. Donec tristique rutrum porta. Praesent mattis ac tortor quis scelerisque. Integer luctus nulla ut lacinia tempus."
+ }
+ }
+ Component {
+ id: pieMenuComponent
+ Item {
+ enabled: !settingsData.allDisabled
+
+ Column {
+ anchors.fill: parent
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: controlData.textMargins
+ spacing: Math.round(controlData.textMargins * 0.5)
+
+ Image {
+ id: pieMenuImage
+ source: "qrc:/images/piemenu-image-rgb.jpg"
+ fillMode: Image.PreserveAspectFit
+ width: parent.width
+ height: Math.min((width / sourceSize.width) * sourceSize.height, (parent.height - parent.spacing) * 0.88)
+ }
+ Item {
+ width: parent.width
+ height: parent.height - pieMenuImage.height - parent.spacing
+
+ Text {
+ id: instructionText
+ anchors.fill: parent
+ anchors.leftMargin: controlData.textMargins
+ anchors.rightMargin: controlData.textMargins
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ text: "Tap and hold to open menu"
+ font.family: Flat.FlatStyle.fontFamily
+ font.pixelSize: Math.round(20 * Flat.FlatStyle.scaleFactor)
+ fontSizeMode: Text.Fit
+ color: Flat.FlatStyle.lightFrameColor
+ }
+ }
+ }
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onPressAndHold: pieMenu.popup(mouse.x, mouse.y)
+ }
+ PieMenu {
+ id: pieMenu
+ triggerMode: TriggerMode.TriggerOnClick
+
+ MenuItem {
+ iconSource: "qrc:/images/piemenu-rgb-" + (pieMenu.currentIndex === 0 ? "pressed" : "normal") + ".png"
+ onTriggered: pieMenuImage.source = "qrc:/images/piemenu-image-rgb.jpg"
+ }
+ MenuItem {
+ iconSource: "qrc:/images/piemenu-bw-" + (pieMenu.currentIndex === 1 ? "pressed" : "normal") + ".png"
+ onTriggered: pieMenuImage.source = "qrc:/images/piemenu-image-bw.jpg"
+ }
+ MenuItem {
+ iconSource: "qrc:/images/piemenu-sepia-" + (pieMenu.currentIndex === 2 ? "pressed" : "normal") + ".png"
+ onTriggered: pieMenuImage.source = "qrc:/images/piemenu-image-sepia.jpg"
+ }
+ }
+ }
+ }
+ Component {
+ id: delayButtonComponent
+ Item {
+ enabled: !settingsData.allDisabled
+ DelayButton {
+ text: progress < 1 ? "START" : "STOP"
+ anchors.centerIn: parent
+ }
+ }
+ }
+ Component {
+ id: dialComponent
+ Item {
+ enabled: !settingsData.allDisabled
+ Dial {
+ anchors.centerIn: parent
+ }
+ }
+ }
+ Component {
+ id: tumblerComponent
+ Item {
+ enabled: !settingsData.allDisabled
+ Tumbler {
+ anchors.centerIn: parent
+ TumblerColumn {
+ model: {
+ var hours = [];
+ for (var i = 1; i <= 24; ++i)
+ hours.push(i < 10 ? "0" + i : i);
+ hours;
+ }
+ }
+ TumblerColumn {
+ model: {
+ var minutes = [];
+ for (var i = 0; i < 60; ++i)
+ minutes.push(i < 10 ? "0" + i : i);
+ minutes;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/examples/quickcontrols/extras/flat/SettingsIcon.qml b/examples/quickcontrols/extras/flat/SettingsIcon.qml
new file mode 100644
index 000000000..e494e5370
--- /dev/null
+++ b/examples/quickcontrols/extras/flat/SettingsIcon.qml
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** 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.4
+
+Canvas {
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ ctx.scale(width, height);
+
+ ctx.beginPath();
+ ctx.moveTo(0.706,0.542);
+ ctx.bezierCurveTo(0.709,0.527,0.711,0.512,0.711,0.49700000000000005);
+ ctx.bezierCurveTo(0.711,0.4820000000000001,0.709,0.465,0.706,0.451);
+ ctx.lineTo(0.752,0.41600000000000004);
+ ctx.lineTo(0.759,0.41);
+ ctx.lineTo(0.756,0.4);
+ ctx.bezierCurveTo(0.756,0.399,0.749,0.382,0.737,0.36200000000000004);
+ ctx.bezierCurveTo(0.725,0.3420000000000001,0.714,0.328,0.714,0.327);
+ ctx.lineTo(0.708,0.319);
+ ctx.lineTo(0.698,0.324);
+ ctx.lineTo(0.645,0.346);
+ ctx.bezierCurveTo(0.623,0.32499999999999996,0.595,0.309,0.5650000000000001,0.3);
+ ctx.lineTo(0.558,0.243);
+ ctx.lineTo(0.557,0.23299999999999998);
+ ctx.lineTo(0.547,0.23099999999999998);
+ ctx.bezierCurveTo(0.546,0.23099999999999998,0.528,0.22799999999999998,0.505,0.22799999999999998);
+ ctx.bezierCurveTo(0.481,0.22799999999999998,0.463,0.23099999999999998,0.463,0.23099999999999998);
+ ctx.lineTo(0.453,0.23299999999999998);
+ ctx.lineTo(0.452,0.243);
+ ctx.lineTo(0.444,0.299);
+ ctx.bezierCurveTo(0.41400000000000003,0.308,0.387,0.324,0.364,0.345);
+ ctx.lineTo(0.312,0.323);
+ ctx.lineTo(0.302,0.319);
+ ctx.lineTo(0.296,0.327);
+ ctx.bezierCurveTo(0.296,0.327,0.284,0.342,0.27299999999999996,0.362);
+ ctx.bezierCurveTo(0.26,0.383,0.254,0.399,0.254,0.4);
+ ctx.lineTo(0.25,0.41);
+ ctx.lineTo(0.258,0.416);
+ ctx.lineTo(0.303,0.45099999999999996);
+ ctx.bezierCurveTo(0.3,0.465,0.299,0.48,0.299,0.497);
+ ctx.bezierCurveTo(0.299,0.513,0.3,0.528,0.304,0.543);
+ ctx.lineTo(0.259,0.577);
+ ctx.lineTo(0.25,0.584);
+ ctx.lineTo(0.254,0.593);
+ ctx.bezierCurveTo(0.254,0.594,0.261,0.61,0.273,0.63);
+ ctx.bezierCurveTo(0.28500000000000003,0.65,0.29500000000000004,0.664,0.29600000000000004,0.665);
+ ctx.lineTo(0.30200000000000005,0.673);
+ ctx.lineTo(0.31200000000000006,0.669);
+ ctx.lineTo(0.36500000000000005,0.647);
+ ctx.bezierCurveTo(0.38700000000000007,0.668,0.41400000000000003,0.684,0.44400000000000006,0.6930000000000001);
+ ctx.lineTo(0.45200000000000007,0.7510000000000001);
+ ctx.lineTo(0.45300000000000007,0.7620000000000001);
+ ctx.lineTo(0.4640000000000001,0.7630000000000001);
+ ctx.bezierCurveTo(0.4640000000000001,0.7630000000000001,0.4820000000000001,0.7640000000000001,0.5060000000000001,0.7640000000000001);
+ ctx.bezierCurveTo(0.5300000000000001,0.7640000000000001,0.5470000000000002,0.7620000000000001,0.5480000000000002,0.7620000000000001);
+ ctx.lineTo(0.5580000000000002,0.7610000000000001);
+ ctx.lineTo(0.5590000000000002,0.7510000000000001);
+ ctx.lineTo(0.5660000000000002,0.6940000000000001);
+ ctx.bezierCurveTo(0.5960000000000002,0.685,0.6230000000000002,0.669,0.6460000000000001,0.648);
+ ctx.lineTo(0.6990000000000002,0.67);
+ ctx.lineTo(0.7090000000000002,0.674);
+ ctx.lineTo(0.7150000000000002,0.665);
+ ctx.bezierCurveTo(0.7150000000000002,0.665,0.7260000000000002,0.65,0.7370000000000002,0.63);
+ ctx.bezierCurveTo(0.7490000000000002,0.61,0.7560000000000002,0.594,0.7560000000000002,0.593);
+ ctx.lineTo(0.7600000000000002,0.584);
+ ctx.lineTo(0.751,0.577);
+ ctx.lineTo(0.706,0.542);
+ ctx.closePath();
+ ctx.moveTo(0.505,0.622);
+ ctx.bezierCurveTo(0.436,0.622,0.38,0.566,0.38,0.497);
+ ctx.bezierCurveTo(0.38,0.428,0.436,0.372,0.505,0.372);
+ ctx.bezierCurveTo(0.5740000000000001,0.372,0.63,0.428,0.63,0.497);
+ ctx.bezierCurveTo(0.63,0.565,0.574,0.622,0.505,0.622);
+ ctx.closePath();
+ ctx.fillStyle = "#333333";
+ ctx.fill();
+ }
+}
diff --git a/examples/quickcontrols/extras/flat/flat.pro b/examples/quickcontrols/extras/flat/flat.pro
new file mode 100644
index 000000000..6a6906648
--- /dev/null
+++ b/examples/quickcontrols/extras/flat/flat.pro
@@ -0,0 +1,19 @@
+TEMPLATE = app
+TARGET = flat
+QT += quick
+
+SOURCES += \
+ main.cpp
+
+RESOURCES += \
+ flat.qrc
+
+OTHER_FILES += \
+ main.qml
+
+DISTFILES += \
+ Content.qml \
+ SettingsIcon.qml
+
+target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/extras/flat
+INSTALLS += target
diff --git a/examples/quickcontrols/extras/flat/flat.qrc b/examples/quickcontrols/extras/flat/flat.qrc
new file mode 100644
index 000000000..5b06a55ce
--- /dev/null
+++ b/examples/quickcontrols/extras/flat/flat.qrc
@@ -0,0 +1,16 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>images/piemenu-bw-normal.png</file>
+ <file>images/piemenu-bw-pressed.png</file>
+ <file>images/piemenu-rgb-normal.png</file>
+ <file>images/piemenu-rgb-pressed.png</file>
+ <file>images/piemenu-sepia-normal.png</file>
+ <file>images/piemenu-sepia-pressed.png</file>
+ <file>images/piemenu-image-bw.jpg</file>
+ <file>images/piemenu-image-rgb.jpg</file>
+ <file>images/piemenu-image-sepia.jpg</file>
+ <file>Content.qml</file>
+ <file>SettingsIcon.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/quickcontrols/extras/flat/images/piemenu-bw-normal.png b/examples/quickcontrols/extras/flat/images/piemenu-bw-normal.png
new file mode 100644
index 000000000..ef57111fb
--- /dev/null
+++ b/examples/quickcontrols/extras/flat/images/piemenu-bw-normal.png
Binary files differ
diff --git a/examples/quickcontrols/extras/flat/images/piemenu-bw-pressed.png b/examples/quickcontrols/extras/flat/images/piemenu-bw-pressed.png
new file mode 100644
index 000000000..b6bd1d20d
--- /dev/null
+++ b/examples/quickcontrols/extras/flat/images/piemenu-bw-pressed.png
Binary files differ
diff --git a/examples/quickcontrols/extras/flat/images/piemenu-image-bw.jpg b/examples/quickcontrols/extras/flat/images/piemenu-image-bw.jpg
new file mode 100644
index 000000000..ce4d8ffda
--- /dev/null
+++ b/examples/quickcontrols/extras/flat/images/piemenu-image-bw.jpg
Binary files differ
diff --git a/examples/quickcontrols/extras/flat/images/piemenu-image-rgb.jpg b/examples/quickcontrols/extras/flat/images/piemenu-image-rgb.jpg
new file mode 100644
index 000000000..2d7d22056
--- /dev/null
+++ b/examples/quickcontrols/extras/flat/images/piemenu-image-rgb.jpg
Binary files differ
diff --git a/examples/quickcontrols/extras/flat/images/piemenu-image-sepia.jpg b/examples/quickcontrols/extras/flat/images/piemenu-image-sepia.jpg
new file mode 100644
index 000000000..3ef7b1f0f
--- /dev/null
+++ b/examples/quickcontrols/extras/flat/images/piemenu-image-sepia.jpg
Binary files differ
diff --git a/examples/quickcontrols/extras/flat/images/piemenu-rgb-normal.png b/examples/quickcontrols/extras/flat/images/piemenu-rgb-normal.png
new file mode 100644
index 000000000..2278f4a9e
--- /dev/null
+++ b/examples/quickcontrols/extras/flat/images/piemenu-rgb-normal.png
Binary files differ
diff --git a/examples/quickcontrols/extras/flat/images/piemenu-rgb-pressed.png b/examples/quickcontrols/extras/flat/images/piemenu-rgb-pressed.png
new file mode 100644
index 000000000..f45846b17
--- /dev/null
+++ b/examples/quickcontrols/extras/flat/images/piemenu-rgb-pressed.png
Binary files differ
diff --git a/examples/quickcontrols/extras/flat/images/piemenu-sepia-normal.png b/examples/quickcontrols/extras/flat/images/piemenu-sepia-normal.png
new file mode 100644
index 000000000..f1e9ffd26
--- /dev/null
+++ b/examples/quickcontrols/extras/flat/images/piemenu-sepia-normal.png
Binary files differ
diff --git a/examples/quickcontrols/extras/flat/images/piemenu-sepia-pressed.png b/examples/quickcontrols/extras/flat/images/piemenu-sepia-pressed.png
new file mode 100644
index 000000000..0f2b35171
--- /dev/null
+++ b/examples/quickcontrols/extras/flat/images/piemenu-sepia-pressed.png
Binary files differ
diff --git a/examples/quickcontrols/extras/flat/main.cpp b/examples/quickcontrols/extras/flat/main.cpp
new file mode 100644
index 000000000..57f48cda2
--- /dev/null
+++ b/examples/quickcontrols/extras/flat/main.cpp
@@ -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$
+**
+****************************************************************************/
+
+#include <QtGui/QGuiApplication>
+#include <QtQml/QQmlApplicationEngine>
+#include <QtGui/QFontDatabase>
+#include <QtCore/QDir>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+ if (qgetenv("QT_QUICK_CONTROLS_STYLE").isEmpty()) {
+#ifdef QT_STATIC
+ // Need a full path to find the style when built statically
+ qputenv("QT_QUICK_CONTROLS_STYLE", ":/ExtrasImports/QtQuick/Controls/Styles/Flat");
+#else
+ qputenv("QT_QUICK_CONTROLS_STYLE", "Flat");
+#endif
+ }
+ QQmlApplicationEngine engine;
+ engine.load(QUrl("qrc:/main.qml"));
+ if (engine.rootObjects().isEmpty())
+ return -1;
+ return app.exec();
+}
diff --git a/examples/quickcontrols/extras/flat/main.qml b/examples/quickcontrols/extras/flat/main.qml
new file mode 100644
index 000000000..aec94c368
--- /dev/null
+++ b/examples/quickcontrols/extras/flat/main.qml
@@ -0,0 +1,479 @@
+/****************************************************************************
+**
+** 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.4
+import QtQuick.Layouts 1.0
+import QtQuick.Controls 1.4
+import QtQuick.Controls.Styles.Flat 1.0 as Flat
+import QtQuick.Extras 1.4
+import QtQuick.Extras.Private 1.0
+
+ApplicationWindow {
+ id: window
+ width: 480
+ height: 860
+ title: "Flat Example"
+ visible: true
+
+ readonly property bool contentLoaded: contentLoader.item
+ readonly property alias anchorItem: controlsMenu
+ property int currentMenu: -1
+ readonly property int textMargins: Math.round(32 * Flat.FlatStyle.scaleFactor)
+ readonly property int menuMargins: Math.round(13 * Flat.FlatStyle.scaleFactor)
+ readonly property int menuWidth: Math.min(window.width, window.height) * 0.75
+
+ onCurrentMenuChanged: {
+ xBehavior.enabled = true;
+ anchorCurrentMenu();
+ }
+
+ onMenuWidthChanged: anchorCurrentMenu()
+
+ function anchorCurrentMenu() {
+ switch (currentMenu) {
+ case -1:
+ anchorItem.x = -menuWidth;
+ break;
+ case 0:
+ anchorItem.x = 0;
+ break;
+ case 1:
+ anchorItem.x = -menuWidth * 2;
+ break;
+ }
+ }
+
+ Item {
+ id: container
+ anchors.fill: parent
+
+ Item {
+ id: loadingScreen
+ anchors.fill: parent
+ visible: !contentLoaded
+
+ Timer {
+ running: true
+ interval: 100
+ // TODO: Find a way to know when the loading screen has been rendered instead
+ // of using an abritrary amount of time.
+ onTriggered: contentLoader.sourceComponent = Qt.createComponent("Content.qml")
+ }
+
+ Column {
+ anchors.centerIn: parent
+ spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
+
+ BusyIndicator {
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ Label {
+ text: "Loading Light Flat UI..."
+ width: Math.min(loadingScreen.width, loadingScreen.height) * 0.8
+ height: font.pixelSize
+ anchors.horizontalCenter: parent.horizontalCenter
+ renderType: Text.QtRendering
+ font.pixelSize: Math.round(26 * Flat.FlatStyle.scaleFactor)
+ horizontalAlignment: Text.AlignHCenter
+ fontSizeMode: Text.Fit
+ font.family: Flat.FlatStyle.fontFamily
+ font.weight: Font.Light
+ }
+ }
+ }
+
+ Rectangle {
+ id: controlsMenu
+ x: container.x - width
+ z: contentContainer.z + 1
+ width: menuWidth
+ height: parent.height
+
+ // Don't let the menus become visible when resizing the window
+ Binding {
+ target: controlsMenu
+ property: "x"
+ value: container.x - controlsMenu.width
+ when: !xBehavior.enabled && !xNumberAnimation.running && currentMenu == -1
+ }
+
+ Behavior on x {
+ id: xBehavior
+ enabled: false
+ NumberAnimation {
+ id: xNumberAnimation
+ easing.type: Easing.OutExpo
+ duration: 500
+ onRunningChanged: xBehavior.enabled = false
+ }
+ }
+
+ Rectangle {
+ id: controlsTitleBar
+ width: parent.width
+ height: toolBar.height
+ color: Flat.FlatStyle.defaultTextColor
+
+ Label {
+ text: "Controls"
+ font.family: Flat.FlatStyle.fontFamily
+ font.pixelSize: Math.round(16 * Flat.FlatStyle.scaleFactor)
+ renderType: Text.QtRendering
+ color: "white"
+ anchors.left: parent.left
+ anchors.leftMargin: menuMargins
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+
+ ListView {
+ id: controlView
+ width: parent.width
+ anchors.top: controlsTitleBar.bottom
+ anchors.bottom: parent.bottom
+ clip: true
+ currentIndex: 0
+ model: contentLoaded ? contentLoader.item.componentModel : null
+ delegate: MouseArea {
+ id: delegateItem
+ width: parent.width
+ height: 64 * Flat.FlatStyle.scaleFactor
+ onClicked: {
+ if (controlView.currentIndex != index)
+ controlView.currentIndex = index;
+
+ currentMenu = -1;
+ }
+
+ Rectangle {
+ width: parent.width
+ height: Flat.FlatStyle.onePixel
+ anchors.bottom: parent.bottom
+ color: Flat.FlatStyle.lightFrameColor
+ }
+
+ Label {
+ text: delegateItem.ListView.view.model[index].name
+ font.pixelSize: Math.round(15 * Flat.FlatStyle.scaleFactor)
+ font.family: Flat.FlatStyle.fontFamily
+ renderType: Text.QtRendering
+ color: delegateItem.ListView.isCurrentItem ? Flat.FlatStyle.styleColor : Flat.FlatStyle.defaultTextColor
+ anchors.left: parent.left
+ anchors.leftMargin: menuMargins
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+
+ Rectangle {
+ width: parent.height
+ height: 8 * Flat.FlatStyle.scaleFactor
+ rotation: 90
+ anchors.left: parent.right
+ transformOrigin: Item.TopLeft
+
+ gradient: Gradient {
+ GradientStop {
+ color: Qt.rgba(0, 0, 0, 0.15)
+ position: 0
+ }
+ GradientStop {
+ color: Qt.rgba(0, 0, 0, 0.05)
+ position: 0.5
+ }
+ GradientStop {
+ color: Qt.rgba(0, 0, 0, 0)
+ position: 1
+ }
+ }
+ }
+ }
+ }
+
+ Item {
+ id: contentContainer
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.left: controlsMenu.right
+ width: parent.width
+
+ ToolBar {
+ id: toolBar
+ visible: !loadingScreen.visible
+ width: parent.width
+ height: 54 * Flat.FlatStyle.scaleFactor
+ z: contentLoader.z + 1
+ style: Flat.ToolBarStyle {
+ padding.left: 0
+ padding.right: 0
+ }
+
+ RowLayout {
+ anchors.fill: parent
+
+ MouseArea {
+ id: controlsButton
+ Layout.preferredWidth: toolBar.height + textMargins
+ Layout.preferredHeight: toolBar.height
+ onClicked: currentMenu = currentMenu == 0 ? -1 : 0
+
+ Column {
+ id: controlsIcon
+ anchors.left: parent.left
+ anchors.leftMargin: textMargins
+ anchors.verticalCenter: parent.verticalCenter
+ spacing: Math.round(2 * Flat.FlatStyle.scaleFactor)
+
+ Repeater {
+ model: 3
+
+ Rectangle {
+ width: Math.round(4 * Flat.FlatStyle.scaleFactor)
+ height: width
+ radius: width / 2
+ color: Flat.FlatStyle.defaultTextColor
+ }
+ }
+ }
+ }
+
+ Text {
+ text: "Light Flat UI Demo"
+ font.family: Flat.FlatStyle.fontFamily
+ font.pixelSize: Math.round(16 * Flat.FlatStyle.scaleFactor)
+ horizontalAlignment: Text.AlignHCenter
+ color: "#666666"
+ Layout.fillWidth: true
+ }
+
+ MouseArea {
+ id: settingsButton
+ Layout.preferredWidth: controlsButton.Layout.preferredWidth
+ Layout.preferredHeight: controlsButton.Layout.preferredHeight
+ onClicked: currentMenu = currentMenu == 1 ? -1 : 1
+
+ SettingsIcon {
+ width: Math.round(32 * Flat.FlatStyle.scaleFactor)
+ height: Math.round(32 * Flat.FlatStyle.scaleFactor)
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ anchors.rightMargin: textMargins - Math.round(8 * Flat.FlatStyle.scaleFactor)
+ }
+ }
+ }
+ }
+
+ Loader {
+ id: contentLoader
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: toolBar.bottom
+ anchors.bottom: parent.bottom
+
+ property QtObject settingsData: QtObject {
+ readonly property bool checks: disableSingleItemsAction.checked
+ readonly property bool frames: !greyBackgroundAction.checked
+ readonly property bool allDisabled: disableAllAction.checked
+ }
+ property QtObject controlData: QtObject {
+ readonly property int componentIndex: controlView.currentIndex
+ readonly property int textMargins: window.textMargins
+ }
+
+ MouseArea {
+ enabled: currentMenu != -1
+ // We would be able to just set this to true here, if it weren't for QTBUG-43083.
+ hoverEnabled: enabled
+ anchors.fill: parent
+ preventStealing: true
+ onClicked: currentMenu = -1
+ focus: enabled
+ z: 1000
+ }
+ }
+ }
+
+ Rectangle {
+ id: settingsMenu
+ z: contentContainer.z + 1
+ width: menuWidth
+ height: parent.height
+ anchors.left: contentContainer.right
+
+ Rectangle {
+ id: optionsTitleBar
+ width: parent.width
+ height: toolBar.height
+ color: Flat.FlatStyle.defaultTextColor
+
+ Label {
+ text: "Options"
+ font.family: Flat.FlatStyle.fontFamily
+ font.pixelSize: Math.round(16 * Flat.FlatStyle.scaleFactor)
+ renderType: Text.QtRendering
+ color: "white"
+ anchors.left: parent.left
+ anchors.leftMargin: menuMargins
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+
+ Action {
+ id: disableAllAction
+ checkable: true
+ checked: false
+ }
+
+ Action {
+ id: disableSingleItemsAction
+ checkable: true
+ checked: false
+ }
+
+ Action {
+ id: greyBackgroundAction
+ checkable: true
+ checked: false
+ }
+
+ ListView {
+ id: optionsListView
+ width: parent.width
+ anchors.top: optionsTitleBar.bottom
+ anchors.bottom: parent.bottom
+ clip: true
+ interactive: delegateHeight * count > height
+
+ readonly property int delegateHeight: 64 * Flat.FlatStyle.scaleFactor
+
+ model: [
+ { name: "Disable all", action: disableAllAction },
+ { name: "Disable single items", action: disableSingleItemsAction },
+ { name: "Grey background", action: greyBackgroundAction },
+ { name: "Exit", action: null }
+ ]
+ delegate: Rectangle {
+ id: optionDelegateItem
+ width: parent.width
+ height: optionsListView.delegateHeight
+
+ Rectangle {
+ width: parent.width
+ height: Flat.FlatStyle.onePixel
+ anchors.bottom: parent.bottom
+ color: Flat.FlatStyle.lightFrameColor
+ }
+
+ Loader {
+ sourceComponent: optionText !== "Exit"
+ ? optionsListView.checkBoxComponent : optionsListView.exitComponent
+ anchors.fill: parent
+ anchors.leftMargin: menuMargins
+
+ property string optionText: optionsListView.model[index].name
+ property int optionIndex: index
+ }
+ }
+
+ property Component checkBoxComponent: Item {
+ Label {
+ text: optionText
+ font.family: Flat.FlatStyle.fontFamily
+ font.pixelSize: Math.round(15 * Flat.FlatStyle.scaleFactor)
+ fontSizeMode: Text.Fit
+ renderType: Text.QtRendering
+ verticalAlignment: Text.AlignVCenter
+ color: Flat.FlatStyle.defaultTextColor
+ height: parent.height
+ anchors.left: parent.left
+ anchors.right: checkBox.left
+ anchors.rightMargin: Flat.FlatStyle.twoPixels
+ }
+
+ CheckBox {
+ id: checkBox
+ checked: optionsListView.model[optionIndex].action.checked
+ anchors.right: parent.right
+ anchors.rightMargin: menuMargins
+ anchors.verticalCenter: parent.verticalCenter
+ onCheckedChanged: optionsListView.model[optionIndex].action.checked = checkBox.checked
+ }
+ }
+
+ property Component exitComponent: MouseArea {
+ anchors.fill: parent
+ onClicked: Qt.quit()
+
+ Label {
+ text: optionText
+ font.family: Flat.FlatStyle.fontFamily
+ font.pixelSize: Math.round(15 * Flat.FlatStyle.scaleFactor)
+ renderType: Text.QtRendering
+ color: Flat.FlatStyle.defaultTextColor
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+
+ Rectangle {
+ width: parent.height
+ height: 8 * Flat.FlatStyle.scaleFactor
+ rotation: -90
+ anchors.right: parent.left
+ transformOrigin: Item.TopRight
+
+ gradient: Gradient {
+ GradientStop {
+ color: Qt.rgba(0, 0, 0, 0.15)
+ position: 0
+ }
+ GradientStop {
+ color: Qt.rgba(0, 0, 0, 0.05)
+ position: 0.5
+ }
+ GradientStop {
+ color: Qt.rgba(0, 0, 0, 0)
+ position: 1
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/examples/quickcontrols/extras/gallery/fonts/LICENSE.txt b/examples/quickcontrols/extras/gallery/fonts/LICENSE.txt
new file mode 100644
index 000000000..d64569567
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/fonts/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/examples/quickcontrols/extras/gallery/fonts/OpenSans-Regular.ttf b/examples/quickcontrols/extras/gallery/fonts/OpenSans-Regular.ttf
new file mode 100644
index 000000000..db433349b
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/fonts/OpenSans-Regular.ttf
Binary files differ
diff --git a/examples/quickcontrols/extras/gallery/gallery.pro b/examples/quickcontrols/extras/gallery/gallery.pro
new file mode 100644
index 000000000..548df63f4
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/gallery.pro
@@ -0,0 +1,34 @@
+TEMPLATE = app
+TARGET = gallery
+INCLUDEPATH += .
+QT += quick
+
+SOURCES += \
+ main.cpp
+
+RESOURCES += \
+ gallery.qrc
+
+target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/extras/gallery
+INSTALLS += target
+
+OTHER_FILES += \
+ qml/BlackButtonBackground.qml \
+ qml/BlackButtonStyle.qml \
+ qml/CircularGaugeDarkStyle.qml \
+ qml/CircularGaugeDefaultStyle.qml \
+ qml/CircularGaugeLightStyle.qml \
+ qml/CircularGaugeView.qml \
+ qml/ControlLabel.qml \
+ qml/ControlView.qml \
+ qml/ControlViewToolBar.qml \
+ qml/CustomizerSwitch.qml \
+ qml/CustomizerLabel.qml \
+ qml/CustomizerSlider.qml \
+ qml/FlickableMoreIndicator.qml \
+ qml/gallery.qml \
+ qml/PieMenuControlView.qml \
+ qml/PieMenuDefaultStyle.qml \
+ qml/PieMenuDarkStyle.qml \
+ qml/StylePicker.qml \
+ gallery.qrc
diff --git a/examples/quickcontrols/extras/gallery/gallery.qrc b/examples/quickcontrols/extras/gallery/gallery.qrc
new file mode 100644
index 000000000..97beb6b1b
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/gallery.qrc
@@ -0,0 +1,36 @@
+<RCC>
+ <qresource prefix="/">
+ <file>fonts/OpenSans-Regular.ttf</file>
+ <file>images/background-light.png</file>
+ <file>images/background.png</file>
+ <file>images/center-light.png</file>
+ <file>images/center.png</file>
+ <file>images/icon-go.png</file>
+ <file>images/icon-settings.png</file>
+ <file>images/info.png</file>
+ <file>images/needle-light.png</file>
+ <file>images/needle.png</file>
+ <file>images/qt-logo.png</file>
+ <file>images/zoom_in.png</file>
+ <file>images/zoom_out.png</file>
+ <file>qml/BlackButtonBackground.qml</file>
+ <file>qml/BlackButtonStyle.qml</file>
+ <file>qml/CircularGaugeDarkStyle.qml</file>
+ <file>qml/CircularGaugeDefaultStyle.qml</file>
+ <file>qml/CircularGaugeLightStyle.qml</file>
+ <file>qml/CircularGaugeView.qml</file>
+ <file>qml/ControlView.qml</file>
+ <file>qml/ControlViewToolbar.qml</file>
+ <file>qml/CustomizerSwitch.qml</file>
+ <file>qml/CustomizerLabel.qml</file>
+ <file>qml/CustomizerSlider.qml</file>
+ <file>qml/FlickableMoreIndicator.qml</file>
+ <file>qml/gallery.qml</file>
+ <file>qml/PieMenuControlView.qml</file>
+ <file>qml/StylePicker.qml</file>
+ <file>qml/PieMenuDarkStyle.qml</file>
+ <file>qml/PieMenuDefaultStyle.qml</file>
+ <file>qml/ControlLabel.qml</file>
+ <file>images/icon-back.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/quickcontrols/extras/gallery/images/background-light.png b/examples/quickcontrols/extras/gallery/images/background-light.png
new file mode 100644
index 000000000..2f7698452
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/images/background-light.png
Binary files differ
diff --git a/examples/quickcontrols/extras/gallery/images/background.png b/examples/quickcontrols/extras/gallery/images/background.png
new file mode 100644
index 000000000..a3f4302bc
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/images/background.png
Binary files differ
diff --git a/examples/quickcontrols/extras/gallery/images/center-light.png b/examples/quickcontrols/extras/gallery/images/center-light.png
new file mode 100644
index 000000000..75add20ce
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/images/center-light.png
Binary files differ
diff --git a/examples/quickcontrols/extras/gallery/images/center.png b/examples/quickcontrols/extras/gallery/images/center.png
new file mode 100644
index 000000000..fd3696404
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/images/center.png
Binary files differ
diff --git a/examples/quickcontrols/extras/gallery/images/icon-back.png b/examples/quickcontrols/extras/gallery/images/icon-back.png
new file mode 100644
index 000000000..0b037ff69
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/images/icon-back.png
Binary files differ
diff --git a/examples/quickcontrols/extras/gallery/images/icon-go.png b/examples/quickcontrols/extras/gallery/images/icon-go.png
new file mode 100644
index 000000000..bcb2a822a
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/images/icon-go.png
Binary files differ
diff --git a/examples/quickcontrols/extras/gallery/images/icon-settings.png b/examples/quickcontrols/extras/gallery/images/icon-settings.png
new file mode 100644
index 000000000..7763ba20e
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/images/icon-settings.png
Binary files differ
diff --git a/examples/quickcontrols/extras/gallery/images/info.png b/examples/quickcontrols/extras/gallery/images/info.png
new file mode 100644
index 000000000..5c7a9df3c
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/images/info.png
Binary files differ
diff --git a/examples/quickcontrols/extras/gallery/images/needle-light.png b/examples/quickcontrols/extras/gallery/images/needle-light.png
new file mode 100644
index 000000000..d486d9e53
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/images/needle-light.png
Binary files differ
diff --git a/examples/quickcontrols/extras/gallery/images/needle.png b/examples/quickcontrols/extras/gallery/images/needle.png
new file mode 100644
index 000000000..6b10c604a
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/images/needle.png
Binary files differ
diff --git a/examples/quickcontrols/extras/gallery/images/qt-logo.png b/examples/quickcontrols/extras/gallery/images/qt-logo.png
new file mode 100644
index 000000000..14ddf2a02
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/images/qt-logo.png
Binary files differ
diff --git a/examples/quickcontrols/extras/gallery/images/zoom_in.png b/examples/quickcontrols/extras/gallery/images/zoom_in.png
new file mode 100644
index 000000000..412821064
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/images/zoom_in.png
Binary files differ
diff --git a/examples/quickcontrols/extras/gallery/images/zoom_out.png b/examples/quickcontrols/extras/gallery/images/zoom_out.png
new file mode 100644
index 000000000..772d6ac17
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/images/zoom_out.png
Binary files differ
diff --git a/examples/quickcontrols/extras/gallery/main.cpp b/examples/quickcontrols/extras/gallery/main.cpp
new file mode 100644
index 000000000..1d5d23139
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/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 <QtGui/QGuiApplication>
+#include <QtQml/QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+ QQmlApplicationEngine engine(QUrl("qrc:/qml/gallery.qml"));
+ if (engine.rootObjects().isEmpty())
+ return -1;
+ return app.exec();
+}
diff --git a/examples/quickcontrols/extras/gallery/qml/BlackButtonBackground.qml b/examples/quickcontrols/extras/gallery/qml/BlackButtonBackground.qml
new file mode 100644
index 000000000..94852f38c
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/qml/BlackButtonBackground.qml
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** 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.1
+import QtQuick.Controls.Styles 1.1
+
+Rectangle {
+ property bool pressed: false
+
+ gradient: Gradient {
+ GradientStop {
+ color: pressed ? "#222" : "#333"
+ position: 0
+ }
+ GradientStop {
+ color: "#222"
+ position: 1
+ }
+ }
+ Rectangle {
+ height: 1
+ width: parent.width
+ anchors.top: parent.top
+ color: "#444"
+ visible: !pressed
+ }
+ Rectangle {
+ height: 1
+ width: parent.width
+ anchors.bottom: parent.bottom
+ color: "#000"
+ }
+}
diff --git a/examples/quickcontrols/extras/gallery/qml/BlackButtonStyle.qml b/examples/quickcontrols/extras/gallery/qml/BlackButtonStyle.qml
new file mode 100644
index 000000000..e3e60d88b
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/qml/BlackButtonStyle.qml
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** 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.1
+import QtQuick.Controls.Styles 1.1
+
+ButtonStyle {
+ property color fontColor
+
+ property url rightAlignedIconSource
+
+ background: BlackButtonBackground {
+ pressed: control.pressed
+ }
+ label: Item {
+ implicitWidth: row.implicitWidth
+ implicitHeight: row.implicitHeight
+ baselineOffset: row.y + text.y + text.baselineOffset
+
+ Row {
+ id: row
+ anchors.left: control.text.length === 0 ? undefined : parent.left
+ anchors.leftMargin: control.text.length === 0 ? 0 : textSingleton.implicitHeight
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.horizontalCenter: control.text.length === 0 ? parent.horizontalCenter : undefined
+
+ Image {
+ source: control.iconSource
+ width: Math.min(sourceSize.width, height)
+ height: text.implicitHeight
+ fillMode: Image.PreserveAspectFit
+ }
+ Text {
+ id: text
+ text: control.text
+ color: fontColor
+ font.pixelSize: control.height * 0.25
+ font.family: openSans.name
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+
+ Loader {
+ active: rightAlignedIconSource.toString().length !== 0
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ anchors.rightMargin: textSingleton.implicitHeight
+
+ sourceComponent: Image {
+ width: Math.min(sourceSize.width, height)
+ height: text.implicitHeight
+ fillMode: Image.PreserveAspectFit
+ source: rightAlignedIconSource
+ }
+ }
+ }
+}
diff --git a/examples/quickcontrols/extras/gallery/qml/CircularGaugeDarkStyle.qml b/examples/quickcontrols/extras/gallery/qml/CircularGaugeDarkStyle.qml
new file mode 100644
index 000000000..9993a97a6
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/qml/CircularGaugeDarkStyle.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.Controls.Styles 1.4
+
+CircularGaugeStyle {
+ id: root
+ tickmarkStepSize: 10
+ minorTickmarkCount: 1
+ labelStepSize: 20
+ tickmarkInset: outerRadius * 0.06
+ minorTickmarkInset: tickmarkInset
+ labelInset: outerRadius * 0.23
+
+ background: Image {
+ source: "qrc:/images/background.png"
+ }
+
+ needle: Image {
+ id: needleImage
+ transformOrigin: Item.Bottom
+ source: "qrc:/images/needle.png"
+ scale: {
+ var distanceFromLabelToRadius = labelInset / 2;
+ var idealHeight = outerRadius - distanceFromLabelToRadius;
+ var originalImageHeight = needleImage.sourceSize.height;
+ idealHeight / originalImageHeight;
+ }
+ }
+
+ foreground: Item {
+ Image {
+ anchors.centerIn: parent
+ source: "qrc:/images/center.png"
+ scale: (outerRadius * 0.25) / sourceSize.height
+ }
+ }
+
+ tickmark: Rectangle {
+ implicitWidth: outerRadius * 0.02
+ antialiasing: true
+ implicitHeight: outerRadius * 0.05
+ color: "#888"
+ }
+
+ minorTickmark: Rectangle {
+ implicitWidth: outerRadius * 0.01
+ antialiasing: true
+ implicitHeight: outerRadius * 0.02
+ color: "#444"
+ }
+
+ tickmarkLabel: Text {
+ font.pixelSize: Math.max(6, outerRadius * 0.1)
+ text: styleData.value
+ color: "white"
+ }
+}
diff --git a/examples/quickcontrols/extras/gallery/qml/CircularGaugeDefaultStyle.qml b/examples/quickcontrols/extras/gallery/qml/CircularGaugeDefaultStyle.qml
new file mode 100644
index 000000000..b7f1b2412
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/qml/CircularGaugeDefaultStyle.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** 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.Styles 1.4
+
+CircularGaugeStyle {
+ labelStepSize: 20
+}
diff --git a/examples/quickcontrols/extras/gallery/qml/CircularGaugeLightStyle.qml b/examples/quickcontrols/extras/gallery/qml/CircularGaugeLightStyle.qml
new file mode 100644
index 000000000..8e1f34ea7
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/qml/CircularGaugeLightStyle.qml
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** 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.Styles 1.4
+
+CircularGaugeStyle {
+ id: root
+ tickmarkStepSize: 10
+ minorTickmarkCount: 2
+ labelStepSize: 40
+ tickmarkInset: outerRadius * 0.06
+ minorTickmarkInset: tickmarkInset
+ labelInset: outerRadius * 0.23
+
+ background: Image {
+ source: "qrc:/images/background-light.png"
+ }
+
+ needle: Image {
+ id: needleImage
+ source: "qrc:/images/needle-light.png"
+ transformOrigin: Item.Bottom
+ scale: {
+ var distanceFromLabelToRadius = labelInset / 2;
+ var idealHeight = outerRadius - distanceFromLabelToRadius;
+ var originalImageHeight = needleImage.sourceSize.height;
+ idealHeight / originalImageHeight;
+ }
+ }
+
+ foreground: Item {
+ Image {
+ anchors.centerIn: parent
+ source: "qrc:/images/center-light.png"
+ scale: (outerRadius * 0.25) / sourceSize.height
+ }
+ }
+
+ tickmark: Rectangle {
+ implicitWidth: outerRadius * 0.01
+ antialiasing: true
+ implicitHeight: outerRadius * 0.04
+ color: "#999"
+ }
+
+ minorTickmark: Rectangle {
+ implicitWidth: outerRadius * 0.01
+ antialiasing: true
+ implicitHeight: outerRadius * 0.02
+ color: "#bbb"
+ }
+
+ tickmarkLabel: Text {
+ font.family: "Helvetica neue"
+ font.pixelSize: Math.max(6, outerRadius * 0.1)
+ text: styleData.value
+ color: "#333"
+ }
+}
diff --git a/examples/quickcontrols/extras/gallery/qml/CircularGaugeView.qml b/examples/quickcontrols/extras/gallery/qml/CircularGaugeView.qml
new file mode 100644
index 000000000..cd03ebbe5
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/qml/CircularGaugeView.qml
@@ -0,0 +1,230 @@
+/****************************************************************************
+**
+** 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.1
+import QtQuick.Extras 1.4
+
+ControlView {
+ id: controlView
+ darkBackground: customizerItem.currentStyleDark
+
+ property color fontColor: darkBackground ? "white" : "black"
+
+ property bool accelerating: false
+
+ Keys.onSpacePressed: accelerating = true
+ Keys.onReleased: {
+ if (event.key === Qt.Key_Space) {
+ accelerating = false;
+ event.accepted = true;
+ }
+ }
+
+ Button {
+ id: accelerate
+ text: "Accelerate"
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ height: root.height * 0.125
+
+ onPressedChanged: accelerating = pressed
+
+ style: BlackButtonStyle {
+ background: BlackButtonBackground {
+ pressed: control.pressed
+ }
+ label: Text {
+ text: control.text
+ color: "white"
+ font.pixelSize: Math.max(textSingleton.font.pixelSize, root.toPixels(0.04))
+ font.family: openSans.name
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+ }
+ }
+
+ control: CircularGauge {
+ id: gauge
+ minimumValue: customizerItem.minimumValue
+ maximumValue: customizerItem.maximumValue
+ width: controlBounds.width
+ height: controlBounds.height
+
+ value: accelerating ? maximumValue : 0
+ style: styleMap[customizerItem.currentStylePath]
+
+ // This stops the styles being recreated when a new one is chosen.
+ property var styleMap: {
+ var styles = {};
+ for (var i = 0; i < customizerItem.allStylePaths.length; ++i) {
+ var path = customizerItem.allStylePaths[i];
+ styles[path] = Qt.createComponent(path, gauge);
+ }
+ styles;
+ }
+
+ // Called to update the style after the user has edited a property.
+ Connections {
+ target: customizerItem
+ onMinimumValueAngleChanged: __style.minimumValueAngle = customizerItem.minimumValueAngle
+ onMaximumValueAngleChanged: __style.maximumValueAngle = customizerItem.maximumValueAngle
+ onLabelStepSizeChanged: __style.tickmarkStepSize = __style.labelStepSize = customizerItem.labelStepSize
+ }
+
+ Behavior on value {
+ NumberAnimation {
+ easing.type: Easing.OutCubic
+ duration: 6000
+ }
+ }
+ }
+
+ customizer: Column {
+ readonly property var allStylePaths: {
+ var paths = [];
+ for (var i = 0; i < stylePicker.model.count; ++i) {
+ paths.push(stylePicker.model.get(i).path);
+ }
+ paths;
+ }
+ property alias currentStylePath: stylePicker.currentStylePath
+ property alias currentStyleDark: stylePicker.currentStyleDark
+ property alias minimumValue: minimumValueSlider.value
+ property alias maximumValue: maximumValueSlider.value
+ property alias minimumValueAngle: minimumAngleSlider.value
+ property alias maximumValueAngle: maximumAngleSlider.value
+ property alias labelStepSize: labelStepSizeSlider.value
+
+ id: circularGaugeColumn
+ spacing: customizerPropertySpacing
+
+ readonly property bool isDefaultStyle: stylePicker.model.get(stylePicker.currentIndex).name === "Default"
+
+ Item {
+ id: stylePickerBottomSpacing
+ width: parent.width
+ height: stylePicker.height + textSingleton.implicitHeight
+
+ StylePicker {
+ id: stylePicker
+ currentIndex: 1
+
+ model: ListModel {
+ ListElement {
+ name: "Default"
+ path: "CircularGaugeDefaultStyle.qml"
+ dark: true
+ }
+ ListElement {
+ name: "Dark"
+ path: "CircularGaugeDarkStyle.qml"
+ dark: true
+ }
+ ListElement {
+ name: "Light"
+ path: "CircularGaugeLightStyle.qml"
+ dark: false
+ }
+ }
+ }
+ }
+
+ CustomizerLabel {
+ text: "Minimum angle"
+ }
+
+ CustomizerSlider {
+ id: minimumAngleSlider
+ minimumValue: -180
+ value: -145
+ maximumValue: 180
+ width: parent.width
+ }
+
+ CustomizerLabel {
+ text: "Maximum angle"
+ }
+
+ CustomizerSlider {
+ id: maximumAngleSlider
+ minimumValue: -180
+ value: 145
+ maximumValue: 180
+ }
+
+ CustomizerLabel {
+ text: "Minimum value"
+ }
+
+ CustomizerSlider {
+ id: minimumValueSlider
+ minimumValue: 0
+ value: 0
+ maximumValue: 360
+ stepSize: 1
+ }
+
+ CustomizerLabel {
+ text: "Maximum value"
+ }
+
+ CustomizerSlider {
+ id: maximumValueSlider
+ minimumValue: 0
+ value: 240
+ maximumValue: 300
+ stepSize: 1
+ }
+
+ CustomizerLabel {
+ text: "Label step size"
+ }
+
+ CustomizerSlider {
+ id: labelStepSizeSlider
+ minimumValue: 10
+ value: 20
+ maximumValue: 100
+ stepSize: 20
+ }
+ }
+}
diff --git a/examples/quickcontrols/extras/gallery/qml/ControlLabel.qml b/examples/quickcontrols/extras/gallery/qml/ControlLabel.qml
new file mode 100644
index 000000000..6fdcec110
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/qml/ControlLabel.qml
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** 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.Extras 1.4
+
+Text {
+ font.pixelSize: Math.max(textSingleton.font.pixelSize, Math.min(32, root.toPixels(0.045)))
+ color: "#4e4e4e"
+ styleColor: "#ffffff"
+ style: Text.Raised
+}
diff --git a/examples/quickcontrols/extras/gallery/qml/ControlView.qml b/examples/quickcontrols/extras/gallery/qml/ControlView.qml
new file mode 100644
index 000000000..565ab9d90
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/qml/ControlView.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.Controls 1.1
+
+Rectangle {
+ id: view
+ color: darkBackground ? "transparent" : lightBackgroundColor
+
+ Keys.onReleased: {
+ if (event.key === Qt.Key_Back) {
+ stackView.pop();
+ event.accepted = true;
+ }
+ }
+
+ property bool darkBackground: true
+
+ property Component control
+ property Component customizer
+
+ property alias controlItem: controlLoader.item
+ property alias customizerItem: customizerLoader.item
+
+ property bool isCustomizerVisible: false
+
+ property real margin: root.toPixels(0.05)
+
+ property rect controlBounds: Qt.rect(largestControlItem.x + controlBoundsItem.x,
+ largestControlItem.y + controlBoundsItem.y, controlBoundsItem.width, controlBoundsItem.height)
+
+ Item {
+ id: largestControlItem
+ x: margin
+ y: margin
+ width: isCustomizerVisible ? widthWhenCustomizing : widthWhenNotCustomizing
+ height: isCustomizerVisible ? heightWhenCustomizing : heightWhenNotCustomizing
+
+ readonly property real widthWhenCustomizing: (!isScreenPortrait ? parent.width / 2 : parent.width) - margin * 2
+ readonly property real heightWhenCustomizing: (isScreenPortrait ? parent.height / 2 : parent.height - toolbar.height) - margin * 2
+ readonly property real widthWhenNotCustomizing: parent.width - margin * 2
+ readonly property real heightWhenNotCustomizing: parent.height - toolbar.height - margin * 2
+
+ Item {
+ id: controlBoundsItem
+ x: parent.width / 2 - controlBoundsItem.width / 2
+ y: customizer && customizerItem.visible ? 0 : (isScreenPortrait ? (parent.height / 2) - (controlBoundsItem.height / 2) : 0)
+ width: Math.min(parent.widthWhenCustomizing, parent.widthWhenNotCustomizing)
+ height: Math.min(parent.heightWhenCustomizing, parent.heightWhenNotCustomizing)
+
+ Behavior on x {
+ id: controlXBehavior
+ enabled: false
+ NumberAnimation {}
+ }
+
+ Behavior on y {
+ id: controlYBehavior
+ enabled: false
+ NumberAnimation {}
+ }
+
+ Loader {
+ id: controlLoader
+ sourceComponent: control
+ anchors.centerIn: parent
+
+ property alias view: view
+ }
+ }
+ }
+
+ Flickable {
+ id: flickable
+ // Hide the customizer on the right of the screen if it's not visible.
+ x: (isScreenPortrait ? 0 : (isCustomizerVisible ? largestControlItem.x + largestControlItem.width + margin : view.width)) + margin
+ y: (isScreenPortrait ? largestControlItem.y + largestControlItem.height : 0) + margin
+ width: largestControlItem.width
+ height: parent.height - y - toolbar.height - margin
+ anchors.leftMargin: margin
+ anchors.rightMargin: margin
+ visible: customizerLoader.opacity > 0
+
+ flickableDirection: Flickable.VerticalFlick
+
+ clip: true
+ contentWidth: width
+ contentHeight: customizerLoader.height
+
+ Behavior on x {
+ id: flickableXBehavior
+ enabled: false
+ NumberAnimation {}
+ }
+
+ Behavior on y {
+ id: flickableYBehavior
+ enabled: false
+ NumberAnimation {}
+ }
+
+ Loader {
+ id: customizerLoader
+ sourceComponent: customizer
+ opacity: 0
+ width: flickable.width
+
+ property alias view: view
+
+ Behavior on opacity {
+ NumberAnimation {
+ duration: 300
+ }
+ }
+ }
+ }
+
+ ControlViewToolbar {
+ id: toolbar
+
+ onCustomizeClicked: {
+ controlXBehavior.enabled = !isScreenPortrait;
+ controlYBehavior.enabled = isScreenPortrait;
+
+ isCustomizerVisible = !isCustomizerVisible;
+
+ if (isScreenPortrait) {
+ flickableXBehavior.enabled = false;
+ flickableYBehavior.enabled = true;
+ } else {
+ flickableXBehavior.enabled = true;
+ flickableYBehavior.enabled = false;
+ }
+
+ customizerLoader.opacity = isCustomizerVisible ? 1 : 0;
+ }
+ }
+
+ FlickableMoreIndicator {
+ flickable: flickable
+ atTop: true
+ gradientColor: view.darkBackground ? darkBackgroundColor : lightBackgroundColor
+ }
+
+ FlickableMoreIndicator {
+ flickable: flickable
+ atTop: false
+ gradientColor: view.darkBackground ? darkBackgroundColor : lightBackgroundColor
+ }
+}
diff --git a/examples/quickcontrols/extras/gallery/qml/ControlViewToolbar.qml b/examples/quickcontrols/extras/gallery/qml/ControlViewToolbar.qml
new file mode 100644
index 000000000..60a7e3f8c
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/qml/ControlViewToolbar.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** 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.1
+
+BlackButtonBackground {
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ height: root.height * 0.125
+
+ signal customizeClicked
+
+ gradient: Gradient {
+ GradientStop {
+ color: "#333"
+ position: 0
+ }
+ GradientStop {
+ color: "#222"
+ position: 1
+ }
+ }
+
+ Button {
+ id: back
+ width: parent.height
+ height: parent.height
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ iconSource: "qrc:/images/icon-back.png"
+ onClicked: stackView.pop()
+
+ style: BlackButtonStyle {
+ }
+
+ }
+
+ Button {
+ id: customize
+ width: parent.height
+ height: parent.height
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ iconSource: "qrc:/images/icon-settings.png"
+ visible: customizer
+
+ style: BlackButtonStyle {
+ }
+
+ onClicked: customizeClicked()
+ }
+}
diff --git a/examples/quickcontrols/extras/gallery/qml/CustomizerLabel.qml b/examples/quickcontrols/extras/gallery/qml/CustomizerLabel.qml
new file mode 100644
index 000000000..0e9f4592a
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/qml/CustomizerLabel.qml
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** 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
+
+Text {
+ color: darkBackground ? root.darkFontColor : root.lightFontColor
+ font.pixelSize: root.toPixels(0.04)
+ font.family: openSans.name
+ anchors.horizontalCenter: parent.horizontalCenter
+}
diff --git a/examples/quickcontrols/extras/gallery/qml/CustomizerSlider.qml b/examples/quickcontrols/extras/gallery/qml/CustomizerSlider.qml
new file mode 100644
index 000000000..6a004e864
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/qml/CustomizerSlider.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** 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.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Styles 1.1
+
+Slider {
+ id: slider
+ width: parent.width
+ height: root.toPixels(0.1)
+
+ style: SliderStyle {
+ handle: Rectangle {
+ height: root.toPixels(0.06)
+ width: height
+ radius: width/2
+ color: "#fff"
+ }
+
+ groove: Rectangle {
+ implicitHeight: root.toPixels(0.015)
+ implicitWidth: 100
+ radius: height/2
+ border.color: "#333"
+ color: "#222"
+ Rectangle {
+ height: parent.height
+ width: styleData.handlePosition
+ implicitHeight: 6
+ implicitWidth: 100
+ radius: height/2
+ color: "#555"
+ }
+ }
+
+ }
+}
diff --git a/examples/quickcontrols/extras/gallery/qml/CustomizerSwitch.qml b/examples/quickcontrols/extras/gallery/qml/CustomizerSwitch.qml
new file mode 100644
index 000000000..a64a7f8a0
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/qml/CustomizerSwitch.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** 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.1
+
+Switch {
+ anchors.horizontalCenter: parent.horizontalCenter
+}
diff --git a/examples/quickcontrols/extras/gallery/qml/FlickableMoreIndicator.qml b/examples/quickcontrols/extras/gallery/qml/FlickableMoreIndicator.qml
new file mode 100644
index 000000000..1fb18c01c
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/qml/FlickableMoreIndicator.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
+
+Rectangle {
+ anchors.top: atTop ? flickable.top : undefined
+ anchors.bottom: atTop ? undefined : flickable.bottom
+ anchors.left: isScreenPortrait ? parent.left : parent.horizontalCenter
+ anchors.right: parent.right
+ height: 30
+ visible: flickable.visible
+ opacity: atTop
+ ? (flickable.contentY > showDistance ? 1 : 0)
+ : (flickable.contentY < flickable.contentHeight - showDistance ? 1 : 0)
+ scale: atTop ? 1 : -1
+
+ readonly property real showDistance: 0
+ property Flickable flickable
+ property color gradientColor
+ /*! \c true if this indicator is at the top of the item */
+ property bool atTop
+
+ Behavior on opacity {
+ NumberAnimation {
+ }
+ }
+
+ gradient: Gradient {
+ GradientStop {
+ position: 0.0
+ color: gradientColor
+ }
+ GradientStop {
+ position: 1.0
+ color: "transparent"
+ }
+ }
+}
diff --git a/examples/quickcontrols/extras/gallery/qml/PieMenuControlView.qml b/examples/quickcontrols/extras/gallery/qml/PieMenuControlView.qml
new file mode 100644
index 000000000..bbaa8637a
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/qml/PieMenuControlView.qml
@@ -0,0 +1,187 @@
+/****************************************************************************
+**
+** 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 QtGraphicalEffects 1.0
+import QtQuick.Controls 1.1
+import QtQuick.Extras 1.4
+
+Rectangle {
+ id: view
+ color: customizerItem.currentStyleDark ? "#111" : "#555"
+
+ Behavior on color {
+ ColorAnimation {}
+ }
+
+ Keys.onReleased: {
+ if (event.key === Qt.Key_Back) {
+ stackView.pop();
+ event.accepted = true;
+ }
+ }
+
+ property bool darkBackground: true
+
+ property Component mouseArea
+
+ property Component customizer: Item {
+ property alias currentStylePath: stylePicker.currentStylePath
+ property alias currentStyleDark: stylePicker.currentStyleDark
+
+ StylePicker {
+ id: stylePicker
+ currentIndex: 0
+ width: Math.round(Math.max(textSingleton.implicitHeight * 6 * 2, parent.width * 0.5))
+ anchors.centerIn: parent
+
+ model: ListModel {
+ ListElement {
+ name: "Default"
+ path: "PieMenuDefaultStyle.qml"
+ dark: false
+ }
+ ListElement {
+ name: "Dark"
+ path: "PieMenuDarkStyle.qml"
+ dark: true
+ }
+ }
+ }
+ }
+
+ property alias controlItem: pieMenu
+ property alias customizerItem: customizerLoader.item
+
+ Item {
+ id: controlBoundsItem
+ width: parent.width
+ height: parent.height - toolbar.height
+ visible: customizerLoader.opacity === 0
+
+ Image {
+ id: bgImage
+ anchors.centerIn: parent
+ height: 48
+ Text {
+ id: bgLabel
+ anchors.top: parent.bottom
+ anchors.topMargin: 20
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: "Tap to open"
+ color: "#999"
+ font.pointSize: 20
+ }
+ }
+
+ MouseArea {
+ id: touchArea
+ anchors.fill: parent
+ onClicked: pieMenu.popup(touchArea.mouseX, touchArea.mouseY)
+ }
+
+ PieMenu {
+ id: pieMenu
+ triggerMode: TriggerMode.TriggerOnClick
+ width: Math.min(controlBoundsItem.width, controlBoundsItem.height) * 0.5
+ height: width
+
+ style: Qt.createComponent(customizerItem.currentStylePath)
+
+ MenuItem {
+ text: "Zoom In"
+ onTriggered: {
+ bgImage.source = iconSource
+ bgLabel.text = text + " selected"
+ }
+ iconSource: "qrc:/images/zoom_in.png"
+ }
+ MenuItem {
+ text: "Zoom Out"
+ onTriggered: {
+ bgImage.source = iconSource
+ bgLabel.text = text + " selected"
+ }
+ iconSource: "qrc:/images/zoom_out.png"
+ }
+ MenuItem {
+ text: "Info"
+ onTriggered: {
+ bgImage.source = iconSource
+ bgLabel.text = text + " selected"
+ }
+ iconSource: "qrc:/images/info.png"
+ }
+ }
+ }
+ Loader {
+ id: customizerLoader
+ sourceComponent: customizer
+ opacity: 0
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.leftMargin: 30
+ anchors.rightMargin: 30
+ y: parent.height / 2 - height / 2 - toolbar.height
+ visible: customizerLoader.opacity > 0
+
+ property alias view: view
+
+ Behavior on y {
+ NumberAnimation {
+ duration: 300
+ }
+ }
+
+ Behavior on opacity {
+ NumberAnimation {
+ duration: 300
+ }
+ }
+ }
+
+ ControlViewToolbar {
+ id: toolbar
+
+ onCustomizeClicked: {
+ customizerLoader.opacity = customizerLoader.opacity == 0 ? 1 : 0;
+ }
+ }
+}
diff --git a/examples/quickcontrols/extras/gallery/qml/PieMenuDarkStyle.qml b/examples/quickcontrols/extras/gallery/qml/PieMenuDarkStyle.qml
new file mode 100644
index 000000000..98e042981
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/qml/PieMenuDarkStyle.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** 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.Controls.Styles 1.4
+
+PieMenuStyle {
+ backgroundColor: "#222"
+ shadowColor: Qt.rgba(1, 1, 1, 0.26)
+}
diff --git a/examples/quickcontrols/extras/gallery/qml/PieMenuDefaultStyle.qml b/examples/quickcontrols/extras/gallery/qml/PieMenuDefaultStyle.qml
new file mode 100644
index 000000000..02a189d6b
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/qml/PieMenuDefaultStyle.qml
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** 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.Controls.Styles 1.4
+
+PieMenuStyle {
+}
diff --git a/examples/quickcontrols/extras/gallery/qml/StylePicker.qml b/examples/quickcontrols/extras/gallery/qml/StylePicker.qml
new file mode 100644
index 000000000..f1d2cad22
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/qml/StylePicker.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.4
+import QtQuick.Controls.Styles 1.4
+import QtQuick.Extras 1.4
+
+ListView {
+ id: stylePicker
+ width: parent.width
+ height: root.height * 0.06
+ interactive: false
+ spacing: -1
+
+ orientation: ListView.Horizontal
+
+ readonly property string currentStylePath: stylePicker.model.get(stylePicker.currentIndex).path
+ readonly property bool currentStyleDark: stylePicker.model.get(stylePicker.currentIndex).dark !== undefined
+ ? stylePicker.model.get(stylePicker.currentIndex).dark
+ : true
+
+ ExclusiveGroup {
+ id: styleExclusiveGroup
+ }
+
+ delegate: Button {
+ width: Math.round(stylePicker.width / stylePicker.model.count)
+ height: stylePicker.height
+ checkable: true
+ checked: index === ListView.view.currentIndex
+ exclusiveGroup: styleExclusiveGroup
+
+ onCheckedChanged: {
+ if (checked) {
+ ListView.view.currentIndex = index;
+ }
+ }
+
+ style: ButtonStyle {
+ background: Rectangle {
+ readonly property color checkedColor: currentStyleDark ? "#444" : "#777"
+ readonly property color uncheckedColor: currentStyleDark ? "#222" : "#bbb"
+ color: checked ? checkedColor : uncheckedColor
+ border.color: checkedColor
+ border.width: 1
+ radius: 1
+ }
+
+ label: Text {
+ text: name
+ color: currentStyleDark ? "white" : (checked ? "white" : "black")
+ font.pixelSize: root.toPixels(0.04)
+ font.family: openSans.name
+ anchors.centerIn: parent
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+ }
+ }
+}
diff --git a/examples/quickcontrols/extras/gallery/qml/gallery.qml b/examples/quickcontrols/extras/gallery/qml/gallery.qml
new file mode 100644
index 000000000..d6b46dc15
--- /dev/null
+++ b/examples/quickcontrols/extras/gallery/qml/gallery.qml
@@ -0,0 +1,439 @@
+/****************************************************************************
+**
+** 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 QtGraphicalEffects 1.0
+import QtQuick.Controls 1.4
+import QtQuick.Controls.Styles 1.4
+import QtQuick.Dialogs 1.0
+import QtQuick.Extras 1.4
+import QtQuick.Layouts 1.0
+import QtQuick.Window 2.1
+
+Window {
+ id: root
+ objectName: "window"
+ visible: true
+ width: 480
+ height: 800
+
+ color: "#161616"
+ title: "Qt Quick Extras Demo"
+
+ function toPixels(percentage) {
+ return percentage * Math.min(root.width, root.height);
+ }
+
+ property bool isScreenPortrait: height > width
+ property color lightFontColor: "#222"
+ property color darkFontColor: "#e7e7e7"
+ readonly property color lightBackgroundColor: "#cccccc"
+ readonly property color darkBackgroundColor: "#161616"
+ property real customizerPropertySpacing: 10
+ property real colorPickerRowSpacing: 8
+
+ Text {
+ id: textSingleton
+ }
+
+ property Component circularGauge: CircularGaugeView {}
+
+ property Component dial: ControlView {
+ darkBackground: false
+
+ control: Column {
+ id: dialColumn
+ width: controlBounds.width
+ height: controlBounds.height - spacing
+ spacing: root.toPixels(0.05)
+
+ ColumnLayout {
+ id: volumeColumn
+ width: parent.width
+ height: (dialColumn.height - dialColumn.spacing) / 2
+ spacing: height * 0.025
+
+ Dial {
+ id: volumeDial
+ anchors.horizontalCenter: parent.horizontalCenter
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+
+ /*!
+ Determines whether the dial animates its rotation to the new value when
+ a single click or touch is received on the dial.
+ */
+ property bool animate: customizerItem.animate
+
+ Behavior on value {
+ enabled: volumeDial.animate && !volumeDial.pressed
+ NumberAnimation {
+ duration: 300
+ easing.type: Easing.OutSine
+ }
+ }
+ }
+
+ ControlLabel {
+ id: volumeText
+ text: "Volume"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+
+ ColumnLayout {
+ id: trebleColumn
+ width: parent.width
+ height: (dialColumn.height - dialColumn.spacing) / 2
+ spacing: height * 0.025
+
+ Dial {
+ id: dial2
+ anchors.horizontalCenter: parent.horizontalCenter
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+
+ stepSize: 1
+ maximumValue: 10
+
+ style: DialStyle {
+ labelInset: outerRadius * 0
+ }
+ }
+
+ ControlLabel {
+ id: trebleText
+ text: "Treble"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+ }
+
+ customizer: Column {
+ spacing: customizerPropertySpacing
+
+ property alias animate: animateCheckBox.checked
+
+ CustomizerLabel {
+ text: "Animate"
+ }
+
+ CustomizerSwitch {
+ id: animateCheckBox
+ }
+ }
+ }
+
+ property Component delayButton: ControlView {
+ darkBackground: false
+
+ control: DelayButton {
+ text: "Alarm"
+ anchors.centerIn: parent
+ }
+ }
+
+ property Component gauge: ControlView {
+ id: gaugeView
+ control: Gauge {
+ id: gauge
+ width: orientation === Qt.Vertical ? implicitWidth : gaugeView.controlBounds.width
+ height: orientation === Qt.Vertical ? gaugeView.controlBounds.height : implicitHeight
+ anchors.centerIn: parent
+
+ minimumValue: 0
+ value: customizerItem.value
+ maximumValue: 100
+ orientation: customizerItem.orientationFlag ? Qt.Vertical : Qt.Horizontal
+ tickmarkAlignment: orientation === Qt.Vertical
+ ? (customizerItem.alignFlag ? Qt.AlignLeft : Qt.AlignRight)
+ : (customizerItem.alignFlag ? Qt.AlignTop : Qt.AlignBottom)
+ }
+
+ customizer: Column {
+ spacing: customizerPropertySpacing
+
+ property alias value: valueSlider.value
+ property alias orientationFlag: orientationCheckBox.checked
+ property alias alignFlag: alignCheckBox.checked
+
+ CustomizerLabel {
+ text: "Value"
+ }
+
+ CustomizerSlider {
+ id: valueSlider
+ minimumValue: 0
+ value: 50
+ maximumValue: 100
+ }
+
+ CustomizerLabel {
+ text: "Vertical orientation"
+ }
+
+ CustomizerSwitch {
+ id: orientationCheckBox
+ checked: true
+ }
+
+ CustomizerLabel {
+ text: controlItem.orientation === Qt.Vertical ? "Left align" : "Top align"
+ }
+
+ CustomizerSwitch {
+ id: alignCheckBox
+ checked: true
+ }
+ }
+ }
+
+ property Component toggleButton: ControlView {
+ darkBackground: false
+
+ control: ToggleButton {
+ text: checked ? "On" : "Off"
+ anchors.centerIn: parent
+ }
+ }
+
+ property Component pieMenu: PieMenuControlView {}
+
+ property Component statusIndicator: ControlView {
+ id: statusIndicatorView
+ darkBackground: false
+
+ Timer {
+ id: recordingFlashTimer
+ running: true
+ repeat: true
+ interval: 1000
+ }
+
+ ColumnLayout {
+ id: indicatorLayout
+ width: statusIndicatorView.controlBounds.width * 0.25
+ height: statusIndicatorView.controlBounds.height * 0.75
+ anchors.centerIn: parent
+
+ Repeater {
+ model: ListModel {
+ id: indicatorModel
+ ListElement {
+ name: "Power"
+ indicatorColor: "#35e02f"
+ }
+ ListElement {
+ name: "Recording"
+ indicatorColor: "red"
+ }
+ }
+
+ ColumnLayout {
+ Layout.preferredWidth: indicatorLayout.width
+ spacing: 0
+
+ StatusIndicator {
+ id: indicator
+ color: indicatorColor
+ Layout.preferredWidth: statusIndicatorView.controlBounds.width * 0.07
+ Layout.preferredHeight: Layout.preferredWidth
+ Layout.alignment: Qt.AlignHCenter
+ on: true
+
+ Connections {
+ target: recordingFlashTimer
+ onTriggered: if (name == "Recording") indicator.active = !indicator.active
+ }
+ }
+ ControlLabel {
+ id: indicatorLabel
+ text: name
+ Layout.alignment: Qt.AlignHCenter
+ Layout.maximumWidth: parent.width
+ horizontalAlignment: Text.AlignHCenter
+ }
+ }
+ }
+ }
+ }
+
+ property Component tumbler: ControlView {
+ id: tumblerView
+ darkBackground: false
+
+ Tumbler {
+ id: tumbler
+ anchors.centerIn: parent
+
+ // TODO: Use FontMetrics with 5.4
+ Label {
+ id: characterMetrics
+ font.bold: true
+ font.pixelSize: textSingleton.font.pixelSize * 1.25
+ font.family: openSans.name
+ visible: false
+ text: "M"
+ }
+
+ readonly property real delegateTextMargins: characterMetrics.width * 1.5
+ readonly property var days: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
+
+ TumblerColumn {
+ id: tumblerDayColumn
+
+ function updateModel() {
+ var previousIndex = tumblerDayColumn.currentIndex;
+ var newDays = tumbler.days[monthColumn.currentIndex];
+
+ if (!model) {
+ var array = [];
+ for (var i = 0; i < newDays; ++i) {
+ array.push(i + 1);
+ }
+ model = array;
+ } else {
+ // If we've already got days in the model, just add or remove
+ // the minimum amount necessary to make spinning the month column fast.
+ var difference = model.length - newDays;
+ if (model.length > newDays) {
+ model.splice(model.length - 1, difference);
+ } else {
+ var lastDay = model[model.length - 1];
+ for (i = lastDay; i < lastDay + difference; ++i) {
+ model.push(i + 1);
+ }
+ }
+ }
+
+ tumbler.setCurrentIndexAt(0, Math.min(newDays - 1, previousIndex));
+ }
+ }
+ TumblerColumn {
+ id: monthColumn
+ width: characterMetrics.width * 3 + tumbler.delegateTextMargins
+ model: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
+ onCurrentIndexChanged: tumblerDayColumn.updateModel()
+ }
+ TumblerColumn {
+ width: characterMetrics.width * 4 + tumbler.delegateTextMargins
+ model: ListModel {
+ Component.onCompleted: {
+ for (var i = 2000; i < 2100; ++i) {
+ append({value: i.toString()});
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+ FontLoader {
+ id: openSans
+ source: "qrc:/fonts/OpenSans-Regular.ttf"
+ }
+
+ property var componentMap: {
+ "CircularGauge": circularGauge,
+ "DelayButton": delayButton,
+ "Dial": dial,
+ "Gauge": gauge,
+ "PieMenu": pieMenu,
+ "StatusIndicator": statusIndicator,
+ "ToggleButton": toggleButton,
+ "Tumbler": tumbler
+ }
+
+ StackView {
+ id: stackView
+ anchors.fill: parent
+
+ initialItem: ListView {
+ model: ListModel {
+ ListElement {
+ title: "CircularGauge"
+ }
+ ListElement {
+ title: "DelayButton"
+ }
+ ListElement {
+ title: "Dial"
+ }
+ ListElement {
+ title: "Gauge"
+ }
+ ListElement {
+ title: "PieMenu"
+ }
+ ListElement {
+ title: "StatusIndicator"
+ }
+ ListElement {
+ title: "ToggleButton"
+ }
+ ListElement {
+ title: "Tumbler"
+ }
+ }
+
+ delegate: Button {
+ width: stackView.width
+ height: root.height * 0.125
+ text: title
+
+ style: BlackButtonStyle {
+ fontColor: root.darkFontColor
+ rightAlignedIconSource: "qrc:/images/icon-go.png"
+ }
+
+ onClicked: {
+ if (stackView.depth == 1) {
+ // Only push the control view if we haven't already pushed it...
+ stackView.push({item: componentMap[title]});
+ stackView.currentItem.forceActiveFocus();
+ }
+ }
+ }
+ }
+ }
+}
+
+
diff --git a/examples/quickcontrols/quickcontrols.pro b/examples/quickcontrols/quickcontrols.pro
new file mode 100644
index 000000000..dfe855099
--- /dev/null
+++ b/examples/quickcontrols/quickcontrols.pro
@@ -0,0 +1,5 @@
+TEMPLATE = subdirs
+SUBDIRS = \
+ controls \
+ dialogs \
+ extras