summaryrefslogtreecommitdiffstats
path: root/examples/quick/controls
diff options
context:
space:
mode:
Diffstat (limited to 'examples/quick/controls')
-rw-r--r--examples/quick/controls/ApplicationTemplate/ApplicationTemplate.pro16
-rw-r--r--examples/quick/controls/ApplicationTemplate/main.cpp66
-rw-r--r--examples/quick/controls/ApplicationTemplate/qml/images/qt_icon.pngbin0 -> 6396 bytes
-rw-r--r--examples/quick/controls/ApplicationTemplate/qml/main.qml86
-rw-r--r--examples/quick/controls/ApplicationTemplate/resources.qrc6
-rw-r--r--examples/quick/controls/basiclayouts/basiclayouts.qmlproject16
-rw-r--r--examples/quick/controls/basiclayouts/main.qml120
-rw-r--r--examples/quick/controls/controls.pro13
-rw-r--r--examples/quick/controls/gallery/content/ChildWindow.qml122
-rw-r--r--examples/quick/controls/gallery/content/Controls.qml180
-rw-r--r--examples/quick/controls/gallery/content/ImageViewer.qml58
-rw-r--r--examples/quick/controls/gallery/content/ModelView.qml96
-rw-r--r--examples/quick/controls/gallery/content/Panel.qml140
-rw-r--r--examples/quick/controls/gallery/content/Styles.qml291
-rw-r--r--examples/quick/controls/gallery/gallery.pro10
-rw-r--r--examples/quick/controls/gallery/gallery.qmlproject16
-rw-r--r--examples/quick/controls/gallery/images/document-open.pngbin0 -> 1550 bytes
-rw-r--r--examples/quick/controls/gallery/images/[email protected]bin0 -> 3355 bytes
-rw-r--r--examples/quick/controls/gallery/images/document-save-as.pngbin0 -> 1837 bytes
-rw-r--r--examples/quick/controls/gallery/images/[email protected]bin0 -> 4500 bytes
-rw-r--r--examples/quick/controls/gallery/images/folder_new.pngbin0 -> 1199 bytes
-rw-r--r--examples/quick/controls/gallery/images/go-next.pngbin0 -> 1219 bytes
-rw-r--r--examples/quick/controls/gallery/images/go-previous.pngbin0 -> 1200 bytes
-rw-r--r--examples/quick/controls/gallery/images/page.pngbin0 -> 639 bytes
-rw-r--r--examples/quick/controls/gallery/images/panel.pngbin0 -> 1756 bytes
-rw-r--r--examples/quick/controls/gallery/images/preferences-system.pngbin0 -> 2129 bytes
-rw-r--r--examples/quick/controls/gallery/images/process-stop.pngbin0 -> 1927 bytes
-rw-r--r--examples/quick/controls/gallery/images/tab.pngbin0 -> 9877 bytes
-rw-r--r--examples/quick/controls/gallery/images/tab_selected.pngbin0 -> 10184 bytes
-rw-r--r--examples/quick/controls/gallery/images/toplevel_window.pngbin0 -> 3690 bytes
-rw-r--r--examples/quick/controls/gallery/images/view-refresh.pngbin0 -> 2024 bytes
-rw-r--r--examples/quick/controls/gallery/images/window-new.pngbin0 -> 671 bytes
-rw-r--r--examples/quick/controls/gallery/images/[email protected]bin0 -> 1900 bytes
-rw-r--r--examples/quick/controls/gallery/main.qml293
-rw-r--r--examples/quick/controls/splitview/main.qml89
-rw-r--r--examples/quick/controls/splitview/splitview.pro4
-rw-r--r--examples/quick/controls/splitview/splitview.qmlproject16
-rw-r--r--examples/quick/controls/stackview/ButtonMenu.qml61
-rw-r--r--examples/quick/controls/stackview/View.qml49
-rw-r--r--examples/quick/controls/stackview/main.qml65
-rw-r--r--examples/quick/controls/stackview/stackview.pro6
-rw-r--r--examples/quick/controls/stackview/stackview.qmlproject16
-rw-r--r--examples/quick/controls/tableview/images/header.pngbin0 -> 356 bytes
-rw-r--r--examples/quick/controls/tableview/images/selectedrow.pngbin0 -> 303 bytes
-rw-r--r--examples/quick/controls/tableview/main.qml427
-rw-r--r--examples/quick/controls/tableview/tableview.pro4
-rw-r--r--examples/quick/controls/tableview/tableview.qmlproject16
-rw-r--r--examples/quick/controls/text/example.html79
-rw-r--r--examples/quick/controls/text/qml/images/editcopy.pngbin0 -> 1468 bytes
-rw-r--r--examples/quick/controls/text/qml/images/editcut.pngbin0 -> 1512 bytes
-rw-r--r--examples/quick/controls/text/qml/images/editpaste.pngbin0 -> 1906 bytes
-rw-r--r--examples/quick/controls/text/qml/images/editredo.pngbin0 -> 1752 bytes
-rw-r--r--examples/quick/controls/text/qml/images/editundo.pngbin0 -> 1746 bytes
-rw-r--r--examples/quick/controls/text/qml/images/exportpdf.pngbin0 -> 1215 bytes
-rw-r--r--examples/quick/controls/text/qml/images/filenew.pngbin0 -> 1172 bytes
-rw-r--r--examples/quick/controls/text/qml/images/fileopen.pngbin0 -> 2168 bytes
-rw-r--r--examples/quick/controls/text/qml/images/fileprint.pngbin0 -> 2087 bytes
-rw-r--r--examples/quick/controls/text/qml/images/filesave.pngbin0 -> 1206 bytes
-rw-r--r--examples/quick/controls/text/qml/images/logo32.pngbin0 -> 1410 bytes
-rw-r--r--examples/quick/controls/text/qml/images/textbold.pngbin0 -> 1611 bytes
-rw-r--r--examples/quick/controls/text/qml/images/textcenter.pngbin0 -> 1404 bytes
-rw-r--r--examples/quick/controls/text/qml/images/textitalic.pngbin0 -> 1164 bytes
-rw-r--r--examples/quick/controls/text/qml/images/textjustify.pngbin0 -> 1257 bytes
-rw-r--r--examples/quick/controls/text/qml/images/textleft.pngbin0 -> 1235 bytes
-rw-r--r--examples/quick/controls/text/qml/images/textright.pngbin0 -> 1406 bytes
-rw-r--r--examples/quick/controls/text/qml/images/textunder.pngbin0 -> 1183 bytes
-rw-r--r--examples/quick/controls/text/qml/images/zoomin.pngbin0 -> 1696 bytes
-rw-r--r--examples/quick/controls/text/qml/images/zoomout.pngbin0 -> 1662 bytes
-rw-r--r--examples/quick/controls/text/qml/main.qml261
-rw-r--r--examples/quick/controls/text/resources.qrc26
-rw-r--r--examples/quick/controls/text/src/documenthandler.cpp284
-rw-r--r--examples/quick/controls/text/src/documenthandler.h165
-rw-r--r--examples/quick/controls/text/src/main.cpp72
-rw-r--r--examples/quick/controls/text/src/src.pri9
-rw-r--r--examples/quick/controls/text/text.pro19
-rw-r--r--examples/quick/controls/touch/content/AndroidDelegate.qml92
-rw-r--r--examples/quick/controls/touch/content/ButtonPage.qml115
-rw-r--r--examples/quick/controls/touch/content/ProgressBarPage.qml114
-rw-r--r--examples/quick/controls/touch/content/SliderPage.qml106
-rw-r--r--examples/quick/controls/touch/content/TabBarPage.qml101
-rw-r--r--examples/quick/controls/touch/content/TextInputPage.qml106
-rw-r--r--examples/quick/controls/touch/images/NOTICE.txt2
-rw-r--r--examples/quick/controls/touch/images/button_default.pngbin0 -> 1406 bytes
-rw-r--r--examples/quick/controls/touch/images/button_pressed.pngbin0 -> 1694 bytes
-rw-r--r--examples/quick/controls/touch/images/navigation_next_item.pngbin0 -> 1341 bytes
-rw-r--r--examples/quick/controls/touch/images/navigation_previous_item.pngbin0 -> 1343 bytes
-rw-r--r--examples/quick/controls/touch/images/tab_selected.pngbin0 -> 217 bytes
-rw-r--r--examples/quick/controls/touch/images/tabs_standard.pngbin0 -> 1230 bytes
-rw-r--r--examples/quick/controls/touch/images/textinput.pngbin0 -> 4132 bytes
-rw-r--r--examples/quick/controls/touch/images/toolbar.pngbin0 -> 1643 bytes
-rw-r--r--examples/quick/controls/touch/main.qml150
-rw-r--r--examples/quick/controls/touch/touch.pro10
-rw-r--r--examples/quick/controls/touch/touch.qmlproject16
93 files changed, 4009 insertions, 0 deletions
diff --git a/examples/quick/controls/ApplicationTemplate/ApplicationTemplate.pro b/examples/quick/controls/ApplicationTemplate/ApplicationTemplate.pro
new file mode 100644
index 000000000..f877756dc
--- /dev/null
+++ b/examples/quick/controls/ApplicationTemplate/ApplicationTemplate.pro
@@ -0,0 +1,16 @@
+QT += qml quick widgets
+CONFIG += console
+TARGET = application
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ qml/main.qml
+
+RESOURCES += \
+ resources.qrc
+
+MOC_DIR = ./.moc
+OBJECTS_DIR = ./.obj
+UI_DIR = ./.ui
+RCC_DIR = ./.rcc
diff --git a/examples/quick/controls/ApplicationTemplate/main.cpp b/examples/quick/controls/ApplicationTemplate/main.cpp
new file mode 100644
index 000000000..ef8dd8048
--- /dev/null
+++ b/examples/quick/controls/ApplicationTemplate/main.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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 <QtWidgets/QApplication>
+#include <QtQml>
+#include <QtQuick/QQuickView>
+
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(QUrl("qrc:/qml/main.qml"));
+ if ( !component.isReady() ) {
+ qWarning("%s", qPrintable(component.errorString()));
+ return -1;
+ }
+ QObject *topLevel = component.create();
+ QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
+ if ( !window ) {
+ qWarning("Error: Your root item has to be a Window.");
+ return -1;
+ }
+ QObject::connect(&engine, SIGNAL(quit()), &app, SLOT(quit()));
+ window->show();
+ return app.exec();
+}
diff --git a/examples/quick/controls/ApplicationTemplate/qml/images/qt_icon.png b/examples/quick/controls/ApplicationTemplate/qml/images/qt_icon.png
new file mode 100644
index 000000000..229cdb006
--- /dev/null
+++ b/examples/quick/controls/ApplicationTemplate/qml/images/qt_icon.png
Binary files differ
diff --git a/examples/quick/controls/ApplicationTemplate/qml/main.qml b/examples/quick/controls/ApplicationTemplate/qml/main.qml
new file mode 100644
index 000000000..0c92e9cad
--- /dev/null
+++ b/examples/quick/controls/ApplicationTemplate/qml/main.qml
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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 1.0
+import QtQuick.Layouts 1.0
+
+ApplicationWindow {
+ width: 640
+ height: 480
+ minimumWidth: 400
+ minimumHeight: 300
+
+ menuBar: MenuBar {
+ Menu {
+ title: "File"
+ MenuItem { text: "Quit"; onTriggered: Qt.quit() }
+ }
+ Menu {
+ title: "Help"
+ MenuItem { text: "About..."; enabled: false }
+ }
+ }
+
+ toolBar: ToolBar {
+ RowLayout {
+ ToolButton { iconSource: "qrc:images/qt_icon.png" }
+ ToolButton { iconSource: "qrc:images/qt_icon.png" }
+ }
+ }
+
+ SplitView {
+ anchors.fill: parent
+ TableView {
+ frameVisible: false
+ highlightOnFocus: false
+ model: 40
+ TableViewColumn { title: "Left Column" }
+ }
+ TextArea {
+ frameVisible: false
+ highlightOnFocus: false
+ text: "Hello World"
+ }
+ }
+}
diff --git a/examples/quick/controls/ApplicationTemplate/resources.qrc b/examples/quick/controls/ApplicationTemplate/resources.qrc
new file mode 100644
index 000000000..dfdba433d
--- /dev/null
+++ b/examples/quick/controls/ApplicationTemplate/resources.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/">
+ <file>qml/main.qml</file>
+ <file>qml/images/qt_icon.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/quick/controls/basiclayouts/basiclayouts.qmlproject b/examples/quick/controls/basiclayouts/basiclayouts.qmlproject
new file mode 100644
index 000000000..e5a8bf02c
--- /dev/null
+++ b/examples/quick/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/quick/controls/basiclayouts/main.qml b/examples/quick/controls/basiclayouts/main.qml
new file mode 100644
index 000000000..7b83a2e07
--- /dev/null
+++ b/examples/quick/controls/basiclayouts/main.qml
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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.0
+import QtQuick.Layouts 1.0
+
+ApplicationWindow {
+ title: "Basic layouts"
+ property int margin: 11
+ minimumWidth: mainLayout.implicitWidth + 2 * margin
+ minimumHeight: mainLayout.implicitHeight + 2 * margin
+ width: minimumWidth
+ height: minimumHeight
+
+ ColumnLayout {
+ id: mainLayout
+ anchors.fill: parent
+ anchors.margins: margin
+ GroupBox {
+ id: rowBox
+ title: "Row layout"
+ contentWidth: rowLayout.implicitWidth
+ contentHeight: rowLayout.implicitHeight
+ 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"
+ contentWidth: gridLayout.implicitWidth
+ contentHeight: gridLayout.implicitHeight
+ 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.preferredWidth: 200
+ Layout.preferredHeight: 400
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ }
+ }
+}
diff --git a/examples/quick/controls/controls.pro b/examples/quick/controls/controls.pro
new file mode 100644
index 000000000..0be155cd7
--- /dev/null
+++ b/examples/quick/controls/controls.pro
@@ -0,0 +1,13 @@
+TEMPLATE = subdirs
+
+SUBDIRS += \
+ gallery \
+ splitview \
+ stackview \
+ tableview \
+ touch
+
+qtHaveModule(widgets) {
+ SUBDIRS += text \
+ ApplicationTemplate
+}
diff --git a/examples/quick/controls/gallery/content/ChildWindow.qml b/examples/quick/controls/gallery/content/ChildWindow.qml
new file mode 100644
index 000000000..5473e834e
--- /dev/null
+++ b/examples/quick/controls/gallery/content/ChildWindow.qml
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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.Window 2.1
+import QtQuick.Controls 1.0
+
+Window {
+ id: window1
+
+ width: 400
+ height: 400
+
+ title: "child window"
+ flags: Qt.Dialog
+
+ Rectangle {
+ color: syspal.window
+ anchors.fill: parent
+
+ Text {
+ id: dimensionsText
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: parent.top
+ width: parent.width
+ horizontalAlignment: Text.AlignHCenter
+ }
+
+ Text {
+ id: availableDimensionsText
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: dimensionsText.bottom
+ width: parent.width
+ horizontalAlignment: Text.AlignHCenter
+ }
+
+ Text {
+ id: closeText
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: availableDimensionsText.bottom
+ text: "This is a new Window, press the\nbutton below to close it again."
+ }
+ Button {
+ anchors.horizontalCenter: closeText.horizontalCenter
+ anchors.top: closeText.bottom
+ id: closeWindowButton
+ text:"Close"
+ width: 98
+ tooltip:"Press me, to close this window again"
+ onClicked: window1.visible = false
+ }
+ Button {
+ anchors.horizontalCenter: closeText.horizontalCenter
+ anchors.top: closeWindowButton.bottom
+ id: maximizeWindowButton
+ text:"Maximize"
+ width: 98
+ tooltip:"Press me, to maximize this window again"
+ onClicked: window1.visibility = Window.Maximized;
+ }
+ Button {
+ anchors.horizontalCenter: closeText.horizontalCenter
+ anchors.top: maximizeWindowButton.bottom
+ id: normalizeWindowButton
+ text:"Normalize"
+ width: 98
+ tooltip:"Press me, to normalize this window again"
+ onClicked: window1.visibility = Window.Windowed;
+ }
+ Button {
+ anchors.horizontalCenter: closeText.horizontalCenter
+ anchors.top: normalizeWindowButton.bottom
+ id: minimizeWindowButton
+ text:"Minimize"
+ width: 98
+ tooltip:"Press me, to minimize this window again"
+ onClicked: window1.visibility = Window.Minimized;
+ }
+ }
+}
+
diff --git a/examples/quick/controls/gallery/content/Controls.qml b/examples/quick/controls/gallery/content/Controls.qml
new file mode 100644
index 000000000..abcebbebc
--- /dev/null
+++ b/examples/quick/controls/gallery/content/Controls.qml
@@ -0,0 +1,180 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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.0
+import QtQuick.Controls.Styles 1.0
+
+Item {
+ id: flickable
+ anchors.fill: parent
+ enabled: enabledCheck.checked
+
+ property int tabPosition: tabPositionGroup.current === r2 ? Qt.BottomEdge : Qt.TopEdge
+
+ Row {
+ id: contentRow
+ anchors.fill:parent
+ anchors.margins: 8
+ spacing: 16
+ Column {
+ id: firstColumn
+ spacing: 9
+ Row {
+ spacing:8
+ Button {
+ id: button1
+ text: "Button 1"
+ width: 97
+ tooltip:"This is an interesting tool tip"
+ }
+ Button {
+ id:button2
+ text:"Button 2"
+ width:97
+ }
+ }
+ ComboBox {
+ id: combo;
+ model: choices;
+ width: parent.width;
+ currentIndex: 2
+ }
+ Row {
+ spacing: 8
+ SpinBox {
+ id: t1
+ width: 97
+
+ minimumValue: -50
+ value: -20
+ }
+ SpinBox {
+ id: t2
+ width:97
+ }
+ }
+ TextField {
+ id: t3
+ placeholderText: "This is a placeholder for a TextField"
+ width: 200
+ }
+ ProgressBar {
+ // normalize value [0.0 .. 1.0]
+ value: (slider.value - slider.minimumValue) / (slider.maximumValue - slider.minimumValue)
+ }
+ ProgressBar {
+ indeterminate: true
+ }
+ Slider {
+ id: slider
+ value: 0.5
+ width: 200
+ tickmarksEnabled: tickmarkCheck.checked
+ }
+ }
+ Column {
+ id: rightcol
+ spacing: 12
+ anchors {
+ top: parent.top
+ bottom: parent.bottom
+ }
+
+ GroupBox {
+ id: group1
+ title: "CheckBox"
+ width: area.width
+ Row {
+ CheckBox {
+ id: frameCheckbox
+ text: "Text frame"
+ checked: true
+ width: 100
+ }
+ CheckBox {
+ id: tickmarkCheck
+ text: "Tickmarks"
+ checked: false
+ }
+ CheckBox {
+ id: wrapCheck
+ text: "Word wrap"
+ checked: true
+ }
+ }
+ }
+ GroupBox {
+ id: group2
+ title:"Tab Position"
+ width: area.width
+ ExclusiveGroup { id: tabPositionGroup }
+ Row {
+ RadioButton {
+ id: r1
+ text: "Top"
+ checked: true
+ exclusiveGroup: tabPositionGroup
+ width: 100
+ }
+ RadioButton {
+ id: r2
+ text: "Bottom"
+ exclusiveGroup: tabPositionGroup
+ }
+ }
+ }
+
+ TextArea {
+ id: area
+ frameVisible: frameCheckbox.checked
+ text: loremIpsum + loremIpsum
+ wrapMode: wrapCheck.checked ? TextEdit.WordWrap : TextEdit.NoWrap
+ width: contentRow.width - firstColumn.width - contentRow.spacing
+ height: parent.height - group1.height - group2.height - 2 * parent.spacing
+ anchors { right: parent.right }
+ }
+ }
+ }
+}
diff --git a/examples/quick/controls/gallery/content/ImageViewer.qml b/examples/quick/controls/gallery/content/ImageViewer.qml
new file mode 100644
index 000000000..0b045bf6a
--- /dev/null
+++ b/examples/quick/controls/gallery/content/ImageViewer.qml
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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.Window 2.1
+
+Window {
+ id: imageViewer
+ minimumWidth: viewerImage.width
+ minimumHeight: viewerImage.height
+ function open(source) {
+ viewerImage.source = source
+ width = viewerImage.implicitWidth + 20
+ height = viewerImage.implicitHeight + 20
+ title = source
+ visible = true
+ }
+ Image {
+ id: viewerImage
+ anchors.centerIn: parent
+ }
+}
diff --git a/examples/quick/controls/gallery/content/ModelView.qml b/examples/quick/controls/gallery/content/ModelView.qml
new file mode 100644
index 000000000..237604e5d
--- /dev/null
+++ b/examples/quick/controls/gallery/content/ModelView.qml
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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.0
+//import QtQuick.XmlListModel 2.1
+
+Item {
+ id: root
+ width: 600
+ height: 300
+ anchors.fill: parent
+ anchors.margins: Qt.platform.os === "mac" ? 12 : 0
+
+// XmlListModel {
+// id: flickerModel
+// source: "http://api.flickr.com/services/feeds/photos_public.gne?format=rss2&tags=" + "Cat"
+// query: "/rss/channel/item"
+// namespaceDeclarations: "declare namespace media=\"http://search.yahoo.com/mrss/\";"
+// XmlRole { name: "title"; query: "title/string()" }
+// XmlRole { name: "imagesource"; query: "media:thumbnail/@url/string()" }
+// XmlRole { name: "credit"; query: "media:credit/string()" }
+// }
+
+ ListModel {
+ id: dummyModel
+ Component.onCompleted: {
+ for (var i = 0 ; i < 100 ; ++i) {
+ append({"title": "A title " + i, "imagesource" :"http://someurl.com", "credit" : "N/A"})
+ }
+ }
+ }
+
+ TableView{
+ model: dummyModel
+ anchors.fill: parent
+
+ TableViewColumn {
+ role: "title"
+ title: "Title"
+ width: 120
+ }
+ TableViewColumn {
+ role: "credit"
+ title: "Credit"
+ width: 120
+ }
+ TableViewColumn {
+ role: "imagesource"
+ title: "Image source"
+ width: 200
+ visible: true
+ }
+ }
+}
diff --git a/examples/quick/controls/gallery/content/Panel.qml b/examples/quick/controls/gallery/content/Panel.qml
new file mode 100644
index 000000000..bdb10f834
--- /dev/null
+++ b/examples/quick/controls/gallery/content/Panel.qml
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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.0
+
+Rectangle {
+ id:root
+
+ width: 540
+ height: 340
+ color:"#c3c3c3"
+ ScrollView {
+ frameVisible: false
+ anchors.fill: parent
+
+ Item {
+ width:600
+ height:600
+ BorderImage {
+ id: page
+ source: "../images/page.png"
+ y:10; x:50
+ width: 400; height: 400
+ border.left: 12; border.top: 12
+ border.right: 12; border.bottom: 12
+ Text {
+ id:text
+ anchors.fill: parent
+ anchors.margins: 40
+ text:textfield.text
+ }
+ Rectangle {
+ border.color: "#444"
+ anchors.centerIn: parent
+ color: Qt.rgba(s1.value, s2.value, s3.value)
+ width: 200
+ height: width
+ }
+
+ }
+
+ BorderImage {
+ id: sidebar
+ source: "../images/panel.png"
+ anchors.left: parent.left
+ anchors.top: parent.top
+ width: show ? 160 : 40
+ height:root.height
+ Behavior on width { NumberAnimation { easing.type: Easing.OutSine ; duration: 250 } }
+ property bool show: false
+ border.left: 0;
+ border.right: 26;
+ MouseArea {
+ id:mouseArea
+ anchors.fill: parent
+ onClicked: sidebar.show = !sidebar.show
+ }
+ Column {
+ id: panel1
+ opacity: sidebar.show ? 1 : 0
+ Behavior on opacity { NumberAnimation { easing.type:Easing.InCubic; duration: 600} }
+
+ scale: sidebar.show ? 1 : 0
+ Behavior on scale { NumberAnimation { easing.type:Easing.InCubic; duration: 200 } }
+ transformOrigin: Item.Top
+
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.margins: 12
+ spacing:12
+
+ Button { width: parent.width - 12; text: "Close Panel"; onClicked: sidebar.show = false}
+ TextField { id: textfield; text: "Some text" ; width: parent.width - 12}
+ SpinBox { width: parent.width - 12}
+ CheckBox{ id: expander; text:"Sliders"}
+ }
+
+ Column {
+ id: panel2
+ opacity: expander.checked && sidebar.show ? 1 : 0
+ scale: opacity
+ Behavior on opacity{ NumberAnimation { easing.type:Easing.OutSine; duration: 300}}
+ transformOrigin: Item.Top
+ anchors.top: panel1.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.margins: 12
+ spacing: 12
+ Slider { id: s1; width:parent.width - 12; value:0.5}
+ Slider { id: s2; width:parent.width - 12; value:0.5}
+ Slider { id: s3; width:parent.width - 12; value:0.5}
+
+ }
+ }
+ }
+ }
+}
diff --git a/examples/quick/controls/gallery/content/Styles.qml b/examples/quick/controls/gallery/content/Styles.qml
new file mode 100644
index 000000000..618b2d7fa
--- /dev/null
+++ b/examples/quick/controls/gallery/content/Styles.qml
@@ -0,0 +1,291 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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.0
+import QtQuick.Controls.Styles 1.0
+import QtQuick.Dialogs 1.0
+
+Item {
+ id: root
+ width: 300
+ height: 200
+
+ ColorDialog {
+ id: colorDialog
+ color: "#afe"
+ property color last: "#afe"
+ onRejected: color = last
+ onVisibleChanged: if (visible) last = color
+ }
+
+ Column {
+ anchors.margins: 20
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: parent.top
+ spacing: 20
+
+ Row {
+ spacing: 8
+ Button {
+ text: "Set color…"
+ style: ButtonStyle { backgroundColor: colorDialog.color }
+ onClicked: colorDialog.open()
+ }
+ Button {
+ text: "Push me"
+ style: ButtonStyle { backgroundColor: "#eee" }
+ }
+ Button {
+ text: "Push me"
+ style: buttonStyle
+ }
+ }
+ Row {
+ spacing: 8
+ TextField {
+ style: TextFieldStyle { backgroundColor: colorDialog.color }
+ }
+ TextField {
+ style: TextFieldStyle { backgroundColor: "#eee" }
+ }
+ TextField {
+ style: textfieldStyle
+ }
+ }
+ Row {
+ spacing: 8
+ SpinBox {
+ width: 100
+ style: SpinBoxStyle { backgroundColor: colorDialog.color }
+ }
+ SpinBox {
+ width: 100
+ style: SpinBoxStyle { backgroundColor: "#eee" }
+ }
+ SpinBox {
+ width: 100
+ style: spinboxStyle
+ }
+ }
+
+ Row {
+ spacing: 8
+ Slider {
+ value: 50
+ maximumValue: 100
+ width: 100
+ style: SliderStyle { backgroundColor: colorDialog.color}
+ }
+ Slider {
+ value: 50
+ maximumValue: 100
+ width: 100
+ style: SliderStyle { backgroundColor: "#eee"}
+ }
+ Slider {
+ value: 50
+ maximumValue: 100
+ width: 100
+ style: sliderStyle
+ }
+ }
+
+ Row {
+ spacing: 8
+ ProgressBar {
+ value: 50
+ maximumValue: 100
+ width: 100
+ style: ProgressBarStyle{ backgroundColor: colorDialog.color }
+ }
+ ProgressBar {
+ value: 50
+ maximumValue: 100
+ width: 100
+ style: ProgressBarStyle{ backgroundColor: "#eee" }
+ }
+ ProgressBar {
+ value: 50
+ maximumValue: 100
+ width: 100
+ style: progressbarStyle
+ }
+ }
+
+ Row {
+ spacing: 8
+ CheckBox {
+ text: "CheckBox"
+ style: CheckBoxStyle{}
+ }
+ RadioButton {
+ style: RadioButtonStyle{}
+ text: "RadioButton"
+ }
+
+ ComboBox {
+ model: ["Paris", "Oslo", "New York"]
+ style: ComboBoxStyle{}
+ }
+ }
+
+ Row {
+ TabView {
+ width: 400
+ height: 30
+ Tab { title: "One" ; Item {}}
+ Tab { title: "Two" ; Item {}}
+ Tab { title: "Three" ; Item {}}
+ Tab { title: "Four" ; Item {}}
+ style: tabViewStyle
+ }
+ }
+ }
+
+ // Style delegates:
+
+ property Component buttonStyle: ButtonStyle {
+ background: Rectangle {
+ implicitHeight: 20
+ implicitWidth: 100
+ color: control.pressed ? "darkGray" : "lightGray"
+ antialiasing: true
+ border.color: "gray"
+ radius: height/2
+ }
+ }
+
+ property Component textfieldStyle: TextFieldStyle {
+ background: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 20
+ color: "#f0f0f0"
+ antialiasing: true
+ border.color: "gray"
+ radius: height/2
+ }
+ }
+
+ property Component sliderStyle: SliderStyle {
+ handle: Rectangle {
+ width: 14
+ height: 14
+ color: control.pressed ? "darkGray" : "lightGray"
+ border.color: "gray"
+ antialiasing: true
+ radius: height/2
+ }
+
+ background: Rectangle {
+ height: 8
+ implicitWidth: 100
+ implicitHeight: 20
+
+ antialiasing: true
+ color: "darkGray"
+ border.color: "gray"
+ radius: height/2
+ }
+ }
+
+ property Component spinboxStyle: SpinBoxStyle {
+ leftMargin: 8
+ topMargin: 1
+ background: Rectangle {
+ width: 100
+ height: 20
+ color: "#f0f0f0"
+ border.color: "gray"
+ antialiasing: true
+ radius: height/2
+ }
+ }
+
+ property Component progressbarStyle: ProgressBarStyle {
+ background: Rectangle {
+ width: 100
+ height: 20
+ color: "#f0f0f0"
+ border.color: "gray"
+ antialiasing: true
+ radius: height/2
+ }
+ }
+
+ property Component tabViewStyle: TabViewStyle {
+ tabOverlap: 16
+ leftMargin: 12
+
+ frame: Item {
+ Rectangle {
+ gradient: Gradient{
+ GradientStop { color: "#e5e5e5" ; position: 0 }
+ GradientStop { color: "#e0e0e0" ; position: 1 }
+ }
+ anchors.fill: parent
+ anchors.topMargin: -4
+ border.color: "#898989"
+ Rectangle { anchors.fill: parent ; anchors.margins: 1 ; border.color: "white" ; color: "transparent" }
+ }
+ }
+ tab: Item {
+ implicitWidth: image.sourceSize.width
+ implicitHeight: image.sourceSize.height
+ BorderImage {
+ id: image
+ anchors.fill: parent
+ source: tab.selected ? "../images/tab_selected.png" : "../images/tab.png"
+ border.left: 50
+ smooth: false
+ border.right: 50
+ }
+ Text {
+ text: tab.title
+ anchors.centerIn: parent
+ }
+ }
+ }
+}
+
diff --git a/examples/quick/controls/gallery/gallery.pro b/examples/quick/controls/gallery/gallery.pro
new file mode 100644
index 000000000..82f8b3e28
--- /dev/null
+++ b/examples/quick/controls/gallery/gallery.pro
@@ -0,0 +1,10 @@
+TEMPLATE = aux
+
+OTHER_FILES += \
+ main.qml \
+ content/ChildWindow.qml \
+ content/Controls.qml \
+ content/ImageViewer.qml \
+ content/ModelView.qml \
+ content/Panel.qml \
+ content/Styles.qml
diff --git a/examples/quick/controls/gallery/gallery.qmlproject b/examples/quick/controls/gallery/gallery.qmlproject
new file mode 100644
index 000000000..e5a8bf02c
--- /dev/null
+++ b/examples/quick/controls/gallery/gallery.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/quick/controls/gallery/images/document-open.png b/examples/quick/controls/gallery/images/document-open.png
new file mode 100644
index 000000000..f35f25835
--- /dev/null
+++ b/examples/quick/controls/gallery/images/document-open.png
Binary files differ
diff --git a/examples/quick/controls/gallery/images/[email protected] b/examples/quick/controls/gallery/images/[email protected]
new file mode 100644
index 000000000..9fdbb6657
--- /dev/null
+++ b/examples/quick/controls/gallery/images/[email protected]
Binary files differ
diff --git a/examples/quick/controls/gallery/images/document-save-as.png b/examples/quick/controls/gallery/images/document-save-as.png
new file mode 100644
index 000000000..5c9f6b343
--- /dev/null
+++ b/examples/quick/controls/gallery/images/document-save-as.png
Binary files differ
diff --git a/examples/quick/controls/gallery/images/[email protected] b/examples/quick/controls/gallery/images/[email protected]
new file mode 100644
index 000000000..a15e34c92
--- /dev/null
+++ b/examples/quick/controls/gallery/images/[email protected]
Binary files differ
diff --git a/examples/quick/controls/gallery/images/folder_new.png b/examples/quick/controls/gallery/images/folder_new.png
new file mode 100644
index 000000000..8d8bb9bd7
--- /dev/null
+++ b/examples/quick/controls/gallery/images/folder_new.png
Binary files differ
diff --git a/examples/quick/controls/gallery/images/go-next.png b/examples/quick/controls/gallery/images/go-next.png
new file mode 100644
index 000000000..a68e2db77
--- /dev/null
+++ b/examples/quick/controls/gallery/images/go-next.png
Binary files differ
diff --git a/examples/quick/controls/gallery/images/go-previous.png b/examples/quick/controls/gallery/images/go-previous.png
new file mode 100644
index 000000000..c37bc0414
--- /dev/null
+++ b/examples/quick/controls/gallery/images/go-previous.png
Binary files differ
diff --git a/examples/quick/controls/gallery/images/page.png b/examples/quick/controls/gallery/images/page.png
new file mode 100644
index 000000000..b46f205d3
--- /dev/null
+++ b/examples/quick/controls/gallery/images/page.png
Binary files differ
diff --git a/examples/quick/controls/gallery/images/panel.png b/examples/quick/controls/gallery/images/panel.png
new file mode 100644
index 000000000..02d655eb0
--- /dev/null
+++ b/examples/quick/controls/gallery/images/panel.png
Binary files differ
diff --git a/examples/quick/controls/gallery/images/preferences-system.png b/examples/quick/controls/gallery/images/preferences-system.png
new file mode 100644
index 000000000..6e52db7cf
--- /dev/null
+++ b/examples/quick/controls/gallery/images/preferences-system.png
Binary files differ
diff --git a/examples/quick/controls/gallery/images/process-stop.png b/examples/quick/controls/gallery/images/process-stop.png
new file mode 100644
index 000000000..e7a8d1722
--- /dev/null
+++ b/examples/quick/controls/gallery/images/process-stop.png
Binary files differ
diff --git a/examples/quick/controls/gallery/images/tab.png b/examples/quick/controls/gallery/images/tab.png
new file mode 100644
index 000000000..74fefab78
--- /dev/null
+++ b/examples/quick/controls/gallery/images/tab.png
Binary files differ
diff --git a/examples/quick/controls/gallery/images/tab_selected.png b/examples/quick/controls/gallery/images/tab_selected.png
new file mode 100644
index 000000000..665400ccf
--- /dev/null
+++ b/examples/quick/controls/gallery/images/tab_selected.png
Binary files differ
diff --git a/examples/quick/controls/gallery/images/toplevel_window.png b/examples/quick/controls/gallery/images/toplevel_window.png
new file mode 100644
index 000000000..4dc6a8cee
--- /dev/null
+++ b/examples/quick/controls/gallery/images/toplevel_window.png
Binary files differ
diff --git a/examples/quick/controls/gallery/images/view-refresh.png b/examples/quick/controls/gallery/images/view-refresh.png
new file mode 100644
index 000000000..606ea9eba
--- /dev/null
+++ b/examples/quick/controls/gallery/images/view-refresh.png
Binary files differ
diff --git a/examples/quick/controls/gallery/images/window-new.png b/examples/quick/controls/gallery/images/window-new.png
new file mode 100644
index 000000000..e091702e3
--- /dev/null
+++ b/examples/quick/controls/gallery/images/window-new.png
Binary files differ
diff --git a/examples/quick/controls/gallery/images/[email protected] b/examples/quick/controls/gallery/images/[email protected]
new file mode 100644
index 000000000..36503018e
--- /dev/null
+++ b/examples/quick/controls/gallery/images/[email protected]
Binary files differ
diff --git a/examples/quick/controls/gallery/main.qml b/examples/quick/controls/gallery/main.qml
new file mode 100644
index 000000000..aff3cb4c9
--- /dev/null
+++ b/examples/quick/controls/gallery/main.qml
@@ -0,0 +1,293 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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.0
+import QtQuick.Layouts 1.0
+import QtQuick.Dialogs 1.0
+import "content"
+
+ApplicationWindow {
+ title: "Component Gallery"
+
+ width: 580
+ height: 400
+ minimumHeight: 400
+ minimumWidth: 340
+ property string loremIpsum:
+ "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor "+
+ "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor "+
+ "incididunt ut labore et dolore magna aliqua.\n Ut enim ad minim veniam, quis nostrud "+
+ "exercitation ullamco laboris nisi ut aliquip ex ea commodo cosnsequat. ";
+
+ ImageViewer { id: imageViewer }
+
+ FileDialog {
+ id: fileDialog
+ nameFilters: [ "Image files (*.png *.jpg)" ]
+ onAccepted: imageViewer.open(fileUrl)
+ }
+
+ ToolBar {
+ id: toolbar
+ width: parent.width
+ RowLayout {
+ spacing: 2
+ anchors.verticalCenter: parent.verticalCenter
+ ToolButton {
+ iconSource: "images/window-new.png"
+ anchors.verticalCenter: parent.verticalCenter
+ onClicked: window1.visible = !window1.visible
+ Accessible.name: "New window"
+ tooltip: "Toggle visibility of the second window"
+ }
+ ToolButton {
+ action: openAction
+ }
+ ToolButton {
+ iconSource: "images/document-save-as.png"
+ anchors.verticalCenter: parent.verticalCenter
+ tooltip: "(Pretend to) save as..."
+ }
+ }
+
+ ChildWindow { id: window1 }
+
+ Action {
+ id: openAction
+ text: "&Open"
+ shortcut: "Ctrl+O"
+ iconSource: "images/document-open.png"
+ onTriggered: fileDialog.open()
+ tooltip: "open an image"
+ }
+
+ Action {
+ id: copyAction
+ text: "&Copy"
+ shortcut: "Ctrl+C"
+ iconName: "edit-copy"
+ enabled: (!!activeFocusItem && !!activeFocusItem["copy"])
+ onTriggered: activeFocusItem.copy()
+ }
+
+ Action {
+ id: cutAction
+ text: "Cu&t"
+ shortcut: "Ctrl+X"
+ iconName: "edit-cut"
+ enabled: (!!activeFocusItem && !!activeFocusItem["cut"])
+ onTriggered: activeFocusItem.cut()
+ }
+
+ Action {
+ id: pasteAction
+ text: "&Paste"
+ shortcut: "Ctrl+V"
+ iconName: "edit-paste"
+ enabled: (!!activeFocusItem && !!activeFocusItem["paste"])
+ onTriggered: activeFocusItem.paste()
+ }
+
+ ExclusiveGroup {
+ id: textFormatGroup
+
+ Action {
+ id: a1
+ text: "Align Left"
+ checkable: true
+ Component.onCompleted: checked = true
+ }
+
+ Action {
+ id: a2
+ text: "Center"
+ checkable: true
+ }
+
+ Action {
+ id: a3
+ text: "Align Right"
+ checkable: true
+ }
+ }
+
+ Menu {
+ id: editmenu
+ MenuItem { action: cutAction }
+ MenuItem { action: copyAction }
+ MenuItem { action: pasteAction }
+ MenuSeparator {}
+ Menu {
+ title: "Text Format"
+ MenuItem { action: a1 }
+ MenuItem { action: a2 }
+ MenuItem { action: a3 }
+ MenuSeparator { }
+ MenuItem { text: "Allow Hyphenation"; checkable: true }
+ MenuSeparator { }
+ Menu {
+ title: "More Stuff"
+ MenuItem { action: cutAction }
+ MenuItem { action: copyAction }
+ MenuItem { action: pasteAction }
+ MenuSeparator { }
+ Menu {
+ title: "More Stuff"
+ MenuItem { action: cutAction }
+ MenuItem { action: copyAction }
+ MenuItem { action: pasteAction }
+ MenuSeparator { }
+ Menu {
+ title: "More Stuff"
+ MenuItem { action: cutAction }
+ MenuItem { action: copyAction }
+ MenuItem { action: pasteAction }
+ MenuSeparator { }
+ Menu {
+ title: "More Stuff"
+ MenuItem { action: cutAction }
+ MenuItem { action: copyAction }
+ MenuItem { action: pasteAction }
+ }
+ }
+ }
+ }
+ }
+ Menu {
+ title: "Font Style"
+ MenuItem { text: "Bold"; checkable: true }
+ MenuItem { text: "Italic"; checkable: true }
+ MenuItem { text: "Underline"; checkable: true }
+ }
+ }
+ MouseArea {
+ anchors.fill: parent
+ acceptedButtons: Qt.RightButton
+ onPressed: editmenu.popup()
+ }
+
+ CheckBox {
+ id: enabledCheck
+ text: "Enabled"
+ checked: true
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+
+ menuBar: MenuBar {
+ Menu {
+ title: "&File"
+ MenuItem { action: openAction }
+ MenuItem {
+ text: "Close"
+ shortcut: "Ctrl+Q"
+ onTriggered: Qt.quit()
+ }
+ }
+ Menu {
+ title: "&Edit"
+ MenuItem { action: cutAction }
+ MenuItem { action: copyAction }
+ MenuItem { action: pasteAction }
+ MenuSeparator { }
+ MenuItem {
+ text: "Do Nothing"
+ shortcut: "Ctrl+E,Shift+Ctrl+X"
+ enabled: false
+ }
+ MenuItem {
+ text: "Not Even There"
+ shortcut: "Ctrl+E,Shift+Ctrl+Y"
+ visible: false
+ }
+ Menu {
+ title: "Me Neither"
+ visible: false
+ }
+ }
+ }
+
+
+ SystemPalette {id: syspal}
+ color: syspal.window
+ ListModel {
+ id: choices
+ ListElement { text: "Banana" }
+ ListElement { text: "Orange" }
+ ListElement { text: "Apple" }
+ ListElement { text: "Coconut" }
+ }
+
+ TabView {
+ id:frame
+ enabled: enabledCheck.checked
+ tabPosition: controlPage.item ? controlPage.item.tabPosition : Qt.TopEdge
+ anchors.top: toolbar.bottom
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ anchors.left: parent.left
+ anchors.margins: Qt.platform.os === "mac" ? 12 : 2
+
+ Tab {
+ id: controlPage
+ title: "Control"
+ Controls { }
+ }
+ Tab {
+ title: "Itemviews"
+ ModelView { }
+ }
+ Tab {
+ title: "Styles"
+ Styles { anchors.fill: parent }
+ }
+ Tab {
+ title: "Sidebar"
+ Panel { anchors.fill:parent }
+ }
+ }
+}
+
diff --git a/examples/quick/controls/splitview/main.qml b/examples/quick/controls/splitview/main.qml
new file mode 100644
index 000000000..f035e6448
--- /dev/null
+++ b/examples/quick/controls/splitview/main.qml
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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.0
+import QtQuick.Layouts 1.0
+
+ApplicationWindow {
+ width: 600
+ height: 400
+
+ SplitView {
+ anchors.fill: parent
+
+ Rectangle {
+ id: column
+ width: 200
+ Layout.minimumWidth: 100
+ Layout.maximumWidth: 300
+ color: "lightsteelblue"
+ }
+
+ Rectangle {
+ id: column1
+ width: 200
+ Layout.minimumWidth: 100
+ Layout.maximumWidth: 300
+ color: "lightsteelblue"
+ }
+
+ SplitView {
+ orientation: Qt.Vertical
+ Layout.fillWidth: true
+
+ Rectangle {
+ id: row1
+ height: 200
+ color: "lightblue"
+ Layout.minimumHeight: 1
+ }
+
+ Rectangle {
+ id: row2
+ color: "lightgray"
+ }
+ }
+ }
+}
diff --git a/examples/quick/controls/splitview/splitview.pro b/examples/quick/controls/splitview/splitview.pro
new file mode 100644
index 000000000..8b88e385c
--- /dev/null
+++ b/examples/quick/controls/splitview/splitview.pro
@@ -0,0 +1,4 @@
+TEMPLATE = aux
+
+OTHER_FILES += \
+ main.qml
diff --git a/examples/quick/controls/splitview/splitview.qmlproject b/examples/quick/controls/splitview/splitview.qmlproject
new file mode 100644
index 000000000..e5a8bf02c
--- /dev/null
+++ b/examples/quick/controls/splitview/splitview.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/quick/controls/stackview/ButtonMenu.qml b/examples/quick/controls/stackview/ButtonMenu.qml
new file mode 100644
index 000000000..c1608f7e1
--- /dev/null
+++ b/examples/quick/controls/stackview/ButtonMenu.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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.0
+
+Column {
+ property int index: -1
+ Label {
+ text: "stack index: " + index
+ }
+ Button {
+ text: "push Component"
+ onClicked: stackView.push(componentPage)
+ }
+ Button {
+ text: "push URL"
+ onClicked: stackView.push(Qt.resolvedUrl("View.qml"))
+ }
+ Button {
+ text: "pop"
+ onClicked: stackView.pop()
+ }
+}
diff --git a/examples/quick/controls/stackview/View.qml b/examples/quick/controls/stackview/View.qml
new file mode 100644
index 000000000..e713e0e5a
--- /dev/null
+++ b/examples/quick/controls/stackview/View.qml
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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.0
+
+Rectangle {
+ color: "green"
+ ButtonMenu {
+ index: parent.Stack.index
+ }
+}
diff --git a/examples/quick/controls/stackview/main.qml b/examples/quick/controls/stackview/main.qml
new file mode 100644
index 000000000..af016fb28
--- /dev/null
+++ b/examples/quick/controls/stackview/main.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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.0
+
+ApplicationWindow {
+ width: 480
+ height: 640
+ property alias stackView: stackView
+ property alias componentPage: componentPage
+
+ StackView {
+ id: stackView
+ anchors.fill: parent
+ initialItem: componentPage
+ }
+
+ Component {
+ id: componentPage
+ Rectangle {
+ color: "yellow"
+ ButtonMenu {
+ index: parent.Stack.index
+ }
+ }
+ }
+}
diff --git a/examples/quick/controls/stackview/stackview.pro b/examples/quick/controls/stackview/stackview.pro
new file mode 100644
index 000000000..9d02e4c75
--- /dev/null
+++ b/examples/quick/controls/stackview/stackview.pro
@@ -0,0 +1,6 @@
+TEMPLATE = aux
+
+OTHER_FILES += \
+ main.qml \
+ ButtonMenu.qml \
+ View.qml
diff --git a/examples/quick/controls/stackview/stackview.qmlproject b/examples/quick/controls/stackview/stackview.qmlproject
new file mode 100644
index 000000000..e5a8bf02c
--- /dev/null
+++ b/examples/quick/controls/stackview/stackview.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/quick/controls/tableview/images/header.png b/examples/quick/controls/tableview/images/header.png
new file mode 100644
index 000000000..dba664609
--- /dev/null
+++ b/examples/quick/controls/tableview/images/header.png
Binary files differ
diff --git a/examples/quick/controls/tableview/images/selectedrow.png b/examples/quick/controls/tableview/images/selectedrow.png
new file mode 100644
index 000000000..71192ea4e
--- /dev/null
+++ b/examples/quick/controls/tableview/images/selectedrow.png
Binary files differ
diff --git a/examples/quick/controls/tableview/main.qml b/examples/quick/controls/tableview/main.qml
new file mode 100644
index 000000000..92901bf61
--- /dev/null
+++ b/examples/quick/controls/tableview/main.qml
@@ -0,0 +1,427 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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.0
+import QtQuick.XmlListModel 2.0
+
+Rectangle {
+
+ width: 538 + frame.margins * 2
+ height: 360 + frame.margins * 2
+
+ ToolBar {
+ id: toolbar
+ width: parent.width
+
+ ListModel {
+ id: delegatemenu
+ ListElement { text: "Shiny delegate" }
+ ListElement { text: "Scale selected" }
+ ListElement { text: "Editable items" }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ acceptedButtons: Qt.RightButton
+ onPressed: editmenu.show(mouseX, mouseY)
+ }
+
+ ComboBox {
+ id: delegateChooser
+ opacity: frame.currentIndex === 3 ? 1 : 0
+ Behavior on opacity{ NumberAnimation{} }
+ model: delegatemenu
+ width: 150
+ anchors.left: parent.left
+ anchors.leftMargin: 8
+ anchors.verticalCenter: parent.verticalCenter
+ }
+
+ CheckBox {
+ id: enabledCheck
+ text: "Enabled"
+ checked: true
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+
+ SystemPalette {id: syspal}
+ color: syspal.window
+
+ XmlListModel {
+ id: flickerModel
+ source: "http://api.flickr.com/services/feeds/photos_public.gne?format=rss2&tags=" + "Qt"
+ query: "/rss/channel/item"
+ namespaceDeclarations: "declare namespace media=\"http://search.yahoo.com/mrss/\";"
+ XmlRole { name: "title"; query: "title/string()" }
+ XmlRole { name: "imagesource"; query: "media:thumbnail/@url/string()" }
+ XmlRole { name: "credit"; query: "media:credit/string()" }
+ }
+
+ ListModel {
+ id: nestedModel
+ ListElement{attributes: ListElement { description: "Core" ; color:"#ffaacc"}}
+ ListElement{attributes: ListElement { description: "Second" ; color:"#ffccaa"}}
+ ListElement{attributes: ListElement { description: "Third" ; color:"#ffffaa"}}
+ }
+
+ ListModel {
+ id: largeModel
+ Component.onCompleted: {
+ for (var i=0 ; i< 500 ; ++i)
+ largeModel.append({"name":"Person "+i , "age": Math.round(Math.random()*100), "gender": Math.random()>0.5 ? "Male" : "Female"})
+ }
+ }
+
+ Column {
+ anchors.top: toolbar.bottom
+ anchors.right: parent.right
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ anchors.margins: 8
+
+ TabView {
+ id:frame
+ focus:true
+ enabled: enabledCheck.checked
+
+ property int margins: Qt.platform.os === "mac" ? 16 : 0
+
+ height: parent.height - 34
+ anchors.right: parent.right
+ anchors.left: parent.left
+ anchors.margins: margins
+
+ Tab {
+ title: "XmlListModel"
+
+ TableView {
+ model: flickerModel
+ anchors.fill: parent
+ anchors.margins: 12
+
+ TableViewColumn {
+ role: "title"
+ title: "Title"
+ width: 120
+ }
+ TableViewColumn {
+ role: "credit"
+ title: "Credit"
+ width: 120
+ }
+ TableViewColumn {
+ role: "imagesource"
+ title: "Image source"
+ width: 200
+ visible: true
+ }
+
+ frameVisible: frameCheckbox.checked
+ headerVisible: headerCheckbox.checked
+ sortIndicatorVisible: sortableCheckbox.checked
+ alternatingRowColors: alternateCheckbox.checked
+ }
+ }
+ Tab {
+ title: "Multivalue"
+
+ TableView {
+ model: nestedModel
+ anchors.fill: parent
+ anchors.margins: 12
+
+ TableViewColumn {
+ role: "attributes"
+ title: "Text and Color"
+ width: 220
+ }
+
+ itemDelegate: Item {
+ Rectangle{
+ color: itemValue.get(0).color
+ anchors.top:parent.top
+ anchors.right:parent.right
+ anchors.bottom:parent.bottom
+ anchors.margins: 4
+ width:32
+ border.color:"#666"
+ }
+ Text {
+ width: parent.width
+ anchors.margins: 4
+ anchors.left: parent.left
+ anchors.verticalCenter: parent.verticalCenter
+ elide: itemElideMode
+ text: itemValue.get(0).description
+ color: itemTextColor
+ }
+ }
+
+ frameVisible: frameCheckbox.checked
+ headerVisible: headerCheckbox.checked
+ sortIndicatorVisible: sortableCheckbox.checked
+ alternatingRowColors: alternateCheckbox.checked
+ }
+ }
+ Tab {
+ title: "Generated"
+
+ TableView {
+ model: largeModel
+ anchors.margins: 12
+ anchors.fill: parent
+ TableViewColumn {
+ role: "name"
+ title: "Name"
+ width: 120
+ }
+ TableViewColumn {
+ role: "age"
+ title: "Age"
+ width: 120
+ }
+ TableViewColumn {
+ role: "gender"
+ title: "Gender"
+ width: 120
+ }
+ frameVisible: frameCheckbox.checked
+ headerVisible: headerCheckbox.checked
+ sortIndicatorVisible: sortableCheckbox.checked
+ alternatingRowColors: alternateCheckbox.checked
+ }
+ }
+
+ Tab {
+ title: "Delegates"
+ Item {
+ anchors.fill: parent
+
+ Component {
+ id: delegate1
+ Item {
+ clip: true
+ Text {
+ width: parent.width
+ anchors.margins: 4
+ anchors.left: parent.left
+ anchors.verticalCenter: parent.verticalCenter
+ elide: itemElideMode
+ text: itemValue !== undefined ? itemValue : ""
+ color: itemTextColor
+ }
+ }
+ }
+
+ Component {
+ id: slickRowDelegate
+ Rectangle { color: alternateBackground ? "#cef" : "white" }
+ }
+
+ Component {
+ id: delegate2
+ Item {
+ height: itemSelected? 60 : 20
+ Behavior on height{ NumberAnimation{} }
+ Text {
+ width: parent.width
+ anchors.margins: 4
+ anchors.left: parent.left
+ anchors.verticalCenter: parent.verticalCenter
+ elide: itemElideMode
+ text: itemValue !== undefined ? itemValue : ""
+ color: itemTextColor
+ }
+ }
+ }
+
+ Component {
+ id: editableDelegate
+ Item {
+
+ Text {
+ width: parent.width
+ anchors.margins: 4
+ anchors.left: parent.left
+ anchors.verticalCenter: parent.verticalCenter
+ elide: itemElideMode
+ text: itemValue !== undefined ? itemValue : ""
+ color: itemTextColor
+ visible: !itemSelected
+ }
+ Loader { // Initialize text editor lazily to improve performance
+ id: loaderEditor
+ anchors.fill: parent
+ anchors.margins: 4
+ Connections {
+ target: loaderEditor.item
+ onAccepted: {
+ if (typeof itemValue === 'number')
+ model.setProperty(rowIndex, role, Number(parseFloat(loaderEditor.item.text).toFixed(0)))
+ else
+ model.setProperty(rowIndex, role, loaderEditor.item.text)
+ }
+ }
+ sourceComponent: itemSelected ? editor : null
+ Component {
+ id: editor
+ TextInput {
+ id: textinput
+ color: itemTextColor
+ text: itemValue
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ hoverEnabled: true
+ onClicked: textinput.forceActiveFocus()
+ }
+ }
+ }
+ }
+ }
+ }
+ TableView {
+ model: largeModel
+ anchors.margins: 12
+ anchors.fill:parent
+ frameVisible: frameCheckbox.checked
+ headerVisible: headerCheckbox.checked
+ sortIndicatorVisible: sortableCheckbox.checked
+ alternatingRowColors: alternateCheckbox.checked
+
+ TableViewColumn {
+ role: "name"
+ title: "Name"
+ width: 120
+ }
+ TableViewColumn {
+ role: "age"
+ title: "Age"
+ width: 120
+ }
+ TableViewColumn {
+ role: "gender"
+ title: "Gender"
+ width: 120
+ }
+
+ headerDelegate: BorderImage{
+ source: "images/header.png"
+ border{left:2;right:2;top:2;bottom:2}
+ Text {
+ text: itemValue
+ anchors.centerIn:parent
+ color:"#333"
+ }
+ }
+
+ rowDelegate: Rectangle {
+ height: 20
+ color: rowSelected ? "#448" : (alternateBackground ? "#eee" : "#fff")
+ border.color:"#ccc"
+ border.width: 1
+ anchors.left: parent ? parent.left : undefined
+ anchors.leftMargin: -2
+ anchors.rightMargin: -1
+ BorderImage{
+ id: selected
+ anchors.fill: parent
+ source: "images/selectedrow.png"
+ visible: rowSelected
+ border{left:2; right:2; top:2; bottom:2}
+ SequentialAnimation {
+ running: true; loops: Animation.Infinite
+ NumberAnimation { target:selected; property: "opacity"; to: 1.0; duration: 900}
+ NumberAnimation { target:selected; property: "opacity"; to: 0.5; duration: 900}
+ }
+ }
+ }
+
+ itemDelegate: {
+ switch (delegateChooser.currentIndex) {
+ case 0:
+ return delegate1
+ case 1:
+ return delegate2
+ case 2:
+ return editableDelegate
+ }
+ }
+ }
+ }
+ }
+ }
+ Row{
+ x: 12
+ height: 34
+ CheckBox{
+ id: alternateCheckbox
+ checked: true
+ text: "Alternate"
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ CheckBox{
+ id: sortableCheckbox
+ checked: false
+ text: "Sortindicator"
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ CheckBox{
+ id: frameCheckbox
+ checked: true
+ text: "Frame"
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ CheckBox{
+ id: headerCheckbox
+ checked: true
+ text: "Headers"
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+ }
+}
diff --git a/examples/quick/controls/tableview/tableview.pro b/examples/quick/controls/tableview/tableview.pro
new file mode 100644
index 000000000..8b88e385c
--- /dev/null
+++ b/examples/quick/controls/tableview/tableview.pro
@@ -0,0 +1,4 @@
+TEMPLATE = aux
+
+OTHER_FILES += \
+ main.qml
diff --git a/examples/quick/controls/tableview/tableview.qmlproject b/examples/quick/controls/tableview/tableview.qmlproject
new file mode 100644
index 000000000..e5a8bf02c
--- /dev/null
+++ b/examples/quick/controls/tableview/tableview.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/quick/controls/text/example.html b/examples/quick/controls/text/example.html
new file mode 100644
index 000000000..0560897b6
--- /dev/null
+++ b/examples/quick/controls/text/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>QTextEdit 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;">QTextEdit</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 QTextEdit widget is an advanced editor that supports formatted rich text. It can be used to display HTML and other rich document formats. Internally, QTextEdit uses the QTextDocument 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;">textedit</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;">QTextEdit 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:'Times'; font-size:11pt; font-weight:600;">Times New Roman</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><span style=" font-size:11pt; font-style:italic;">If you place the cursor in a region of styled text, the controls in the tool bars will change to reflect the current style.</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 created that can be used for tables of contents. Different characters can be used to enumerate items, and we 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/logo32.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;">QTextEdit 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;">Hyperlinks</span></p>
+<p 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;">QTextEdit is designed to support hyperlinks between documents, and this feature is used extensively in </span><span style=" font-size:11pt; font-style:italic;">Qt Assistant</span><span style=" font-size:11pt;">. Hyperlinks are automatically created when an HTML file is imported into an editor. Since the rich text framework supports hyperlinks natively, they can also be created programatically.</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;"><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 QTextEdit and the underlying rich text framework. Operations on a document can be packaged together to make editing a more comfortable experience 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/quick/controls/text/qml/images/editcopy.png b/examples/quick/controls/text/qml/images/editcopy.png
new file mode 100644
index 000000000..f55136446
--- /dev/null
+++ b/examples/quick/controls/text/qml/images/editcopy.png
Binary files differ
diff --git a/examples/quick/controls/text/qml/images/editcut.png b/examples/quick/controls/text/qml/images/editcut.png
new file mode 100644
index 000000000..a784fd570
--- /dev/null
+++ b/examples/quick/controls/text/qml/images/editcut.png
Binary files differ
diff --git a/examples/quick/controls/text/qml/images/editpaste.png b/examples/quick/controls/text/qml/images/editpaste.png
new file mode 100644
index 000000000..64c0b2d6a
--- /dev/null
+++ b/examples/quick/controls/text/qml/images/editpaste.png
Binary files differ
diff --git a/examples/quick/controls/text/qml/images/editredo.png b/examples/quick/controls/text/qml/images/editredo.png
new file mode 100644
index 000000000..8875bf246
--- /dev/null
+++ b/examples/quick/controls/text/qml/images/editredo.png
Binary files differ
diff --git a/examples/quick/controls/text/qml/images/editundo.png b/examples/quick/controls/text/qml/images/editundo.png
new file mode 100644
index 000000000..a3bd5e0bf
--- /dev/null
+++ b/examples/quick/controls/text/qml/images/editundo.png
Binary files differ
diff --git a/examples/quick/controls/text/qml/images/exportpdf.png b/examples/quick/controls/text/qml/images/exportpdf.png
new file mode 100644
index 000000000..ebb44e6b8
--- /dev/null
+++ b/examples/quick/controls/text/qml/images/exportpdf.png
Binary files differ
diff --git a/examples/quick/controls/text/qml/images/filenew.png b/examples/quick/controls/text/qml/images/filenew.png
new file mode 100644
index 000000000..d3882c7b3
--- /dev/null
+++ b/examples/quick/controls/text/qml/images/filenew.png
Binary files differ
diff --git a/examples/quick/controls/text/qml/images/fileopen.png b/examples/quick/controls/text/qml/images/fileopen.png
new file mode 100644
index 000000000..fc06c5ec6
--- /dev/null
+++ b/examples/quick/controls/text/qml/images/fileopen.png
Binary files differ
diff --git a/examples/quick/controls/text/qml/images/fileprint.png b/examples/quick/controls/text/qml/images/fileprint.png
new file mode 100644
index 000000000..10ca56c82
--- /dev/null
+++ b/examples/quick/controls/text/qml/images/fileprint.png
Binary files differ
diff --git a/examples/quick/controls/text/qml/images/filesave.png b/examples/quick/controls/text/qml/images/filesave.png
new file mode 100644
index 000000000..b41ecf531
--- /dev/null
+++ b/examples/quick/controls/text/qml/images/filesave.png
Binary files differ
diff --git a/examples/quick/controls/text/qml/images/logo32.png b/examples/quick/controls/text/qml/images/logo32.png
new file mode 100644
index 000000000..5f91e9873
--- /dev/null
+++ b/examples/quick/controls/text/qml/images/logo32.png
Binary files differ
diff --git a/examples/quick/controls/text/qml/images/textbold.png b/examples/quick/controls/text/qml/images/textbold.png
new file mode 100644
index 000000000..38400bd1f
--- /dev/null
+++ b/examples/quick/controls/text/qml/images/textbold.png
Binary files differ
diff --git a/examples/quick/controls/text/qml/images/textcenter.png b/examples/quick/controls/text/qml/images/textcenter.png
new file mode 100644
index 000000000..2ef5b2ee6
--- /dev/null
+++ b/examples/quick/controls/text/qml/images/textcenter.png
Binary files differ
diff --git a/examples/quick/controls/text/qml/images/textitalic.png b/examples/quick/controls/text/qml/images/textitalic.png
new file mode 100644
index 000000000..0170ee26a
--- /dev/null
+++ b/examples/quick/controls/text/qml/images/textitalic.png
Binary files differ
diff --git a/examples/quick/controls/text/qml/images/textjustify.png b/examples/quick/controls/text/qml/images/textjustify.png
new file mode 100644
index 000000000..39cd6c1a9
--- /dev/null
+++ b/examples/quick/controls/text/qml/images/textjustify.png
Binary files differ
diff --git a/examples/quick/controls/text/qml/images/textleft.png b/examples/quick/controls/text/qml/images/textleft.png
new file mode 100644
index 000000000..83a66d553
--- /dev/null
+++ b/examples/quick/controls/text/qml/images/textleft.png
Binary files differ
diff --git a/examples/quick/controls/text/qml/images/textright.png b/examples/quick/controls/text/qml/images/textright.png
new file mode 100644
index 000000000..e7c04645c
--- /dev/null
+++ b/examples/quick/controls/text/qml/images/textright.png
Binary files differ
diff --git a/examples/quick/controls/text/qml/images/textunder.png b/examples/quick/controls/text/qml/images/textunder.png
new file mode 100644
index 000000000..968bac5e9
--- /dev/null
+++ b/examples/quick/controls/text/qml/images/textunder.png
Binary files differ
diff --git a/examples/quick/controls/text/qml/images/zoomin.png b/examples/quick/controls/text/qml/images/zoomin.png
new file mode 100644
index 000000000..d46f5aff0
--- /dev/null
+++ b/examples/quick/controls/text/qml/images/zoomin.png
Binary files differ
diff --git a/examples/quick/controls/text/qml/images/zoomout.png b/examples/quick/controls/text/qml/images/zoomout.png
new file mode 100644
index 000000000..46326566d
--- /dev/null
+++ b/examples/quick/controls/text/qml/images/zoomout.png
Binary files differ
diff --git a/examples/quick/controls/text/qml/main.qml b/examples/quick/controls/text/qml/main.qml
new file mode 100644
index 000000000..dd8b18489
--- /dev/null
+++ b/examples/quick/controls/text/qml/main.qml
@@ -0,0 +1,261 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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.0
+import QtQuick.Layouts 1.0
+import QtQuick.Dialogs 1.0
+import org.qtproject.example 1.0
+
+ApplicationWindow {
+ width: 640
+ height: 480
+ minimumWidth: 400
+ minimumHeight: 300
+
+ title: document.documentTitle + " - Text Editor Example"
+
+ Action {
+ id: cut
+ text: "Cut"
+ shortcut: "ctrl+x"
+ iconSource: "images/editcut.png"
+ iconName: "edit-cut"
+ }
+
+ Action {
+ id: copy
+ text: "Copy"
+ shortcut: "Ctrl+C"
+ iconSource: "images/editcopy.png"
+ iconName: "edit-copy"
+ onTriggered: console.log("Ctrl C pressed - in action...")
+ }
+
+ Action {
+ id: paste
+ text: "Paste"
+ shortcut: "ctrl+v"
+ iconSource: "qrc:images/editpaste.png"
+ iconName: "edit-paste"
+ }
+
+ Action {
+ id: alignLeft
+ 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: alignCenter
+ text: "C&enter"
+ iconSource: "images/textcenter.png"
+ iconName: "format-justify-center"
+ onTriggered: document.alignment = Qt.AlignCenter
+ checkable: true
+ checked: document.alignment == Qt.AlignCenter
+ }
+ Action {
+ id: alignRight
+ text: "&Right"
+ iconSource: "images/textright.png"
+ iconName: "format-justify-right"
+ onTriggered: document.alignment = Qt.AlignRight
+ checkable: true
+ checked: document.alignment == Qt.AlignRight
+ }
+ Action {
+ id: alignJustify
+ text: "&Justify"
+ iconSource: "images/textjustify.png"
+ iconName: "format-justify-fill"
+ onTriggered: document.alignment = Qt.AlignJustify
+ checkable: true
+ checked: document.alignment == Qt.AlignJustify
+ }
+
+ Action {
+ id: bold
+ text: "&Bold"
+ iconSource: "images/textbold.png"
+ iconName: "format-text-bold"
+ onTriggered: document.bold = !document.bold
+ checkable: true
+ checked: document.bold
+ }
+ Action {
+ id: italic
+ text: "&Italic"
+ iconSource: "images/textitalic.png"
+ iconName: "format-text-italic"
+ onTriggered: document.italic = !document.italic
+ checkable: true
+ checked: document.italic
+ }
+ Action {
+ id: underline
+ text: "&Underline"
+ iconSource: "images/textunder.png"
+ iconName: "format-text-underline"
+ onTriggered: document.underline = !document.underline
+ checkable: true
+ checked: document.underline
+ }
+ Action {
+ id: color
+ text: "&Color ..."
+ iconSource: "images/textcolor.png"
+ iconName: "format-text-color"
+ }
+
+ FileDialog {
+ id: file
+ nameFilters: ["Text files (*.txt)", "HTML files (*.html)"]
+ onAccepted: document.fileUrl = fileUrl
+ }
+
+ Action {
+ id: fileOpen
+ iconSource: "images/fileopen.png"
+ iconName: "document-open"
+ text: "Open"
+ onTriggered: file.open()
+ }
+
+ menuBar: MenuBar {
+ Menu {
+ title: "&File"
+ MenuItem { action: fileOpen }
+ MenuItem { text: "Quit"; onTriggered: Qt.quit() }
+ }
+ Menu {
+ title: "&Edit"
+ MenuItem { action: copy }
+ MenuItem { action: cut }
+ MenuItem { action: paste }
+ }
+ Menu {
+ title: "F&ormat"
+ MenuItem { action: bold }
+ MenuItem { action: italic }
+ MenuItem { action: underline }
+ MenuSeparator {}
+ MenuItem { action: alignLeft }
+ MenuItem { action: alignCenter }
+ MenuItem { action: alignRight }
+ MenuItem { action: alignJustify }
+ MenuSeparator {}
+ MenuItem { action: color }
+ }
+ Menu {
+ title: "&Help"
+ MenuItem { text: "About..." }
+ MenuItem { text: "About Qt" }
+ }
+ }
+
+ toolBar: ToolBar {
+ id: mainToolBar
+ width: parent.width
+ RowLayout {
+ anchors.fill: parent
+ spacing: 1
+ ToolButton { action: fileOpen }
+
+ Item { width: 4 }
+ ToolButton { action: copy }
+ ToolButton { action: cut }
+ ToolButton { action: paste }
+ Item { width: 4 }
+ ToolButton { action: bold }
+ ToolButton { action: italic }
+ ToolButton { action: underline }
+
+ Item { width: 4 }
+ ToolButton { action: alignLeft }
+ ToolButton { action: alignCenter }
+ ToolButton { action: alignRight }
+ ToolButton { action: alignJustify }
+ Item { Layout.fillWidth: true }
+ }
+ }
+ ToolBar {
+ id: secondaryToolBar
+ width: parent.width
+
+ RowLayout {
+ anchors.fill: parent
+ anchors.margins: 4
+ ComboBox {
+ model: document.defaultFontSizes
+ onCurrentTextChanged: document.fontSize = currentText
+ currentIndex: document.defaultFontSizes.indexOf(document.fontSize + "")
+ }
+ TextField { id: fontEdit; enabled: false }
+ Item { Layout.fillWidth: true }
+ }
+ }
+
+ TextArea {
+ Accessible.name: "document"
+ id: textArea
+ width: parent.width
+ anchors.top: secondaryToolBar.bottom
+ anchors.bottom: parent.bottom
+ text: document.text
+ textFormat: Qt.RichText
+ Component.onCompleted: forceActiveFocus()
+ }
+
+ DocumentHandler {
+ id: document
+ target: textArea
+ cursorPosition: textArea.cursorPosition
+ selectionStart: textArea.selectionStart
+ selectionEnd: textArea.selectionEnd
+ onCurrentFontChanged: {
+ fontEdit.text = currentFont.family
+ }
+ }
+}
diff --git a/examples/quick/controls/text/resources.qrc b/examples/quick/controls/text/resources.qrc
new file mode 100644
index 000000000..e67fac6ad
--- /dev/null
+++ b/examples/quick/controls/text/resources.qrc
@@ -0,0 +1,26 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/">
+ <file>qml/main.qml</file>
+ <file>qml/images/logo32.png</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>
+</qresource>
+</RCC>
diff --git a/examples/quick/controls/text/src/documenthandler.cpp b/examples/quick/controls/text/src/documenthandler.cpp
new file mode 100644
index 000000000..48b6d033c
--- /dev/null
+++ b/examples/quick/controls/text/src/documenthandler.cpp
@@ -0,0 +1,284 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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)
+{
+ setFileUrl(QUrl("qrc:/example.html"));
+}
+
+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();
+ }
+ }
+ 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();
+ }
+}
+
+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;
+
+ emit currentFontChanged();
+ emit alignmentChanged();
+ emit boldChanged();
+ emit italicChanged();
+ emit underlineChanged();
+ emit fontSizeChanged();
+}
+
+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;
+// emit selectionStartChanged();
+}
+
+void DocumentHandler::setSelectionEnd(int position)
+{
+ m_selectionEnd = position;
+// emit selectionEndChanged();
+}
+
+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
+{
+// if (!m_doc || m_doc->isEmpty() || m_cursorPosition < 0)
+// return Qt::AlignLeft;
+ QTextCursor cursor = textCursor();
+ if (cursor.isNull() || cursor.blockNumber() == 0)
+ return Qt::AlignLeft;
+ return textCursor().blockFormat().alignment();
+}
+
+bool DocumentHandler::bold() const
+{
+ QTextCursor cursor = textCursor();
+ if (cursor.isNull() || cursor.blockNumber() == 0)
+ return false;
+ return textCursor().charFormat().fontWeight() == QFont::Bold;
+}
+
+bool DocumentHandler::italic() const
+{
+ QTextCursor cursor = textCursor();
+ if (cursor.isNull() || cursor.blockNumber() == 0)
+ return false;
+ return textCursor().charFormat().fontItalic();
+}
+
+bool DocumentHandler::underline() const
+{
+ QTextCursor cursor = textCursor();
+ if (cursor.isNull() || cursor.blockNumber() == 0)
+ 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();
+}
+
+QFont DocumentHandler::currentFont() const
+{
+ QTextCursor cursor = textCursor();
+ if (cursor.isNull())
+ return QFont();
+ QTextCharFormat format = cursor.charFormat();
+ return format.font();
+}
+
+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/quick/controls/text/src/documenthandler.h b/examples/quick/controls/text/src/documenthandler.h
new file mode 100644
index 000000000..c60bc1d51
--- /dev/null
+++ b/examples/quick/controls/text/src/documenthandler.h
@@ -0,0 +1,165 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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(QFont currentFont READ currentFont NOTIFY currentFontChanged)
+ 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; }
+
+ QFont currentFont() 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 setFileUrl(const QUrl &arg);
+ void setText(const QString &arg);
+
+ void setDocumentTitle(QString arg);
+
+Q_SIGNALS:
+ void targetChanged();
+ void cursorPositionChanged();
+ void selectionStartChanged();
+ void selectionEndChanged();
+
+ void currentFontChanged();
+ void alignmentChanged();
+
+ void boldChanged();
+ void italicChanged();
+ void underlineChanged();
+
+ void fontSizeChanged();
+ void defaultFontSizesChanged();
+
+ void fileUrlChanged();
+
+ void textChanged();
+ void documentTitleChanged();
+
+private:
+ 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;
+ bool m_bold;
+ bool m_italic;
+ bool m_underline;
+ int m_fontSize;
+ QUrl m_fileUrl;
+ QString m_text;
+ QString m_documentTitle;
+};
+
+#endif
diff --git a/examples/quick/controls/text/src/main.cpp b/examples/quick/controls/text/src/main.cpp
new file mode 100644
index 000000000..0fc064dce
--- /dev/null
+++ b/examples/quick/controls/text/src/main.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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 <QtWidgets/QApplication>
+#include <QtQml>
+#include <QtQuick/QQuickView>
+#include <QtCore/QString>
+
+#include "documenthandler.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ QQmlEngine engine;
+
+ qmlRegisterType<DocumentHandler>("org.qtproject.example", 1, 0, "DocumentHandler");
+
+ QQmlComponent component(&engine);
+ component.loadUrl(QUrl("qrc:/qml/main.qml"));
+ if ( !component.isReady() ) {
+ qWarning("%s", qPrintable(component.errorString()));
+ return -1;
+ }
+ QObject *topLevel = component.create();
+ QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
+ if ( !window ) {
+ qWarning("Error: Your root item has to be a Window.");
+ return -1;
+ }
+
+ QObject::connect(&engine, SIGNAL(quit()), &app, SLOT(quit()));
+ window->show();
+ return app.exec();
+}
diff --git a/examples/quick/controls/text/src/src.pri b/examples/quick/controls/text/src/src.pri
new file mode 100644
index 000000000..2b89cd629
--- /dev/null
+++ b/examples/quick/controls/text/src/src.pri
@@ -0,0 +1,9 @@
+SOURCES += \
+ $$PWD/documenthandler.cpp \
+ $$PWD/main.cpp
+
+
+HEADERS += \
+ $$PWD/documenthandler.h
+
+
diff --git a/examples/quick/controls/text/text.pro b/examples/quick/controls/text/text.pro
new file mode 100644
index 000000000..3b5b10469
--- /dev/null
+++ b/examples/quick/controls/text/text.pro
@@ -0,0 +1,19 @@
+QT += qml quick
+CONFIG += console
+TARGET = text
+qtHaveModule(widgets) {
+ QT += widgets
+}
+
+include(src/src.pri)
+
+OTHER_FILES += \
+ qml/main.qml
+
+RESOURCES += \
+ resources.qrc
+
+MOC_DIR = ./.moc
+OBJECTS_DIR = ./.obj
+UI_DIR = ./.ui
+RCC_DIR = ./.rcc
diff --git a/examples/quick/controls/touch/content/AndroidDelegate.qml b/examples/quick/controls/touch/content/AndroidDelegate.qml
new file mode 100644
index 000000000..36a439a8e
--- /dev/null
+++ b/examples/quick/controls/touch/content/AndroidDelegate.qml
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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
+
+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/quick/controls/touch/content/ButtonPage.qml b/examples/quick/controls/touch/content/ButtonPage.qml
new file mode 100644
index 000000000..cc5925ce0
--- /dev/null
+++ b/examples/quick/controls/touch/content/ButtonPage.qml
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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.0
+import QtQuick.Controls.Styles 1.0
+
+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 {
+ anchors.margins: 20
+ text: "Press me"
+ style: touchStyle
+ }
+
+ Button {
+ anchors.margins: 20
+ style: touchStyle
+ text: "Press me too"
+ }
+
+ Button {
+ anchors.margins: 20
+ style: touchStyle
+ text: "Dont press me"
+ onClicked: if (pageStack) pageStack.pop()
+ }
+
+ }
+
+ Component {
+ id: touchStyle
+ ButtonStyle {
+ background: 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"
+ }
+ }
+ foregroundColor: "white"
+ font.pixelSize: 23
+ }
+ }
+}
diff --git a/examples/quick/controls/touch/content/ProgressBarPage.qml b/examples/quick/controls/touch/content/ProgressBarPage.qml
new file mode 100644
index 000000000..86a46b69b
--- /dev/null
+++ b/examples/quick/controls/touch/content/ProgressBarPage.qml
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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.0
+import QtQuick.Controls.Styles 1.0
+
+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 {
+ background: 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/quick/controls/touch/content/SliderPage.qml b/examples/quick/controls/touch/content/SliderPage.qml
new file mode 100644
index 000000000..8d9ff0b1f
--- /dev/null
+++ b/examples/quick/controls/touch/content/SliderPage.qml
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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.0
+import QtQuick.Controls.Styles 1.0
+
+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)
+ }
+
+ background: 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/quick/controls/touch/content/TabBarPage.qml b/examples/quick/controls/touch/content/TabBarPage.qml
new file mode 100644
index 000000000..41de78220
--- /dev/null
+++ b/examples/quick/controls/touch/content/TabBarPage.qml
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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.0
+import QtQuick.Controls.Styles 1.0
+
+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 {
+ tabBarAlignment: "center"
+ frame: Item { }
+ tab: Item {
+ implicitWidth: control.width/control.count
+ implicitHeight: 50
+ BorderImage {
+ anchors.fill: parent
+ border.bottom: 8
+ border.top: 8
+ source: tab.selected ? "../images/tab_selected.png":"../images/tabs_standard.png"
+ Text {
+ anchors.centerIn: parent
+ color: "white"
+ text: tab.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/quick/controls/touch/content/TextInputPage.qml b/examples/quick/controls/touch/content/TextInputPage.qml
new file mode 100644
index 000000000..3f408d472
--- /dev/null
+++ b/examples/quick/controls/touch/content/TextInputPage.qml
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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.0
+import QtQuick.Controls.Styles 1.0
+
+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 {
+ foregroundColor: "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/quick/controls/touch/images/NOTICE.txt b/examples/quick/controls/touch/images/NOTICE.txt
new file mode 100644
index 000000000..93a9afc8c
--- /dev/null
+++ b/examples/quick/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/quick/controls/touch/images/button_default.png b/examples/quick/controls/touch/images/button_default.png
new file mode 100644
index 000000000..6d6cfd9ad
--- /dev/null
+++ b/examples/quick/controls/touch/images/button_default.png
Binary files differ
diff --git a/examples/quick/controls/touch/images/button_pressed.png b/examples/quick/controls/touch/images/button_pressed.png
new file mode 100644
index 000000000..ab78b6ea3
--- /dev/null
+++ b/examples/quick/controls/touch/images/button_pressed.png
Binary files differ
diff --git a/examples/quick/controls/touch/images/navigation_next_item.png b/examples/quick/controls/touch/images/navigation_next_item.png
new file mode 100644
index 000000000..6665c9d85
--- /dev/null
+++ b/examples/quick/controls/touch/images/navigation_next_item.png
Binary files differ
diff --git a/examples/quick/controls/touch/images/navigation_previous_item.png b/examples/quick/controls/touch/images/navigation_previous_item.png
new file mode 100644
index 000000000..f8be01197
--- /dev/null
+++ b/examples/quick/controls/touch/images/navigation_previous_item.png
Binary files differ
diff --git a/examples/quick/controls/touch/images/tab_selected.png b/examples/quick/controls/touch/images/tab_selected.png
new file mode 100644
index 000000000..2345f7a8e
--- /dev/null
+++ b/examples/quick/controls/touch/images/tab_selected.png
Binary files differ
diff --git a/examples/quick/controls/touch/images/tabs_standard.png b/examples/quick/controls/touch/images/tabs_standard.png
new file mode 100644
index 000000000..7140ab7b7
--- /dev/null
+++ b/examples/quick/controls/touch/images/tabs_standard.png
Binary files differ
diff --git a/examples/quick/controls/touch/images/textinput.png b/examples/quick/controls/touch/images/textinput.png
new file mode 100644
index 000000000..b0256db2c
--- /dev/null
+++ b/examples/quick/controls/touch/images/textinput.png
Binary files differ
diff --git a/examples/quick/controls/touch/images/toolbar.png b/examples/quick/controls/touch/images/toolbar.png
new file mode 100644
index 000000000..e9eba4c74
--- /dev/null
+++ b/examples/quick/controls/touch/images/toolbar.png
Binary files differ
diff --git a/examples/quick/controls/touch/main.qml b/examples/quick/controls/touch/main.qml
new file mode 100644
index 000000000..342d4f2d1
--- /dev/null
+++ b/examples/quick/controls/touch/main.qml
@@ -0,0 +1,150 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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.0
+import "content"
+
+ApplicationWindow {
+ width: 800
+ height: 1280
+
+ Rectangle {
+ color: "#212126"
+ anchors.fill: parent
+ }
+
+ // Implements back key navigation
+ Keys.onReleased: {
+ if (event.key === Qt.Key_Back) {
+ if (pageStack.depth > 1) {
+ pageStack.pop();
+ event.accepted = true;
+ } else { Qt.quit(); }
+ }
+ }
+
+ 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: pageStack.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: pageStack.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"
+ }
+ }
+
+ StackView {
+ id: pageStack
+ anchors.fill: parent
+
+ initialItem: Item {
+ width: parent.width
+ height: parent.height
+ ListView {
+ model: pageModel
+ anchors.fill: parent
+ delegate: AndroidDelegate {
+ text: title
+ onClicked: pageStack.push(Qt.resolvedUrl(page))
+ }
+ }
+ }
+ }
+
+}
diff --git a/examples/quick/controls/touch/touch.pro b/examples/quick/controls/touch/touch.pro
new file mode 100644
index 000000000..f81aa0585
--- /dev/null
+++ b/examples/quick/controls/touch/touch.pro
@@ -0,0 +1,10 @@
+TEMPLATE = aux
+
+OTHER_FILES += \
+ main.qml \
+ content/AndroidDelegate.qml \
+ content/ButtonPage.qml \
+ content/ProgressBarPage.qml \
+ content/SliderPage.qml \
+ content/TabBarPage.qml \
+ content/TextInputPage.qml
diff --git a/examples/quick/controls/touch/touch.qmlproject b/examples/quick/controls/touch/touch.qmlproject
new file mode 100644
index 000000000..e5a8bf02c
--- /dev/null
+++ b/examples/quick/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: "."
+ }
+}