summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@theqtcompany.com>2015-02-12 13:55:22 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-02-13 12:01:33 +0000
commit6f15c206b069ed0fcf48a285bfcc4ad636927df0 (patch)
tree6150e262bc2d049219981a4cb1e1deeeeed5d636 /examples
parentd28a02aec9a1632f2263d9276099454b33fb6741 (diff)
downloadqtquickcontrols-6f15c206b069ed0fcf48a285bfcc4ad636927df0.tar.gz
Import Qt Quick Extras (the former Qt Quick Enterprise Controls)
Change-Id: I59c5c97c564f707da4ce617e25e13ff8124f7d4b Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/examples.pro1
-rw-r--r--examples/quick/extras/dashboard/dashboard.pro18
-rw-r--r--examples/quick/extras/dashboard/dashboard.qrc13
-rw-r--r--examples/quick/extras/dashboard/fonts/DejaVuSans.ttfbin0 -> 720856 bytes
-rw-r--r--examples/quick/extras/dashboard/images/fuel-icon.pngbin0 -> 666 bytes
-rw-r--r--examples/quick/extras/dashboard/images/temperature-icon.pngbin0 -> 3302 bytes
-rw-r--r--examples/quick/extras/dashboard/main.cpp55
-rw-r--r--examples/quick/extras/dashboard/qml/DashboardGaugeStyle.qml164
-rw-r--r--examples/quick/extras/dashboard/qml/IconGaugeStyle.qml124
-rw-r--r--examples/quick/extras/dashboard/qml/TachometerStyle.qml116
-rw-r--r--examples/quick/extras/dashboard/qml/TurnIndicator.qml105
-rw-r--r--examples/quick/extras/dashboard/qml/ValueSource.qml320
-rw-r--r--examples/quick/extras/dashboard/qml/dashboard.qml175
-rw-r--r--examples/quick/extras/extras.pro5
-rw-r--r--examples/quick/extras/flat/Content.qml707
-rw-r--r--examples/quick/extras/flat/SettingsIcon.qml118
-rw-r--r--examples/quick/extras/flat/flat.pro16
-rw-r--r--examples/quick/extras/flat/flat.qrc16
-rw-r--r--examples/quick/extras/flat/images/piemenu-bw-normal.pngbin0 -> 1716 bytes
-rw-r--r--examples/quick/extras/flat/images/piemenu-bw-pressed.pngbin0 -> 1394 bytes
-rw-r--r--examples/quick/extras/flat/images/piemenu-image-bw.jpgbin0 -> 1065560 bytes
-rw-r--r--examples/quick/extras/flat/images/piemenu-image-rgb.jpgbin0 -> 1152261 bytes
-rw-r--r--examples/quick/extras/flat/images/piemenu-image-sepia.jpgbin0 -> 1513238 bytes
-rw-r--r--examples/quick/extras/flat/images/piemenu-rgb-normal.pngbin0 -> 1665 bytes
-rw-r--r--examples/quick/extras/flat/images/piemenu-rgb-pressed.pngbin0 -> 1571 bytes
-rw-r--r--examples/quick/extras/flat/images/piemenu-sepia-normal.pngbin0 -> 1410 bytes
-rw-r--r--examples/quick/extras/flat/images/piemenu-sepia-pressed.pngbin0 -> 1386 bytes
-rw-r--r--examples/quick/extras/flat/main.cpp55
-rw-r--r--examples/quick/extras/flat/main.qml480
-rw-r--r--examples/quick/extras/gallery/fonts/LICENSE.txt202
-rw-r--r--examples/quick/extras/gallery/fonts/OpenSans-Regular.ttfbin0 -> 217360 bytes
-rw-r--r--examples/quick/extras/gallery/gallery.pro31
-rw-r--r--examples/quick/extras/gallery/gallery.qrc36
-rw-r--r--examples/quick/extras/gallery/images/background-light.pngbin0 -> 46832 bytes
-rw-r--r--examples/quick/extras/gallery/images/background.pngbin0 -> 45497 bytes
-rw-r--r--examples/quick/extras/gallery/images/center-light.pngbin0 -> 2113 bytes
-rw-r--r--examples/quick/extras/gallery/images/center.pngbin0 -> 2392 bytes
-rw-r--r--examples/quick/extras/gallery/images/icon-back.pngbin0 -> 614 bytes
-rw-r--r--examples/quick/extras/gallery/images/icon-go.pngbin0 -> 1435 bytes
-rw-r--r--examples/quick/extras/gallery/images/icon-settings.pngbin0 -> 1786 bytes
-rw-r--r--examples/quick/extras/gallery/images/info.pngbin0 -> 709 bytes
-rw-r--r--examples/quick/extras/gallery/images/needle-light.pngbin0 -> 2105 bytes
-rw-r--r--examples/quick/extras/gallery/images/needle.pngbin0 -> 4891 bytes
-rw-r--r--examples/quick/extras/gallery/images/qt-logo.pngbin0 -> 5149 bytes
-rw-r--r--examples/quick/extras/gallery/images/zoom_in.pngbin0 -> 829 bytes
-rw-r--r--examples/quick/extras/gallery/images/zoom_out.pngbin0 -> 779 bytes
-rw-r--r--examples/quick/extras/gallery/main.cpp49
-rw-r--r--examples/quick/extras/gallery/qml/BlackButtonBackground.qml71
-rw-r--r--examples/quick/extras/gallery/qml/BlackButtonStyle.qml97
-rw-r--r--examples/quick/extras/gallery/qml/CircularGaugeDarkStyle.qml96
-rw-r--r--examples/quick/extras/gallery/qml/CircularGaugeDefaultStyle.qml46
-rw-r--r--examples/quick/extras/gallery/qml/CircularGaugeLightStyle.qml97
-rw-r--r--examples/quick/extras/gallery/qml/CircularGaugeView.qml230
-rw-r--r--examples/quick/extras/gallery/qml/ControlLabel.qml49
-rw-r--r--examples/quick/extras/gallery/qml/ControlView.qml188
-rw-r--r--examples/quick/extras/gallery/qml/ControlViewToolbar.qml91
-rw-r--r--examples/quick/extras/gallery/qml/CustomizerLabel.qml48
-rw-r--r--examples/quick/extras/gallery/qml/CustomizerSlider.qml75
-rw-r--r--examples/quick/extras/gallery/qml/CustomizerSwitch.qml46
-rw-r--r--examples/quick/extras/gallery/qml/FlickableMoreIndicator.qml76
-rw-r--r--examples/quick/extras/gallery/qml/PieMenuControlView.qml187
-rw-r--r--examples/quick/extras/gallery/qml/PieMenuDarkStyle.qml46
-rw-r--r--examples/quick/extras/gallery/qml/PieMenuDefaultStyle.qml44
-rw-r--r--examples/quick/extras/gallery/qml/StylePicker.qml99
-rw-r--r--examples/quick/extras/gallery/qml/gallery.qml440
65 files changed, 4832 insertions, 0 deletions
diff --git a/examples/examples.pro b/examples/examples.pro
index 266358ca..c80af37f 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -2,3 +2,4 @@ TEMPLATE = subdirs
SUBDIRS += quick/controls
SUBDIRS += quick/dialogs
+SUBDIRS += quick/extras
diff --git a/examples/quick/extras/dashboard/dashboard.pro b/examples/quick/extras/dashboard/dashboard.pro
new file mode 100644
index 00000000..c549250e
--- /dev/null
+++ b/examples/quick/extras/dashboard/dashboard.pro
@@ -0,0 +1,18 @@
+TEMPLATE = app
+TARGET = dashboard
+INCLUDEPATH += .
+QT += quick
+
+SOURCES += \
+ main.cpp
+
+RESOURCES += \
+ dashboard.qrc
+
+OTHER_FILES += \
+ qml/dashboard.qml \
+ qml/DashboardGaugeStyle.qml \
+ qml/IconGaugeStyle.qml \
+ qml/TachometerStyle.qml \
+ qml/TurnIndicator.qml \
+ qml/ValueSource.qml
diff --git a/examples/quick/extras/dashboard/dashboard.qrc b/examples/quick/extras/dashboard/dashboard.qrc
new file mode 100644
index 00000000..605e1678
--- /dev/null
+++ b/examples/quick/extras/dashboard/dashboard.qrc
@@ -0,0 +1,13 @@
+<RCC>
+ <qresource prefix="/">
+ <file>fonts/DejaVuSans.ttf</file>
+ <file>images/fuel-icon.png</file>
+ <file>images/temperature-icon.png</file>
+ <file>qml/dashboard.qml</file>
+ <file>qml/DashboardGaugeStyle.qml</file>
+ <file>qml/IconGaugeStyle.qml</file>
+ <file>qml/TachometerStyle.qml</file>
+ <file>qml/TurnIndicator.qml</file>
+ <file>qml/ValueSource.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/quick/extras/dashboard/fonts/DejaVuSans.ttf b/examples/quick/extras/dashboard/fonts/DejaVuSans.ttf
new file mode 100644
index 00000000..19ed0b46
--- /dev/null
+++ b/examples/quick/extras/dashboard/fonts/DejaVuSans.ttf
Binary files differ
diff --git a/examples/quick/extras/dashboard/images/fuel-icon.png b/examples/quick/extras/dashboard/images/fuel-icon.png
new file mode 100644
index 00000000..f521e905
--- /dev/null
+++ b/examples/quick/extras/dashboard/images/fuel-icon.png
Binary files differ
diff --git a/examples/quick/extras/dashboard/images/temperature-icon.png b/examples/quick/extras/dashboard/images/temperature-icon.png
new file mode 100644
index 00000000..5a4334e0
--- /dev/null
+++ b/examples/quick/extras/dashboard/images/temperature-icon.png
Binary files differ
diff --git a/examples/quick/extras/dashboard/main.cpp b/examples/quick/extras/dashboard/main.cpp
new file mode 100644
index 00000000..035d8932
--- /dev/null
+++ b/examples/quick/extras/dashboard/main.cpp
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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 <QtGui/QGuiApplication>
+#include <QtQml/QQmlApplicationEngine>
+#include <QtGui/QFont>
+#include <QtGui/QFontDatabase>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QFontDatabase::addApplicationFont(":/fonts/DejaVuSans.ttf");
+ app.setFont(QFont("DejaVu Sans"));
+
+ QQmlApplicationEngine engine(QUrl("qrc:/qml/dashboard.qml"));
+ return app.exec();
+}
diff --git a/examples/quick/extras/dashboard/qml/DashboardGaugeStyle.qml b/examples/quick/extras/dashboard/qml/DashboardGaugeStyle.qml
new file mode 100644
index 00000000..c2b43fce
--- /dev/null
+++ b/examples/quick/extras/dashboard/qml/DashboardGaugeStyle.qml
@@ -0,0 +1,164 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.2
+import QtQuick.Extras.Styles 1.3
+
+CircularGaugeStyle {
+ tickmarkInset: toPixels(0.04)
+ minorTickmarkInset: tickmarkInset
+ labelStepSize: 20
+ labelInset: toPixels(0.23)
+
+ property real xCenter: outerRadius
+ property real yCenter: outerRadius
+ property real needleLength: outerRadius - tickmarkInset * 1.25
+ property real needleTipWidth: toPixels(0.02)
+ property real needleBaseWidth: toPixels(0.06)
+ property bool halfGauge: false
+
+ function toPixels(percentage) {
+ return percentage * outerRadius;
+ }
+
+ function degToRad(degrees) {
+ return degrees * (Math.PI / 180);
+ }
+
+ function radToDeg(radians) {
+ return radians * (180 / Math.PI);
+ }
+
+ function paintBackground(ctx) {
+ if (halfGauge) {
+ ctx.beginPath();
+ ctx.rect(0, 0, ctx.canvas.width, ctx.canvas.height / 2);
+ ctx.clip();
+ }
+
+ ctx.beginPath();
+ ctx.fillStyle = "black";
+ ctx.ellipse(0, 0, ctx.canvas.width, ctx.canvas.height);
+ ctx.fill();
+
+ ctx.beginPath();
+ ctx.lineWidth = tickmarkInset;
+ ctx.strokeStyle = "black";
+ ctx.arc(xCenter, yCenter, outerRadius - ctx.lineWidth / 2, outerRadius - ctx.lineWidth / 2, 0, Math.PI * 2);
+ ctx.stroke();
+
+ ctx.beginPath();
+ ctx.lineWidth = tickmarkInset / 2;
+ ctx.strokeStyle = "#222";
+ ctx.arc(xCenter, yCenter, outerRadius - ctx.lineWidth / 2, outerRadius - ctx.lineWidth / 2, 0, Math.PI * 2);
+ ctx.stroke();
+
+ ctx.beginPath();
+ var gradient = ctx.createRadialGradient(xCenter, yCenter, outerRadius * 0.8, xCenter, yCenter, outerRadius);
+ gradient.addColorStop(0, Qt.rgba(1, 1, 1, 0));
+ gradient.addColorStop(0.7, Qt.rgba(1, 1, 1, 0.13));
+ gradient.addColorStop(1, Qt.rgba(1, 1, 1, 1));
+ ctx.fillStyle = gradient;
+ ctx.arc(xCenter, yCenter, outerRadius - tickmarkInset, outerRadius - tickmarkInset, 0, Math.PI * 2);
+ ctx.fill();
+ }
+
+ background: Canvas {
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+ paintBackground(ctx);
+ }
+
+ Text {
+ id: speedText
+ font.pixelSize: toPixels(0.3)
+ text: kphInt
+ color: "white"
+ horizontalAlignment: Text.AlignRight
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: parent.verticalCenter
+ anchors.topMargin: toPixels(0.1)
+
+ readonly property int kphInt: control.value
+ }
+ Text {
+ text: "km/h"
+ color: "white"
+ font.pixelSize: toPixels(0.09)
+ anchors.top: speedText.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+
+ needle: Canvas {
+ implicitWidth: needleBaseWidth
+ implicitHeight: needleLength
+
+ property real xCenter: width / 2
+ property real yCenter: height / 2
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ ctx.beginPath();
+ ctx.moveTo(xCenter, height);
+ ctx.lineTo(xCenter - needleBaseWidth / 2, height - needleBaseWidth / 2);
+ ctx.lineTo(xCenter - needleTipWidth / 2, 0);
+ ctx.lineTo(xCenter, yCenter - needleLength);
+ ctx.lineTo(xCenter, 0);
+ ctx.closePath();
+ ctx.fillStyle = Qt.rgba(0.66, 0, 0, 0.66);
+ ctx.fill();
+
+ ctx.beginPath();
+ ctx.moveTo(xCenter, height)
+ ctx.lineTo(width, height - needleBaseWidth / 2);
+ ctx.lineTo(xCenter + needleTipWidth / 2, 0);
+ ctx.lineTo(xCenter, 0);
+ ctx.closePath();
+ ctx.fillStyle = Qt.lighter(Qt.rgba(0.66, 0, 0, 0.66));
+ ctx.fill();
+ }
+ }
+
+ foreground: null
+}
diff --git a/examples/quick/extras/dashboard/qml/IconGaugeStyle.qml b/examples/quick/extras/dashboard/qml/IconGaugeStyle.qml
new file mode 100644
index 00000000..4bf4751d
--- /dev/null
+++ b/examples/quick/extras/dashboard/qml/IconGaugeStyle.qml
@@ -0,0 +1,124 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.2
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Styles 1.3
+
+DashboardGaugeStyle {
+ id: fuelGaugeStyle
+ minimumValueAngle: -60
+ maximumValueAngle: 60
+ tickmarkStepSize: 1
+ labelStepSize: 1
+ labelInset: toPixels(-0.25)
+ minorTickmarkCount: 3
+
+ needleLength: toPixels(0.85)
+ needleBaseWidth: toPixels(0.08)
+ needleTipWidth: toPixels(0.03)
+
+ halfGauge: true
+
+ property string icon: ""
+ property color minWarningColor: "transparent"
+ property color maxWarningColor: "transparent"
+ readonly property real minWarningStartAngle: minimumValueAngle - 90
+ readonly property real maxWarningStartAngle: maximumValueAngle - 90
+
+ tickmark: Rectangle {
+ implicitWidth: toPixels(0.06)
+ antialiasing: true
+ implicitHeight: toPixels(0.2)
+ color: "#c8c8c8"
+ }
+
+ minorTickmark: Rectangle {
+ implicitWidth: toPixels(0.03)
+ antialiasing: true
+ implicitHeight: toPixels(0.15)
+ color: "#c8c8c8"
+ }
+
+ background: Item {
+ Canvas {
+ anchors.fill: parent
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ paintBackground(ctx);
+
+ if (minWarningColor != "transparent") {
+ ctx.beginPath();
+ ctx.lineWidth = fuelGaugeStyle.toPixels(0.08);
+ ctx.strokeStyle = minWarningColor;
+ ctx.arc(outerRadius, outerRadius,
+ // Start the line in from the decorations, and account for the width of the line itself.
+ outerRadius - tickmarkInset - ctx.lineWidth / 2,
+ degToRad(minWarningStartAngle),
+ degToRad(minWarningStartAngle + angleRange / (minorTickmarkCount + 1)), false);
+ ctx.stroke();
+ }
+ if (maxWarningColor != "transparent") {
+ ctx.beginPath();
+ ctx.lineWidth = fuelGaugeStyle.toPixels(0.08);
+ ctx.strokeStyle = maxWarningColor;
+ ctx.arc(outerRadius, outerRadius,
+ // Start the line in from the decorations, and account for the width of the line itself.
+ outerRadius - tickmarkInset - ctx.lineWidth / 2,
+ degToRad(maxWarningStartAngle - angleRange / (minorTickmarkCount + 1)),
+ degToRad(maxWarningStartAngle), false);
+ ctx.stroke();
+ }
+ }
+ }
+
+ Image {
+ source: icon
+ anchors.bottom: parent.verticalCenter
+ anchors.bottomMargin: toPixels(0.3)
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: toPixels(0.3)
+ height: width
+ fillMode: Image.PreserveAspectFit
+ }
+ }
+}
diff --git a/examples/quick/extras/dashboard/qml/TachometerStyle.qml b/examples/quick/extras/dashboard/qml/TachometerStyle.qml
new file mode 100644
index 00000000..40ef157a
--- /dev/null
+++ b/examples/quick/extras/dashboard/qml/TachometerStyle.qml
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.2
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Styles 1.3
+
+DashboardGaugeStyle {
+ id: tachometerStyle
+ tickmarkStepSize: 1
+ labelStepSize: 1
+ needleLength: toPixels(0.85)
+ needleBaseWidth: toPixels(0.08)
+ needleTipWidth: toPixels(0.03)
+
+ tickmark: Rectangle {
+ implicitWidth: toPixels(0.03)
+ antialiasing: true
+ implicitHeight: toPixels(0.08)
+ color: styleData.index === 7 || styleData.index === 8 ? Qt.rgba(0.5, 0, 0, 1) : "#c8c8c8"
+ }
+
+ minorTickmark: null
+
+ tickmarkLabel: Text {
+ font.pixelSize: Math.max(6, toPixels(0.12))
+ text: styleData.value
+ color: styleData.index === 7 || styleData.index === 8 ? Qt.rgba(0.5, 0, 0, 1) : "#c8c8c8"
+ antialiasing: true
+ }
+
+ background: Canvas {
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+ paintBackground(ctx);
+
+ ctx.beginPath();
+ ctx.lineWidth = tachometerStyle.toPixels(0.08);
+ ctx.strokeStyle = Qt.rgba(0.5, 0, 0, 1);
+ var warningCircumference = maximumValueAngle - minimumValueAngle * 0.1;
+ var startAngle = maximumValueAngle - 90;
+ ctx.arc(outerRadius, outerRadius,
+ // Start the line in from the decorations, and account for the width of the line itself.
+ outerRadius - tickmarkInset - ctx.lineWidth / 2,
+ degToRad(startAngle - angleRange / 8 + angleRange * 0.015),
+ degToRad(startAngle - angleRange * 0.015), false);
+ ctx.stroke();
+ }
+
+ Text {
+ id: rpmText
+ font.pixelSize: tachometerStyle.toPixels(0.3)
+ text: rpmInt
+ color: "white"
+ horizontalAlignment: Text.AlignRight
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: parent.verticalCenter
+ anchors.topMargin: 20
+
+ readonly property int rpmInt: valueSource.rpm
+ }
+ Text {
+ text: "x1000"
+ color: "white"
+ font.pixelSize: tachometerStyle.toPixels(0.1)
+ anchors.top: parent.top
+ anchors.topMargin: parent.height / 4
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ Text {
+ text: "RPM"
+ color: "white"
+ font.pixelSize: tachometerStyle.toPixels(0.1)
+ anchors.top: rpmText.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+}
diff --git a/examples/quick/extras/dashboard/qml/TurnIndicator.qml b/examples/quick/extras/dashboard/qml/TurnIndicator.qml
new file mode 100644
index 00000000..960d27e7
--- /dev/null
+++ b/examples/quick/extras/dashboard/qml/TurnIndicator.qml
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.2
+import QtQuick.Extras.Styles 1.3
+
+Item {
+ // This enum is actually keyboard-related, but it serves its purpose
+ // as an indication of direction for us.
+ property int direction: Qt.LeftArrow
+ property bool on: false
+
+ property bool flashing: false
+
+ scale: direction === Qt.LeftArrow ? 1 : -1
+
+ Timer {
+ id: flashTimer
+ interval: 500
+ running: on
+ repeat: true
+ onTriggered: flashing = !flashing
+ }
+
+ function paintOutlinePath(ctx) {
+ ctx.beginPath();
+ ctx.moveTo(0, height * 0.5);
+ ctx.lineTo(0.6 * width, 0);
+ ctx.lineTo(0.6 * width, height * 0.28);
+ ctx.lineTo(width, height * 0.28);
+ ctx.lineTo(width, height * 0.72);
+ ctx.lineTo(0.6 * width, height * 0.72);
+ ctx.lineTo(0.6 * width, height);
+ ctx.lineTo(0, height * 0.5);
+ }
+
+ Canvas {
+ id: backgroundCanvas
+ anchors.fill: parent
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ paintOutlinePath(ctx);
+
+ ctx.lineWidth = 1;
+ ctx.strokeStyle = "black";
+ ctx.stroke();
+ }
+ }
+
+ Canvas {
+ id: foregroundCanvas
+ anchors.fill: parent
+ visible: on && flashing
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ paintOutlinePath(ctx);
+
+ ctx.fillStyle = "green";
+ ctx.fill();
+ }
+ }
+}
diff --git a/examples/quick/extras/dashboard/qml/ValueSource.qml b/examples/quick/extras/dashboard/qml/ValueSource.qml
new file mode 100644
index 00000000..6f762724
--- /dev/null
+++ b/examples/quick/extras/dashboard/qml/ValueSource.qml
@@ -0,0 +1,320 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.2
+
+Item {
+ id: valueSource
+ property real kph: 0
+ property real rpm: 1
+ property real fuel: 0.85
+ property string gear: {
+ var g;
+ if (kph == 0) {
+ return "P";
+ }
+ if (kph < 30) {
+ return "1";
+ }
+ if (kph < 50) {
+ return "2";
+ }
+ if (kph < 80) {
+ return "3";
+ }
+ if (kph < 120) {
+ return "4";
+ }
+ if (kph < 160) {
+ return "5";
+ }
+ }
+ property int turnSignal: gear == "P" && !start ? randomDirection() : -1
+ property real temperature: 0.6
+ property bool start: true
+
+ function randomDirection() {
+ return Math.random() > 0.5 ? Qt.LeftArrow : Qt.RightArrow;
+ }
+
+ SequentialAnimation {
+ running: true
+ loops: 1
+
+ // We want a small pause at the beginning, but we only want it to happen once.
+ PauseAnimation {
+ duration: 1000
+ }
+
+ PropertyAction {
+ target: valueSource
+ property: "start"
+ value: false
+ }
+
+ SequentialAnimation {
+ loops: Animation.Infinite
+
+ ParallelAnimation {
+ NumberAnimation {
+ target: valueSource
+ property: "kph"
+ easing.type: Easing.InOutSine
+ from: 0
+ to: 30
+ duration: 3000
+ }
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ from: 1
+ to: 6.1
+ duration: 3000
+ }
+ }
+ ParallelAnimation {
+ // We changed gears so we lost a bit of speed.
+ NumberAnimation {
+ target: valueSource
+ property: "kph"
+ easing.type: Easing.InOutSine
+ from: 30
+ to: 26
+ duration: 600
+ }
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ from: 6
+ to: 2.4
+ duration: 600
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation {
+ target: valueSource
+ property: "kph"
+ easing.type: Easing.InOutSine
+ to: 60
+ duration: 3000
+ }
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ to: 5.6
+ duration: 3000
+ }
+ }
+ ParallelAnimation {
+ // We changed gears so we lost a bit of speed.
+ NumberAnimation {
+ target: valueSource
+ property: "kph"
+ easing.type: Easing.InOutSine
+ to: 56
+ duration: 600
+ }
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ to: 2.3
+ duration: 600
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation {
+ target: valueSource
+ property: "kph"
+ easing.type: Easing.InOutSine
+ to: 100
+ duration: 3000
+ }
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ to: 5.1
+ duration: 3000
+ }
+ }
+ ParallelAnimation {
+ // We changed gears so we lost a bit of speed.
+ NumberAnimation {
+ target: valueSource
+ property: "kph"
+ easing.type: Easing.InOutSine
+ to: 96
+ duration: 600
+ }
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ to: 2.2
+ duration: 600
+ }
+ }
+
+ ParallelAnimation {
+ NumberAnimation {
+ target: valueSource
+ property: "kph"
+ easing.type: Easing.InOutSine
+ to: 140
+ duration: 3000
+ }
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ to: 6.2
+ duration: 3000
+ }
+ }
+
+ // Start downshifting.
+
+ // Fifth to fourth gear.
+ ParallelAnimation {
+ NumberAnimation {
+ target: valueSource
+ property: "kph"
+ easing.type: Easing.Linear
+ to: 100
+ duration: 5000
+ }
+
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ to: 3.1
+ duration: 5000
+ }
+ }
+
+ // Fourth to third gear.
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ to: 5.5
+ duration: 600
+ }
+
+ ParallelAnimation {
+ NumberAnimation {
+ target: valueSource
+ property: "kph"
+ easing.type: Easing.InOutSine
+ to: 60
+ duration: 5000
+ }
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ to: 2.6
+ duration: 5000
+ }
+ }
+
+ // Third to second gear.
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ to: 6.3
+ duration: 600
+ }
+
+ ParallelAnimation {
+ NumberAnimation {
+ target: valueSource
+ property: "kph"
+ easing.type: Easing.InOutSine
+ to: 30
+ duration: 5000
+ }
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ to: 2.6
+ duration: 5000
+ }
+ }
+
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ to: 6.5
+ duration: 600
+ }
+
+ // Second to first gear.
+ ParallelAnimation {
+ NumberAnimation {
+ target: valueSource
+ property: "kph"
+ easing.type: Easing.InOutSine
+ to: 0
+ duration: 5000
+ }
+ NumberAnimation {
+ target: valueSource
+ property: "rpm"
+ easing.type: Easing.InOutSine
+ to: 1
+ duration: 4500
+ }
+ }
+
+ PauseAnimation {
+ duration: 5000
+ }
+ }
+ }
+}
diff --git a/examples/quick/extras/dashboard/qml/dashboard.qml b/examples/quick/extras/dashboard/qml/dashboard.qml
new file mode 100644
index 00000000..d18e7bc6
--- /dev/null
+++ b/examples/quick/extras/dashboard/qml/dashboard.qml
@@ -0,0 +1,175 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.2
+import QtQuick.Window 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Styles 1.1
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Styles 1.3
+
+Window {
+ id: root
+ visible: true
+ width: 1024
+ height: 600
+
+ color: "#161616"
+ title: "Qt Quick Extras Demo"
+
+ ValueSource {
+ id: valueSource
+ }
+
+ // Dashboards are typically in a landscape orientation, so we need to ensure
+ // our height is never greater than our width.
+ Item {
+ id: container
+ width: root.width
+ height: Math.min(root.width, root.height)
+ anchors.centerIn: parent
+
+ Row {
+ id: gaugeRow
+ spacing: container.width * 0.02
+ anchors.centerIn: parent
+
+ TurnIndicator {
+ id: leftIndicator
+ anchors.verticalCenter: parent.verticalCenter
+ width: height
+ height: container.height * 0.1 - gaugeRow.spacing
+
+ direction: Qt.LeftArrow
+ on: valueSource.turnSignal == Qt.LeftArrow
+ }
+
+ Item {
+ width: height
+ height: container.height * 0.25 - gaugeRow.spacing
+ anchors.verticalCenter: parent.verticalCenter
+
+ CircularGauge {
+ id: fuelGauge
+ value: valueSource.fuel
+ maximumValue: 1
+ y: parent.height / 2 - height / 2 - container.height * 0.01
+ width: parent.width
+ height: parent.height * 0.7
+
+ style: IconGaugeStyle {
+ id: fuelGaugeStyle
+
+ icon: "qrc:/images/fuel-icon.png"
+ minWarningColor: Qt.rgba(0.5, 0, 0, 1)
+
+ tickmarkLabel: Text {
+ color: "white"
+ visible: styleData.value === 0 || styleData.value === 1
+ font.pixelSize: fuelGaugeStyle.toPixels(0.225)
+ text: styleData.value === 0 ? "E" : (styleData.value === 1 ? "F" : "")
+ }
+ }
+ }
+
+ CircularGauge {
+ value: valueSource.temperature
+ maximumValue: 1
+ width: parent.width
+ height: parent.height * 0.7
+ y: parent.height / 2 + container.height * 0.01
+
+ style: IconGaugeStyle {
+ id: tempGaugeStyle
+
+ icon: "qrc:/images/temperature-icon.png"
+ maxWarningColor: Qt.rgba(0.5, 0, 0, 1)
+
+ tickmarkLabel: Text {
+ color: "white"
+ visible: styleData.value === 0 || styleData.value === 1
+ font.pixelSize: tempGaugeStyle.toPixels(0.225)
+ text: styleData.value === 0 ? "C" : (styleData.value === 1 ? "H" : "")
+ }
+ }
+ }
+ }
+
+ CircularGauge {
+ id: speedometer
+ value: valueSource.kph
+ anchors.verticalCenter: parent.verticalCenter
+ maximumValue: 280
+ // We set the width to the height, because the height will always be
+ // the more limited factor. Also, all circular controls letterbox
+ // their contents to ensure that they remain circular. However, we
+ // don't want to extra space on the left and right of our gauges,
+ // because they're laid out horizontally, and that would create
+ // large horizontal gaps between gauges on wide screens.
+ width: height
+ height: container.height * 0.5
+
+ style: DashboardGaugeStyle {}
+ }
+
+ CircularGauge {
+ id: tachometer
+ width: height
+ height: container.height * 0.25 - gaugeRow.spacing
+ value: valueSource.rpm
+ maximumValue: 8
+ anchors.verticalCenter: parent.verticalCenter
+
+ style: TachometerStyle {}
+ }
+
+ TurnIndicator {
+ id: rightIndicator
+ anchors.verticalCenter: parent.verticalCenter
+ width: height
+ height: container.height * 0.1 - gaugeRow.spacing
+
+ direction: Qt.RightArrow
+ on: valueSource.turnSignal == Qt.RightArrow
+ }
+
+ }
+ }
+}
diff --git a/examples/quick/extras/extras.pro b/examples/quick/extras/extras.pro
new file mode 100644
index 00000000..7f7b7215
--- /dev/null
+++ b/examples/quick/extras/extras.pro
@@ -0,0 +1,5 @@
+TEMPLATE = subdirs
+SUBDIRS += \
+ gallery \
+ dashboard \
+ flat
diff --git a/examples/quick/extras/flat/Content.qml b/examples/quick/extras/flat/Content.qml
new file mode 100644
index 00000000..dcef1f1c
--- /dev/null
+++ b/examples/quick/extras/flat/Content.qml
@@ -0,0 +1,707 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.4
+import QtQuick.Layouts 1.1
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles.Flat 1.0 as Flat
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Styles 1.3
+import QtQuick.XmlListModel 2.0
+
+Item {
+ anchors.fill: parent
+
+ Text {
+ id: text
+ visible: false
+ }
+
+ FontMetrics {
+ id: fontMetrics
+ font.family: Flat.FlatStyle.fontFamily
+ }
+
+ readonly property int layoutSpacing: Math.round(5 * Flat.FlatStyle.scaleFactor)
+
+ property var componentModel: [
+ { name: "Buttons", component: buttonsComponent },
+ { name: "Calendar", component: calendarComponent },
+ { name: "DelayButton", component: delayButtonComponent },
+ { name: "Dial", component: dialComponent },
+ { name: "Input", component: inputComponent },
+ { name: "PieMenu", component: pieMenuComponent },
+ { name: "Progress", component: progressComponent },
+ { name: "TableView", component: tableViewComponent },
+ { name: "TextArea", component: textAreaComponent },
+ { name: "Tumbler", component: tumblerComponent }
+ ]
+
+ Loader {
+ id: componentLoader
+ anchors.fill: parent
+ sourceComponent: componentModel[controlData.componentIndex].component
+ }
+
+ property Component buttonsComponent: ScrollView {
+ id: scrollView
+ horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
+
+ Flickable {
+ anchors.fill: parent
+ contentWidth: viewport.width
+ contentHeight: buttoncolumn.implicitHeight + textMargins * 1.5
+ ColumnLayout {
+ id: buttoncolumn
+ anchors.fill: parent
+ anchors.margins: textMargins
+ anchors.topMargin: textMargins / 2
+ spacing: textMargins / 2
+ enabled: !settingsData.allDisabled
+
+ GroupBox {
+ title: "Button"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ GridLayout {
+ columns: Math.max(1, Math.floor(scrollView.width / button.implicitWidth - 0.5))
+ Button {
+ id: button
+ text: "Normal"
+ }
+ Button {
+ text: "Default"
+ isDefault: true
+ }
+ Button {
+ text: "Checkable"
+ checkable: true
+ }
+ Button {
+ text: "Menu"
+ menu: Menu {
+ MenuItem { text: "Normal"; shortcut: "Ctrl+N" }
+ MenuSeparator { }
+ MenuItem { text: "Checkable 1"; checkable: true; checked: true }
+ MenuItem { text: "Checkable 2"; checkable: true; checked: true }
+ MenuSeparator { }
+ }
+ visible: Qt.application.supportsMultipleWindows
+ }
+ }
+ }
+
+ GroupBox {
+ title: "RadioButton"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ ExclusiveGroup { id: radiobuttongroup }
+ ColumnLayout {
+ anchors.fill: parent
+ Repeater {
+ model: ["First", "Second", "Third"]
+ RadioButton {
+ text: modelData
+ checked: index === 0
+ exclusiveGroup: radiobuttongroup
+ Layout.fillWidth: true
+ }
+ }
+ }
+ }
+
+ GroupBox {
+ title: "CheckBox"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ ColumnLayout {
+ anchors.fill: parent
+ Repeater {
+ model: ["First", "Second", "Third"]
+ CheckBox {
+ text: modelData
+ checked: index === 0
+ Layout.fillWidth: true
+ }
+ }
+ }
+ }
+
+ GroupBox {
+ title: "Switch"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ ColumnLayout {
+ anchors.fill: parent
+ Repeater {
+ model: ["First", "Second", "Third"]
+ RowLayout {
+ spacing: layoutSpacing * 2
+ Label {
+ text: modelData
+ font.family: Flat.FlatStyle.fontFamily
+ renderType: Text.QtRendering
+ Layout.preferredWidth: fontMetrics.advanceWidth("Second")
+ }
+ Switch { checked: index == 0 }
+ }
+ }
+ }
+ }
+
+ GroupBox {
+ title: "ToggleButton"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ GridLayout {
+ columns: Math.max(1, !!children[0] ? Math.floor(scrollView.width / children[0].implicitWidth - 0.5) : children.length)
+ ToggleButton {
+ text: "Pump 1"
+ checked: true
+ }
+ ToggleButton {
+ text: "Pump 2"
+ checked: false
+ }
+ }
+ }
+
+ GroupBox {
+ title: "StatusIndicator"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ GridLayout {
+ columns: Math.max(1, Math.floor(scrollView.width / recordButton.implicitWidth - 0.5))
+ columnSpacing: layoutSpacing * 4
+
+ Button {
+ id: recordButton
+ text: "Record"
+ Layout.alignment: Qt.AlignTop
+ onClicked: recordStatusIndicator.active = !recordStatusIndicator.active
+
+ StatusIndicator {
+ id: recordStatusIndicator
+ active: false
+ anchors.left: parent.left
+ anchors.leftMargin: Math.max(6, Math.round(text.implicitHeight * 0.4))
+ anchors.verticalCenter: parent.verticalCenter
+ rotation: 90
+ }
+ }
+ ColumnLayout {
+ Repeater {
+ model: 3
+ delegate: RowLayout {
+ Layout.alignment: Qt.AlignCenter
+ StatusIndicator {
+ active: true
+ color: "#f09116"
+ }
+ Label {
+ text: "Camera " + (index + 1)
+ font.family: Flat.FlatStyle.fontFamily
+ renderType: Text.QtRendering
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ property Component progressComponent: ScrollView {
+ id: scrollView
+ horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
+ Flickable {
+ anchors.fill: parent
+ contentWidth: viewport.width
+ contentHeight: progresscolumn.implicitHeight + textMargins * 1.5
+ ColumnLayout {
+ id: progresscolumn
+ anchors.fill: parent
+ anchors.leftMargin: textMargins
+ anchors.rightMargin: textMargins
+ anchors.bottomMargin: textMargins
+ anchors.topMargin: textMargins / 2
+ spacing: textMargins / 2
+ enabled: !settingsData.allDisabled
+
+ GroupBox {
+ title: "BusyIndicator"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ BusyIndicator {
+ id: busyindicator
+ anchors.centerIn: parent
+ running: scrollView.visible
+ }
+ }
+
+ GroupBox {
+ title: "ProgressBar"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ ColumnLayout {
+ anchors.fill: parent
+ ProgressBar {
+ value: slider.value
+ maximumValue: slider.maximumValue
+ Layout.fillWidth: true
+ }
+ ProgressBar {
+ indeterminate: true
+ value: slider.value
+ maximumValue: slider.maximumValue
+ Layout.fillWidth: true
+ }
+ }
+ }
+
+ GroupBox {
+ title: "Slider"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ ColumnLayout {
+ anchors.fill: parent
+ Slider {
+ id: slider
+ // TODO: can't use maximumValue / 2 here, otherwise the gauges
+ // initially show up as empty; find out why.
+ value: 50
+ // If we use the default value of 1 here, we run into QTBUG-42358,
+ // even though that report specifically uses 100 as an example...
+ maximumValue: 100
+ Layout.fillWidth: true
+ }
+ }
+ }
+
+ GroupBox {
+ title: "Gauge"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ Gauge {
+ id: gauge
+ value: slider.value * 1.4
+ orientation: window.width < window.height ? Qt.Vertical : Qt.Horizontal
+ minimumValue: slider.minimumValue * 1.4
+ maximumValue: slider.maximumValue * 1.4
+ tickmarkStepSize: 20
+
+ anchors.centerIn: parent
+ }
+ }
+
+ GroupBox {
+ title: "CircularGauge"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ Layout.minimumWidth: 0
+ CircularGauge {
+ id: circularGauge
+ value: slider.value * 3.2
+ minimumValue: slider.minimumValue * 3.2
+ maximumValue: slider.maximumValue * 3.2
+
+ anchors.centerIn: parent
+ width: Math.min(implicitWidth, parent.width)
+ height: Math.min(implicitHeight, parent.height)
+
+ style: Flat.CircularGaugeStyle {
+ tickmarkStepSize: 20
+ labelStepSize: 40
+ minorTickmarkCount: 2
+ }
+
+ Column {
+ anchors.centerIn: parent
+
+ Label {
+ text: Math.floor(circularGauge.value)
+ anchors.horizontalCenter: parent.horizontalCenter
+ renderType: Text.QtRendering
+ font.pixelSize: unitLabel.font.pixelSize * 2
+ font.family: Flat.FlatStyle.fontFamily
+ font.weight: Font.Light
+ }
+ Label {
+ id: unitLabel
+ text: "km/h"
+ renderType: Text.QtRendering
+ font.family: Flat.FlatStyle.fontFamily
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ property Component inputComponent: ScrollView {
+ id: scrollView
+ horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
+ Flickable {
+ anchors.fill: parent
+ contentWidth: viewport.width
+ contentHeight: inputcolumn.implicitHeight + textMargins * 1.5
+ ColumnLayout {
+ id: inputcolumn
+ anchors.fill: parent
+ anchors.margins: textMargins
+ spacing: textMargins / 2
+ enabled: !settingsData.allDisabled
+
+ GroupBox {
+ title: "TextField"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ ColumnLayout {
+ anchors.fill: parent
+ TextField {
+ z: 1
+ placeholderText: "TextField"
+ Layout.fillWidth: true
+ }
+ TextField {
+ placeholderText: "Password"
+ echoMode: TextInput.Password // TODO: PasswordEchoOnEdit
+ Layout.fillWidth: true
+ }
+ }
+ }
+
+ GroupBox {
+ title: "ComboBox"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ visible: Qt.application.supportsMultipleWindows
+ ColumnLayout {
+ anchors.fill: parent
+ ComboBox {
+ model: ["Option 1", "Option 2", "Option 3"]
+ Layout.fillWidth: true
+ }
+ ComboBox {
+ editable: true
+ model: ListModel {
+ id: combomodel
+ ListElement { text: "Option 1" }
+ ListElement { text: "Option 2" }
+ ListElement { text: "Option 3" }
+ }
+ onAccepted: {
+ if (find(currentText) === -1) {
+ combomodel.append({text: editText})
+ currentIndex = find(editText)
+ }
+ }
+ Layout.fillWidth: true
+ }
+ }
+ }
+
+ GroupBox {
+ title: "SpinBox"
+ checkable: settingsData.checks
+ flat: !settingsData.frames
+ Layout.fillWidth: true
+ GridLayout {
+ anchors.fill: parent
+ columns: Math.max(1, Math.floor(scrollView.width / spinbox.implicitWidth - 0.5))
+ SpinBox {
+ id: spinbox
+ Layout.fillWidth: true
+ }
+ SpinBox {
+ decimals: 1
+ Layout.fillWidth: true
+ }
+ }
+ }
+ }
+ }
+ }
+
+ Component {
+ id: tableViewComponent
+ TableView {
+ id: view
+ enabled: !settingsData.allDisabled
+ TableViewColumn {
+ role: "title"
+ title: "Title"
+ width: view.width / 2
+ resizable: false
+ movable: false
+ }
+ TableViewColumn {
+ role: "author"
+ title: "Author"
+ width: view.width / 2
+ resizable: false
+ movable: false
+ }
+
+ frameVisible: false
+ backgroundVisible: true
+ alternatingRowColors: false
+ model: ListModel {
+ ListElement {
+ title: "Moby-Dick"
+ author: "Herman Melville"
+ }
+ ListElement {
+ title: "The Adventures of Tom Sawyer"
+ author: "Mark Twain"
+ }
+ ListElement {
+ title: "Cat’s Cradle"
+ author: "Kurt Vonnegut"
+ }
+ ListElement {
+ title: "Farenheit 451"
+ author: "Ray Bradbury"
+ }
+ ListElement {
+ title: "It"
+ author: "Stephen King"
+ }
+ ListElement {
+ title: "On the Road"
+ author: "Jack Kerouac"
+ }
+ ListElement {
+ title: "Of Mice and Men"
+ author: "John Steinbeck"
+ }
+ ListElement {
+ title: "Do Androids Dream of Electric Sheep?"
+ author: "Philip K. Dick"
+ }
+ ListElement {
+ title: "Uncle Tom’s Cabin"
+ author: "Harriet Beecher Stowe"
+ }
+ ListElement {
+ title: "The Call of the Wild"
+ author: "Jack London"
+ }
+ ListElement {
+ title: "The Old Man and the Sea"
+ author: "Ernest Hemingway"
+ }
+ ListElement {
+ title: "A Streetcar Named Desire"
+ author: "Tennessee Williams"
+ }
+ ListElement {
+ title: "Catch-22"
+ author: "Joseph Heller"
+ }
+ ListElement {
+ title: "One Flew Over the Cuckoo’s Nest"
+ author: "Ken Kesey"
+ }
+ ListElement {
+ title: "The Murders in the Rue Morgue"
+ author: "Edgar Allan Poe"
+ }
+ ListElement {
+ title: "Breakfast at Tiffany’s"
+ author: "Truman Capote"
+ }
+ ListElement {
+ title: "Death of a Salesman"
+ author: "Arthur Miller"
+ }
+ ListElement {
+ title: "Post Office"
+ author: "Charles Bukowski"
+ }
+ ListElement {
+ title: "Herbert West—Reanimator"
+ author: "H. P. Lovecraft"
+ }
+ }
+ }
+ }
+ Component {
+ id: calendarComponent
+ Item {
+ enabled: !settingsData.allDisabled
+ Calendar {
+ anchors.centerIn: parent
+ weekNumbersVisible: true
+ frameVisible: settingsData.frames
+ }
+ }
+ }
+ Component {
+ id: textAreaComponent
+ TextArea {
+ enabled: !settingsData.allDisabled
+ frameVisible: false
+ flickableItem.flickableDirection: Flickable.VerticalFlick
+ text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum quis justo a sem faucibus mattis nec vitae nisi. Fusce fringilla nulla a tellus vehicula sodales. Etiam volutpat suscipit erat vitae adipiscing. Sed vestibulum massa nisl, eget posuere urna porta ac. Morbi at nunc ligula. Cras et mauris aliquet ligula sodales suscipit eget imperdiet augue. Ut eget dui eu magna malesuada imperdiet. Donec imperdiet urna eu consequat ornare. Cras at metus tristique, ullamcorper nisl ut, faucibus mauris. Fusce in euismod arcu. Donec tristique rutrum porta. Praesent mattis ac tortor quis scelerisque. Integer luctus nulla ut lacinia tempus."
+ }
+ }
+ Component {
+ id: pieMenuComponent
+ Item {
+ enabled: !settingsData.allDisabled
+
+ Column {
+ anchors.fill: parent
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: controlData.textMargins
+ spacing: Math.round(controlData.textMargins * 0.5)
+
+ Image {
+ id: pieMenuImage
+ source: "qrc:/images/piemenu-image-rgb.jpg"
+ fillMode: Image.PreserveAspectFit
+ width: parent.width
+ height: Math.min((width / sourceSize.width) * sourceSize.height, (parent.height - parent.spacing) * 0.88)
+ }
+ Item {
+ width: parent.width
+ height: parent.height - pieMenuImage.height - parent.spacing
+
+ Text {
+ id: instructionText
+ anchors.fill: parent
+ anchors.leftMargin: controlData.textMargins
+ anchors.rightMargin: controlData.textMargins
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ text: "Tap and hold to open menu"
+ font.family: Flat.FlatStyle.fontFamily
+ font.pixelSize: Math.round(20 * Flat.FlatStyle.scaleFactor)
+ fontSizeMode: Text.Fit
+ color: Flat.FlatStyle.lightFrameColor
+ }
+ }
+ }
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onPressAndHold: pieMenu.popup(mouse.x, mouse.y)
+ }
+ PieMenu {
+ id: pieMenu
+ triggerMode: TriggerMode.TriggerOnClick
+
+ MenuItem {
+ iconSource: "qrc:/images/piemenu-rgb-" + (pieMenu.currentIndex === 0 ? "pressed" : "normal") + ".png"
+ onTriggered: pieMenuImage.source = "qrc:/images/piemenu-image-rgb.jpg"
+ }
+ MenuItem {
+ iconSource: "qrc:/images/piemenu-bw-" + (pieMenu.currentIndex === 1 ? "pressed" : "normal") + ".png"
+ onTriggered: pieMenuImage.source = "qrc:/images/piemenu-image-bw.jpg"
+ }
+ MenuItem {
+ iconSource: "qrc:/images/piemenu-sepia-" + (pieMenu.currentIndex === 2 ? "pressed" : "normal") + ".png"
+ onTriggered: pieMenuImage.source = "qrc:/images/piemenu-image-sepia.jpg"
+ }
+ }
+ }
+ }
+ Component {
+ id: delayButtonComponent
+ Item {
+ enabled: !settingsData.allDisabled
+ DelayButton {
+ text: progress < 1 ? "START" : "STOP"
+ anchors.centerIn: parent
+ }
+ }
+ }
+ Component {
+ id: dialComponent
+ Item {
+ enabled: !settingsData.allDisabled
+ Dial {
+ anchors.centerIn: parent
+ }
+ }
+ }
+ Component {
+ id: tumblerComponent
+ Item {
+ enabled: !settingsData.allDisabled
+ Tumbler {
+ anchors.centerIn: parent
+ TumblerColumn {
+ model: {
+ var hours = [];
+ for (var i = 1; i <= 24; ++i)
+ hours.push(i < 10 ? "0" + i : i);
+ hours;
+ }
+ }
+ TumblerColumn {
+ model: {
+ var minutes = [];
+ for (var i = 0; i < 60; ++i)
+ minutes.push(i < 10 ? "0" + i : i);
+ minutes;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/examples/quick/extras/flat/SettingsIcon.qml b/examples/quick/extras/flat/SettingsIcon.qml
new file mode 100644
index 00000000..a31972ee
--- /dev/null
+++ b/examples/quick/extras/flat/SettingsIcon.qml
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.4
+
+Canvas {
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ ctx.scale(width, height);
+
+ ctx.beginPath();
+ ctx.moveTo(0.706,0.542);
+ ctx.bezierCurveTo(0.709,0.527,0.711,0.512,0.711,0.49700000000000005);
+ ctx.bezierCurveTo(0.711,0.4820000000000001,0.709,0.465,0.706,0.451);
+ ctx.lineTo(0.752,0.41600000000000004);
+ ctx.lineTo(0.759,0.41);
+ ctx.lineTo(0.756,0.4);
+ ctx.bezierCurveTo(0.756,0.399,0.749,0.382,0.737,0.36200000000000004);
+ ctx.bezierCurveTo(0.725,0.3420000000000001,0.714,0.328,0.714,0.327);
+ ctx.lineTo(0.708,0.319);
+ ctx.lineTo(0.698,0.324);
+ ctx.lineTo(0.645,0.346);
+ ctx.bezierCurveTo(0.623,0.32499999999999996,0.595,0.309,0.5650000000000001,0.3);
+ ctx.lineTo(0.558,0.243);
+ ctx.lineTo(0.557,0.23299999999999998);
+ ctx.lineTo(0.547,0.23099999999999998);
+ ctx.bezierCurveTo(0.546,0.23099999999999998,0.528,0.22799999999999998,0.505,0.22799999999999998);
+ ctx.bezierCurveTo(0.481,0.22799999999999998,0.463,0.23099999999999998,0.463,0.23099999999999998);
+ ctx.lineTo(0.453,0.23299999999999998);
+ ctx.lineTo(0.452,0.243);
+ ctx.lineTo(0.444,0.299);
+ ctx.bezierCurveTo(0.41400000000000003,0.308,0.387,0.324,0.364,0.345);
+ ctx.lineTo(0.312,0.323);
+ ctx.lineTo(0.302,0.319);
+ ctx.lineTo(0.296,0.327);
+ ctx.bezierCurveTo(0.296,0.327,0.284,0.342,0.27299999999999996,0.362);
+ ctx.bezierCurveTo(0.26,0.383,0.254,0.399,0.254,0.4);
+ ctx.lineTo(0.25,0.41);
+ ctx.lineTo(0.258,0.416);
+ ctx.lineTo(0.303,0.45099999999999996);
+ ctx.bezierCurveTo(0.3,0.465,0.299,0.48,0.299,0.497);
+ ctx.bezierCurveTo(0.299,0.513,0.3,0.528,0.304,0.543);
+ ctx.lineTo(0.259,0.577);
+ ctx.lineTo(0.25,0.584);
+ ctx.lineTo(0.254,0.593);
+ ctx.bezierCurveTo(0.254,0.594,0.261,0.61,0.273,0.63);
+ ctx.bezierCurveTo(0.28500000000000003,0.65,0.29500000000000004,0.664,0.29600000000000004,0.665);
+ ctx.lineTo(0.30200000000000005,0.673);
+ ctx.lineTo(0.31200000000000006,0.669);
+ ctx.lineTo(0.36500000000000005,0.647);
+ ctx.bezierCurveTo(0.38700000000000007,0.668,0.41400000000000003,0.684,0.44400000000000006,0.6930000000000001);
+ ctx.lineTo(0.45200000000000007,0.7510000000000001);
+ ctx.lineTo(0.45300000000000007,0.7620000000000001);
+ ctx.lineTo(0.4640000000000001,0.7630000000000001);
+ ctx.bezierCurveTo(0.4640000000000001,0.7630000000000001,0.4820000000000001,0.7640000000000001,0.5060000000000001,0.7640000000000001);
+ ctx.bezierCurveTo(0.5300000000000001,0.7640000000000001,0.5470000000000002,0.7620000000000001,0.5480000000000002,0.7620000000000001);
+ ctx.lineTo(0.5580000000000002,0.7610000000000001);
+ ctx.lineTo(0.5590000000000002,0.7510000000000001);
+ ctx.lineTo(0.5660000000000002,0.6940000000000001);
+ ctx.bezierCurveTo(0.5960000000000002,0.685,0.6230000000000002,0.669,0.6460000000000001,0.648);
+ ctx.lineTo(0.6990000000000002,0.67);
+ ctx.lineTo(0.7090000000000002,0.674);
+ ctx.lineTo(0.7150000000000002,0.665);
+ ctx.bezierCurveTo(0.7150000000000002,0.665,0.7260000000000002,0.65,0.7370000000000002,0.63);
+ ctx.bezierCurveTo(0.7490000000000002,0.61,0.7560000000000002,0.594,0.7560000000000002,0.593);
+ ctx.lineTo(0.7600000000000002,0.584);
+ ctx.lineTo(0.751,0.577);
+ ctx.lineTo(0.706,0.542);
+ ctx.closePath();
+ ctx.moveTo(0.505,0.622);
+ ctx.bezierCurveTo(0.436,0.622,0.38,0.566,0.38,0.497);
+ ctx.bezierCurveTo(0.38,0.428,0.436,0.372,0.505,0.372);
+ ctx.bezierCurveTo(0.5740000000000001,0.372,0.63,0.428,0.63,0.497);
+ ctx.bezierCurveTo(0.63,0.565,0.574,0.622,0.505,0.622);
+ ctx.closePath();
+ ctx.fillStyle = "#333333";
+ ctx.fill();
+ }
+}
diff --git a/examples/quick/extras/flat/flat.pro b/examples/quick/extras/flat/flat.pro
new file mode 100644
index 00000000..387e7ca0
--- /dev/null
+++ b/examples/quick/extras/flat/flat.pro
@@ -0,0 +1,16 @@
+TEMPLATE = app
+TARGET = flat
+QT += quick
+
+SOURCES += \
+ main.cpp
+
+RESOURCES += \
+ flat.qrc
+
+OTHER_FILES += \
+ main.qml
+
+DISTFILES += \
+ Content.qml \
+ SettingsIcon.qml
diff --git a/examples/quick/extras/flat/flat.qrc b/examples/quick/extras/flat/flat.qrc
new file mode 100644
index 00000000..5b06a55c
--- /dev/null
+++ b/examples/quick/extras/flat/flat.qrc
@@ -0,0 +1,16 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>images/piemenu-bw-normal.png</file>
+ <file>images/piemenu-bw-pressed.png</file>
+ <file>images/piemenu-rgb-normal.png</file>
+ <file>images/piemenu-rgb-pressed.png</file>
+ <file>images/piemenu-sepia-normal.png</file>
+ <file>images/piemenu-sepia-pressed.png</file>
+ <file>images/piemenu-image-bw.jpg</file>
+ <file>images/piemenu-image-rgb.jpg</file>
+ <file>images/piemenu-image-sepia.jpg</file>
+ <file>Content.qml</file>
+ <file>SettingsIcon.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/quick/extras/flat/images/piemenu-bw-normal.png b/examples/quick/extras/flat/images/piemenu-bw-normal.png
new file mode 100644
index 00000000..ef57111f
--- /dev/null
+++ b/examples/quick/extras/flat/images/piemenu-bw-normal.png
Binary files differ
diff --git a/examples/quick/extras/flat/images/piemenu-bw-pressed.png b/examples/quick/extras/flat/images/piemenu-bw-pressed.png
new file mode 100644
index 00000000..b6bd1d20
--- /dev/null
+++ b/examples/quick/extras/flat/images/piemenu-bw-pressed.png
Binary files differ
diff --git a/examples/quick/extras/flat/images/piemenu-image-bw.jpg b/examples/quick/extras/flat/images/piemenu-image-bw.jpg
new file mode 100644
index 00000000..ce4d8ffd
--- /dev/null
+++ b/examples/quick/extras/flat/images/piemenu-image-bw.jpg
Binary files differ
diff --git a/examples/quick/extras/flat/images/piemenu-image-rgb.jpg b/examples/quick/extras/flat/images/piemenu-image-rgb.jpg
new file mode 100644
index 00000000..2d7d2205
--- /dev/null
+++ b/examples/quick/extras/flat/images/piemenu-image-rgb.jpg
Binary files differ
diff --git a/examples/quick/extras/flat/images/piemenu-image-sepia.jpg b/examples/quick/extras/flat/images/piemenu-image-sepia.jpg
new file mode 100644
index 00000000..3ef7b1f0
--- /dev/null
+++ b/examples/quick/extras/flat/images/piemenu-image-sepia.jpg
Binary files differ
diff --git a/examples/quick/extras/flat/images/piemenu-rgb-normal.png b/examples/quick/extras/flat/images/piemenu-rgb-normal.png
new file mode 100644
index 00000000..2278f4a9
--- /dev/null
+++ b/examples/quick/extras/flat/images/piemenu-rgb-normal.png
Binary files differ
diff --git a/examples/quick/extras/flat/images/piemenu-rgb-pressed.png b/examples/quick/extras/flat/images/piemenu-rgb-pressed.png
new file mode 100644
index 00000000..f45846b1
--- /dev/null
+++ b/examples/quick/extras/flat/images/piemenu-rgb-pressed.png
Binary files differ
diff --git a/examples/quick/extras/flat/images/piemenu-sepia-normal.png b/examples/quick/extras/flat/images/piemenu-sepia-normal.png
new file mode 100644
index 00000000..f1e9ffd2
--- /dev/null
+++ b/examples/quick/extras/flat/images/piemenu-sepia-normal.png
Binary files differ
diff --git a/examples/quick/extras/flat/images/piemenu-sepia-pressed.png b/examples/quick/extras/flat/images/piemenu-sepia-pressed.png
new file mode 100644
index 00000000..0f2b3517
--- /dev/null
+++ b/examples/quick/extras/flat/images/piemenu-sepia-pressed.png
Binary files differ
diff --git a/examples/quick/extras/flat/main.cpp b/examples/quick/extras/flat/main.cpp
new file mode 100644
index 00000000..99ba7205
--- /dev/null
+++ b/examples/quick/extras/flat/main.cpp
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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 <QtGui/QGuiApplication>
+#include <QtQml/QQmlApplicationEngine>
+#include <QtGui/QFontDatabase>
+#include <QtCore/QDir>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+ if (qgetenv("QT_QUICK_CONTROLS_STYLE").isEmpty()) {
+ qputenv("QT_QUICK_CONTROLS_STYLE", "Flat");
+ }
+ QQmlApplicationEngine engine;
+ engine.load(QUrl("qrc:/main.qml"));
+ return app.exec();
+}
diff --git a/examples/quick/extras/flat/main.qml b/examples/quick/extras/flat/main.qml
new file mode 100644
index 00000000..4d93074b
--- /dev/null
+++ b/examples/quick/extras/flat/main.qml
@@ -0,0 +1,480 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.4
+import QtQuick.Layouts 1.0
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles.Flat 1.0 as Flat
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Styles 1.3
+import QtQuick.Extras.Private 1.0
+
+ApplicationWindow {
+ id: window
+ width: 480
+ height: 860
+ title: "Flat Example"
+ visible: true
+
+ readonly property bool contentLoaded: contentLoader.item
+ readonly property alias anchorItem: controlsMenu
+ property int currentMenu: -1
+ readonly property int textMargins: Math.round(32 * Flat.FlatStyle.scaleFactor)
+ readonly property int menuMargins: Math.round(13 * Flat.FlatStyle.scaleFactor)
+ readonly property int menuWidth: Math.min(window.width, window.height) * 0.75
+
+ onCurrentMenuChanged: {
+ xBehavior.enabled = true;
+ anchorCurrentMenu();
+ }
+
+ onMenuWidthChanged: anchorCurrentMenu()
+
+ function anchorCurrentMenu() {
+ switch (currentMenu) {
+ case -1:
+ anchorItem.x = -menuWidth;
+ break;
+ case 0:
+ anchorItem.x = 0;
+ break;
+ case 1:
+ anchorItem.x = -menuWidth * 2;
+ break;
+ }
+ }
+
+ Item {
+ id: container
+ anchors.fill: parent
+
+ Item {
+ id: loadingScreen
+ anchors.fill: parent
+ visible: !contentLoaded
+
+ Timer {
+ running: true
+ interval: 100
+ // TODO: Find a way to know when the loading screen has been rendered instead
+ // of using an abritrary amount of time.
+ onTriggered: contentLoader.sourceComponent = Qt.createComponent("Content.qml")
+ }
+
+ Column {
+ anchors.centerIn: parent
+ spacing: Math.round(10 * Flat.FlatStyle.scaleFactor)
+
+ BusyIndicator {
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ Label {
+ text: "Loading Light Flat UI..."
+ width: Math.min(loadingScreen.width, loadingScreen.height) * 0.8
+ height: font.pixelSize
+ anchors.horizontalCenter: parent.horizontalCenter
+ renderType: Text.QtRendering
+ font.pixelSize: Math.round(26 * Flat.FlatStyle.scaleFactor)
+ horizontalAlignment: Text.AlignHCenter
+ fontSizeMode: Text.Fit
+ font.family: Flat.FlatStyle.fontFamily
+ font.weight: Font.Light
+ }
+ }
+ }
+
+ Rectangle {
+ id: controlsMenu
+ x: container.x - width
+ z: contentContainer.z + 1
+ width: menuWidth
+ height: parent.height
+
+ // Don't let the menus become visible when resizing the window
+ Binding {
+ target: controlsMenu
+ property: "x"
+ value: container.x - controlsMenu.width
+ when: !xBehavior.enabled && !xNumberAnimation.running && currentMenu == -1
+ }
+
+ Behavior on x {
+ id: xBehavior
+ enabled: false
+ NumberAnimation {
+ id: xNumberAnimation
+ easing.type: Easing.OutExpo
+ duration: 500
+ onRunningChanged: xBehavior.enabled = false
+ }
+ }
+
+ Rectangle {
+ id: controlsTitleBar
+ width: parent.width
+ height: toolBar.height
+ color: Flat.FlatStyle.defaultTextColor
+
+ Label {
+ text: "Controls"
+ font.family: Flat.FlatStyle.fontFamily
+ font.pixelSize: Math.round(16 * Flat.FlatStyle.scaleFactor)
+ renderType: Text.QtRendering
+ color: "white"
+ anchors.left: parent.left
+ anchors.leftMargin: menuMargins
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+
+ ListView {
+ id: controlView
+ width: parent.width
+ anchors.top: controlsTitleBar.bottom
+ anchors.bottom: parent.bottom
+ clip: true
+ currentIndex: 0
+ model: contentLoaded ? contentLoader.item.componentModel : null
+ delegate: MouseArea {
+ id: delegateItem
+ width: parent.width
+ height: 64 * Flat.FlatStyle.scaleFactor
+ onClicked: {
+ if (controlView.currentIndex != index)
+ controlView.currentIndex = index;
+
+ currentMenu = -1;
+ }
+
+ Rectangle {
+ width: parent.width
+ height: Flat.FlatStyle.onePixel
+ anchors.bottom: parent.bottom
+ color: Flat.FlatStyle.lightFrameColor
+ }
+
+ Label {
+ text: delegateItem.ListView.view.model[index].name
+ font.pixelSize: Math.round(15 * Flat.FlatStyle.scaleFactor)
+ font.family: Flat.FlatStyle.fontFamily
+ renderType: Text.QtRendering
+ color: delegateItem.ListView.isCurrentItem ? Flat.FlatStyle.styleColor : Flat.FlatStyle.defaultTextColor
+ anchors.left: parent.left
+ anchors.leftMargin: menuMargins
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+
+ Rectangle {
+ width: parent.height
+ height: 8 * Flat.FlatStyle.scaleFactor
+ rotation: 90
+ anchors.left: parent.right
+ transformOrigin: Item.TopLeft
+
+ gradient: Gradient {
+ GradientStop {
+ color: Qt.rgba(0, 0, 0, 0.15)
+ position: 0
+ }
+ GradientStop {
+ color: Qt.rgba(0, 0, 0, 0.05)
+ position: 0.5
+ }
+ GradientStop {
+ color: Qt.rgba(0, 0, 0, 0)
+ position: 1
+ }
+ }
+ }
+ }
+ }
+
+ Item {
+ id: contentContainer
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.left: controlsMenu.right
+ width: parent.width
+
+ ToolBar {
+ id: toolBar
+ visible: !loadingScreen.visible
+ width: parent.width
+ height: 54 * Flat.FlatStyle.scaleFactor
+ z: contentLoader.z + 1
+ style: Flat.ToolBarStyle {
+ padding.left: 0
+ padding.right: 0
+ }
+
+ RowLayout {
+ anchors.fill: parent
+
+ MouseArea {
+ id: controlsButton
+ Layout.preferredWidth: toolBar.height + textMargins
+ Layout.preferredHeight: toolBar.height
+ onClicked: currentMenu = currentMenu == 0 ? -1 : 0
+
+ Column {
+ id: controlsIcon
+ anchors.left: parent.left
+ anchors.leftMargin: textMargins
+ anchors.verticalCenter: parent.verticalCenter
+ spacing: Math.round(2 * Flat.FlatStyle.scaleFactor)
+
+ Repeater {
+ model: 3
+
+ Rectangle {
+ width: Math.round(4 * Flat.FlatStyle.scaleFactor)
+ height: width
+ radius: width / 2
+ color: Flat.FlatStyle.defaultTextColor
+ }
+ }
+ }
+ }
+
+ Text {
+ text: "Light Flat UI Demo"
+ font.family: Flat.FlatStyle.fontFamily
+ font.pixelSize: Math.round(16 * Flat.FlatStyle.scaleFactor)
+ horizontalAlignment: Text.AlignHCenter
+ color: "#666666"
+ Layout.fillWidth: true
+ }
+
+ MouseArea {
+ id: settingsButton
+ Layout.preferredWidth: controlsButton.Layout.preferredWidth
+ Layout.preferredHeight: controlsButton.Layout.preferredHeight
+ onClicked: currentMenu = currentMenu == 1 ? -1 : 1
+
+ SettingsIcon {
+ width: Math.round(32 * Flat.FlatStyle.scaleFactor)
+ height: Math.round(32 * Flat.FlatStyle.scaleFactor)
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ anchors.rightMargin: textMargins - Math.round(8 * Flat.FlatStyle.scaleFactor)
+ }
+ }
+ }
+ }
+
+ Loader {
+ id: contentLoader
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: toolBar.bottom
+ anchors.bottom: parent.bottom
+
+ property QtObject settingsData: QtObject {
+ readonly property bool checks: disableSingleItemsAction.checked
+ readonly property bool frames: !greyBackgroundAction.checked
+ readonly property bool allDisabled: disableAllAction.checked
+ }
+ property QtObject controlData: QtObject {
+ readonly property int componentIndex: controlView.currentIndex
+ readonly property int textMargins: window.textMargins
+ }
+
+ MouseArea {
+ enabled: currentMenu != -1
+ // We would be able to just set this to true here, if it weren't for QTBUG-43083.
+ hoverEnabled: enabled
+ anchors.fill: parent
+ preventStealing: true
+ onClicked: currentMenu = -1
+ focus: enabled
+ z: 1000
+ }
+ }
+ }
+
+ Rectangle {
+ id: settingsMenu
+ z: contentContainer.z + 1
+ width: menuWidth
+ height: parent.height
+ anchors.left: contentContainer.right
+
+ Rectangle {
+ id: optionsTitleBar
+ width: parent.width
+ height: toolBar.height
+ color: Flat.FlatStyle.defaultTextColor
+
+ Label {
+ text: "Options"
+ font.family: Flat.FlatStyle.fontFamily
+ font.pixelSize: Math.round(16 * Flat.FlatStyle.scaleFactor)
+ renderType: Text.QtRendering
+ color: "white"
+ anchors.left: parent.left
+ anchors.leftMargin: menuMargins
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+
+ Action {
+ id: disableAllAction
+ checkable: true
+ checked: false
+ }
+
+ Action {
+ id: disableSingleItemsAction
+ checkable: true
+ checked: false
+ }
+
+ Action {
+ id: greyBackgroundAction
+ checkable: true
+ checked: false
+ }
+
+ ListView {
+ id: optionsListView
+ width: parent.width
+ anchors.top: optionsTitleBar.bottom
+ anchors.bottom: parent.bottom
+ clip: true
+ interactive: delegateHeight * count > height
+
+ readonly property int delegateHeight: 64 * Flat.FlatStyle.scaleFactor
+
+ model: [
+ { name: "Disable all", action: disableAllAction },
+ { name: "Disable single items", action: disableSingleItemsAction },
+ { name: "Grey background", action: greyBackgroundAction },
+ { name: "Exit", action: null }
+ ]
+ delegate: Rectangle {
+ id: optionDelegateItem
+ width: parent.width
+ height: optionsListView.delegateHeight
+
+ Rectangle {
+ width: parent.width
+ height: Flat.FlatStyle.onePixel
+ anchors.bottom: parent.bottom
+ color: Flat.FlatStyle.lightFrameColor
+ }
+
+ Loader {
+ sourceComponent: optionText !== "Exit"
+ ? optionsListView.checkBoxComponent : optionsListView.exitComponent
+ anchors.fill: parent
+ anchors.leftMargin: menuMargins
+
+ property string optionText: optionsListView.model[index].name
+ property int optionIndex: index
+ }
+ }
+
+ property Component checkBoxComponent: Item {
+ Label {
+ text: optionText
+ font.family: Flat.FlatStyle.fontFamily
+ font.pixelSize: Math.round(15 * Flat.FlatStyle.scaleFactor)
+ fontSizeMode: Text.Fit
+ renderType: Text.QtRendering
+ verticalAlignment: Text.AlignVCenter
+ color: Flat.FlatStyle.defaultTextColor
+ height: parent.height
+ anchors.left: parent.left
+ anchors.right: checkBox.left
+ anchors.rightMargin: Flat.FlatStyle.twoPixels
+ }
+
+ CheckBox {
+ id: checkBox
+ checked: optionsListView.model[optionIndex].action.checked
+ anchors.right: parent.right
+ anchors.rightMargin: menuMargins
+ anchors.verticalCenter: parent.verticalCenter
+ onCheckedChanged: optionsListView.model[optionIndex].action.checked = checkBox.checked
+ }
+ }
+
+ property Component exitComponent: MouseArea {
+ anchors.fill: parent
+ onClicked: Qt.quit()
+
+ Label {
+ text: optionText
+ font.family: Flat.FlatStyle.fontFamily
+ font.pixelSize: Math.round(15 * Flat.FlatStyle.scaleFactor)
+ renderType: Text.QtRendering
+ color: Flat.FlatStyle.defaultTextColor
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+
+ Rectangle {
+ width: parent.height
+ height: 8 * Flat.FlatStyle.scaleFactor
+ rotation: -90
+ anchors.right: parent.left
+ transformOrigin: Item.TopRight
+
+ gradient: Gradient {
+ GradientStop {
+ color: Qt.rgba(0, 0, 0, 0.15)
+ position: 0
+ }
+ GradientStop {
+ color: Qt.rgba(0, 0, 0, 0.05)
+ position: 0.5
+ }
+ GradientStop {
+ color: Qt.rgba(0, 0, 0, 0)
+ position: 1
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/examples/quick/extras/gallery/fonts/LICENSE.txt b/examples/quick/extras/gallery/fonts/LICENSE.txt
new file mode 100644
index 00000000..d6456956
--- /dev/null
+++ b/examples/quick/extras/gallery/fonts/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/examples/quick/extras/gallery/fonts/OpenSans-Regular.ttf b/examples/quick/extras/gallery/fonts/OpenSans-Regular.ttf
new file mode 100644
index 00000000..db433349
--- /dev/null
+++ b/examples/quick/extras/gallery/fonts/OpenSans-Regular.ttf
Binary files differ
diff --git a/examples/quick/extras/gallery/gallery.pro b/examples/quick/extras/gallery/gallery.pro
new file mode 100644
index 00000000..3c50a7c2
--- /dev/null
+++ b/examples/quick/extras/gallery/gallery.pro
@@ -0,0 +1,31 @@
+TEMPLATE = app
+TARGET = gallery
+INCLUDEPATH += .
+QT += quick
+
+SOURCES += \
+ main.cpp
+
+RESOURCES += \
+ gallery.qrc
+
+OTHER_FILES += \
+ qml/BlackButtonBackground.qml \
+ qml/BlackButtonStyle.qml \
+ qml/CircularGaugeDarkStyle.qml \
+ qml/CircularGaugeDefaultStyle.qml \
+ qml/CircularGaugeLightStyle.qml \
+ qml/CircularGaugeView.qml \
+ qml/ControlLabel.qml \
+ qml/ControlView.qml \
+ qml/ControlViewToolBar.qml \
+ qml/CustomizerSwitch.qml \
+ qml/CustomizerLabel.qml \
+ qml/CustomizerSlider.qml \
+ qml/FlickableMoreIndicator.qml \
+ qml/gallery.qml \
+ qml/PieMenuControlView.qml \
+ qml/PieMenuDefaultStyle.qml \
+ qml/PieMenuDarkStyle.qml \
+ qml/StylePicker.qml \
+ gallery.qrc
diff --git a/examples/quick/extras/gallery/gallery.qrc b/examples/quick/extras/gallery/gallery.qrc
new file mode 100644
index 00000000..97beb6b1
--- /dev/null
+++ b/examples/quick/extras/gallery/gallery.qrc
@@ -0,0 +1,36 @@
+<RCC>
+ <qresource prefix="/">
+ <file>fonts/OpenSans-Regular.ttf</file>
+ <file>images/background-light.png</file>
+ <file>images/background.png</file>
+ <file>images/center-light.png</file>
+ <file>images/center.png</file>
+ <file>images/icon-go.png</file>
+ <file>images/icon-settings.png</file>
+ <file>images/info.png</file>
+ <file>images/needle-light.png</file>
+ <file>images/needle.png</file>
+ <file>images/qt-logo.png</file>
+ <file>images/zoom_in.png</file>
+ <file>images/zoom_out.png</file>
+ <file>qml/BlackButtonBackground.qml</file>
+ <file>qml/BlackButtonStyle.qml</file>
+ <file>qml/CircularGaugeDarkStyle.qml</file>
+ <file>qml/CircularGaugeDefaultStyle.qml</file>
+ <file>qml/CircularGaugeLightStyle.qml</file>
+ <file>qml/CircularGaugeView.qml</file>
+ <file>qml/ControlView.qml</file>
+ <file>qml/ControlViewToolbar.qml</file>
+ <file>qml/CustomizerSwitch.qml</file>
+ <file>qml/CustomizerLabel.qml</file>
+ <file>qml/CustomizerSlider.qml</file>
+ <file>qml/FlickableMoreIndicator.qml</file>
+ <file>qml/gallery.qml</file>
+ <file>qml/PieMenuControlView.qml</file>
+ <file>qml/StylePicker.qml</file>
+ <file>qml/PieMenuDarkStyle.qml</file>
+ <file>qml/PieMenuDefaultStyle.qml</file>
+ <file>qml/ControlLabel.qml</file>
+ <file>images/icon-back.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/quick/extras/gallery/images/background-light.png b/examples/quick/extras/gallery/images/background-light.png
new file mode 100644
index 00000000..2f769845
--- /dev/null
+++ b/examples/quick/extras/gallery/images/background-light.png
Binary files differ
diff --git a/examples/quick/extras/gallery/images/background.png b/examples/quick/extras/gallery/images/background.png
new file mode 100644
index 00000000..a3f4302b
--- /dev/null
+++ b/examples/quick/extras/gallery/images/background.png
Binary files differ
diff --git a/examples/quick/extras/gallery/images/center-light.png b/examples/quick/extras/gallery/images/center-light.png
new file mode 100644
index 00000000..75add20c
--- /dev/null
+++ b/examples/quick/extras/gallery/images/center-light.png
Binary files differ
diff --git a/examples/quick/extras/gallery/images/center.png b/examples/quick/extras/gallery/images/center.png
new file mode 100644
index 00000000..b18a5fa8
--- /dev/null
+++ b/examples/quick/extras/gallery/images/center.png
Binary files differ
diff --git a/examples/quick/extras/gallery/images/icon-back.png b/examples/quick/extras/gallery/images/icon-back.png
new file mode 100644
index 00000000..0b037ff6
--- /dev/null
+++ b/examples/quick/extras/gallery/images/icon-back.png
Binary files differ
diff --git a/examples/quick/extras/gallery/images/icon-go.png b/examples/quick/extras/gallery/images/icon-go.png
new file mode 100644
index 00000000..bcb2a822
--- /dev/null
+++ b/examples/quick/extras/gallery/images/icon-go.png
Binary files differ
diff --git a/examples/quick/extras/gallery/images/icon-settings.png b/examples/quick/extras/gallery/images/icon-settings.png
new file mode 100644
index 00000000..7763ba20
--- /dev/null
+++ b/examples/quick/extras/gallery/images/icon-settings.png
Binary files differ
diff --git a/examples/quick/extras/gallery/images/info.png b/examples/quick/extras/gallery/images/info.png
new file mode 100644
index 00000000..5c7a9df3
--- /dev/null
+++ b/examples/quick/extras/gallery/images/info.png
Binary files differ
diff --git a/examples/quick/extras/gallery/images/needle-light.png b/examples/quick/extras/gallery/images/needle-light.png
new file mode 100644
index 00000000..d486d9e5
--- /dev/null
+++ b/examples/quick/extras/gallery/images/needle-light.png
Binary files differ
diff --git a/examples/quick/extras/gallery/images/needle.png b/examples/quick/extras/gallery/images/needle.png
new file mode 100644
index 00000000..6b10c604
--- /dev/null
+++ b/examples/quick/extras/gallery/images/needle.png
Binary files differ
diff --git a/examples/quick/extras/gallery/images/qt-logo.png b/examples/quick/extras/gallery/images/qt-logo.png
new file mode 100644
index 00000000..14ddf2a0
--- /dev/null
+++ b/examples/quick/extras/gallery/images/qt-logo.png
Binary files differ
diff --git a/examples/quick/extras/gallery/images/zoom_in.png b/examples/quick/extras/gallery/images/zoom_in.png
new file mode 100644
index 00000000..41282106
--- /dev/null
+++ b/examples/quick/extras/gallery/images/zoom_in.png
Binary files differ
diff --git a/examples/quick/extras/gallery/images/zoom_out.png b/examples/quick/extras/gallery/images/zoom_out.png
new file mode 100644
index 00000000..772d6ac1
--- /dev/null
+++ b/examples/quick/extras/gallery/images/zoom_out.png
Binary files differ
diff --git a/examples/quick/extras/gallery/main.cpp b/examples/quick/extras/gallery/main.cpp
new file mode 100644
index 00000000..5b1dbfee
--- /dev/null
+++ b/examples/quick/extras/gallery/main.cpp
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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 <QtGui/QGuiApplication>
+#include <QtQml/QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+ QQmlApplicationEngine engine(QUrl("qrc:/qml/gallery.qml"));
+ return app.exec();
+}
diff --git a/examples/quick/extras/gallery/qml/BlackButtonBackground.qml b/examples/quick/extras/gallery/qml/BlackButtonBackground.qml
new file mode 100644
index 00000000..983554a2
--- /dev/null
+++ b/examples/quick/extras/gallery/qml/BlackButtonBackground.qml
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.2
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Styles 1.1
+
+Rectangle {
+ property bool pressed: false
+
+ gradient: Gradient {
+ GradientStop {
+ color: pressed ? "#222" : "#333"
+ position: 0
+ }
+ GradientStop {
+ color: "#222"
+ position: 1
+ }
+ }
+ Rectangle {
+ height: 1
+ width: parent.width
+ anchors.top: parent.top
+ color: "#444"
+ visible: !pressed
+ }
+ Rectangle {
+ height: 1
+ width: parent.width
+ anchors.bottom: parent.bottom
+ color: "#000"
+ }
+}
diff --git a/examples/quick/extras/gallery/qml/BlackButtonStyle.qml b/examples/quick/extras/gallery/qml/BlackButtonStyle.qml
new file mode 100644
index 00000000..8bc561a7
--- /dev/null
+++ b/examples/quick/extras/gallery/qml/BlackButtonStyle.qml
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.2
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Styles 1.1
+
+ButtonStyle {
+ property color fontColor
+
+ property url rightAlignedIconSource
+
+ background: BlackButtonBackground {
+ pressed: control.pressed
+ }
+ label: Item {
+ implicitWidth: row.implicitWidth
+ implicitHeight: row.implicitHeight
+ baselineOffset: row.y + text.y + text.baselineOffset
+
+ Row {
+ id: row
+ anchors.left: control.text.length === 0 ? undefined : parent.left
+ anchors.leftMargin: control.text.length === 0 ? 0 : textSingleton.implicitHeight
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.horizontalCenter: control.text.length === 0 ? parent.horizontalCenter : undefined
+
+ Image {
+ source: control.iconSource
+ width: Math.min(sourceSize.width, height)
+ height: text.implicitHeight
+ fillMode: Image.PreserveAspectFit
+ }
+ Text {
+ id: text
+ text: control.text
+ color: fontColor
+ font.pixelSize: control.height * 0.25
+ font.family: openSans.name
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+
+ Loader {
+ active: rightAlignedIconSource.toString().length !== 0
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ anchors.rightMargin: textSingleton.implicitHeight
+
+ sourceComponent: Image {
+ width: Math.min(sourceSize.width, height)
+ height: text.implicitHeight
+ fillMode: Image.PreserveAspectFit
+ source: rightAlignedIconSource
+ }
+ }
+ }
+}
diff --git a/examples/quick/extras/gallery/qml/CircularGaugeDarkStyle.qml b/examples/quick/extras/gallery/qml/CircularGaugeDarkStyle.qml
new file mode 100644
index 00000000..04e9233f
--- /dev/null
+++ b/examples/quick/extras/gallery/qml/CircularGaugeDarkStyle.qml
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.2
+import QtQuick.Extras.Styles 1.3
+
+CircularGaugeStyle {
+ id: root
+ tickmarkStepSize: 10
+ minorTickmarkCount: 1
+ labelStepSize: 20
+ tickmarkInset: outerRadius * 0.06
+ minorTickmarkInset: tickmarkInset
+ labelInset: outerRadius * 0.23
+
+ background: Image {
+ source: "qrc:/images/background.png"
+ }
+
+ needle: Image {
+ id: needleImage
+ transformOrigin: Item.Bottom
+ source: "qrc:/images/needle.png"
+ scale: {
+ var distanceFromLabelToRadius = labelInset / 2;
+ var idealHeight = outerRadius - distanceFromLabelToRadius;
+ var originalImageHeight = needleImage.sourceSize.height;
+ idealHeight / originalImageHeight;
+ }
+ }
+
+ foreground: Item {
+ Image {
+ anchors.centerIn: parent
+ source: "qrc:/images/center.png"
+ scale: (outerRadius * 0.25) / sourceSize.height
+ }
+ }
+
+ tickmark: Rectangle {
+ implicitWidth: outerRadius * 0.02
+ antialiasing: true
+ implicitHeight: outerRadius * 0.05
+ color: "#888"
+ }
+
+ minorTickmark: Rectangle {
+ implicitWidth: outerRadius * 0.01
+ antialiasing: true
+ implicitHeight: outerRadius * 0.02
+ color: "#444"
+ }
+
+ tickmarkLabel: Text {
+ font.pixelSize: Math.max(6, outerRadius * 0.1)
+ text: styleData.value
+ color: "white"
+ }
+}
diff --git a/examples/quick/extras/gallery/qml/CircularGaugeDefaultStyle.qml b/examples/quick/extras/gallery/qml/CircularGaugeDefaultStyle.qml
new file mode 100644
index 00000000..2f276163
--- /dev/null
+++ b/examples/quick/extras/gallery/qml/CircularGaugeDefaultStyle.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.2
+import QtQuick.Extras.Styles 1.3
+
+CircularGaugeStyle {
+ labelStepSize: 20
+}
diff --git a/examples/quick/extras/gallery/qml/CircularGaugeLightStyle.qml b/examples/quick/extras/gallery/qml/CircularGaugeLightStyle.qml
new file mode 100644
index 00000000..d31e831a
--- /dev/null
+++ b/examples/quick/extras/gallery/qml/CircularGaugeLightStyle.qml
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.2
+import QtQuick.Extras.Styles 1.3
+
+CircularGaugeStyle {
+ id: root
+ tickmarkStepSize: 10
+ minorTickmarkCount: 2
+ labelStepSize: 40
+ tickmarkInset: outerRadius * 0.06
+ minorTickmarkInset: tickmarkInset
+ labelInset: outerRadius * 0.23
+
+ background: Image {
+ source: "qrc:/images/background-light.png"
+ }
+
+ needle: Image {
+ id: needleImage
+ source: "qrc:/images/needle-light.png"
+ transformOrigin: Item.Bottom
+ scale: {
+ var distanceFromLabelToRadius = labelInset / 2;
+ var idealHeight = outerRadius - distanceFromLabelToRadius;
+ var originalImageHeight = needleImage.sourceSize.height;
+ idealHeight / originalImageHeight;
+ }
+ }
+
+ foreground: Item {
+ Image {
+ anchors.centerIn: parent
+ source: "qrc:/images/center-light.png"
+ scale: (outerRadius * 0.25) / sourceSize.height
+ }
+ }
+
+ tickmark: Rectangle {
+ implicitWidth: outerRadius * 0.01
+ antialiasing: true
+ implicitHeight: outerRadius * 0.04
+ color: "#999"
+ }
+
+ minorTickmark: Rectangle {
+ implicitWidth: outerRadius * 0.01
+ antialiasing: true
+ implicitHeight: outerRadius * 0.02
+ color: "#bbb"
+ }
+
+ tickmarkLabel: Text {
+ font.family: "Helvetica neue"
+ font.pixelSize: Math.max(6, outerRadius * 0.1)
+ text: styleData.value
+ color: "#333"
+ }
+}
diff --git a/examples/quick/extras/gallery/qml/CircularGaugeView.qml b/examples/quick/extras/gallery/qml/CircularGaugeView.qml
new file mode 100644
index 00000000..e763e7b9
--- /dev/null
+++ b/examples/quick/extras/gallery/qml/CircularGaugeView.qml
@@ -0,0 +1,230 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.2
+import QtQuick.Controls 1.1
+import QtQuick.Extras 1.3
+
+ControlView {
+ id: controlView
+ darkBackground: customizerItem.currentStyleDark
+
+ property color fontColor: darkBackground ? "white" : "black"
+
+ property bool accelerating: false
+
+ Keys.onSpacePressed: accelerating = true
+ Keys.onReleased: {
+ if (event.key === Qt.Key_Space) {
+ accelerating = false;
+ event.accepted = true;
+ }
+ }
+
+ Button {
+ id: accelerate
+ text: "Accelerate"
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ height: root.height * 0.125
+
+ onPressedChanged: accelerating = pressed
+
+ style: BlackButtonStyle {
+ background: BlackButtonBackground {
+ pressed: control.pressed
+ }
+ label: Text {
+ text: control.text
+ color: "white"
+ font.pixelSize: Math.max(textSingleton.font.pixelSize, root.toPixels(0.04))
+ font.family: openSans.name
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+ }
+ }
+
+ control: CircularGauge {
+ id: gauge
+ minimumValue: customizerItem.minimumValue
+ maximumValue: customizerItem.maximumValue
+ width: controlBounds.width
+ height: controlBounds.height
+
+ value: accelerating ? maximumValue : 0
+ style: styleMap[customizerItem.currentStylePath]
+
+ // This stops the styles being recreated when a new one is chosen.
+ property var styleMap: {
+ var styles = {};
+ for (var i = 0; i < customizerItem.allStylePaths.length; ++i) {
+ var path = customizerItem.allStylePaths[i];
+ styles[path] = Qt.createComponent(path, gauge);
+ }
+ styles;
+ }
+
+ // Called to update the style after the user has edited a property.
+ Connections {
+ target: customizerItem
+ onMinimumValueAngleChanged: __style.minimumValueAngle = customizerItem.minimumValueAngle
+ onMaximumValueAngleChanged: __style.maximumValueAngle = customizerItem.maximumValueAngle
+ onLabelStepSizeChanged: __style.tickmarkStepSize = __style.labelStepSize = customizerItem.labelStepSize
+ }
+
+ Behavior on value {
+ NumberAnimation {
+ easing.type: Easing.OutCubic
+ duration: 6000
+ }
+ }
+ }
+
+ customizer: Column {
+ readonly property var allStylePaths: {
+ var paths = [];
+ for (var i = 0; i < stylePicker.model.count; ++i) {
+ paths.push(stylePicker.model.get(i).path);
+ }
+ paths;
+ }
+ property alias currentStylePath: stylePicker.currentStylePath
+ property alias currentStyleDark: stylePicker.currentStyleDark
+ property alias minimumValue: minimumValueSlider.value
+ property alias maximumValue: maximumValueSlider.value
+ property alias minimumValueAngle: minimumAngleSlider.value
+ property alias maximumValueAngle: maximumAngleSlider.value
+ property alias labelStepSize: labelStepSizeSlider.value
+
+ id: circularGaugeColumn
+ spacing: customizerPropertySpacing
+
+ readonly property bool isDefaultStyle: stylePicker.model.get(stylePicker.currentIndex).name === "Default"
+
+ Item {
+ id: stylePickerBottomSpacing
+ width: parent.width
+ height: stylePicker.height + textSingleton.implicitHeight
+
+ StylePicker {
+ id: stylePicker
+ currentIndex: 1
+
+ model: ListModel {
+ ListElement {
+ name: "Default"
+ path: "CircularGaugeDefaultStyle.qml"
+ dark: true
+ }
+ ListElement {
+ name: "Dark"
+ path: "CircularGaugeDarkStyle.qml"
+ dark: true
+ }
+ ListElement {
+ name: "Light"
+ path: "CircularGaugeLightStyle.qml"
+ dark: false
+ }
+ }
+ }
+ }
+
+ CustomizerLabel {
+ text: "Minimum angle"
+ }
+
+ CustomizerSlider {
+ id: minimumAngleSlider
+ minimumValue: -180
+ value: -145
+ maximumValue: 180
+ width: parent.width
+ }
+
+ CustomizerLabel {
+ text: "Maximum angle"
+ }
+
+ CustomizerSlider {
+ id: maximumAngleSlider
+ minimumValue: -180
+ value: 145
+ maximumValue: 180
+ }
+
+ CustomizerLabel {
+ text: "Minimum value"
+ }
+
+ CustomizerSlider {
+ id: minimumValueSlider
+ minimumValue: 0
+ value: 0
+ maximumValue: 360
+ stepSize: 1
+ }
+
+ CustomizerLabel {
+ text: "Maximum value"
+ }
+
+ CustomizerSlider {
+ id: maximumValueSlider
+ minimumValue: 0
+ value: 240
+ maximumValue: 300
+ stepSize: 1
+ }
+
+ CustomizerLabel {
+ text: "Label step size"
+ }
+
+ CustomizerSlider {
+ id: labelStepSizeSlider
+ minimumValue: 10
+ value: 20
+ maximumValue: 100
+ stepSize: 20
+ }
+ }
+}
diff --git a/examples/quick/extras/gallery/qml/ControlLabel.qml b/examples/quick/extras/gallery/qml/ControlLabel.qml
new file mode 100644
index 00000000..b13c2a04
--- /dev/null
+++ b/examples/quick/extras/gallery/qml/ControlLabel.qml
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.2
+import QtQuick.Extras 1.3
+
+Text {
+ font.pixelSize: Math.max(textSingleton.font.pixelSize, Math.min(32, root.toPixels(0.045)))
+ color: "#4e4e4e"
+ styleColor: "#ffffff"
+ style: Text.Raised
+}
diff --git a/examples/quick/extras/gallery/qml/ControlView.qml b/examples/quick/extras/gallery/qml/ControlView.qml
new file mode 100644
index 00000000..cc479439
--- /dev/null
+++ b/examples/quick/extras/gallery/qml/ControlView.qml
@@ -0,0 +1,188 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.2
+import QtQuick.Controls 1.1
+
+Rectangle {
+ id: view
+ color: darkBackground ? "transparent" : lightBackgroundColor
+
+ Keys.onReleased: {
+ if (event.key === Qt.Key_Back) {
+ stackView.pop();
+ event.accepted = true;
+ }
+ }
+
+ property bool darkBackground: true
+
+ property Component control
+ property Component customizer
+
+ property alias controlItem: controlLoader.item
+ property alias customizerItem: customizerLoader.item
+
+ property bool isCustomizerVisible: false
+
+ property real margin: root.toPixels(0.05)
+
+ property rect controlBounds: Qt.rect(largestControlItem.x + controlBoundsItem.x,
+ largestControlItem.y + controlBoundsItem.y, controlBoundsItem.width, controlBoundsItem.height)
+
+ Item {
+ id: largestControlItem
+ x: margin
+ y: margin
+ width: isCustomizerVisible ? widthWhenCustomizing : widthWhenNotCustomizing
+ height: isCustomizerVisible ? heightWhenCustomizing : heightWhenNotCustomizing
+
+ readonly property real widthWhenCustomizing: (!isScreenPortrait ? parent.width / 2 : parent.width) - margin * 2
+ readonly property real heightWhenCustomizing: (isScreenPortrait ? parent.height / 2 : parent.height - toolbar.height) - margin * 2
+ readonly property real widthWhenNotCustomizing: parent.width - margin * 2
+ readonly property real heightWhenNotCustomizing: parent.height - toolbar.height - margin * 2
+
+ Item {
+ id: controlBoundsItem
+ x: parent.width / 2 - controlBoundsItem.width / 2
+ y: customizer && customizerItem.visible ? 0 : (isScreenPortrait ? (parent.height / 2) - (controlBoundsItem.height / 2) : 0)
+ width: Math.min(parent.widthWhenCustomizing, parent.widthWhenNotCustomizing)
+ height: Math.min(parent.heightWhenCustomizing, parent.heightWhenNotCustomizing)
+
+ Behavior on x {
+ id: controlXBehavior
+ enabled: false
+ NumberAnimation {}
+ }
+
+ Behavior on y {
+ id: controlYBehavior
+ enabled: false
+ NumberAnimation {}
+ }
+
+ Loader {
+ id: controlLoader
+ sourceComponent: control
+ anchors.centerIn: parent
+
+ property alias view: view
+ }
+ }
+ }
+
+ Flickable {
+ id: flickable
+ // Hide the customizer on the right of the screen if it's not visible.
+ x: (isScreenPortrait ? 0 : (isCustomizerVisible ? largestControlItem.x + largestControlItem.width + margin : view.width)) + margin
+ y: (isScreenPortrait ? largestControlItem.y + largestControlItem.height : 0) + margin
+ width: largestControlItem.width
+ height: parent.height - y - toolbar.height - margin
+ anchors.leftMargin: margin
+ anchors.rightMargin: margin
+ visible: customizerLoader.opacity > 0
+
+ flickableDirection: Flickable.VerticalFlick
+
+ clip: true
+ contentWidth: width
+ contentHeight: customizerLoader.height
+
+ Behavior on x {
+ id: flickableXBehavior
+ enabled: false
+ NumberAnimation {}
+ }
+
+ Behavior on y {
+ id: flickableYBehavior
+ enabled: false
+ NumberAnimation {}
+ }
+
+ Loader {
+ id: customizerLoader
+ sourceComponent: customizer
+ opacity: 0
+ width: flickable.width
+
+ property alias view: view
+
+ Behavior on opacity {
+ NumberAnimation {
+ duration: 300
+ }
+ }
+ }
+ }
+
+ ControlViewToolbar {
+ id: toolbar
+
+ onCustomizeClicked: {
+ controlXBehavior.enabled = !isScreenPortrait;
+ controlYBehavior.enabled = isScreenPortrait;
+
+ isCustomizerVisible = !isCustomizerVisible;
+
+ if (isScreenPortrait) {
+ flickableXBehavior.enabled = false;
+ flickableYBehavior.enabled = true;
+ } else {
+ flickableXBehavior.enabled = true;
+ flickableYBehavior.enabled = false;
+ }
+
+ customizerLoader.opacity = isCustomizerVisible ? 1 : 0;
+ }
+ }
+
+ FlickableMoreIndicator {
+ flickable: flickable
+ atTop: true
+ gradientColor: view.darkBackground ? darkBackgroundColor : lightBackgroundColor
+ }
+
+ FlickableMoreIndicator {
+ flickable: flickable
+ atTop: false
+ gradientColor: view.darkBackground ? darkBackgroundColor : lightBackgroundColor
+ }
+}
diff --git a/examples/quick/extras/gallery/qml/ControlViewToolbar.qml b/examples/quick/extras/gallery/qml/ControlViewToolbar.qml
new file mode 100644
index 00000000..7df5103c
--- /dev/null
+++ b/examples/quick/extras/gallery/qml/ControlViewToolbar.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.2
+import QtQuick.Controls 1.1
+
+BlackButtonBackground {
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ height: root.height * 0.125
+
+ signal customizeClicked
+
+ gradient: Gradient {
+ GradientStop {
+ color: "#333"
+ position: 0
+ }
+ GradientStop {
+ color: "#222"
+ position: 1
+ }
+ }
+
+ Button {
+ id: back
+ width: parent.height
+ height: parent.height
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ iconSource: "qrc:/images/icon-back.png"
+ onClicked: stackView.pop()
+
+ style: BlackButtonStyle {
+ }
+
+ }
+
+ Button {
+ id: customize
+ width: parent.height
+ height: parent.height
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ iconSource: "qrc:/images/icon-settings.png"
+ visible: customizer
+
+ style: BlackButtonStyle {
+ }
+
+ onClicked: customizeClicked()
+ }
+}
diff --git a/examples/quick/extras/gallery/qml/CustomizerLabel.qml b/examples/quick/extras/gallery/qml/CustomizerLabel.qml
new file mode 100644
index 00000000..1640f86c
--- /dev/null
+++ b/examples/quick/extras/gallery/qml/CustomizerLabel.qml
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.2
+
+Text {
+ color: darkBackground ? root.darkFontColor : root.lightFontColor
+ font.pixelSize: root.toPixels(0.04)
+ font.family: openSans.name
+ anchors.horizontalCenter: parent.horizontalCenter
+}
diff --git a/examples/quick/extras/gallery/qml/CustomizerSlider.qml b/examples/quick/extras/gallery/qml/CustomizerSlider.qml
new file mode 100644
index 00000000..54b85ca9
--- /dev/null
+++ b/examples/quick/extras/gallery/qml/CustomizerSlider.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.1
+import QtQuick.Controls.Styles 1.1
+
+Slider {
+ id: slider
+ width: parent.width
+ height: root.toPixels(0.1)
+
+ style: SliderStyle {
+ handle: Rectangle {
+ height: root.toPixels(0.06)
+ width: height
+ radius: width/2
+ color: "#fff"
+ }
+
+ groove: Rectangle {
+ implicitHeight: root.toPixels(0.015)
+ implicitWidth: 100
+ radius: height/2
+ border.color: "#333"
+ color: "#222"
+ Rectangle {
+ height: parent.height
+ width: styleData.handlePosition
+ implicitHeight: 6
+ implicitWidth: 100
+ radius: height/2
+ color: "#555"
+ }
+ }
+
+ }
+}
diff --git a/examples/quick/extras/gallery/qml/CustomizerSwitch.qml b/examples/quick/extras/gallery/qml/CustomizerSwitch.qml
new file mode 100644
index 00000000..2586b63f
--- /dev/null
+++ b/examples/quick/extras/gallery/qml/CustomizerSwitch.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.2
+import QtQuick.Controls 1.1
+
+Switch {
+ anchors.horizontalCenter: parent.horizontalCenter
+}
diff --git a/examples/quick/extras/gallery/qml/FlickableMoreIndicator.qml b/examples/quick/extras/gallery/qml/FlickableMoreIndicator.qml
new file mode 100644
index 00000000..649e9715
--- /dev/null
+++ b/examples/quick/extras/gallery/qml/FlickableMoreIndicator.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.2
+
+Rectangle {
+ anchors.top: atTop ? flickable.top : undefined
+ anchors.bottom: atTop ? undefined : flickable.bottom
+ anchors.left: isScreenPortrait ? parent.left : parent.horizontalCenter
+ anchors.right: parent.right
+ height: 30
+ visible: flickable.visible
+ opacity: atTop
+ ? (flickable.contentY > showDistance ? 1 : 0)
+ : (flickable.contentY < flickable.contentHeight - showDistance ? 1 : 0)
+ scale: atTop ? 1 : -1
+
+ readonly property real showDistance: 0
+ property Flickable flickable
+ property color gradientColor
+ /*! \c true if this indicator is at the top of the item */
+ property bool atTop
+
+ Behavior on opacity {
+ NumberAnimation {
+ }
+ }
+
+ gradient: Gradient {
+ GradientStop {
+ position: 0.0
+ color: gradientColor
+ }
+ GradientStop {
+ position: 1.0
+ color: "transparent"
+ }
+ }
+}
diff --git a/examples/quick/extras/gallery/qml/PieMenuControlView.qml b/examples/quick/extras/gallery/qml/PieMenuControlView.qml
new file mode 100644
index 00000000..f486431a
--- /dev/null
+++ b/examples/quick/extras/gallery/qml/PieMenuControlView.qml
@@ -0,0 +1,187 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.2
+import QtGraphicalEffects 1.0
+import QtQuick.Controls 1.1
+import QtQuick.Extras 1.3
+
+Rectangle {
+ id: view
+ color: customizerItem.currentStyleDark ? "#111" : "#555"
+
+ Behavior on color {
+ ColorAnimation {}
+ }
+
+ Keys.onReleased: {
+ if (event.key === Qt.Key_Back) {
+ stackView.pop();
+ event.accepted = true;
+ }
+ }
+
+ property bool darkBackground: true
+
+ property Component mouseArea
+
+ property Component customizer: Item {
+ property alias currentStylePath: stylePicker.currentStylePath
+ property alias currentStyleDark: stylePicker.currentStyleDark
+
+ StylePicker {
+ id: stylePicker
+ currentIndex: 0
+ width: Math.round(Math.max(textSingleton.implicitHeight * 6 * 2, parent.width * 0.5))
+ anchors.centerIn: parent
+
+ model: ListModel {
+ ListElement {
+ name: "Default"
+ path: "PieMenuDefaultStyle.qml"
+ dark: false
+ }
+ ListElement {
+ name: "Dark"
+ path: "PieMenuDarkStyle.qml"
+ dark: true
+ }
+ }
+ }
+ }
+
+ property alias controlItem: pieMenu
+ property alias customizerItem: customizerLoader.item
+
+ Item {
+ id: controlBoundsItem
+ width: parent.width
+ height: parent.height - toolbar.height
+ visible: customizerLoader.opacity === 0
+
+ Image {
+ id: bgImage
+ anchors.centerIn: parent
+ height: 48
+ Text {
+ id: bgLabel
+ anchors.top: parent.bottom
+ anchors.topMargin: 20
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: "Tap to open"
+ color: "#999"
+ font.pointSize: 20
+ }
+ }
+
+ MouseArea {
+ id: touchArea
+ anchors.fill: parent
+ onClicked: pieMenu.popup(touchArea.mouseX, touchArea.mouseY)
+ }
+
+ PieMenu {
+ id: pieMenu
+ triggerMode: TriggerMode.TriggerOnClick
+ width: Math.min(controlBoundsItem.width, controlBoundsItem.height) * 0.5
+ height: width
+
+ style: Qt.createComponent(customizerItem.currentStylePath)
+
+ MenuItem {
+ text: "Zoom In"
+ onTriggered: {
+ bgImage.source = iconSource
+ bgLabel.text = text + " selected"
+ }
+ iconSource: "qrc:/images/zoom_in.png"
+ }
+ MenuItem {
+ text: "Zoom Out"
+ onTriggered: {
+ bgImage.source = iconSource
+ bgLabel.text = text + " selected"
+ }
+ iconSource: "qrc:/images/zoom_out.png"
+ }
+ MenuItem {
+ text: "Info"
+ onTriggered: {
+ bgImage.source = iconSource
+ bgLabel.text = text + " selected"
+ }
+ iconSource: "qrc:/images/info.png"
+ }
+ }
+ }
+ Loader {
+ id: customizerLoader
+ sourceComponent: customizer
+ opacity: 0
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.leftMargin: 30
+ anchors.rightMargin: 30
+ y: parent.height / 2 - height / 2 - toolbar.height
+ visible: customizerLoader.opacity > 0
+
+ property alias view: view
+
+ Behavior on y {
+ NumberAnimation {
+ duration: 300
+ }
+ }
+
+ Behavior on opacity {
+ NumberAnimation {
+ duration: 300
+ }
+ }
+ }
+
+ ControlViewToolbar {
+ id: toolbar
+
+ onCustomizeClicked: {
+ customizerLoader.opacity = customizerLoader.opacity == 0 ? 1 : 0;
+ }
+ }
+}
diff --git a/examples/quick/extras/gallery/qml/PieMenuDarkStyle.qml b/examples/quick/extras/gallery/qml/PieMenuDarkStyle.qml
new file mode 100644
index 00000000..b5905192
--- /dev/null
+++ b/examples/quick/extras/gallery/qml/PieMenuDarkStyle.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.Extras.Styles 1.3
+
+PieMenuStyle {
+ backgroundColor: "#222"
+ shadowColor: Qt.rgba(1, 1, 1, 0.26)
+}
diff --git a/examples/quick/extras/gallery/qml/PieMenuDefaultStyle.qml b/examples/quick/extras/gallery/qml/PieMenuDefaultStyle.qml
new file mode 100644
index 00000000..f34584fe
--- /dev/null
+++ b/examples/quick/extras/gallery/qml/PieMenuDefaultStyle.qml
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.Extras.Styles 1.3
+
+PieMenuStyle {
+}
diff --git a/examples/quick/extras/gallery/qml/StylePicker.qml b/examples/quick/extras/gallery/qml/StylePicker.qml
new file mode 100644
index 00000000..4606cb97
--- /dev/null
+++ b/examples/quick/extras/gallery/qml/StylePicker.qml
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.2
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Styles 1.1
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Styles 1.3
+
+ListView {
+ id: stylePicker
+ width: parent.width
+ height: root.height * 0.06
+ interactive: false
+ spacing: -1
+
+ orientation: ListView.Horizontal
+
+ readonly property string currentStylePath: stylePicker.model.get(stylePicker.currentIndex).path
+ readonly property bool currentStyleDark: stylePicker.model.get(stylePicker.currentIndex).dark !== undefined
+ ? stylePicker.model.get(stylePicker.currentIndex).dark
+ : true
+
+ ExclusiveGroup {
+ id: styleExclusiveGroup
+ }
+
+ delegate: Button {
+ width: Math.round(stylePicker.width / stylePicker.model.count)
+ height: stylePicker.height
+ checkable: true
+ checked: index === ListView.view.currentIndex
+ exclusiveGroup: styleExclusiveGroup
+
+ onCheckedChanged: {
+ if (checked) {
+ ListView.view.currentIndex = index;
+ }
+ }
+
+ style: ButtonStyle {
+ background: Rectangle {
+ readonly property color checkedColor: currentStyleDark ? "#444" : "#777"
+ readonly property color uncheckedColor: currentStyleDark ? "#222" : "#bbb"
+ color: checked ? checkedColor : uncheckedColor
+ border.color: checkedColor
+ border.width: 1
+ radius: 1
+ }
+
+ label: Text {
+ text: name
+ color: currentStyleDark ? "white" : (checked ? "white" : "black")
+ font.pixelSize: root.toPixels(0.04)
+ font.family: openSans.name
+ anchors.centerIn: parent
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+ }
+ }
+}
diff --git a/examples/quick/extras/gallery/qml/gallery.qml b/examples/quick/extras/gallery/qml/gallery.qml
new file mode 100644
index 00000000..d29b8997
--- /dev/null
+++ b/examples/quick/extras/gallery/qml/gallery.qml
@@ -0,0 +1,440 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd 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.2
+import QtGraphicalEffects 1.0
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Styles 1.1
+import QtQuick.Dialogs 1.0
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Styles 1.3
+import QtQuick.Layouts 1.0
+import QtQuick.Window 2.1
+
+Window {
+ id: root
+ objectName: "window"
+ visible: true
+ width: 480
+ height: 800
+
+ color: "#161616"
+ title: "Qt Quick Extras Demo"
+
+ function toPixels(percentage) {
+ return percentage * Math.min(root.width, root.height);
+ }
+
+ property bool isScreenPortrait: height > width
+ property color lightFontColor: "#222"
+ property color darkFontColor: "#e7e7e7"
+ readonly property color lightBackgroundColor: "#cccccc"
+ readonly property color darkBackgroundColor: "#161616"
+ property real customizerPropertySpacing: 10
+ property real colorPickerRowSpacing: 8
+
+ Text {
+ id: textSingleton
+ }
+
+ property Component circularGauge: CircularGaugeView {}
+
+ property Component dial: ControlView {
+ darkBackground: false
+
+ control: Column {
+ id: dialColumn
+ width: controlBounds.width
+ height: controlBounds.height - spacing
+ spacing: root.toPixels(0.05)
+
+ ColumnLayout {
+ id: volumeColumn
+ width: parent.width
+ height: (dialColumn.height - dialColumn.spacing) / 2
+ spacing: height * 0.025
+
+ Dial {
+ id: volumeDial
+ anchors.horizontalCenter: parent.horizontalCenter
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+
+ /*!
+ Determines whether the dial animates its rotation to the new value when
+ a single click or touch is received on the dial.
+ */
+ property bool animate: customizerItem.animate
+
+ Behavior on value {
+ enabled: volumeDial.animate && !volumeDial.pressed
+ NumberAnimation {
+ duration: 300
+ easing.type: Easing.OutSine
+ }
+ }
+ }
+
+ ControlLabel {
+ id: volumeText
+ text: "Volume"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+
+ ColumnLayout {
+ id: trebleColumn
+ width: parent.width
+ height: (dialColumn.height - dialColumn.spacing) / 2
+ spacing: height * 0.025
+
+ Dial {
+ id: dial2
+ anchors.horizontalCenter: parent.horizontalCenter
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+
+ stepSize: 1
+ maximumValue: 10
+
+ style: DialStyle {
+ labelInset: outerRadius * 0
+ }
+ }
+
+ ControlLabel {
+ id: trebleText
+ text: "Treble"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+ }
+
+ customizer: Column {
+ spacing: customizerPropertySpacing
+
+ property alias animate: animateCheckBox.checked
+
+ CustomizerLabel {
+ text: "Animate"
+ }
+
+ CustomizerSwitch {
+ id: animateCheckBox
+ }
+ }
+ }
+
+ property Component delayButton: ControlView {
+ darkBackground: false
+
+ control: DelayButton {
+ text: "Alarm"
+ anchors.centerIn: parent
+ }
+ }
+
+ property Component gauge: ControlView {
+ id: gaugeView
+ control: Gauge {
+ id: gauge
+ width: orientation === Qt.Vertical ? implicitWidth : gaugeView.controlBounds.width
+ height: orientation === Qt.Vertical ? gaugeView.controlBounds.height : implicitHeight
+ anchors.centerIn: parent
+
+ minimumValue: 0
+ value: customizerItem.value
+ maximumValue: 100
+ orientation: customizerItem.orientationFlag ? Qt.Vertical : Qt.Horizontal
+ tickmarkAlignment: orientation === Qt.Vertical
+ ? (customizerItem.alignFlag ? Qt.AlignLeft : Qt.AlignRight)
+ : (customizerItem.alignFlag ? Qt.AlignTop : Qt.AlignBottom)
+ }
+
+ customizer: Column {
+ spacing: customizerPropertySpacing
+
+ property alias value: valueSlider.value
+ property alias orientationFlag: orientationCheckBox.checked
+ property alias alignFlag: alignCheckBox.checked
+
+ CustomizerLabel {
+ text: "Value"
+ }
+
+ CustomizerSlider {
+ id: valueSlider
+ minimumValue: 0
+ value: 50
+ maximumValue: 100
+ }
+
+ CustomizerLabel {
+ text: "Vertical orientation"
+ }
+
+ CustomizerSwitch {
+ id: orientationCheckBox
+ checked: true
+ }
+
+ CustomizerLabel {
+ text: controlItem.orientation === Qt.Vertical ? "Left align" : "Top align"
+ }
+
+ CustomizerSwitch {
+ id: alignCheckBox
+ checked: true
+ }
+ }
+ }
+
+ property Component toggleButton: ControlView {
+ darkBackground: false
+
+ control: ToggleButton {
+ text: checked ? "On" : "Off"
+ anchors.centerIn: parent
+ }
+ }
+
+ property Component pieMenu: PieMenuControlView {}
+
+ property Component statusIndicator: ControlView {
+ id: statusIndicatorView
+ darkBackground: false
+
+ Timer {
+ id: recordingFlashTimer
+ running: true
+ repeat: true
+ interval: 1000
+ }
+
+ ColumnLayout {
+ id: indicatorLayout
+ width: statusIndicatorView.controlBounds.width * 0.25
+ height: statusIndicatorView.controlBounds.height * 0.75
+ anchors.centerIn: parent
+
+ Repeater {
+ model: ListModel {
+ id: indicatorModel
+ ListElement {
+ name: "Power"
+ indicatorColor: "#35e02f"
+ }
+ ListElement {
+ name: "Recording"
+ indicatorColor: "red"
+ }
+ }
+
+ ColumnLayout {
+ Layout.preferredWidth: indicatorLayout.width
+ spacing: 0
+
+ StatusIndicator {
+ id: indicator
+ color: indicatorColor
+ Layout.preferredWidth: statusIndicatorView.controlBounds.width * 0.07
+ Layout.preferredHeight: Layout.preferredWidth
+ Layout.alignment: Qt.AlignHCenter
+ on: true
+
+ Connections {
+ target: recordingFlashTimer
+ onTriggered: if (name == "Recording") indicator.active = !indicator.active
+ }
+ }
+ ControlLabel {
+ id: indicatorLabel
+ text: name
+ Layout.alignment: Qt.AlignHCenter
+ Layout.maximumWidth: parent.width
+ horizontalAlignment: Text.AlignHCenter
+ }
+ }
+ }
+ }
+ }
+
+ property Component tumbler: ControlView {
+ id: tumblerView
+ darkBackground: false
+
+ Tumbler {
+ id: tumbler
+ anchors.centerIn: parent
+
+ // TODO: Use FontMetrics with 5.4
+ Label {
+ id: characterMetrics
+ font.bold: true
+ font.pixelSize: textSingleton.font.pixelSize * 1.25
+ font.family: openSans.name
+ visible: false
+ text: "M"
+ }
+
+ readonly property real delegateTextMargins: characterMetrics.width * 1.5
+ readonly property var days: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
+
+ TumblerColumn {
+ id: tumblerDayColumn
+
+ function updateModel() {
+ var previousIndex = tumblerDayColumn.currentIndex;
+ var newDays = tumbler.days[monthColumn.currentIndex];
+
+ if (!model) {
+ var array = [];
+ for (var i = 0; i < newDays; ++i) {
+ array.push(i + 1);
+ }
+ model = array;
+ } else {
+ // If we've already got days in the model, just add or remove
+ // the minimum amount necessary to make spinning the month column fast.
+ var difference = model.length - newDays;
+ if (model.length > newDays) {
+ model.splice(model.length - 1, difference);
+ } else {
+ var lastDay = model[model.length - 1];
+ for (i = lastDay; i < lastDay + difference; ++i) {
+ model.push(i + 1);
+ }
+ }
+ }
+
+ tumbler.setCurrentIndexAt(0, Math.min(newDays - 1, previousIndex));
+ }
+ }
+ TumblerColumn {
+ id: monthColumn
+ width: characterMetrics.width * 3 + tumbler.delegateTextMargins
+ model: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
+ onCurrentIndexChanged: tumblerDayColumn.updateModel()
+ }
+ TumblerColumn {
+ width: characterMetrics.width * 4 + tumbler.delegateTextMargins
+ model: ListModel {
+ Component.onCompleted: {
+ for (var i = 2000; i < 2100; ++i) {
+ append({value: i.toString()});
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+ FontLoader {
+ id: openSans
+ source: "qrc:/fonts/OpenSans-Regular.ttf"
+ }
+
+ property var componentMap: {
+ "CircularGauge": circularGauge,
+ "DelayButton": delayButton,
+ "Dial": dial,
+ "Gauge": gauge,
+ "PieMenu": pieMenu,
+ "StatusIndicator": statusIndicator,
+ "ToggleButton": toggleButton,
+ "Tumbler": tumbler
+ }
+
+ StackView {
+ id: stackView
+ anchors.fill: parent
+
+ initialItem: ListView {
+ model: ListModel {
+ ListElement {
+ title: "CircularGauge"
+ }
+ ListElement {
+ title: "DelayButton"
+ }
+ ListElement {
+ title: "Dial"
+ }
+ ListElement {
+ title: "Gauge"
+ }
+ ListElement {
+ title: "PieMenu"
+ }
+ ListElement {
+ title: "StatusIndicator"
+ }
+ ListElement {
+ title: "ToggleButton"
+ }
+ ListElement {
+ title: "Tumbler"
+ }
+ }
+
+ delegate: Button {
+ width: stackView.width
+ height: root.height * 0.125
+ text: title
+
+ style: BlackButtonStyle {
+ fontColor: root.darkFontColor
+ rightAlignedIconSource: "qrc:/images/icon-go.png"
+ }
+
+ onClicked: {
+ if (stackView.depth == 1) {
+ // Only push the control view if we haven't already pushed it...
+ stackView.push({item: componentMap[title]});
+ stackView.currentItem.forceActiveFocus();
+ }
+ }
+ }
+ }
+ }
+}
+
+