summaryrefslogtreecommitdiff
path: root/src/extras
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 /src/extras
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 'src/extras')
-rw-r--r--src/extras/CircularGauge.qml159
-rw-r--r--src/extras/DelayButton.qml157
-rw-r--r--src/extras/Dial.qml228
-rw-r--r--src/extras/Gauge.qml209
-rw-r--r--src/extras/PieMenu.qml747
-rw-r--r--src/extras/Private/CircularButton.qml49
-rw-r--r--src/extras/Private/CircularButtonStyleHelper.qml133
-rw-r--r--src/extras/Private/CircularTickmarkLabel.qml142
-rw-r--r--src/extras/Private/Handle.qml120
-rw-r--r--src/extras/Private/PieMenuIcon.qml99
-rw-r--r--src/extras/Private/TextSingleton.qml41
-rw-r--r--src/extras/Private/private.pri24
-rw-r--r--src/extras/Private/qmldir1
-rw-r--r--src/extras/Private/qquickcircularprogressbar.cpp209
-rw-r--r--src/extras/Private/qquickcircularprogressbar_p.h99
-rw-r--r--src/extras/Private/qquickflatprogressbar.cpp202
-rw-r--r--src/extras/Private/qquickflatprogressbar_p.h88
-rw-r--r--src/extras/Private/qquickmathutils.cpp111
-rw-r--r--src/extras/Private/qquickmathutils_p.h61
-rw-r--r--src/extras/Private/qquickmousethief.cpp208
-rw-r--r--src/extras/Private/qquickmousethief_p.h86
-rw-r--r--src/extras/Private/qquickstylesettings.cpp157
-rw-r--r--src/extras/Private/qquickstylesettings_p.h79
-rw-r--r--src/extras/StatusIndicator.qml117
-rw-r--r--src/extras/Styles/Base/Base.pro34
-rw-r--r--src/extras/Styles/Base/CircularButtonStyle.qml85
-rw-r--r--src/extras/Styles/Base/CircularGaugeStyle.qml498
-rw-r--r--src/extras/Styles/Base/CircularTickmarkLabelStyle.qml304
-rw-r--r--src/extras/Styles/Base/CommonStyleHelper.qml56
-rw-r--r--src/extras/Styles/Base/DelayButtonStyle.qml233
-rw-r--r--src/extras/Styles/Base/DialStyle.qml392
-rw-r--r--src/extras/Styles/Base/GaugeStyle.qml545
-rw-r--r--src/extras/Styles/Base/HandleStyle.qml73
-rw-r--r--src/extras/Styles/Base/HandleStyleHelper.qml91
-rw-r--r--src/extras/Styles/Base/PieMenuStyle.qml393
-rw-r--r--src/extras/Styles/Base/StatusIndicatorStyle.qml237
-rw-r--r--src/extras/Styles/Base/ToggleButtonStyle.qml294
-rw-r--r--src/extras/Styles/Base/TumblerStyle.qml330
-rw-r--r--src/extras/Styles/Base/basestyle.qrc19
-rw-r--r--src/extras/Styles/Base/basestyleplugin.cpp70
-rw-r--r--src/extras/Styles/Base/basestyleplugin.h58
-rw-r--r--src/extras/Styles/Base/images/knob.pngbin0 -> 5495 bytes
-rw-r--r--src/extras/Styles/Base/images/needle.pngbin0 -> 4354 bytes
-rw-r--r--src/extras/Styles/Base/qmldir4
-rw-r--r--src/extras/Styles/Flat/ApplicationWindowStyle.qml111
-rw-r--r--src/extras/Styles/Flat/BusyIndicatorStyle.qml75
-rw-r--r--src/extras/Styles/Flat/ButtonStyle.qml194
-rw-r--r--src/extras/Styles/Flat/CalendarStyle.qml205
-rw-r--r--src/extras/Styles/Flat/CheckBoxDrawer.qml100
-rw-r--r--src/extras/Styles/Flat/CheckBoxStyle.qml62
-rw-r--r--src/extras/Styles/Flat/CircularButtonStyle.qml38
-rw-r--r--src/extras/Styles/Flat/CircularGaugeStyle.qml168
-rw-r--r--src/extras/Styles/Flat/CircularTickmarkLabelStyle.qml39
-rw-r--r--src/extras/Styles/Flat/ComboBoxStyle.qml163
-rw-r--r--src/extras/Styles/Flat/CursorHandleStyle.qml45
-rw-r--r--src/extras/Styles/Flat/DelayButtonStyle.qml291
-rw-r--r--src/extras/Styles/Flat/DialStyle.qml97
-rw-r--r--src/extras/Styles/Flat/Flat.pro67
-rw-r--r--src/extras/Styles/Flat/FlatStyle.qml100
-rw-r--r--src/extras/Styles/Flat/FocusFrameStyle.qml38
-rw-r--r--src/extras/Styles/Flat/GaugeStyle.qml132
-rw-r--r--src/extras/Styles/Flat/GroupBoxStyle.qml99
-rw-r--r--src/extras/Styles/Flat/LeftArrowIcon.qml61
-rw-r--r--src/extras/Styles/Flat/MenuBarStyle.qml42
-rw-r--r--src/extras/Styles/Flat/MenuStyle.qml95
-rw-r--r--src/extras/Styles/Flat/PieMenuStyle.qml169
-rw-r--r--src/extras/Styles/Flat/ProgressBarStyle.qml60
-rw-r--r--src/extras/Styles/Flat/RadioButtonStyle.qml87
-rw-r--r--src/extras/Styles/Flat/ScrollViewStyle.qml76
-rw-r--r--src/extras/Styles/Flat/SelectionHandleStyle.qml44
-rw-r--r--src/extras/Styles/Flat/SliderStyle.qml110
-rw-r--r--src/extras/Styles/Flat/SpinBoxStyle.qml153
-rw-r--r--src/extras/Styles/Flat/StatusBarStyle.qml38
-rw-r--r--src/extras/Styles/Flat/StatusIndicatorStyle.qml62
-rw-r--r--src/extras/Styles/Flat/SwitchStyle.qml86
-rw-r--r--src/extras/Styles/Flat/TabViewStyle.qml102
-rw-r--r--src/extras/Styles/Flat/TableViewStyle.qml163
-rw-r--r--src/extras/Styles/Flat/TextAreaStyle.qml67
-rw-r--r--src/extras/Styles/Flat/TextFieldStyle.qml70
-rw-r--r--src/extras/Styles/Flat/ToggleButtonStyle.qml99
-rw-r--r--src/extras/Styles/Flat/ToolBarStyle.qml75
-rw-r--r--src/extras/Styles/Flat/ToolButtonBackground.qml94
-rw-r--r--src/extras/Styles/Flat/ToolButtonIndicator.qml70
-rw-r--r--src/extras/Styles/Flat/ToolButtonStyle.qml110
-rw-r--r--src/extras/Styles/Flat/TumblerStyle.qml167
-rw-r--r--src/extras/Styles/Flat/flatstyle.qrc51
-rw-r--r--src/extras/Styles/Flat/flatstyleplugin.cpp117
-rw-r--r--src/extras/Styles/Flat/flatstyleplugin.h58
-rw-r--r--src/extras/Styles/Flat/fonts/LICENSE.txt202
-rw-r--r--src/extras/Styles/Flat/fonts/OpenSans-Light.ttfbin0 -> 222412 bytes
-rw-r--r--src/extras/Styles/Flat/fonts/OpenSans-Regular.ttfbin0 -> 217360 bytes
-rw-r--r--src/extras/Styles/Flat/fonts/OpenSans-Semibold.ttfbin0 -> 221328 bytes
-rw-r--r--src/extras/Styles/Flat/images/BusyIndicator_Normal-Large.pngbin0 -> 4377 bytes
-rw-r--r--src/extras/Styles/Flat/images/BusyIndicator_Normal-Medium.pngbin0 -> 2526 bytes
-rw-r--r--src/extras/Styles/Flat/images/BusyIndicator_Normal-Small.pngbin0 -> 1591 bytes
-rw-r--r--src/extras/Styles/Flat/qmldir3
-rw-r--r--src/extras/Styles/Flat/qquicktexthandle.cpp129
-rw-r--r--src/extras/Styles/Flat/qquicktexthandle.h83
-rw-r--r--src/extras/Styles/styles.pro4
-rw-r--r--src/extras/ToggleButton.qml69
-rw-r--r--src/extras/Tumbler.qml464
-rw-r--r--src/extras/TumblerColumn.qml170
-rw-r--r--src/extras/designer/CircularGaugeSpecifics.qml111
-rw-r--r--src/extras/designer/DelayButtonSpecifics.qml93
-rw-r--r--src/extras/designer/DialSpecifics.qml128
-rw-r--r--src/extras/designer/GaugeSpecifics.qml131
-rw-r--r--src/extras/designer/PictureSpecifics.qml80
-rw-r--r--src/extras/designer/PieMenuSpecifics.qml100
-rw-r--r--src/extras/designer/StatusIndicatorSpecifics.qml76
-rw-r--r--src/extras/designer/ToggleButtonSpecifics.qml92
-rw-r--r--src/extras/designer/TumblerSpecifics.qml50
-rw-r--r--src/extras/designer/designer.pri33
-rw-r--r--src/extras/designer/images/circulargauge-icon.pngbin0 -> 1542 bytes
-rw-r--r--src/extras/designer/images/circulargauge-icon16.pngbin0 -> 1349 bytes
-rw-r--r--src/extras/designer/images/delaybutton-icon.pngbin0 -> 1509 bytes
-rw-r--r--src/extras/designer/images/delaybutton-icon16.pngbin0 -> 1291 bytes
-rw-r--r--src/extras/designer/images/dial-icon.pngbin0 -> 1467 bytes
-rw-r--r--src/extras/designer/images/dial-icon16.pngbin0 -> 1247 bytes
-rw-r--r--src/extras/designer/images/gauge-icon.pngbin0 -> 1182 bytes
-rw-r--r--src/extras/designer/images/gauge-icon16.pngbin0 -> 1145 bytes
-rw-r--r--src/extras/designer/images/picture-icon.pngbin0 -> 1245 bytes
-rw-r--r--src/extras/designer/images/picture-icon16.pngbin0 -> 1189 bytes
-rw-r--r--src/extras/designer/images/piemenu-icon.pngbin0 -> 1578 bytes
-rw-r--r--src/extras/designer/images/piemenu-icon16.pngbin0 -> 1334 bytes
-rw-r--r--src/extras/designer/images/statusindicator-icon.pngbin0 -> 645 bytes
-rw-r--r--src/extras/designer/images/statusindicator-icon16.pngbin0 -> 404 bytes
-rw-r--r--src/extras/designer/images/togglebutton-icon.pngbin0 -> 1495 bytes
-rw-r--r--src/extras/designer/images/togglebutton-icon16.pngbin0 -> 1298 bytes
-rw-r--r--src/extras/designer/images/tumbler-icon.pngbin0 -> 1188 bytes
-rw-r--r--src/extras/designer/images/tumbler-icon16.pngbin0 -> 1130 bytes
-rw-r--r--src/extras/designer/qtquickextras.metainfo122
-rw-r--r--src/extras/doc/compat/qtquickextras.qdocconf5
-rw-r--r--src/extras/doc/images/circulargauge-angles.pngbin0 -> 19719 bytes
-rw-r--r--src/extras/doc/images/circulargauge-needle-example-2.pngbin0 -> 12680 bytes
-rw-r--r--src/extras/doc/images/circulargauge-needle.pngbin0 -> 1561 bytes
-rw-r--r--src/extras/doc/images/circulargauge-reversed.pngbin0 -> 21836 bytes
-rw-r--r--src/extras/doc/images/circulargauge-tickmark-indices-values.pngbin0 -> 40132 bytes
-rw-r--r--src/extras/doc/images/circulargauge.pngbin0 -> 26247 bytes
-rw-r--r--src/extras/doc/images/delaybutton-activated.pngbin0 -> 18460 bytes
-rw-r--r--src/extras/doc/images/delaybutton-progress.pngbin0 -> 15558 bytes
-rw-r--r--src/extras/doc/images/delaybutton.pngbin0 -> 8354 bytes
-rw-r--r--src/extras/doc/images/dial.pngbin0 -> 14815 bytes
-rw-r--r--src/extras/doc/images/gauge-minorTickmark-example.pngbin0 -> 4780 bytes
-rw-r--r--src/extras/doc/images/gauge-temperature.pngbin0 -> 6055 bytes
-rw-r--r--src/extras/doc/images/gauge-tickmark-example.pngbin0 -> 4882 bytes
-rw-r--r--src/extras/doc/images/gauge.pngbin0 -> 4852 bytes
-rw-r--r--src/extras/doc/images/piemenu-boundingItem-example.pngbin0 -> 30901 bytes
-rw-r--r--src/extras/doc/images/piemenu-boundingItem-null-example.pngbin0 -> 27923 bytes
-rw-r--r--src/extras/doc/images/piemenu-menuitem-example.pngbin0 -> 10606 bytes
-rw-r--r--src/extras/doc/images/piemenu.pngbin0 -> 17205 bytes
-rw-r--r--src/extras/doc/images/qtquickextras-example-dashboard.pngbin0 -> 75060 bytes
-rw-r--r--src/extras/doc/images/qtquickextras-example-flat.pngbin0 -> 20627 bytes
-rw-r--r--src/extras/doc/images/qtquickextras-example-gallery.pngbin0 -> 38319 bytes
-rw-r--r--src/extras/doc/images/statusindicator-active.pngbin0 -> 3434 bytes
-rw-r--r--src/extras/doc/images/statusindicator-green.pngbin0 -> 3753 bytes
-rw-r--r--src/extras/doc/images/statusindicator-inactive.pngbin0 -> 1702 bytes
-rw-r--r--src/extras/doc/images/styling-circulargauge-background-example.pngbin0 -> 13071 bytes
-rw-r--r--src/extras/doc/images/styling-circulargauge-knob-example.pngbin0 -> 13209 bytes
-rw-r--r--src/extras/doc/images/styling-circulargauge-minorTickmark-example.pngbin0 -> 11770 bytes
-rw-r--r--src/extras/doc/images/styling-circulargauge-needle-example.pngbin0 -> 13472 bytes
-rw-r--r--src/extras/doc/images/styling-circulargauge-tickmark-example.pngbin0 -> 12179 bytes
-rw-r--r--src/extras/doc/images/styling-circulargauge-tickmarkLabel-example.pngbin0 -> 12171 bytes
-rw-r--r--src/extras/doc/images/styling-gauge-font-size.pngbin0 -> 4410 bytes
-rw-r--r--src/extras/doc/images/styling-gauge-foreground.pngbin0 -> 3557 bytes
-rw-r--r--src/extras/doc/images/styling-gauge-minorTickmark.pngbin0 -> 3527 bytes
-rw-r--r--src/extras/doc/images/styling-gauge-tickmark.pngbin0 -> 3547 bytes
-rw-r--r--src/extras/doc/images/styling-gauge-valueBar.pngbin0 -> 3691 bytes
-rw-r--r--src/extras/doc/images/togglebutton-checked.pngbin0 -> 11014 bytes
-rw-r--r--src/extras/doc/images/togglebutton-unchecked.pngbin0 -> 10717 bytes
-rw-r--r--src/extras/doc/images/tumbler-flat-style.pngbin0 -> 5896 bytes
-rw-r--r--src/extras/doc/images/tumbler.pngbin0 -> 9856 bytes
-rw-r--r--src/extras/doc/qtquickextras-compat.qdocconf17
-rw-r--r--src/extras/doc/qtquickextras-project.qdocconf59
-rw-r--r--src/extras/doc/qtquickextras.qdocconf4
-rw-r--r--src/extras/doc/snippets/circulargauge-background-range.qml121
-rw-r--r--src/extras/doc/snippets/circulargauge-tickmark-indices-values.qml85
-rw-r--r--src/extras/doc/snippets/styling-gauge.qml93
-rw-r--r--src/extras/doc/src/qtquickextras-examples.qdoc67
-rw-r--r--src/extras/doc/src/qtquickextras-index.qdoc56
-rw-r--r--src/extras/doc/src/qtquickextras-overview.qdoc106
-rw-r--r--src/extras/doc/src/qtquickextras.qdoc48
-rw-r--r--src/extras/doc/src/qtquickextrasstyles-index.qdoc130
-rw-r--r--src/extras/doc/src/styling-circulargauge.qdoc145
-rw-r--r--src/extras/doc/src/styling-gauge.qdoc129
-rw-r--r--src/extras/extras.pro39
-rw-r--r--src/extras/extras.qrc19
-rw-r--r--src/extras/generateresource.prf27
-rw-r--r--src/extras/plugin.cpp116
-rw-r--r--src/extras/plugin.h61
-rw-r--r--src/extras/plugins.qmltypes619
-rw-r--r--src/extras/qmldir4
-rw-r--r--src/extras/qquickpicture.cpp158
-rw-r--r--src/extras/qquickpicture_p.h72
-rw-r--r--src/extras/qquicktriggermode_p.h72
194 files changed, 15984 insertions, 0 deletions
diff --git a/src/extras/CircularGauge.qml b/src/extras/CircularGauge.qml
new file mode 100644
index 00000000..7a91f8bf
--- /dev/null
+++ b/src/extras/CircularGauge.qml
@@ -0,0 +1,159 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+// Workaround for QTBUG-37751; we need this import for RangeModel, although we shouldn't.
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras.Private 1.0
+import QtQuick.Extras.Styles 1.3
+
+/*!
+ \qmltype CircularGauge
+ \inqmlmodule QtQuick.Extras
+ \since QtQuick.Extras 1.0
+ \ingroup extras
+ \ingroup extras-non-interactive
+ \brief A gauge that displays a value within a range along an arc.
+
+ \image circulargauge.png CircularGauge
+
+ The CircularGauge is similar to traditional mechanical gauges that use a
+ needle to display a value from some input, such as the speed of a vehicle or
+ air pressure, for example.
+
+ The minimum and maximum values displayable by the gauge can be set with the
+ \l minimumValue and \l maximumValue properties. The angle at which these
+ values are displayed can be set with the
+ \l {QtQuick.Extras.Styles::CircularGaugeStyle::}{minimumValueAngle} and
+ \l {QtQuick.Extras.Styles::CircularGaugeStyle::}{maximumValueAngle} properties of
+ \l {QtQuick.Extras.Styles::}{CircularGaugeStyle}.
+
+ Example:
+ \code
+ CircularGauge {
+ value: accelerating ? maximumValue : 0
+ anchors.centerIn: parent
+
+ property bool accelerating: false
+
+ Keys.onSpacePressed: accelerating = true
+ Keys.onReleased: {
+ if (event.key === Qt.Key_Space) {
+ accelerating = false;
+ event.accepted = true;
+ }
+ }
+
+ Component.onCompleted: forceActiveFocus()
+
+ Behavior on value {
+ NumberAnimation {
+ duration: 1000
+ }
+ }
+ }
+ \endcode
+
+ You can create a custom appearance for a CircularGauge by assigning a
+ \l {QtQuick.Extras.Styles::}{CircularGaugeStyle}.
+*/
+
+Control {
+ id: circularGauge
+
+ style: Qt.createComponent(StyleSettings.style + "/CircularGaugeStyle.qml", circularGauge)
+
+ /*!
+ \qmlproperty real CircularGauge::minimumValue
+
+ This property holds the smallest value displayed by the gauge.
+ */
+ property alias minimumValue: range.minimumValue
+
+ /*!
+ \qmlproperty real CircularGauge::maximumValue
+
+ This property holds the largest value displayed by the gauge.
+ */
+ property alias maximumValue: range.maximumValue
+
+ /*!
+ This property holds the current value displayed by the gauge, which will
+ always be between \l minimumValue and \l maximumValue, inclusive.
+ */
+ property alias value: range.value
+
+ /*!
+ \qmlproperty real CircularGauge::stepSize
+
+ This property holds the size of the value increments that the needle
+ displays.
+
+ For example, when stepSize is \c 10 and value is \c 0, adding \c 5 to
+ \l value will have no visible effect on the needle, although \l value
+ will still be incremented. Adding an extra \c 5 to \l value will then
+ cause the needle to point to \c 10.
+ */
+ property alias stepSize: range.stepSize
+
+ /*!
+ \since 1.2
+
+ This property determines whether or not the gauge displays tickmarks,
+ minor tickmarks, and labels.
+
+ For more fine-grained control over what is displayed, the following
+ style components of
+ \l {QtQuick.Extras.Styles::}{CircularGaugeStyle} can be
+ used:
+
+ \list
+ \li \l {QtQuick.Extras.Styles::CircularGaugeStyle::tickmark}{tickmark}
+ \li \l {QtQuick.Extras.Styles::CircularGaugeStyle::minorTickmark}{minorTickmark}
+ \li \l {QtQuick.Extras.Styles::CircularGaugeStyle::tickmarkLabel}{tickmarkLabel}
+ \endlist
+ */
+ property bool tickmarksVisible: true
+
+ RangeModel {
+ id: range
+ minimumValue: 0
+ maximumValue: 100
+ stepSize: 0
+ value: minimumValue
+ }
+}
diff --git a/src/extras/DelayButton.qml b/src/extras/DelayButton.qml
new file mode 100644
index 00000000..7218d457
--- /dev/null
+++ b/src/extras/DelayButton.qml
@@ -0,0 +1,157 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Styles 1.3
+import QtQuick.Extras.Private 1.0
+
+/*!
+ \qmltype DelayButton
+ \inherits QtQuickControls::Button
+ \inqmlmodule QtQuick.Extras
+ \since QtQuick.Extras 1.0
+ \ingroup extras
+ \ingroup extras-interactive
+ \brief A checkable button that triggers an action when held in long enough.
+
+ \image delaybutton.png A DelayButton
+
+ The DelayButton is a checkable button that incorporates a delay before
+ the button becomes checked and the \l activated signal is emitted. This
+ delay prevents accidental presses.
+
+ The current progress is expressed as a decimal value between \c 0.0 and
+ \c 1.0. The time it takes for \l activated to be emitted is measured in
+ milliseconds, and can be set with the \l delay property.
+
+ The progress is indicated by a progress indicator around the button. When
+ the indicator reaches completion, it flashes.
+
+ \image delaybutton-progress.png A DelayButton being held down
+ A DelayButton being held down
+ \image delaybutton-activated.png A DelayButton after being activated
+ A DelayButton after being activated
+
+ You can create a custom appearance for a DelayButton by assigning a
+ \l {QtQuick.Extras.Styles::}{DelayButtonStyle}.
+*/
+
+Button {
+ id: root
+
+ style: Qt.createComponent(StyleSettings.style + "/DelayButtonStyle.qml", root)
+
+ /*!
+ \qmlproperty real DelayButton::progress
+
+ This property holds the current progress as displayed by the progress
+ indicator, in the range \c 0.0 - \c 1.0.
+ */
+ readonly property alias progress: root.__progress
+
+ /*!
+ This property holds the time it takes (in milliseconds) for \l progress
+ to reach \c 1.0 and emit \l activated.
+
+ The default value is \c 3000 ms.
+ */
+ property int delay: 3000
+
+ /*!
+ This signal is emitted when \l progress reaches \c 1.0 and the button
+ becomes checked.
+ */
+ signal activated
+
+
+ /*! \internal */
+ property real __progress: 0.0
+
+ Behavior on __progress {
+ id: progressBehavior
+
+ NumberAnimation {
+ id: numberAnimation
+ }
+ }
+
+ Binding {
+ // Force checkable to false to get full control over the checked -property
+ target: root
+ property: "checkable"
+ value: false
+ }
+
+ onProgressChanged: {
+ if (__progress === 1.0) {
+ checked = true;
+ activated();
+ }
+ }
+
+ onCheckedChanged: {
+ if (checked) {
+ if (__progress < 1) {
+ // Programmatically activated the button; don't animate.
+ progressBehavior.enabled = false;
+ __progress = 1;
+ progressBehavior.enabled = true;
+ }
+ } else {
+ // Unchecked the button after it was flashing; it should instantly stop
+ // flashing (with no reversed progress bar).
+ progressBehavior.enabled = false;
+ __progress = 0;
+ progressBehavior.enabled = true;
+ }
+ }
+
+ onPressedChanged: {
+ if (checked) {
+ if (pressed) {
+ // Pressed the button to stop the activation.
+ checked = false;
+ }
+ } else {
+ var effectiveDelay = pressed ? delay : delay * 0.3;
+ // Not active. Either the button is being held down or let go.
+ numberAnimation.duration = Math.max(0, (pressed ? 1 - __progress : __progress) * effectiveDelay);
+ __progress = pressed ? 1 : 0;
+ }
+ }
+}
diff --git a/src/extras/Dial.qml b/src/extras/Dial.qml
new file mode 100644
index 00000000..aa1dc4d6
--- /dev/null
+++ b/src/extras/Dial.qml
@@ -0,0 +1,228 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Styles 1.3
+import QtQuick.Extras.Private 1.0
+
+/*!
+ \qmltype Dial
+ \inqmlmodule QtQuick.Extras
+ \since QtQuick.Extras 1.0
+ \ingroup extras
+ \ingroup extras-interactive
+ \brief A circular dial that is rotated to set a value.
+
+ \image dial.png A Dial
+
+ The Dial is similar to a traditional dial knob that is found on devices
+ such as stereos or industrial equipment. It allows the user to specify a
+ value within a range.
+
+ Like CircularGauge, Dial can display tickmarks to give an indication of
+ the current value. When a suitable stepSize is combined with
+ \l {QtQuick.Extras.Styles::DialStyle::}{tickmarkStepSize},
+ the dial "snaps" to each tickmark.
+
+ You can create a custom appearance for a Dial by assigning a
+ \l {QtQuick.Extras.Styles::}{DialStyle}.
+*/
+
+Control {
+ id: dial
+
+ activeFocusOnTab: true
+ style: Qt.createComponent(StyleSettings.style + "/DialStyle.qml", dial)
+
+ /*!
+ \qmlproperty real Dial::value
+
+ The angle of the handle along the dial, in the range of
+ \c 0.0 to \c 1.0.
+
+ The default value is \c{0.0}.
+ */
+ property alias value: range.value
+
+ /*!
+ \qmlproperty real Dial::minimumValue
+
+ The smallest value allowed by the dial.
+
+ The default value is \c{0.0}.
+
+ \sa value, maximumValue
+ */
+ property alias minimumValue: range.minimumValue
+
+ /*!
+ \qmlproperty real Dial::maximumValue
+
+ The largest value allowed by the dial.
+
+ The default value is \c{1.0}.
+
+ \sa value, minimumValue
+ */
+ property alias maximumValue: range.maximumValue
+
+ /*!
+ \qmlproperty real Dial::hovered
+
+ This property holds whether the button is being hovered.
+ */
+ readonly property alias hovered: mouseArea.containsMouse
+
+ /*!
+ \qmlproperty real Dial::stepSize
+
+ The default value is \c{0.0}.
+ */
+ property alias stepSize: range.stepSize
+
+ /*!
+ \internal
+ Determines whether the dial can be freely rotated past the zero marker.
+
+ The default value is \c false.
+ */
+ property bool __wrap: false
+
+ /*!
+ This property specifies whether the dial should gain active focus when
+ pressed.
+
+ The default value is \c false.
+
+ \sa pressed
+ */
+ property bool activeFocusOnPress: false
+
+ /*!
+ \qmlproperty bool Dial::pressed
+
+ Returns \c true if the dial is pressed.
+
+ \sa activeFocusOnPress
+ */
+ readonly property alias pressed: mouseArea.pressed
+
+ /*!
+ \since QtQuick.Extras 1.1
+
+ This property determines whether or not the dial displays tickmarks,
+ minor tickmarks, and labels.
+
+ For more fine-grained control over what is displayed, the following
+ style components of
+ \l {QtQuick.Extras.Styles::}{DialStyle} can be used:
+
+ \list
+ \li \l {QtQuick.Extras.Styles::DialStyle::tickmark}{tickmark}
+ \li \l {QtQuick.Extras.Styles::DialStyle::minorTickmark}{minorTickmark}
+ \li \l {QtQuick.Extras.Styles::DialStyle::tickmarkLabel}{tickmarkLabel}
+ \endlist
+
+ The default value is \c true.
+ */
+ property bool tickmarksVisible: true
+
+ Keys.onLeftPressed: value -= stepSize
+ Keys.onDownPressed: value -= stepSize
+ Keys.onRightPressed: value += stepSize
+ Keys.onUpPressed: value += stepSize
+ Keys.onPressed: {
+ if (event.key === Qt.Key_Home) {
+ value = minimumValue;
+ event.accepted = true;
+ } else if (event.key === Qt.Key_End) {
+ value = maximumValue;
+ event.accepted = true;
+ }
+ }
+
+ RangeModel {
+ id: range
+ minimumValue: 0.0
+ maximumValue: 1.0
+ stepSize: 0
+ value: 0
+ }
+
+ MouseArea {
+ id: mouseArea
+ hoverEnabled: true
+ parent: __panel.background.parent
+ anchors.fill: parent
+
+ onPositionChanged: {
+ if (pressed) {
+ value = valueFromPoint(mouseX, mouseY);
+ }
+ }
+ onPressed: {
+ if (!__style.__dragToSet)
+ value = valueFromPoint(mouseX, mouseY);
+
+ if (activeFocusOnPress)
+ dial.forceActiveFocus();
+ }
+
+ function bound(val) { return Math.max(minimumValue, Math.min(maximumValue, val)); }
+
+ function valueFromPoint(x, y)
+ {
+ var yy = height / 2.0 - y;
+ var xx = x - width / 2.0;
+ var angle = (xx || yy) ? Math.atan2(yy, xx) : 0;
+
+ if (angle < Math.PI/ -2)
+ angle = angle + Math.PI * 2;
+
+ var range = maximumValue - minimumValue;
+ var value;
+ if (__wrap)
+ value = (minimumValue + range * (Math.PI * 3 / 2 - angle) / (2 * Math.PI));
+ else
+ value = (minimumValue + range * (Math.PI * 4 / 3 - angle) / (Math.PI * 10 / 6));
+
+ return bound(value)
+ }
+ }
+}
diff --git a/src/extras/Gauge.qml b/src/extras/Gauge.qml
new file mode 100644
index 00000000..1a845ee3
--- /dev/null
+++ b/src/extras/Gauge.qml
@@ -0,0 +1,209 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Styles 1.3
+import QtQuick.Extras.Private 1.0
+
+/*!
+ \qmltype Gauge
+ \inqmlmodule QtQuick.Extras
+ \since QtQuick.Extras 1.0
+ \ingroup extras
+ \ingroup extras-non-interactive
+ \brief A straight gauge that displays a value within a range.
+
+ \image gauge.png Gauge
+
+ The Gauge control displays a value within some range along a horizontal or
+ vertical axis. It can be thought of as an extension of ProgressBar,
+ providing tickmarks and labels to provide a visual measurement of the
+ progress.
+
+ The minimum and maximum values displayable by the gauge can be set with the
+ \l minimumValue and \l maximumValue properties.
+
+ Example:
+ \code
+ Gauge {
+ minimumValue: 0
+ value: 50
+ maximumValue: 100
+ anchors.centerIn: parent
+ }
+ \endcode
+
+ You can create a custom appearance for a Gauge by assigning a
+ \l {QtQuick.Extras.Styles::}{GaugeStyle}.
+*/
+
+Control {
+ id: gauge
+
+ style: Qt.createComponent(StyleSettings.style + "/GaugeStyle.qml", gauge)
+
+ /*!
+ This property holds the smallest value displayed by the gauge.
+
+ The default value is \c 0.
+ */
+ property alias minimumValue: range.minimumValue
+
+ /*!
+ This property holds the value displayed by the gauge.
+
+ The default value is \c 0.
+ */
+ property alias value: range.value
+
+ /*!
+ This property holds the largest value displayed by the gauge.
+
+ The default value is \c 100.
+ */
+ property alias maximumValue: range.maximumValue
+
+ /*!
+ This property determines the orientation of the gauge.
+
+ The default value is \c Qt.Vertical.
+ */
+ property int orientation: Qt.Vertical
+
+ /*!
+ This property determines the alignment of each tickmark within the
+ gauge. When \l orientation is \c Qt.Vertical, the valid values are:
+
+ \list
+ \li Qt.AlignLeft
+ \li Qt.AlignRight
+ \endlist
+
+ Any other value will cause \c Qt.AlignLeft to be used, which is also the
+ default value for this orientation.
+
+ When \l orientation is \c Qt.Horizontal, the valid values are:
+
+ \list
+ \li Qt.AlignTop
+ \li Qt.AlignBottom
+ \endlist
+
+ Any other value will cause \c Qt.AlignBottom to be used, which is also
+ the default value for this orientation.
+ */
+ property int tickmarkAlignment: orientation == Qt.Vertical ? Qt.AlignLeft : Qt.AlignBottom
+ property int __tickmarkAlignment: {
+ if (orientation == Qt.Vertical) {
+ return (tickmarkAlignment == Qt.AlignLeft || tickmarkAlignment == Qt.AlignRight) ? tickmarkAlignment : Qt.AlignLeft;
+ }
+
+ return (tickmarkAlignment == Qt.AlignTop || tickmarkAlignment == Qt.AlignBottom) ? tickmarkAlignment : Qt.AlignBottom;
+ }
+
+ /*!
+ \internal
+
+ TODO: finish this
+
+ This property determines whether or not the tickmarks and their labels
+ are drawn inside (over) the gauge. The value of this property affects
+ \l tickmarkAlignment.
+ */
+ property bool __tickmarksInside: false
+
+ /*!
+ This property determines the rate at which tickmarks are drawn on the
+ gauge. The lower the value, the more often tickmarks are drawn.
+
+ The default value is \c 10.
+ */
+ property real tickmarkStepSize: 10
+
+ /*!
+ This property determines the amount of minor tickmarks drawn between
+ each regular tickmark.
+
+ The default value is \c 4.
+ */
+ property int minorTickmarkCount: 4
+
+ /*!
+ \qmlproperty font Gauge::font
+
+ The font to use for the tickmark text.
+ */
+ property alias font: hiddenText.font
+
+ /*!
+ \since QtQuick.Extras 1.3
+
+ This property accepts a function that formats the given \a value for
+ display in
+ \l {QtQuick.Extras.Styles::GaugeStyle}{tickmarkLabel}.
+
+ For example, to provide a custom format that displays all values with 3
+ decimal places:
+
+ \code
+ formatValue: function(value) {
+ return value.toFixed(3);
+ }
+ \endcode
+
+ The default function does no formatting.
+ */
+ property var formatValue: function(value) {
+ return value;
+ }
+
+ property alias __hiddenText: hiddenText
+ Text {
+ id: hiddenText
+ text: formatValue(maximumValue)
+ visible: false
+ }
+
+ RangeModel {
+ id: range
+ minimumValue: 0
+ value: 0
+ maximumValue: 100
+ }
+}
diff --git a/src/extras/PieMenu.qml b/src/extras/PieMenu.qml
new file mode 100644
index 00000000..94b6d414
--- /dev/null
+++ b/src/extras/PieMenu.qml
@@ -0,0 +1,747 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Private 1.0
+import QtQuick.Extras.Private.CppUtils 1.0 as CppUtils
+import QtQuick.Extras.Styles 1.3
+
+/*!
+ \qmltype PieMenu
+ \inqmlmodule QtQuick.Extras
+ \since QtQuick.Extras 1.0
+ \ingroup extras
+ \ingroup extras-interactive
+ \brief A popup menu that displays several menu items along an arc.
+
+ \image piemenu.png A PieMenu
+
+ The PieMenu provides a radial context menu as an alternative to a
+ traditional menu. All of the items in a PieMenu are an equal distance
+ from the center of the control.
+
+ \section2 Populating the Menu
+
+ To create a menu, define at least one MenuItem as a child of it:
+ \code
+ PieMenu {
+ id: pieMenu
+
+ MenuItem {
+ text: "Action 1"
+ onTriggered: print("Action 1")
+ }
+ MenuItem {
+ text: "Action 2"
+ onTriggered: print("Action 2")
+ }
+ MenuItem {
+ text: "Action 3"
+ onTriggered: print("Action 3")
+ }
+ }
+ \endcode
+
+ By default, only the currently selected item's text is displayed above the
+ menu. To provide text that is always visible when there is no current item,
+ set the \l title property.
+
+ \section2 Displaying the Menu
+
+ The typical use case for a menu is to open at the point of the mouse
+ cursor after a right click occurs. To do that, define a MouseArea that
+ covers the region upon which clicks should open the menu. When the
+ MouseArea is right-clicked, call the popup() function:
+ \code
+ MouseArea {
+ anchors.fill: parent
+ acceptedButtons: Qt.RightButton
+
+ onClicked: pieMenu.popup(mouseX, mouseY)
+ }
+ \endcode
+
+ If the menu is opened in a position where some of its menu items would be
+ outside of \l boundingItem, it is automatically moved to a position where
+ they will not be hidden. By default, the boundingItem is set to the parent
+ of the menu. It can also be set to \c null to prevent this behavior.
+
+ PieMenu can be displayed at any position on the screen. With a traditional
+ context menu, the menu would be positioned with its top left corner at the
+ position of the right click, but since PieMenu is radial, we position it
+ centered over the position of the right click.
+
+ To create a PieMenu that opens after a long press and selects items upon
+ releasing, you can combine ActivationMode.ActivateOnRelease with a
+ MouseArea using a Timer:
+ \code
+ MouseArea {
+ id: touchArea
+ anchors.fill: parent
+
+ Timer {
+ id: pressAndHoldTimer
+ interval: 300
+ onTriggered: pieMenu.popup(touchArea.mouseX, touchArea.mouseY);
+ }
+
+ onPressed: pressAndHoldTimer.start()
+ onReleased: pressAndHoldTimer.stop();
+ }
+
+ PieMenu {
+ id: pieMenu
+
+ triggerMode: TriggerMode.TriggerOnRelease
+
+ MenuItem {
+ text: "Action 1"
+ onTriggered: print("Action 1")
+ }
+ MenuItem {
+ text: "Action 2"
+ onTriggered: print("Action 2")
+ }
+ MenuItem {
+ text: "Action 3"
+ onTriggered: print("Action 3")
+ }
+ }
+ \endcode
+
+ You can hide individual menu items by setting their visible property to
+ \c false. Hiding items does not affect the
+ \l {QtQuick.Extras.Styles::PieMenuStyle::}{startAngle} or
+ \l {QtQuick.Extras.Styles::PieMenuStyle::}{endAngle}; the
+ remaining items will grow to consume the available space.
+
+ You can create a custom appearance for a PieMenu by assigning a
+ \l {QtQuick.Extras.Styles::}{PieMenuStyle}.
+*/
+
+Control {
+ id: pieMenu
+ visible: false
+
+ style: Qt.createComponent(StyleSettings.style + "/PieMenuStyle.qml", pieMenu)
+
+ /*!
+ This property reflects the angle (in radians) created by the imaginary
+ line from the center of the menu to the position of the cursor.
+
+ Its value is undefined when the menu is not visible.
+ */
+ readonly property real selectionAngle: {
+ var centerX = width / 2;
+ var centerY = height / 2;
+ var targetX = __protectedScope.selectionPos.x;
+ var targetY = __protectedScope.selectionPos.y;
+
+ var xDistance = centerX - targetX;
+ var yDistance = centerY - targetY;
+
+ var angleToTarget = Math.atan2(xDistance, yDistance) * -1;
+ angleToTarget;
+ }
+
+ /*!
+ \qmlproperty enumeration PieMenu::activationMode
+
+ This property determines the method for selecting items in the menu.
+
+ \list
+ \li An activationMode of \a ActivationMode.ActivateOnPress means that menu
+ items will only be selected when a mouse press event occurs over them.
+
+ \li An activationMode of \a ActivationMode.ActivateOnRelease means that menu
+ items will only be selected when a mouse release event occurs over them.
+ This means that the user must keep the mouse button down after opening
+ the menu and release the mouse over the item they wish to select.
+
+ \li An activationMode of \a ActivationMode.ActivateOnClick means that menu
+ items will only be selected when the user clicks once over them.
+ \endlist
+
+ \warning Changing the activationMode while the menu is visible will
+ result in undefined behavior.
+
+ \deprecated Use triggerMode instead.
+ */
+ property alias activationMode: pieMenu.triggerMode
+
+ /*!
+ \qmlproperty enumeration PieMenu::triggerMode
+
+ This property determines the method for selecting items in the menu.
+
+ \list
+ \li A triggerMode of \a TriggerMode.TriggerOnPress means that menu
+ items will only be selected when a mouse press event occurs over them.
+
+ \li A triggerMode of \a TriggerMode.TriggerOnRelease means that menu
+ items will only be selected when a mouse release event occurs over them.
+ This means that the user must keep the mouse button down after opening
+ the menu and release the mouse over the item they wish to select.
+
+ \li A triggerMode of \a TriggerMode.TriggerOnClick means that menu
+ items will only be selected when the user clicks once over them.
+ \endlist
+
+ \warning Changing the triggerMode while the menu is visible will
+ result in undefined behavior.
+ */
+ property int triggerMode: TriggerMode.TriggerOnClick
+
+ /*!
+ \qmlproperty list<MenuItem> menuItems
+
+ The list of menu items displayed by this menu.
+
+ You can assign menu items by declaring them as children of PieMenu:
+ \code
+ PieMenu {
+ MenuItem {
+ text: "Action 1"
+ onTriggered: function() { print("Action 1"); }
+ }
+ MenuItem {
+ text: "Action 2"
+ onTriggered: function() { print("Action 2"); }
+ }
+ MenuItem {
+ text: "Action 3"
+ onTriggered: function() { print("Action 3"); }
+ }
+ }
+ \endcode
+ */
+ default property alias menuItems: defaultPropertyHack.menuItems
+
+ QtObject {
+ // Can't specify a list as a default property (QTBUG-10822)
+ id: defaultPropertyHack
+ property list<MenuItem> menuItems
+ }
+
+ /*!
+ \qmlproperty int PieMenu::currentIndex
+
+ The index of the the menu item that is currently under the mouse,
+ or \c -1 if there is no such item.
+ */
+ readonly property alias currentIndex: protectedScope.currentIndex
+
+ /*!
+ \qmlproperty int PieMenu::currentItem
+
+ The menu item that is currently under the mouse, or \c null if there is
+ no such item.
+ */
+ readonly property alias currentItem: protectedScope.currentItem
+
+ /*!
+ \since QtQuick.Extras 1.1
+
+ This property defines the text that is shown above the menu when
+ there is no current menu item (currentIndex is \c -1).
+
+ The default value is \c "" (an empty string).
+ */
+ property string title: ""
+
+ /*!
+ \since QtQuick.Extras 1.2
+
+ The item which the menu must stay within.
+
+ A typical use case for PieMenu involves:
+
+ \list
+ \li A MouseArea that determines the clickable area within which the
+ menu can be opened.
+ \li The bounds that the menu must not go outside of.
+ \endlist
+
+ Although they sound similar, they have different purposes. Consider the
+ example below:
+
+ \image piemenu-boundingItem-example.png Canvas boundingItem example
+
+ The user can only open the menu within the inner rectangle. In this
+ case, they've opened the menu on the edge of the MouseArea, but there
+ would not be enough room to display the entire menu centered at the
+ cursor position, so it was moved to the left.
+
+ If for some reason we didn't want this restriction, we can set
+ boundingItem to \c null:
+
+ \image piemenu-boundingItem-null-example.png Canvas null boundingItem example
+
+ By default, the menu's \l {Item::}{parent} is the boundingItem.
+ */
+ property Item boundingItem: parent
+
+ /*!
+ \qmlmethod void popup(real x, real y)
+
+ Opens the menu at coordinates \a x, \a y.
+ */
+ function popup(x, y) {
+ if (x !== undefined)
+ pieMenu.x = x - pieMenu.width / 2;
+ if (y !== undefined)
+ pieMenu.y = y - pieMenu.height / 2;
+
+ pieMenu.visible = true;
+ }
+
+ /*!
+ \since QtQuick.Extras 1.1
+
+ \qmlmethod void addItem(string text)
+
+ Adds an item to the end of the menu items.
+
+ Equivalent to passing calling \c insertItem(menuItems.length, text).
+
+ Returns the newly added item.
+ */
+ function addItem(text) {
+ return insertItem(menuItems.length, text);
+ }
+
+ /*!
+ \since QtQuick.Extras 1.1
+
+ \qmlmethod void insertItem(int before, string text)
+
+ Inserts a MenuItem with \a text before the index at \a before.
+
+ To insert an item at the end, pass \c menuItems.length.
+
+ Returns the newly inserted item, or \c null if \a before is invalid.
+ */
+ function insertItem(before, text) {
+ if (before < 0 || before > menuItems.length) {
+ return null;
+ }
+
+ var newItems = __protectedScope.copyItemsToJsArray();
+ var newItem = Qt.createQmlObject("import QtQuick.Controls 1.1; MenuItem {}", pieMenu, "");
+ newItem.text = text;
+ newItems.splice(before, 0, newItem);
+
+ menuItems = newItems;
+ return newItem;
+ }
+
+ /*!
+ \since QtQuick.Extras 1.1
+
+ \qmlmethod void removeItem(item)
+
+ Removes \a item from the menu.
+ */
+ function removeItem(item) {
+ for (var i = 0; i < menuItems.length; ++i) {
+ if (menuItems[i] === item) {
+ var newItems = __protectedScope.copyItemsToJsArray();
+
+ newItems.splice(i, 1);
+ menuItems = newItems;
+ break;
+ }
+ }
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ hoverEnabled: !Settings.hasTouchScreen && triggerMode !== TriggerMode.TriggerOnRelease
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ onContainsMouseChanged: if (!containsMouse) __protectedScope.currentIndex = -1
+ objectName: "PieMenu internal MouseArea"
+
+ // The mouse thief also updates the selectionPos, so we can't bind to
+ // this mouseArea's mouseX/mouseY.
+ onPositionChanged: {
+ __protectedScope.selectionPos = Qt.point(mouseX, mouseY)
+ }
+ }
+
+ /*! \internal */
+ property alias __mouseThief: mouseThief
+
+ CppUtils.MouseThief {
+ id: mouseThief
+
+ onPressed: {
+ __protectedScope.selectionPos = Qt.point(mouseX, mouseY);
+ if (__protectedScope.handleEvent(ActivationMode.ActivateOnPress)) {
+ mouseThief.acceptCurrentEvent();
+ // We handled the press event, so we can reset this now.
+ mouseThief.receivedPressEvent = false;
+ }
+ }
+ onReleased: {
+ __protectedScope.selectionPos = Qt.point(mouseX, mouseY);
+ if (__protectedScope.handleEvent(ActivationMode.ActivateOnRelease)) {
+ mouseThief.acceptCurrentEvent();
+ // We handled the press event, so we can reset this now.
+ mouseThief.receivedPressEvent = false;
+ }
+ __protectedScope.pressedIndex = -1;
+ }
+ onClicked: {
+ __protectedScope.selectionPos = Qt.point(mouseX, mouseY);
+ if (__protectedScope.handleEvent(ActivationMode.ActivateOnClick)) {
+ mouseThief.acceptCurrentEvent();
+ }
+
+ // Clicked is the last stage in a click event (press, release, click),
+ // so we can safely set this to false now.
+ mouseThief.receivedPressEvent = false;
+ }
+ onTouchUpdate: __protectedScope.selectionPos = Qt.point(mouseX, mouseY)
+ }
+
+ onVisibleChanged: {
+ // parent check is for when it's created without a parent,
+ // which we do in the tests, for example.
+ if (parent) {
+ if (visible) {
+ if (boundingItem)
+ __protectedScope.moveWithinBounds();
+
+ // We need to grab the mouse so that we can detect released()
+ // (which is only emitted after pressed(), which our MouseArea can't
+ // emit as it didn't have focus until we were made visible).
+ mouseThief.grabMouse(mouseArea);
+ } else {
+ mouseThief.ungrabMouse();
+ __protectedScope.selectionPos = Qt.point(width / 2, height / 2);
+ }
+ }
+ }
+ onSelectionAngleChanged: __protectedScope.checkForCurrentItem()
+
+ /*! \internal */
+ property QtObject __protectedScope: QtObject {
+ id: protectedScope
+
+ property int currentIndex: -1
+ property MenuItem currentItem: currentIndex != -1 ? visibleItems[currentIndex] : null
+ property point selectionPos: Qt.point(width / 2, height / 2)
+ property int pressedIndex: -1
+ readonly property var localRect: mapFromItem(mouseArea, mouseArea.mouseX, mouseArea.mouseY)
+ readonly property var visibleItems: {
+ var items = [];
+ for (var i = 0; i < menuItems.length; ++i) {
+ if (menuItems[i].visible) {
+ items.push(menuItems[i]);
+ }
+ }
+ return items;
+ }
+
+ onSelectionPosChanged: __protectedScope.checkForCurrentItem()
+
+ // Can't bind directly, because the menu sets this to (0, 0) on closing.
+ onLocalRectChanged: {
+ if (visible)
+ selectionPos = Qt.point(localRect.x, localRect.y);
+ }
+
+ function copyItemsToJsArray() {
+ var newItems = [];
+ for (var j = 0; j < menuItems.length; ++j) {
+ newItems.push(menuItems[j]);
+ }
+ return newItems;
+ }
+
+ /*!
+ Returns \c true if the mouse is over the section at \a itemIndex.
+ */
+ function isMouseOver(itemIndex) {
+ if (__style == null)
+ return false;
+
+ // Our mouse angle's origin is north naturally, but the section angles need to be
+ // altered to have their origin north, so we need to remove the alteration here in order to compare properly.
+ // For example, section 0 will start at -1.57, whereas we want it to start at 0.
+ var sectionStart = __protectedScope.sectionStartAngle(itemIndex) + Math.PI / 2;
+ var sectionEnd = __protectedScope.sectionEndAngle(itemIndex) + Math.PI / 2;
+
+ var selAngle = selectionAngle;
+ var pastStart = selAngle >= sectionStart;
+ var isWithinOurAngle = false;
+
+ if (sectionStart > CppUtils.MathUtils.pi2) {
+ sectionStart %= CppUtils.MathUtils.pi2;
+ } else if (sectionStart < -CppUtils.MathUtils.pi2) {
+ sectionStart %= -CppUtils.MathUtils.pi2;
+ }
+
+ if (sectionEnd > CppUtils.MathUtils.pi2) {
+ sectionEnd %= CppUtils.MathUtils.pi2;
+ } else if (sectionEnd < -CppUtils.MathUtils.pi2) {
+ sectionEnd %= -CppUtils.MathUtils.pi2;
+ }
+
+ // If the section crosses the -180 => 180 wrap-around point (from atan2),
+ // temporarily rotate the section so it doesn't.
+ if (sectionStart > Math.PI) {
+ var difference = sectionStart - Math.PI;
+ selAngle -= difference;
+ sectionStart -= difference;
+ sectionEnd -= difference;
+ } else if (sectionStart < -Math.PI) {
+ difference = Math.abs(sectionStart - (-Math.PI));
+ selAngle += difference;
+ sectionStart += difference;
+ sectionEnd += difference;
+ }
+
+ if (sectionEnd > Math.PI) {
+ difference = sectionEnd - Math.PI;
+ selAngle -= difference;
+ sectionStart -= difference;
+ sectionEnd -= difference;
+ } else if (sectionEnd < -Math.PI) {
+ difference = Math.abs(sectionEnd - (-Math.PI));
+ selAngle += difference;
+ sectionStart += difference;
+ sectionEnd += difference;
+ }
+
+ // If we moved the mouse past -180 or 180, we need to move it back within,
+ // without changing its actual direction.
+ if (selAngle > Math.PI) {
+ selAngle = selAngle - CppUtils.MathUtils.pi2;
+ } else if (selAngle < -Math.PI) {
+ selAngle += CppUtils.MathUtils.pi2;
+ }
+
+ if (sectionStart > sectionEnd) {
+ isWithinOurAngle = selAngle >= sectionEnd && selAngle < sectionStart;
+ } else {
+ isWithinOurAngle = selAngle >= sectionStart && selAngle < sectionEnd;
+ }
+
+ var x1 = width / 2;
+ var y1 = height / 2;
+ var x2 = __protectedScope.selectionPos.x;
+ var y2 = __protectedScope.selectionPos.y;
+ var distanceFromCenter = Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2);
+ var cancelRadiusSquared = __style.cancelRadius * __style.cancelRadius;
+ var styleRadiusSquared = __style.radius * __style.radius;
+ var isWithinOurRadius = distanceFromCenter >= cancelRadiusSquared
+ && distanceFromCenter < styleRadiusSquared;
+ return isWithinOurAngle && isWithinOurRadius;
+ }
+
+ readonly property real arcRange: endAngleRadians - startAngleRadians
+
+ /*!
+ The size of one section in radians.
+ */
+ readonly property real sectionSize: arcRange / visibleItems.length
+ readonly property real startAngleRadians: CppUtils.MathUtils.degToRadOffset(__style.startAngle)
+ readonly property real endAngleRadians: CppUtils.MathUtils.degToRadOffset(__style.endAngle)
+
+ readonly property real circumferenceOfFullRange: 2 * Math.PI * __style.radius
+ readonly property real percentageOfFullRange: (arcRange / (Math.PI * 2))
+ readonly property real circumferenceOfSection: (sectionSize / arcRange) * (percentageOfFullRange * circumferenceOfFullRange)
+
+ function sectionStartAngle(section) {
+ var start = startAngleRadians + section * sectionSize;
+ return start;
+ }
+
+ function sectionCenterAngle(section) {
+ return (sectionStartAngle(section) + sectionEndAngle(section)) / 2;
+ }
+
+ function sectionEndAngle(section) {
+ var end = startAngleRadians + section * sectionSize + sectionSize;
+ return end;
+ }
+
+ function handleEvent(eventType) {
+ if (!visible)
+ return false;
+
+ checkForCurrentItem();
+
+ if (eventType === TriggerMode.TriggerOnPress)
+ pressedIndex = currentIndex;
+
+ if (eventType === TriggerMode.TriggerOnPress && triggerMode === TriggerMode.TriggerOnClick) {
+ // We *MUST* accept press events if we plan on also accepting the release
+ // (aka click, since we create that ourselves) event. If we don't, the
+ // external mouse area gets the press event but not the release event,
+ // and won't open until a release event is received, which means until the
+ // user taps twice on the external mouse area.
+ // Usually, we accept the current event in the onX MouseThief event handlers above,
+ // but there we set receivedPressEvent to false if this function says it handled
+ // the event, which we don't want, since TriggerOnClick is expecting to have
+ // received a press event. So, we ensure that receivedPressEvent stays true
+ // by saying we didn't handle the event, even though we actually do.
+ mouseThief.acceptCurrentEvent();
+ return false;
+ }
+
+ if (triggerMode === eventType) {
+ if (eventType === TriggerMode.TriggerOnClick && !mouseThief.receivedPressEvent) {
+ // When the trigger mode is TriggerOnClick, we can't
+ // act on a click event if we didn't receive the press.
+ return false;
+ }
+
+ // Setting visible to false resets the selectionPos to the center
+ // of the menu, which in turn causes the currentItem check to be re-evaluated,
+ // which sees that there's no current item because the selectionPos is centered.
+ // To avoid all of that, we store these variables before setting visible to false.
+ var currentItemBeforeClosing = currentItem;
+ var selectionPosBeforeClosing = selectionPos;
+ var currentIndexBeforeClosing = currentIndex;
+
+ // If the cursor was over an item; trigger it. If it wasn't,
+ // close our menu regardless. We do this first so that it's
+ // possible to keep the menu open by setting visible to true in onTriggered.
+ visible = false;
+
+ if (currentItemBeforeClosing) {
+ currentItemBeforeClosing.trigger();
+ }
+
+ if (visible && !Settings.hasTouchScreen && !Settings.isMobile) {
+ // The user kept the menu open in onTriggered, so restore the hover stuff.
+ selectionPos = selectionPosBeforeClosing;
+ currentIndex = currentIndexBeforeClosing;
+ }
+
+ // If the trigger mode and event are Release, we should ensure
+ // that we received a press event beforehand. If we didn't, we shouldn't steal
+ // the event in MouseThief's event filter.
+ return mouseThief.receivedPressEvent;
+ }
+ return false;
+ }
+
+ function checkForCurrentItem() {
+ // Use a temporary varibable because setting currentIndex to -1 here
+ // will trigger onCurrentIndexChanged.
+ if (!!visibleItems) {
+ var hoveredIndex = -1;
+ for (var i = 0; i < visibleItems.length; ++i) {
+ if (isMouseOver(i)) {
+ hoveredIndex = i;
+ break;
+ }
+ }
+ currentIndex = hoveredIndex;
+ }
+ }
+
+ function simplifyAngle(angle) {
+ var simplified = angle % 360;
+ if (simplified < 0)
+ simplified += 360;
+ return simplified;
+ }
+
+ function isWithinBottomEdge() {
+ var start = simplifyAngle(pieMenu.__style.startAngle);
+ var end = simplifyAngle(pieMenu.__style.endAngle);
+ return start >= 270 && end <= 90 && ((start < 360 && end <= 360) || (start >= 0 && end > 0));
+ }
+
+ function isWithinTopEdge() {
+ var start = simplifyAngle(pieMenu.__style.startAngle);
+ var end = simplifyAngle(pieMenu.__style.endAngle);
+ return start >= 90 && start < 270 && end > 90 && end <= 270;
+ }
+
+ function isWithinLeftEdge() {
+ var start = simplifyAngle(pieMenu.__style.startAngle);
+ var end = simplifyAngle(pieMenu.__style.endAngle);
+ return (start === 360 || start >= 0) && start < 180 && end > 0 && end <= 180;
+ }
+
+ function isWithinRightEdge() {
+ var start = simplifyAngle(pieMenu.__style.startAngle);
+ var end = simplifyAngle(pieMenu.__style.endAngle);
+ return start >= 180 && start < 360 && end > 180 && (end === 360 || end === 0);
+ }
+
+ /*!
+ Moves the menu if it would open with parts outside of \a rootParent.
+ */
+ function moveWithinBounds() {
+ // Find the bounding rect of the bounding item in the parent's referential.
+ var topLeft = boundingItem.mapToItem(pieMenu.parent, 0, 0);
+ var topRight = boundingItem.mapToItem(pieMenu.parent, boundingItem.width, 0);
+ var bottomLeft = boundingItem.mapToItem(pieMenu.parent, 0, boundingItem.height);
+ var bottomRight = boundingItem.mapToItem(pieMenu.parent, boundingItem.width, boundingItem.height);
+
+ // If the boundingItem is rotated, normalize the bounding rect.
+ topLeft.x = Math.min(topLeft.x, topRight.x, bottomLeft.x, bottomRight.x);
+ topLeft.y = Math.min(topLeft.y, topRight.y, bottomLeft.y, bottomRight.y);
+ bottomRight.x = Math.max(topLeft.x, topRight.x, bottomLeft.x, bottomRight.x);
+ bottomRight.y = Math.max(topLeft.y, topRight.y, bottomLeft.y, bottomRight.y);
+
+ if (pieMenu.x < topLeft.x && !isWithinLeftEdge()) {
+ // The width and height of the menu is always that of a full circle,
+ // so the menu is not always outside an edge when it's outside the edge -
+ // it depends on the start and end angles.
+ pieMenu.x = topLeft.x;
+ } else if (pieMenu.x + pieMenu.width > bottomRight.x && !isWithinRightEdge()) {
+ pieMenu.x = bottomRight.x - pieMenu.width;
+ }
+
+ if (pieMenu.y < topLeft.y && !isWithinTopEdge()) {
+ pieMenu.y = topLeft.y;
+ } else if (pieMenu.y + pieMenu.height > bottomRight.y && !isWithinBottomEdge()) {
+ pieMenu.y = bottomRight.y - pieMenu.height;
+ }
+ }
+ }
+}
diff --git a/src/extras/Private/CircularButton.qml b/src/extras/Private/CircularButton.qml
new file mode 100644
index 00000000..b2baf5a2
--- /dev/null
+++ b/src/extras/Private/CircularButton.qml
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Private 1.0
+import QtQuick.Extras.Styles 1.3
+
+/*!
+ \internal
+*/
+Button {
+ id: button
+ style: Qt.createComponent(StyleSettings.style + "/CircularButtonStyle.qml", button)
+}
diff --git a/src/extras/Private/CircularButtonStyleHelper.qml b/src/extras/Private/CircularButtonStyleHelper.qml
new file mode 100644
index 00000000..fedd3a37
--- /dev/null
+++ b/src/extras/Private/CircularButtonStyleHelper.qml
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Private 1.0
+
+QtObject {
+ id: circularButtonStyleHelper
+
+ property Item control
+
+ property color buttonColorUpTop: "#e3e3e3"
+ property color buttonColorUpBottom: "#b3b3b3"
+ property color buttonColorDownTop: "#d3d3d3"
+ property color buttonColorDownBottom: "#939393"
+ property color outerArcColorTop: "#9c9c9c"
+ property color outerArcColorBottom: Qt.rgba(0.941, 0.941, 0.941, 0.29)
+ property color innerArcColorTop: "#e3e3e3"
+ property color innerArcColorBottom: "#acacac"
+ property real innerArcColorBottomStop: 0.4
+ property color shineColor: Qt.rgba(1, 1, 1, 0.29)
+ property real smallestAxis: control ? Math.min(control.width, control.height) : 0
+ property real outerArcLineWidth: smallestAxis * 0.04
+ property real innerArcLineWidth: Math.max(1, outerArcLineWidth * 0.1)
+ property real shineArcLineWidth: Math.max(1, outerArcLineWidth * 0.1)
+ property real implicitWidth: Math.round(TextSingleton.implicitHeight * 8)
+ property real implicitHeight: Math.round(TextSingleton.implicitHeight * 8)
+
+ property color textColorUp: "#4e4e4e"
+ property color textColorDown: "#303030"
+ property color textRaisedColorUp: "#ffffff"
+ property color textRaisedColorDown: "#e3e3e3"
+
+ property real radius: (smallestAxis * 0.5) - outerArcLineWidth - innerArcLineWidth
+ property real halfRadius: radius / 2
+ property real outerArcRadius: innerArcRadius + outerArcLineWidth / 2
+ property real innerArcRadius: radius + innerArcLineWidth / 2
+ property real shineArcRadius: outerArcRadius + outerArcLineWidth / 2 - shineArcLineWidth / 2
+ property real zeroAngle: Math.PI * 0.5
+
+ property color buttonColorTop: control && control.pressed ? buttonColorDownTop : buttonColorUpTop
+ property color buttonColorBottom: control && control.pressed ? buttonColorDownBottom : buttonColorUpBottom
+
+ function toPixels(percentageOfSmallestAxis) {
+ return percentageOfSmallestAxis * smallestAxis;
+ }
+
+ function paintBackground(ctx) {
+ ctx.reset();
+
+ if (outerArcRadius < 0 || radius < 0)
+ return;
+
+ var xCenter = ctx.canvas.width / 2;
+ var yCenter = ctx.canvas.height / 2;
+
+ /* Draw outer arc */
+ ctx.beginPath();
+ ctx.lineWidth = outerArcLineWidth;
+ ctx.arc(xCenter, yCenter, outerArcRadius, 0, Math.PI * 2, false);
+ var gradient = ctx.createRadialGradient(xCenter, yCenter - halfRadius,
+ halfRadius, xCenter, yCenter - halfRadius, radius);
+ gradient.addColorStop(0, outerArcColorTop);
+ gradient.addColorStop(1, outerArcColorBottom);
+ ctx.strokeStyle = gradient;
+ ctx.stroke();
+
+ /* Draw the shine along the bottom */
+ ctx.beginPath();
+ ctx.lineWidth = shineArcLineWidth;
+ ctx.arc(xCenter, yCenter, shineArcRadius, 0, Math.PI, false);
+ gradient = ctx.createLinearGradient(xCenter, yCenter + radius, xCenter, yCenter);
+ gradient.addColorStop(0, shineColor);
+ gradient.addColorStop(0.5, "rgba(255, 255, 255, 0)");
+ ctx.strokeStyle = gradient;
+ ctx.stroke();
+
+ /* Draw inner arc */
+ ctx.beginPath();
+ ctx.lineWidth = innerArcLineWidth + 1;
+ ctx.arc(xCenter, yCenter, innerArcRadius, 0, Math.PI * 2, false);
+ gradient = ctx.createLinearGradient(xCenter, yCenter - halfRadius,
+ xCenter, yCenter + halfRadius);
+ gradient.addColorStop(0, innerArcColorTop);
+ gradient.addColorStop(innerArcColorBottomStop, innerArcColorBottom);
+ ctx.strokeStyle = gradient;
+ ctx.stroke();
+
+ /* Draw the button's body */
+ ctx.beginPath();
+ ctx.ellipse(xCenter - radius, yCenter - radius, radius * 2, radius * 2);
+ gradient = ctx.createRadialGradient(xCenter, yCenter + radius * 0.85, radius,
+ xCenter, yCenter + radius * 0.85, radius * 0.85);
+ gradient.addColorStop(1, buttonColorTop);
+ gradient.addColorStop(0, buttonColorBottom);
+ ctx.fillStyle = gradient;
+ ctx.fill();
+ }
+}
diff --git a/src/extras/Private/CircularTickmarkLabel.qml b/src/extras/Private/CircularTickmarkLabel.qml
new file mode 100644
index 00000000..05554878
--- /dev/null
+++ b/src/extras/Private/CircularTickmarkLabel.qml
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+// Workaround for QTBUG-37751; we need this import for RangeModel, although we shouldn't.
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Private 1.0
+
+Control {
+ id: label
+ style: Qt.createComponent(StyleSettings.style + "/CircularTickmarkLabelStyle.qml", label)
+
+ property alias minimumValue: range.minimumValue
+
+ property alias maximumValue: range.maximumValue
+
+ property alias stepSize: range.stepSize
+
+ RangeModel {
+ id: range
+ minimumValue: 0
+ maximumValue: 100
+ stepSize: 0
+ // Not used.
+ value: minimumValue
+ }
+
+ /*!
+ This property determines the angle at which the first tickmark is drawn.
+ */
+ property real minimumValueAngle: -145
+
+ /*!
+ This property determines the angle at which the last tickmark is drawn.
+ */
+ property real maximumValueAngle: 145
+
+ /*!
+ The range between \l minimumValueAngle and \l maximumValueAngle, in
+ degrees.
+ */
+ readonly property real angleRange: maximumValueAngle - minimumValueAngle
+
+ /*!
+ The interval at which tickmarks are displayed.
+ */
+ property real tickmarkStepSize: 10
+
+ /*!
+ The distance in pixels from the outside of the control (outerRadius) at
+ which the outermost point of the tickmark line is drawn.
+ */
+ property real tickmarkInset: 0.0
+
+ /*!
+ The amount of tickmarks displayed.
+ */
+ readonly property int tickmarkCount: __tickmarkCount
+
+ /*!
+ The amount of minor tickmarks between each tickmark.
+ */
+ property int minorTickmarkCount: 4
+
+ /*!
+ The distance in pixels from the outside of the control (outerRadius) at
+ which the outermost point of the minor tickmark line is drawn.
+ */
+ property real minorTickmarkInset: 0.0
+
+ /*!
+ The distance in pixels from the outside of the control (outerRadius) at
+ which the center of the value marker text is drawn.
+ */
+ property real labelInset: __style.__protectedScope.toPixels(0.19)
+
+ /*!
+ The interval at which tickmark labels are displayed.
+ */
+ property real labelStepSize: tickmarkStepSize
+
+ /*!
+ The amount of tickmark labels displayed.
+ */
+ readonly property int labelCount: (maximumValue - minimumValue) / labelStepSize + 1
+
+ /*! \internal */
+ readonly property real __tickmarkCount: tickmarkStepSize > 0 ? (maximumValue - minimumValue) / tickmarkStepSize + 1 : 0
+
+ /*!
+ This property determines whether or not the control displays tickmarks,
+ minor tickmarks, and labels.
+ */
+ property bool tickmarksVisible: true
+
+ /*!
+ Returns \a value as an angle in degrees.
+
+ For example, if minimumValueAngle is set to \c 270 and maximumValueAngle
+ is set to \c 90, this function will return \c 270 when passed
+ minimumValue and \c 90 when passed maximumValue.
+ */
+ function valueToAngle(value) {
+ var normalised = (value - minimumValue) / (maximumValue - minimumValue);
+ return (maximumValueAngle - minimumValueAngle) * normalised + minimumValueAngle;
+ }
+}
diff --git a/src/extras/Private/Handle.qml b/src/extras/Private/Handle.qml
new file mode 100644
index 00000000..12e2804d
--- /dev/null
+++ b/src/extras/Private/Handle.qml
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtGraphicalEffects 1.0
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras.Styles 1.3
+import QtQuick.Extras.Private 1.1
+import QtQuick.Extras.Private.CppUtils 1.0
+
+Control {
+ id: root
+ x: handleArea.centerOfHandle.x - width / 2
+ y: handleArea.centerOfHandle.y - height / 2
+
+ style: Qt.createComponent(StyleSettings.style + "/HandleStyle.qml", root)
+
+ /*!
+ The angle of the handle along the circumference of \l rotationRadius in
+ radians, scaled to be in the range of 0.0 to 1.0.
+ */
+ property alias value: range.value
+
+ RangeModel {
+ id: range
+ minimumValue: 0.0
+ maximumValue: 1.0
+ stepSize: 0
+ value: minimumValue
+ }
+
+ /*!
+ The angle in radians where the dial starts.
+ */
+ property real zeroAngle: 0
+
+ /*!
+ The radius of the rotation of this handle.
+ */
+ property real rotationRadius: 50
+
+ /*!
+ The center of the dial. This is the origin point for the handle's
+ rotation.
+ */
+ property real dialXCenter: 0
+ property real dialYCenter: 0
+
+ /*!
+ This property holds the amount of extra room added to each side of
+ the handle to make it easier to drag on touch devices.
+ */
+ property real allowance: Math.max(width, height) * 1.5
+
+ /*
+ The function used to determine the handle's value from the position of
+ the mouse.
+
+ Can be set to provide custom value calculation. It expects these
+ parameters: \c mouseX, \c mouseY, \c xCenter, \c yCenter, \c zeroAngle
+ */
+ property var valueFromMouse: handleArea.valueFromMouse
+
+ property alias handleArea: handleArea
+
+ MouseArea {
+ id: handleArea
+ // Respond to value changes by calculating the new center of the handle.
+ property point centerOfHandle: MathUtils.centerAlongCircle(dialXCenter, dialYCenter,
+ 0, 0, MathUtils.valueToAngle(value, 1, zeroAngle), rotationRadius);
+
+ anchors.fill: parent
+ anchors.margins: -allowance
+
+ onPositionChanged: {
+ // Whenever the handle is moved with the mouse, update the value.
+ value = root.valueFromMouse(mouse.x + centerOfHandle.x - allowance,
+ mouse.y + centerOfHandle.y - allowance, dialXCenter, dialYCenter, zeroAngle);
+ }
+
+ // A helper function for onPositionChanged.
+ function valueFromMouse(mouseX, mouseY, xCenter, yCenter, zeroAngle) {
+ return MathUtils.angleToValue(
+ MathUtils.halfPi - Math.atan2(mouseX - xCenter, mouseY - yCenter), 1, zeroAngle);
+ }
+ }
+}
diff --git a/src/extras/Private/PieMenuIcon.qml b/src/extras/Private/PieMenuIcon.qml
new file mode 100644
index 00000000..f54e035f
--- /dev/null
+++ b/src/extras/Private/PieMenuIcon.qml
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.3
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Private 1.0
+import QtQuick.Extras.Private.CppUtils 1.0
+
+Loader {
+ id: iconLoader
+ active: iconSource != ""
+
+ property PieMenu control: null
+ property QtObject styleData: null
+
+ readonly property string iconSource: styleData && styleData.index < control.__protectedScope.visibleItems.length
+ ? control.__protectedScope.visibleItems[styleData.index].iconSource
+ : ""
+
+ sourceComponent: Image {
+ id: iconImage
+ source: iconSource
+ x: pos.x
+ y: pos.y
+ scale: scaleFactor
+
+ readonly property point pos: MathUtils.centerAlongCircle(
+ iconLoader.parent.width / 2, iconLoader.parent.height / 2, width, height,
+ MathUtils.degToRadOffset(sectionCenterAngle(styleData.index)), control.__style.__iconOffset)
+
+ /*
+ The icons should scale with the menu at some point, so that they
+ stay within the bounds of each section. We down-scale the image by
+ whichever of the following amounts are larger:
+
+ a) The amount by which the largest dimension's diagonal size exceeds
+ the "selectable" radius. The selectable radius is the distance in pixels
+ between lines A and B in the incredibly visually appealing image below:
+
+ __________
+ - B -
+ / \
+ / ____ \
+ | / A \ |
+ --------| |--------
+
+ b) The amount by which the diagonal exceeds the circumference of
+ one section.
+ */
+ readonly property real scaleFactor: {
+ var largestDimension = Math.max(iconImage.sourceSize.width, iconImage.sourceSize.height) * Math.sqrt(2);
+ // TODO: add padding
+ var radiusDifference = largestDimension - control.__style.__selectableRadius;
+ var circumferenceDifference = largestDimension - Math.abs(control.__protectedScope.circumferenceOfSection);
+ if (circumferenceDifference > 0 || radiusDifference > 0) {
+ // We need to down-scale.
+ if (radiusDifference > circumferenceDifference) {
+ return control.__style.__selectableRadius / largestDimension;
+ } else {
+ return Math.abs(control.__protectedScope.circumferenceOfSection) / largestDimension;
+ }
+ }
+ return 1;
+ }
+ }
+}
diff --git a/src/extras/Private/TextSingleton.qml b/src/extras/Private/TextSingleton.qml
new file mode 100644
index 00000000..6e51c66f
--- /dev/null
+++ b/src/extras/Private/TextSingleton.qml
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+pragma Singleton
+import QtQuick 2.1
+
+Text {
+}
diff --git a/src/extras/Private/private.pri b/src/extras/Private/private.pri
new file mode 100644
index 00000000..4f394412
--- /dev/null
+++ b/src/extras/Private/private.pri
@@ -0,0 +1,24 @@
+QT += gui quick
+
+HEADERS += \
+ $$PWD/qquickcircularprogressbar_p.h \
+ $$PWD/qquickflatprogressbar_p.h \
+ $$PWD/qquickmousethief_p.h \
+ $$PWD/qquickstylesettings_p.h \
+ $$PWD/qquickmathutils_p.h
+
+SOURCES += \
+ $$PWD/qquickcircularprogressbar.cpp \
+ $$PWD/qquickflatprogressbar.cpp \
+ $$PWD/qquickmousethief.cpp \
+ $$PWD/qquickstylesettings.cpp \
+ $$PWD/qquickmathutils.cpp
+
+OTHER_FILES += \
+ $$PWD/qmldir \
+ $$PWD/CircularButton.qml \
+ $$PWD/CircularButtonStyleHelper.qml \
+ $$PWD/CircularTickmarkLabel.qml \
+ $$PWD/Handle.qml \
+ $$PWD/PieMenuIcon.qml \
+ $$PWD/TextSingleton.qml
diff --git a/src/extras/Private/qmldir b/src/extras/Private/qmldir
new file mode 100644
index 00000000..3b115bba
--- /dev/null
+++ b/src/extras/Private/qmldir
@@ -0,0 +1 @@
+module QtQuick.Extras.Private
diff --git a/src/extras/Private/qquickcircularprogressbar.cpp b/src/extras/Private/qquickcircularprogressbar.cpp
new file mode 100644
index 00000000..5bdab7d3
--- /dev/null
+++ b/src/extras/Private/qquickcircularprogressbar.cpp
@@ -0,0 +1,209 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickcircularprogressbar_p.h"
+
+#include <QtGui/QPen>
+#include <QtGui/QPainter>
+#include <QtMath>
+
+QQuickCircularProgressBar::QQuickCircularProgressBar(QQuickItem *parent) :
+ QQuickPaintedItem(parent),
+ mProgress(0),
+ mBarWidth(1),
+ mInset(0),
+ mBackgroundColor(QColor(Qt::transparent)),
+ mMinimumValueAngle(-90 * 16),
+ mMaximumValueAngle(-450 * 16)
+{
+ setFlag(ItemHasContents, true);
+}
+
+QQuickCircularProgressBar::~QQuickCircularProgressBar()
+{
+}
+
+void QQuickCircularProgressBar::paint(QPainter *painter)
+{
+ QPen pen(Qt::red);
+ pen.setWidthF(mBarWidth);
+
+ const QRectF bounds = boundingRect();
+ const qreal smallest = qMin(bounds.width(), bounds.height());
+ QRectF rect = QRectF(pen.widthF() / 2.0, pen.widthF() / 2.0, smallest - pen.widthF(), smallest - pen.widthF());
+ rect.adjust(mInset, mInset, -mInset, -mInset);
+
+ // Make sure the arc is aligned to whole pixels.
+ if (rect.x() - int(rect.x()) > 0) {
+ rect.setX(qCeil(rect.x()));
+ }
+ if (rect.y() - int(rect.y()) > 0) {
+ rect.setY(qCeil(rect.y()));
+ }
+ if (rect.width() - int(rect.width()) > 0) {
+ rect.setWidth(qFloor(rect.width()));
+ }
+ if (rect.height() - int(rect.height()) > 0) {
+ rect.setHeight(qFloor(rect.height()));
+ }
+
+ painter->setRenderHint(QPainter::Antialiasing);
+
+ // QPainter::drawArc uses positive values for counter clockwise - the opposite of our API -
+ // so we must reverse the angles with * -1. Also, our angle origin is at 12 o'clock, whereas
+ // QPainter's is 3 o'clock, hence - 90.
+ const qreal startAngle = ((mMinimumValueAngle - 90) * -1) * 16;
+ if (mBackgroundColor != Qt::transparent) {
+ QBrush bgBrush(mBackgroundColor);
+ QPen bgPen;
+ bgPen.setWidthF(mBarWidth);
+ bgPen.setBrush(bgBrush);
+ painter->setPen(bgPen);
+ painter->drawArc(rect, startAngle, (((mMaximumValueAngle - 90) * -1 * 16) - startAngle));
+ }
+
+ QLinearGradient gradient;
+ gradient.setStart(bounds.width() / 2, mInset);
+ gradient.setFinalStop(bounds.width() / 2, bounds.height() - mInset);
+ gradient.setStops(mGradientStops);
+
+ QBrush brush(gradient);
+ pen.setBrush(brush);
+
+ painter->setPen(pen);
+
+ const qreal spanAngle = progress() * (((mMaximumValueAngle - 90) * -1 * 16) - startAngle);
+ painter->drawArc(rect, startAngle, spanAngle);
+}
+
+qreal QQuickCircularProgressBar::progress() const
+{
+ return mProgress;
+}
+
+void QQuickCircularProgressBar::setProgress(qreal progress)
+{
+ if (mProgress != progress) {
+ mProgress = progress;
+ emit progressChanged(mProgress);
+ update();
+ }
+}
+
+qreal QQuickCircularProgressBar::barWidth() const
+{
+ return mBarWidth;
+}
+
+void QQuickCircularProgressBar::setBarWidth(qreal barWidth)
+{
+ if (mBarWidth != barWidth) {
+ mBarWidth = barWidth;
+ emit barWidthChanged(mBarWidth);
+ update();
+ }
+}
+
+qreal QQuickCircularProgressBar::inset() const
+{
+ return mInset;
+}
+
+void QQuickCircularProgressBar::setInset(qreal inset)
+{
+ if (mInset != inset) {
+ mInset = inset;
+ emit insetChanged(mInset);
+ update();
+ }
+}
+
+qreal QQuickCircularProgressBar::minimumValueAngle() const
+{
+ return mMinimumValueAngle;
+}
+
+void QQuickCircularProgressBar::setMinimumValueAngle(qreal minimumValueAngle)
+{
+ if (mMinimumValueAngle != minimumValueAngle) {
+ mMinimumValueAngle = minimumValueAngle;
+ emit minimumValueAngleChanged(mMinimumValueAngle);
+ update();
+ }
+}
+
+qreal QQuickCircularProgressBar::maximumValueAngle() const
+{
+ return mMinimumValueAngle;
+}
+
+void QQuickCircularProgressBar::setMaximumValueAngle(qreal maximumValueAngle)
+{
+ if (mMaximumValueAngle != maximumValueAngle) {
+ mMaximumValueAngle = maximumValueAngle;
+ emit maximumValueAngleChanged(mMaximumValueAngle);
+ update();
+ }
+}
+
+void QQuickCircularProgressBar::clearStops()
+{
+ mGradientStops.clear();
+}
+
+void QQuickCircularProgressBar::addStop(qreal position, const QColor &color)
+{
+ mGradientStops.append(QGradientStop(position, color));
+}
+
+void QQuickCircularProgressBar::redraw()
+{
+ update();
+}
+
+QColor QQuickCircularProgressBar::backgroundColor() const
+{
+ return mBackgroundColor;
+}
+
+void QQuickCircularProgressBar::setBackgroundColor(const QColor &backgroundColor)
+{
+ if (mBackgroundColor != backgroundColor) {
+ mBackgroundColor = backgroundColor;
+ emit backgroundColorChanged(backgroundColor);
+ update();
+ }
+}
diff --git a/src/extras/Private/qquickcircularprogressbar_p.h b/src/extras/Private/qquickcircularprogressbar_p.h
new file mode 100644
index 00000000..7e9be6ee
--- /dev/null
+++ b/src/extras/Private/qquickcircularprogressbar_p.h
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CIRCULARPROGRESSBAR_P_H
+#define CIRCULARPROGRESSBAR_P_H
+
+#include <QtGui/QColor>
+#include <QtGui/QGradientStops>
+#include <QtQuick/QQuickPaintedItem>
+
+class QQuickCircularProgressBar : public QQuickPaintedItem
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal progress READ progress WRITE setProgress NOTIFY progressChanged)
+ Q_PROPERTY(qreal barWidth READ barWidth WRITE setBarWidth NOTIFY barWidthChanged)
+ Q_PROPERTY(qreal inset READ inset WRITE setInset NOTIFY insetChanged)
+ Q_PROPERTY(qreal minimumValueAngle READ minimumValueAngle WRITE setMinimumValueAngle NOTIFY minimumValueAngleChanged)
+ Q_PROPERTY(qreal maximumValueAngle READ maximumValueAngle WRITE setMaximumValueAngle NOTIFY maximumValueAngleChanged)
+ // For Flat DialStyle, so that we don't need to create two progress bars
+ Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged)
+
+public:
+ QQuickCircularProgressBar(QQuickItem *parent = 0);
+ ~QQuickCircularProgressBar();
+
+ void paint(QPainter *painter);
+
+ qreal progress() const;
+ void setProgress(qreal progress);
+
+ qreal barWidth() const;
+ void setBarWidth(qreal barWidth);
+
+ qreal inset() const;
+ void setInset(qreal inset);
+
+ qreal minimumValueAngle() const;
+ void setMinimumValueAngle(qreal minimumValueAngle);
+
+ qreal maximumValueAngle() const;
+ void setMaximumValueAngle(qreal maximumValueAngle);
+
+ Q_INVOKABLE void clearStops();
+ Q_INVOKABLE void addStop(qreal position, const QColor &color);
+ Q_INVOKABLE void redraw();
+
+ QColor backgroundColor() const;
+ void setBackgroundColor(const QColor &backgroundColor);
+signals:
+ void progressChanged(qreal progress);
+ void barWidthChanged(qreal barWidth);
+ void insetChanged(qreal inset);
+ void minimumValueAngleChanged(qreal minimumValueAngle);
+ void maximumValueAngleChanged(qreal maximumValueAngle);
+ void backgroundColorChanged(const QColor &backgroundColor);
+private:
+ qreal mProgress;
+ qreal mBarWidth;
+ qreal mInset;
+ QGradientStops mGradientStops;
+ QColor mBackgroundColor;
+ qreal mMinimumValueAngle;
+ qreal mMaximumValueAngle;
+};
+
+#endif // CIRCULARPROGRESSBAR_P_H
diff --git a/src/extras/Private/qquickflatprogressbar.cpp b/src/extras/Private/qquickflatprogressbar.cpp
new file mode 100644
index 00000000..f45a708a
--- /dev/null
+++ b/src/extras/Private/qquickflatprogressbar.cpp
@@ -0,0 +1,202 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickflatprogressbar_p.h"
+
+#include <QtCore/QtMath>
+#include <QtGui/QPainter>
+
+QQuickFlatProgressBar::QQuickFlatProgressBar(QQuickItem *parent) :
+ QQuickPaintedItem(parent),
+ mStripeOffset(0),
+ mRadius(0),
+ mIndeterminate(false)
+{
+ mAnimation.setTargetObject(this);
+ mAnimation.setPropertyName("stripeOffset");
+ mAnimation.setEndValue(0);
+ mAnimation.setDuration(800);
+ mAnimation.setLoopCount(-1);
+
+ connect(this, SIGNAL(stripeOffsetChanged(qreal)), this, SLOT(repaint()));
+ connect(this, SIGNAL(progressChanged(qreal)), this, SLOT(repaint()));
+ connect(this, SIGNAL(enabledChanged()), this, SLOT(repaint()));
+ connect(this, SIGNAL(indeterminateChanged(bool)), this, SLOT(repaint()));
+ connect(this, SIGNAL(widthChanged()), this, SLOT(onWidthChanged()));
+ connect(this, SIGNAL(heightChanged()), this, SLOT(onHeightChanged()));
+ connect(this, SIGNAL(visibleChanged()), this, SLOT(onVisibleChanged()));
+}
+
+int QQuickFlatProgressBar::barWidth()
+{
+ // 14 is the design height of stripes on the bar, 10 is design width of stripe
+ return int(height() * 10 / 14);
+}
+
+void QQuickFlatProgressBar::paint(QPainter *painter)
+{
+ // This item should always be rounded to an integer size, so it is safe to use int here.
+ const int w = width();
+ const int h = height();
+
+ painter->setRenderHint(QPainter::Antialiasing, true);
+ painter->setPen(Qt::transparent);
+
+ // Draw the background.
+ painter->setBrush(isIndeterminate() && mProgress > 0 ? QColor(92, 170, 21) : QColor(0, 0, 0, 255 * 0.15));
+ painter->drawRoundedRect(0, 0, w, h, mRadius, mRadius);
+
+ // Draw progress, or indeterminate stripes.
+ painter->setClipPath(mClipPath);
+
+ if (!mIndeterminate) {
+ painter->setBrush(isEnabled() ? QColor(92, 170, 21) : QColor(179, 179, 179));
+ painter->drawRect(0, 0, int(w * mProgress), h);
+ } else {
+ QPainterPath innerClipPath;
+ // 1 is the design margin thickness.
+ const int margin = qMax(1, int(height() * (1.0 / 16.0)));
+ // We take the margin from the radius so that the inner and outer radii match each other visually.
+ innerClipPath.addRoundedRect(margin, margin, width() - margin * 2, height() - margin * 2, mRadius - margin, mRadius - margin);
+ painter->setClipPath(innerClipPath);
+
+ painter->translate(mStripeOffset, 0);
+
+ const qreal stripeWidth = barWidth();
+ // The horizontal distance created by the slant of the stripe.
+ const qreal stripeSlantDistance = h;
+
+ // One stripe width is equal to the height of the bar.
+ QPainterPath stripe;
+ stripe.moveTo(0, h);
+ stripe.lineTo(stripeSlantDistance, 0);
+ stripe.lineTo(stripeSlantDistance + stripeWidth, 0);
+ stripe.lineTo(stripeWidth, h);
+ stripe.closeSubpath();
+
+ painter->setBrush(QBrush(mProgress > 0 ? QColor(255, 255, 255, 77) : Qt::white));
+
+ for (int i = -stripeWidth * 2; i < w + stripeWidth * 2; i += stripeWidth * 2) {
+ painter->translate(i, 0);
+ painter->drawPath(stripe);
+ painter->translate(-i, 0);
+ }
+
+ painter->translate(-mStripeOffset, 0);
+ }
+}
+
+qreal QQuickFlatProgressBar::stripeOffset() const
+{
+ return mStripeOffset;
+}
+
+void QQuickFlatProgressBar::setStripeOffset(qreal pos)
+{
+ if (pos != mStripeOffset) {
+ mStripeOffset = pos;
+ emit stripeOffsetChanged(pos);
+ }
+}
+
+qreal QQuickFlatProgressBar::progress() const
+{
+ return mProgress;
+}
+
+void QQuickFlatProgressBar::setProgress(qreal progress)
+{
+ if (progress != mProgress) {
+ mProgress = progress;
+ emit progressChanged(mProgress);
+ }
+}
+
+bool QQuickFlatProgressBar::isIndeterminate()
+{
+ return mIndeterminate;
+}
+
+void QQuickFlatProgressBar::setIndeterminate(bool indeterminate)
+{
+ if (indeterminate != mIndeterminate) {
+ mIndeterminate = indeterminate;
+ emit indeterminateChanged(mIndeterminate);
+ }
+}
+
+void QQuickFlatProgressBar::repaint()
+{
+ QQuickPaintedItem::update(QRect(0, 0, width(), height()));
+}
+
+void QQuickFlatProgressBar::restartAnimation()
+{
+ mAnimation.stop();
+ mAnimation.setStartValue(-barWidth() * 2);
+ mAnimation.start();
+}
+
+void QQuickFlatProgressBar::onVisibleChanged()
+{
+ if (isVisible()) {
+ restartAnimation();
+ } else {
+ mAnimation.stop();
+ }
+}
+
+void QQuickFlatProgressBar::onWidthChanged()
+{
+ restartAnimation();
+
+ mClipPath = QPainterPath();
+ mClipPath.addRoundedRect(0, 0, width(), height(), mRadius, mRadius);
+}
+
+void QQuickFlatProgressBar::onHeightChanged()
+{
+ restartAnimation();
+
+ // 3 is the design radius, 16 is the design height of the bar
+ const qreal radius = height() * 3 / 16;
+ if (radius != mRadius) {
+ mRadius = radius;
+ }
+
+ mClipPath = QPainterPath();
+ mClipPath.addRoundedRect(0, 0, width(), height(), mRadius, mRadius);
+}
diff --git a/src/extras/Private/qquickflatprogressbar_p.h b/src/extras/Private/qquickflatprogressbar_p.h
new file mode 100644
index 00000000..1c3061e4
--- /dev/null
+++ b/src/extras/Private/qquickflatprogressbar_p.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef FLATPROGRESSBAR_H
+#define FLATPROGRESSBAR_H
+
+#include <QtCore/QPropertyAnimation>
+#include <QtGui/QPainterPath>
+#include <QtQuick/QQuickPaintedItem>
+
+class QQuickFlatProgressBar : public QQuickPaintedItem
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal stripeOffset READ stripeOffset WRITE setStripeOffset NOTIFY stripeOffsetChanged)
+ Q_PROPERTY(qreal progress READ progress WRITE setProgress NOTIFY progressChanged)
+ Q_PROPERTY(bool indeterminate READ isIndeterminate WRITE setIndeterminate NOTIFY indeterminateChanged)
+public:
+ explicit QQuickFlatProgressBar(QQuickItem *parent = 0);
+
+ void paint(QPainter *painter);
+
+ qreal stripeOffset() const;
+ void setStripeOffset(qreal stripeOffset);
+
+ qreal progress() const;
+ void setProgress(qreal progress);
+
+ bool isIndeterminate();
+ void setIndeterminate(bool indeterminate);
+
+public slots:
+ void repaint();
+ void restartAnimation();
+ void onVisibleChanged();
+ void onWidthChanged();
+ void onHeightChanged();
+
+signals:
+ void stripeOffsetChanged(qreal stripeOffset);
+ void progressChanged(qreal progress);
+ void indeterminateChanged(bool indeterminate);
+
+private:
+ int barWidth();
+
+private:
+ qreal mStripeOffset;
+ qreal mProgress;
+ qreal mRadius;
+ bool mIndeterminate;
+ QPainterPath mClipPath;
+ QPropertyAnimation mAnimation;
+};
+
+#endif // FLATPROGRESSBAR_H
diff --git a/src/extras/Private/qquickmathutils.cpp b/src/extras/Private/qquickmathutils.cpp
new file mode 100644
index 00000000..8f4b2a6b
--- /dev/null
+++ b/src/extras/Private/qquickmathutils.cpp
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickmathutils_p.h"
+
+#include <qmath.h>
+
+QQuickMathUtils::QQuickMathUtils(QObject *parent) :
+ QObject(parent)
+{
+}
+
+qreal QQuickMathUtils::pi2() const
+{
+ return M_PI * 2;
+}
+
+/*!
+ Converts the angle \a degrees to radians.
+*/
+qreal QQuickMathUtils::degToRad(qreal degrees) const {
+ return degrees * (M_PI / 180);
+}
+
+/*!
+ Converts the angle \a degrees to radians.
+
+ This function assumes that the angle origin (0) is north, as this
+ is the origin used by all of the Extras. The angle
+ returned will have its angle origin (0) pointing east, in order to be
+ consistent with standard angles used by \l {QtQuick::Canvas}{Canvas},
+ for example.
+*/
+qreal QQuickMathUtils::degToRadOffset(qreal degrees) const {
+ return (degrees - 90) * (M_PI / 180);
+}
+
+/*!
+ Converts the angle \a radians to degrees.
+*/
+qreal QQuickMathUtils::radToDeg(qreal radians) const {
+ return radians * (180 / M_PI);
+}
+
+/*!
+ Converts the angle \a radians to degrees.
+
+ This function assumes that the angle origin (0) is east; as is standard for
+ mathematical operations using radians (this origin is used by
+ \l {QtQuick::Canvas}{Canvas}, for example). The angle returned in degrees
+ will have its angle origin (0) pointing north, which is what the extras
+ expect.
+*/
+qreal QQuickMathUtils::radToDegOffset(qreal radians) const {
+ return radians * (180 / M_PI) + 90;
+}
+
+/*!
+ Returns the top left position of the item if it were centered along
+ a circle according to \a angleOnCircle and \a distanceAlongRadius.
+
+ \a angleOnCircle is from 0.0 - M_PI2.
+ \a distanceAlongRadius is the distance along the radius in M_PIxels.
+*/
+QPointF QQuickMathUtils::centerAlongCircle(qreal xCenter, qreal yCenter,
+ qreal width, qreal height, qreal angleOnCircle, qreal distanceAlongRadius) const {
+ return QPointF(
+ (xCenter - width / 2) + (distanceAlongRadius * cos(angleOnCircle)),
+ (yCenter - height / 2) + (distanceAlongRadius * sin(angleOnCircle)));
+}
+
+/*!
+ Returns \a number rounded to the nearest even integer.
+*/
+qreal QQuickMathUtils::roundEven(qreal number) const {
+ int rounded = qRound(number);
+ return rounded % 2 == 0 ? rounded : rounded + 1;
+}
diff --git a/src/extras/Private/qquickmathutils_p.h b/src/extras/Private/qquickmathutils_p.h
new file mode 100644
index 00000000..35e15a84
--- /dev/null
+++ b/src/extras/Private/qquickmathutils_p.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKMATHUTILS_P
+#define QQUICKMATHUTILS_P
+
+#include <QObject>
+#include <QPointF>
+
+class QQuickMathUtils : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal pi2 READ pi2 CONSTANT)
+public:
+ QQuickMathUtils(QObject *parent = 0);
+
+ qreal pi2() const;
+ Q_INVOKABLE qreal degToRad(qreal degrees) const;
+ Q_INVOKABLE qreal degToRadOffset(qreal degrees) const;
+ Q_INVOKABLE qreal radToDeg(qreal radians) const;
+ Q_INVOKABLE qreal radToDegOffset(qreal radians) const;
+ Q_INVOKABLE QPointF centerAlongCircle(qreal xCenter, qreal yCenter,
+ qreal width, qreal height, qreal angleOnCircle, qreal distanceAlongRadius) const;
+ Q_INVOKABLE qreal roundEven(qreal number) const;
+};
+
+#endif // QQUICKMATHUTILS_P
+
diff --git a/src/extras/Private/qquickmousethief.cpp b/src/extras/Private/qquickmousethief.cpp
new file mode 100644
index 00000000..5fe82672
--- /dev/null
+++ b/src/extras/Private/qquickmousethief.cpp
@@ -0,0 +1,208 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickmousethief_p.h"
+
+#include <QtCore/QMetaObject>
+#include <QtQuick/QQuickWindow>
+
+QQuickMouseThief::QQuickMouseThief(QObject *parent) :
+ QObject(parent),
+ mItem(0),
+ mReceivedPressEvent(false),
+ mAcceptCurrentEvent(false)
+{
+}
+
+bool QQuickMouseThief::receivedPressEvent() const
+{
+ return mReceivedPressEvent;
+}
+
+void QQuickMouseThief::setReceivedPressEvent(bool receivedPressEvent)
+{
+ if (receivedPressEvent != mReceivedPressEvent) {
+ mReceivedPressEvent = receivedPressEvent;
+ emit receivedPressEventChanged();
+ }
+}
+
+void QQuickMouseThief::grabMouse(QQuickItem *item)
+{
+ if (item) {
+ mItem = item;
+
+ // Handle the case where someone makes the PieMenu an orphan. E.g.:
+ // property PieMenu pieMenu: PieMenu {}
+ // They have to set the parent explicitly if they want that to work.
+ // This can also be null if the menu is visible when constructed.
+ if (mItem->window()) {
+ // We install an event filter so that we can track release events.
+ // This is because the MouseArea that we steal the mouse from stores the
+ // pressed flag (before item is visible) and we don't, so we don't know
+ // that it's a release.
+ mItem->grabMouse();
+ mItem->window()->installEventFilter(this);
+ } else {
+ // The menu was visible when constructed (visible: true), so install the
+ // event filter later on.
+ connect(mItem, SIGNAL(windowChanged(QQuickWindow*)),
+ this, SLOT(itemWindowChanged(QQuickWindow*)));
+ }
+ }
+}
+
+void QQuickMouseThief::ungrabMouse()
+{
+ if (mItem) {
+ // This can be null if someone does the following:
+ // PieMenu { Component.onCompleted: { visible = true; visible = false; }
+ if (mItem->window()) {
+ if (mItem->window()->mouseGrabberItem() == mItem) {
+ mItem->ungrabMouse();
+ }
+ mItem->window()->removeEventFilter(this);
+ }
+ mItem = 0;
+ }
+}
+
+void QQuickMouseThief::acceptCurrentEvent()
+{
+ mAcceptCurrentEvent = true;
+}
+
+void QQuickMouseThief::itemWindowChanged(QQuickWindow *window)
+{
+ // The window will be null when the application is closing.
+ if (window) {
+ // This can be null if someone does the following:
+ // PieMenu { Component.onCompleted: { visible = true; visible = false; }
+ if (mItem) {
+ mItem->grabMouse();
+ window->installEventFilter(this);
+ }
+ }
+}
+
+bool QQuickMouseThief::eventFilter(QObject *, QEvent *event)
+{
+ if (!mItem)
+ return false;
+
+ // The PieMenu QML code dictates which events are accepted by
+ // setting this property when it responds to our signals.
+ mAcceptCurrentEvent = false;
+
+ if (event->type() == QEvent::MouseButtonRelease) {
+ const QPointF mouseWindowPos = static_cast<QMouseEvent *>(event)->windowPos();
+ emitReleased(mouseWindowPos);
+ // Even if the release should close the menu, we should emit
+ // clicked to be consistent since we have to do it ourselves.
+ bool releaseAccepted = mAcceptCurrentEvent;
+ mAcceptCurrentEvent = false;
+
+ emitClicked(mouseWindowPos);
+ if (!mAcceptCurrentEvent) {
+ // We might not have accepted click, but we may have accepted release.
+ mAcceptCurrentEvent = releaseAccepted;
+ }
+ } else if (event->type() == QEvent::MouseButtonPress) {
+ emitPressed(static_cast<QMouseEvent *>(event)->windowPos());
+ } else if (event->type() == QEvent::TouchEnd) {
+ // The finger(s) were lifted off the screen. We don't get this as a release event since
+ // we're doing our own custom handling, so we handle it here.
+ QTouchEvent *touchEvent = static_cast<QTouchEvent*>(event);
+ const QList<QTouchEvent::TouchPoint> points = touchEvent->touchPoints();
+ // We only care about one finger. If there's more than one, ignore them.
+ if (!points.isEmpty()) {
+ const QPointF pos = points.first().pos();
+ emitReleased(pos);
+ // Even if the release should close the menu, we should emit
+ // clicked to be consistent since we have to do it ourselves.
+ bool releaseAccepted = mAcceptCurrentEvent;
+ mAcceptCurrentEvent = false;
+
+ emitClicked(pos);
+ if (!mAcceptCurrentEvent) {
+ // We might not have accepted click, but we may have accepted release.
+ mAcceptCurrentEvent = releaseAccepted;
+ }
+ }
+ } else if (event->type() == QEvent::TouchBegin) {
+ QTouchEvent *touchEvent = static_cast<QTouchEvent*>(event);
+ const QList<QTouchEvent::TouchPoint> points = touchEvent->touchPoints();
+ if (!points.isEmpty()) {
+ emitPressed(points.first().pos());
+ }
+ } else if (event->type() == QEvent::TouchUpdate) {
+ QTouchEvent *touchEvent = static_cast<QTouchEvent*>(event);
+ const QList<QTouchEvent::TouchPoint> points = touchEvent->touchPoints();
+ if (!points.isEmpty()) {
+ const QPointF mappedPos = mItem->mapFromScene(points.first().pos());
+ emit touchUpdate(mappedPos.x(), mappedPos.y());
+ }
+ }
+ return mAcceptCurrentEvent;
+}
+
+void QQuickMouseThief::emitPressed(const QPointF &pos)
+{
+ setReceivedPressEvent(true);
+
+ // PieMenu can't detect presses outside its own MouseArea,
+ // so we need to provide these as well.
+ QPointF mappedPos = mItem->mapFromScene(pos);
+ emit pressed(mappedPos.x(), mappedPos.y());
+}
+
+void QQuickMouseThief::emitReleased(const QPointF &pos)
+{
+ QPointF mappedPos = mItem->mapFromScene(pos);
+ emit released(mappedPos.x(), mappedPos.y());
+}
+
+void QQuickMouseThief::emitClicked(const QPointF &pos)
+{
+ // mItem can be destroyed if the slots connected to released() caused it to be hidden.
+ // That's fine for us, since PieMenu doesn't need to handle anything if released()
+ // is emitted when the triggerMode is PieMenu.TriggerOnRelease.
+ if (mItem) {
+ QPointF mappedPos = mItem->mapFromScene(pos);
+ // Since we are creating the release events, we must also handle clicks.
+ emit clicked(mappedPos.x(), mappedPos.y());
+ }
+}
diff --git a/src/extras/Private/qquickmousethief_p.h b/src/extras/Private/qquickmousethief_p.h
new file mode 100644
index 00000000..3b1a5a4d
--- /dev/null
+++ b/src/extras/Private/qquickmousethief_p.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MOUSETHIEF_H
+#define MOUSETHIEF_H
+
+#include <QObject>
+#include <QtQuick/QQuickItem>
+
+class QQuickMouseThief : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool receivedPressEvent READ receivedPressEvent
+ WRITE setReceivedPressEvent NOTIFY receivedPressEventChanged)
+public:
+ explicit QQuickMouseThief(QObject *parent = 0);
+
+ bool receivedPressEvent() const;
+ void setReceivedPressEvent(bool receivedPressEvent);
+
+ Q_INVOKABLE void grabMouse(QQuickItem *item);
+ Q_INVOKABLE void ungrabMouse();
+ Q_INVOKABLE void acceptCurrentEvent();
+signals:
+ /*!
+ Coordinates are relative to the window of mItem.
+ */
+ void pressed(int mouseX, int mouseY);
+
+ void released(int mouseX, int mouseY);
+
+ void clicked(int mouseX, int mouseY);
+
+ void touchUpdate(int mouseX, int mouseY);
+
+ void receivedPressEventChanged();
+
+ void handledEventChanged();
+protected:
+ bool eventFilter(QObject *obj, QEvent *event);
+private slots:
+ void itemWindowChanged(QQuickWindow *window);
+private:
+ void emitPressed(const QPointF &pos);
+ void emitReleased(const QPointF &pos);
+ void emitClicked(const QPointF &pos);
+
+ QQuickItem *mItem;
+ bool mReceivedPressEvent;
+ bool mAcceptCurrentEvent;
+};
+
+#endif // MOUSETHIEF_H
diff --git a/src/extras/Private/qquickstylesettings.cpp b/src/extras/Private/qquickstylesettings.cpp
new file mode 100644
index 00000000..0936e55e
--- /dev/null
+++ b/src/extras/Private/qquickstylesettings.cpp
@@ -0,0 +1,157 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickstylesettings_p.h"
+#include <qqmlengine.h>
+#include <qfileinfo.h>
+#include <qdebug.h>
+#include <qdir.h>
+
+QT_BEGIN_NAMESPACE
+
+static QString defaultStyleName()
+{
+ return QLatin1String("Base");
+}
+
+static QString styleImportName()
+{
+ QString name = qgetenv("QT_QUICK_CONTROLS_STYLE");
+ if (name.isEmpty())
+ name = defaultStyleName();
+ return QFileInfo(name).fileName();
+}
+
+static bool isResource(const QString &path)
+{
+ return path.startsWith(":/");
+}
+
+static QString styleImportPath(QQmlEngine *engine, const QString &styleName)
+{
+ static const char * const stylePaths[] = { "/QtQuick/Extras/Styles", "/QtQuick/Controls/Styles" };
+ QString path = qgetenv("QT_QUICK_CONTROLS_STYLE");
+ QFileInfo info(path);
+ if (isResource(path)) {
+ path = info.path();
+ } else if (info.isRelative()) {
+ bool found = false;
+ QStringList importPaths = engine->importPathList();
+ importPaths.prepend(QStringLiteral(":/ExtrasImports/"));
+
+ foreach (const QString &import, importPaths) {
+ for (unsigned i = 0; i < sizeof(stylePaths) / sizeof(stylePaths[0]); i++) {
+ QDir dir(import + QLatin1String(stylePaths[i]));
+ if (dir.exists(styleName)) {
+ found = true;
+ path = dir.absolutePath();
+ break;
+ }
+ }
+ if (found)
+ break;
+ }
+ if (!found)
+ path = QLatin1String(":/ExtrasImports/QtQuick/Extras/Styles");
+ } else {
+ path = info.absolutePath();
+ }
+ return path;
+}
+
+QQuickStyleSettings::QQuickStyleSettings(QQmlEngine *engine)
+{
+ m_name = styleImportName();
+ m_path = styleImportPath(engine, m_name);
+
+ QString path = styleFilePath();
+
+ if (!QDir(path).exists()) {
+ QString unknownStyle = m_name;
+ m_name = defaultStyleName();
+ m_path = styleImportPath(engine, m_name);
+ qWarning() << "WARNING: Cannot find style" << unknownStyle << "- fallback:" << styleFilePath();
+ }
+
+ connect(this, SIGNAL(styleNameChanged()), SIGNAL(styleChanged()));
+ connect(this, SIGNAL(stylePathChanged()), SIGNAL(styleChanged()));
+}
+
+QUrl QQuickStyleSettings::style() const
+{
+ QUrl result;
+ QString path = styleFilePath();
+ if (isResource(path)) {
+ result.setScheme("qrc");
+ path.remove(0, 1); // remove ':' prefix
+ result.setPath(path);
+ } else
+ result = QUrl::fromLocalFile(path);
+ return result;
+}
+
+QString QQuickStyleSettings::styleName() const
+{
+ return m_name;
+}
+
+void QQuickStyleSettings::setStyleName(const QString &name)
+{
+ if (m_name != name) {
+ m_name = name;
+ emit styleNameChanged();
+ }
+}
+
+QString QQuickStyleSettings::stylePath() const
+{
+ return m_path;
+}
+
+void QQuickStyleSettings::setStylePath(const QString &path)
+{
+ if (m_path != path) {
+ m_path = path;
+ emit stylePathChanged();
+ }
+}
+
+QString QQuickStyleSettings::styleFilePath() const
+{
+ return m_path + QLatin1Char('/') + m_name;
+}
+
+QT_END_NAMESPACE
diff --git a/src/extras/Private/qquickstylesettings_p.h b/src/extras/Private/qquickstylesettings_p.h
new file mode 100644
index 00000000..3cb157a8
--- /dev/null
+++ b/src/extras/Private/qquickstylesettings_p.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef STYLESETTINGS_P_H
+#define STYLESETTINGS_P_H
+
+#include <QtCore/qurl.h>
+#include <QtCore/qobject.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQmlEngine;
+
+class QQuickStyleSettings : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QUrl style READ style NOTIFY styleChanged)
+ Q_PROPERTY(QString styleName READ styleName WRITE setStyleName NOTIFY styleNameChanged)
+ Q_PROPERTY(QString stylePath READ stylePath WRITE setStylePath NOTIFY stylePathChanged)
+
+public:
+ QQuickStyleSettings(QQmlEngine *engine);
+
+ QUrl style() const;
+
+ QString styleName() const;
+ void setStyleName(const QString &name);
+
+ QString stylePath() const;
+ void setStylePath(const QString &path);
+
+signals:
+ void styleChanged();
+ void styleNameChanged();
+ void stylePathChanged();
+
+private:
+ QString styleFilePath() const;
+
+ QString m_name;
+ QString m_path;
+};
+
+QT_END_NAMESPACE
+
+#endif // STYLESETTINGS_P_H
diff --git a/src/extras/StatusIndicator.qml b/src/extras/StatusIndicator.qml
new file mode 100644
index 00000000..8be50737
--- /dev/null
+++ b/src/extras/StatusIndicator.qml
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Styles 1.3
+import QtQuick.Extras.Private 1.0
+
+/*!
+ \qmltype StatusIndicator
+ \inqmlmodule QtQuick.Extras
+ \since QtQuick.Extras 1.1
+ \ingroup extras
+ \ingroup extras-non-interactive
+ \brief An indicator that displays active or inactive states.
+
+ \image statusindicator-active.png A StatusIndicator in the active state
+ A StatusIndicator in the active state.
+ \image statusindicator-inactive.png A StatusIndicator in the inactive state
+ A StatusIndicator in the inactive state.
+
+ The StatusIndicator displays active or inactive states. By using different
+ colors via the \l color property, StatusIndicator can provide extra
+ context to these states. For example:
+
+ \table
+ \row
+ \li QML
+ \li Result
+ \row
+ \li
+ \code
+ import QtQuick 2.2
+ import QtQuick.Extras 1.3
+
+ Rectangle {
+ width: 100
+ height: 100
+ color: "#cccccc"
+
+ StatusIndicator {
+ anchors.centerIn: parent
+ color: "green"
+ }
+ }
+ \endcode
+ \li \image statusindicator-green.png "Green StatusIndicator"
+ \endtable
+
+ You can create a custom appearance for a StatusIndicator by assigning a
+ \l {QtQuick.Extras.Styles::}{StatusIndicatorStyle}.
+*/
+
+Control {
+ id: statusIndicator
+
+ style: Qt.createComponent(StyleSettings.style + "/StatusIndicatorStyle.qml", statusIndicator)
+
+ /*!
+ This property specifies whether the indicator is active or inactive.
+
+ The default value is \c false (off).
+
+ \deprecated Use active instead.
+ */
+ property alias on: statusIndicator.active
+
+ /*!
+ \since QtQuick.Extras 1.2
+
+ This property specifies whether the indicator is active or inactive.
+
+ The default value is \c false (inactive).
+ */
+ property bool active: false
+
+ /*!
+ This property specifies the color of the indicator when it is active.
+
+ The default value is \c "red".
+ */
+ property color color: __style.color
+}
diff --git a/src/extras/Styles/Base/Base.pro b/src/extras/Styles/Base/Base.pro
new file mode 100644
index 00000000..fcb6ad95
--- /dev/null
+++ b/src/extras/Styles/Base/Base.pro
@@ -0,0 +1,34 @@
+TARGET = qtquickextrasstylesplugin
+TARGETPATH = QtQuick/Extras/Styles
+
+QT += qml
+
+HEADERS += \
+ basestyleplugin.h
+SOURCES += \
+ basestyleplugin.cpp
+
+BASE_STYLE = \
+ $$PWD/CircularGaugeStyle.qml \
+ $$PWD/CircularButtonStyle.qml \
+ $$PWD/CircularTickmarkLabelStyle.qml \
+ $$PWD/CommonStyleHelper.qml \
+ $$PWD/DelayButtonStyle.qml \
+ $$PWD/DialStyle.qml \
+ $$PWD/GaugeStyle.qml \
+ $$PWD/HandleStyle.qml \
+ $$PWD/HandleStyleHelper.qml \
+ $$PWD/PieMenuStyle.qml \
+ $$PWD/StatusIndicatorStyle.qml \
+ $$PWD/ToggleButtonStyle.qml \
+ $$PWD/TumblerStyle.qml
+
+BASE_STYLE += \
+ $$PWD/images/knob.png \
+ $$PWD/images/needle.png
+
+RESOURCES += \
+ basestyle.qrc
+
+CONFIG += no_cxx_module
+load(qml_plugin)
diff --git a/src/extras/Styles/Base/CircularButtonStyle.qml b/src/extras/Styles/Base/CircularButtonStyle.qml
new file mode 100644
index 00000000..9e29a534
--- /dev/null
+++ b/src/extras/Styles/Base/CircularButtonStyle.qml
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls.Styles 1.1
+import QtQuick.Extras.Styles 1.3
+import QtQuick.Extras.Private 1.0
+
+ButtonStyle {
+ id: buttonStyle
+
+ label: Text {
+ anchors.fill: parent
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ text: control.text
+ font.pixelSize: TextSingleton.font.pixelSize * 1.25
+ color: control.pressed || control.checked ? __buttonHelper.textColorDown : __buttonHelper.textColorUp
+ styleColor: control.pressed || control.checked ? __buttonHelper.textRaisedColorDown : __buttonHelper.textRaisedColorUp
+ style: Text.Raised
+ wrapMode: Text.Wrap
+ fontSizeMode: Text.Fit
+ }
+
+ /*! \internal */
+ property alias __buttonHelper: buttonHelper
+
+ CircularButtonStyleHelper {
+ id: buttonHelper
+ control: buttonStyle.control
+ }
+
+ background: Item {
+ implicitWidth: __buttonHelper.implicitWidth
+ implicitHeight: __buttonHelper.implicitHeight
+
+ Canvas {
+ id: backgroundCanvas
+ anchors.fill: parent
+
+ Connections {
+ target: control
+ onPressedChanged: backgroundCanvas.requestPaint()
+ }
+
+ onPaint: {
+ var ctx = getContext("2d");
+ __buttonHelper.paintBackground(ctx);
+ }
+ }
+ }
+}
diff --git a/src/extras/Styles/Base/CircularGaugeStyle.qml b/src/extras/Styles/Base/CircularGaugeStyle.qml
new file mode 100644
index 00000000..2030f775
--- /dev/null
+++ b/src/extras/Styles/Base/CircularGaugeStyle.qml
@@ -0,0 +1,498 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtGraphicalEffects 1.0
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Styles 1.3
+import QtQuick.Extras.Private 1.0
+
+/*!
+ \qmltype CircularGaugeStyle
+ \inqmlmodule QtQuick.Extras.Styles
+ \since QtQuick.Extras.Styles 1.0
+ \ingroup extrasstyles
+ \brief Provides custom styling for CircularGauge.
+
+ You can create a custom circular gauge by replacing the following delegates:
+ \list
+ \li \l background
+ \li \l tickmark
+ \li \l minorTickmark
+ \li \l tickmarkLabel
+ \li \l needle
+ \li \l foreground
+ \endlist
+
+ Below is an example that changes the needle to a basic orange \l Rectangle:
+ \code
+ CircularGauge {
+ style: CircularGaugeStyle {
+ needle: Rectangle {
+ y: outerRadius * 0.15
+ implicitWidth: outerRadius * 0.03
+ implicitHeight: outerRadius * 0.9
+ antialiasing: true
+ color: Qt.rgba(0.66, 0.3, 0, 1)
+ }
+ }
+ }
+ \endcode
+
+ The result:
+ \image circulargauge-needle-example-2.png CircularGaugeStyle example
+
+ \section2 Direction
+
+ \l minimumValueAngle and \l maximumValueAngle determine not only the
+ position of the tickmarks, labels and needle, but the direction in which
+ they are displayed around the gauge. For example, if \l minimumValueAngle
+ is greater than \l maximumValueAngle, the gauge will be anti-clockwise.
+ Below, there are two gauges: the top gauge has a \l minimumValueAngle of
+ \c -90 degrees and a \l maximumValueAngle of \c 90 degrees, and the bottom
+ gauge has the opposite.
+
+ \image circulargauge-reversed.png Reversed CircularGauge
+
+ \sa {Styling CircularGauge}
+*/
+
+Style {
+ id: circularGaugeStyle
+
+ /*!
+ \since 1.3
+
+ The \l CircularGauge that this style is attached to.
+ */
+ readonly property CircularGauge control: __control
+
+ /*!
+ The distance from the center of the gauge to the outer edge of the
+ gauge.
+
+ This property is useful for determining the size of the various
+ components of the style, in order to ensure that they are scaled
+ proportionately when the gauge is resized.
+ */
+ readonly property real outerRadius: Math.min(control.width, control.height) * 0.5
+
+ /*!
+ This property determines the angle at which the minimum value is
+ displayed on the gauge.
+
+ The angle set affects the following components of the gauge:
+ \list
+ \li The angle of the needle
+ \li The position of the tickmarks and labels
+ \endlist
+
+ The angle origin points north:
+
+ \image circulargauge-angles.png
+
+ There is no minimum or maximum angle for this property, but the default
+ style only supports angles whose absolute range is less than or equal
+ to \c 360 degrees. This is because ranges higher than \c 360 degrees
+ will cause the tickmarks and labels to overlap each other.
+
+ The default value is \c -145.
+ */
+ property real minimumValueAngle: -145
+
+ /*!
+ This property determines the angle at which the maximum value is
+ displayed on the gauge.
+
+ The angle set affects the following components of the gauge:
+ \list
+ \li The angle of the needle
+ \li The position of the tickmarks and labels
+ \endlist
+
+ The angle origin points north:
+
+ \image circulargauge-angles.png
+
+ There is no minimum or maximum angle for this property, but the default
+ style only supports angles whose absolute range is less than or equal
+ to \c 360 degrees. This is because ranges higher than \c 360 degrees
+ will cause the tickmarks and labels to overlap each other.
+
+ The default value is \c 145.
+ */
+ property real maximumValueAngle: 145
+
+ /*!
+ The range between \l minimumValueAngle and \l maximumValueAngle, in
+ degrees. This value will always be positive.
+ */
+ readonly property real angleRange: control.__panel.circularTickmarkLabel.angleRange
+
+ /*!
+ This property holds the rotation of the needle in degrees.
+ */
+ property real needleRotation: {
+ var percentage = (control.value - control.minimumValue) / (control.maximumValue - control.minimumValue);
+ minimumValueAngle + percentage * angleRange;
+ }
+
+ /*!
+ The interval at which tickmarks are displayed.
+
+ For example, if this property is set to \c 10 (the default),
+ control.minimumValue to \c 0, and control.maximumValue to \c 100,
+ the tickmarks displayed will be 0, 10, 20, etc., to 100,
+ around the gauge.
+ */
+ property real tickmarkStepSize: 10
+
+ /*!
+ The distance in pixels from the outside of the gauge (outerRadius) at
+ which the outermost point of the tickmark line is drawn.
+ */
+ property real tickmarkInset: 0
+
+
+ /*!
+ The amount of tickmarks displayed by the gauge, calculated from
+ \l tickmarkStepSize and the control's
+ \l {CircularGauge::minimumValue}{minimumValue} and
+ \l {CircularGauge::maximumValue}{maximumValue}.
+
+ \sa minorTickmarkCount
+ */
+ readonly property int tickmarkCount: control.__panel.circularTickmarkLabel.tickmarkCount
+
+ /*!
+ The amount of minor tickmarks between each tickmark.
+
+ The default value is \c 4.
+
+ \sa tickmarkCount
+ */
+ property int minorTickmarkCount: 4
+
+ /*!
+ The distance in pixels from the outside of the gauge (outerRadius) at
+ which the outermost point of the minor tickmark line is drawn.
+ */
+ property real minorTickmarkInset: 0
+
+ /*!
+ The distance in pixels from the outside of the gauge (outerRadius) at
+ which the center of the value marker text is drawn.
+ */
+ property real labelInset: __protectedScope.toPixels(0.19)
+
+ /*!
+ The interval at which tickmark labels are displayed.
+
+ For example, if this property is set to \c 10 (the default),
+ control.minimumValue to \c 0, and control.maximumValue to \c 100, the
+ tickmark labels displayed will be 0, 10, 20, etc., to 100,
+ around the gauge.
+ */
+ property real labelStepSize: tickmarkStepSize
+
+ /*!
+ The amount of tickmark labels displayed by the gauge, calculated from
+ \l labelStepSize and the control's
+ \l {CircularGauge::minimumValue}{minimumValue} and
+ \l {CircularGauge::maximumValue}{maximumValue}.
+
+ \sa tickmarkCount, minorTickmarkCount
+ */
+ readonly property int labelCount: control.__panel.circularTickmarkLabel.labelCount
+
+ /*!
+ \since QtQuick.Extras 1.2
+
+ Returns \a value as an angle in degrees.
+
+ This function is useful for custom drawing or positioning of items in
+ the style's components. For example, it can be used to calculate the
+ angles at which to draw an arc around the gauge indicating the safe
+ area for the needle to be within.
+
+ For example, if minimumValueAngle is set to \c 270 and
+ maximumValueAngle is set to \c 90, this function will return \c 270
+ when passed minimumValue and \c 90 when passed maximumValue.
+
+ \sa {Styling CircularGauge#styling-circulargauge-background}{
+ Styling CircularGauge's background}
+ */
+ function valueToAngle(value) {
+ return control.__panel.circularTickmarkLabel.valueToAngle(value);
+ }
+
+ property QtObject __protectedScope: QtObject {
+ /*!
+ Converts a value expressed as a percentage of \l outerRadius to
+ a pixel value.
+ */
+ function toPixels(percentageOfOuterRadius) {
+ return percentageOfOuterRadius * outerRadius;
+ }
+ }
+
+ /*!
+ The background of the gauge.
+
+ If set, the background determines the implicit size of the gauge.
+
+ By default, there is no background defined.
+
+ \sa {Styling CircularGauge#styling-circulargauge-background}{
+ Styling CircularGauge's background}
+ */
+ property Component background
+
+ /*!
+ This component defines each individual tickmark. The position of each
+ tickmark is already set; only the
+ \l {Item::implicitWidth}{implicitWidth} and
+ \l {Item::implicitHeight}{implicitHeight} need to be specified.
+
+ Each instance of this component has access to the following properties:
+
+ \table
+ \row \li \c {readonly property int} \b styleData.index
+ \li The index of this tickmark.
+ \row \li \c {readonly property real} \b styleData.value
+ \li The value that this tickmark represents.
+ \endtable
+
+ To illustrate what these properties refer to, we can use the following
+ example:
+
+ \snippet circulargauge-tickmark-indices-values.qml tickmarks
+
+ We've replaced the conventional \e line tickmarks with \l Text items
+ and have hidden the tickmarkLabel component in order to make the
+ association clearer:
+
+ \image circulargauge-tickmark-indices-values.png Tickmarks
+
+ The index property can be useful if you have another model that
+ contains images to display for each index, for example.
+
+ The value property is useful for drawing lower and upper limits around
+ the gauge to indicate the recommended value ranges. For example, speeds
+ above 200 kilometers an hour in a car's speedometer could be indicated
+ as dangerous using this property.
+
+ \sa {Styling CircularGauge#styling-circulargauge-tickmark}{
+ Styling CircularGauge's tickmark}
+ */
+ property Component tickmark: Rectangle {
+ implicitWidth: outerRadius * 0.02
+ antialiasing: true
+ implicitHeight: outerRadius * 0.06
+ color: "#c8c8c8"
+ }
+
+ /*!
+ This component defines each individual minor tickmark. The position of
+ each minor tickmark is already set; only the
+ \l {Item::implicitWidth}{implicitWidth} and
+ \l {Item::implicitHeight}{implicitHeight} need to be specified.
+
+ Each instance of this component has access to the following properties:
+
+ \table
+ \row \li \c {readonly property int} \b styleData.index
+ \li The index of this tickmark.
+ \row \li \c {readonly property real} \b styleData.value
+ \li The value that this tickmark represents.
+ \endtable
+
+ \sa {Styling CircularGauge#styling-circulargauge-minorTickmark}{
+ Styling CircularGauge's minorTickmark}
+ */
+ property Component minorTickmark: Rectangle {
+ implicitWidth: outerRadius * 0.01
+ antialiasing: true
+ implicitHeight: outerRadius * 0.03
+ color: "#c8c8c8"
+ }
+
+ /*!
+ This defines the text of each tickmark label on the gauge.
+
+ Each instance of this component has access to the following properties:
+
+ \table
+ \row \li \c {readonly property int} \b styleData.index
+ \li The index of this label.
+ \row \li \c {readonly property real} \b styleData.value
+ \li The value that this label represents.
+ \endtable
+
+ \sa {Styling CircularGauge#styling-circulargauge-tickmarkLabel}{
+ Styling CircularGauge's tickmarkLabel}
+ */
+ property Component tickmarkLabel: Text {
+ font.pixelSize: Math.max(6, __protectedScope.toPixels(0.12))
+ text: styleData.value
+ color: "#c8c8c8"
+ antialiasing: true
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+
+ /*!
+ The needle that points to the gauge's current value.
+
+ This component is drawn below the \l foreground component.
+
+ The style expects the needle to be pointing up at a rotation of \c 0,
+ in order for the rotation to be correct. For example:
+
+ \image circulargauge-needle.png CircularGauge's needle
+
+ When defining your own needle component, the only properties that the
+ style requires you to set are the
+ \l {Item::implicitWidth}{implicitWidth} and
+ \l {Item::implicitHeight}{implicitHeight}.
+
+ Optionally, you can set \l {Item::x}{x} and \l {Item::y}{y} to change
+ the needle's transform origin. Setting the \c x position can be useful
+ for needle images where the needle is not centered exactly
+ horizontally. Setting the \c y position allows you to make the base of
+ the needle hang over the center of the gauge.
+
+ \sa {Styling CircularGauge#styling-circulargauge-needle}{
+ Styling CircularGauge's needle}
+ */
+ property Component needle: Item {
+ implicitWidth: __protectedScope.toPixels(0.08)
+ implicitHeight: 0.9 * outerRadius
+
+ Image {
+ anchors.fill: parent
+ source: "images/needle.png"
+ }
+ }
+
+ /*!
+ The foreground of the gauge. This component is drawn above all others.
+
+ Like \l background, the foreground component fills the entire gauge.
+
+ By default, the knob of the gauge is defined here.
+
+ \sa {Styling CircularGauge#styling-circulargauge-foreground}{
+ Styling CircularGauge's foreground}
+ */
+ property Component foreground: Item {
+ Image {
+ source: "images/knob.png"
+ anchors.centerIn: parent
+ scale: {
+ var idealHeight = __protectedScope.toPixels(0.2);
+ var originalImageHeight = sourceSize.height;
+ idealHeight / originalImageHeight;
+ }
+ }
+ }
+
+ /*! \internal */
+ property Component panel: Item {
+ id: panelItem
+ implicitWidth: backgroundLoader.item ? backgroundLoader.implicitWidth : TextSingleton.implicitHeight * 16
+ implicitHeight: backgroundLoader.item ? backgroundLoader.implicitHeight : TextSingleton.implicitHeight * 16
+
+ property alias background: backgroundLoader.item
+ property alias circularTickmarkLabel: circularTickmarkLabel_
+
+ Loader {
+ id: backgroundLoader
+ sourceComponent: circularGaugeStyle.background
+ width: outerRadius * 2
+ height: outerRadius * 2
+ anchors.centerIn: parent
+ }
+
+ CircularTickmarkLabel {
+ id: circularTickmarkLabel_
+ anchors.fill: backgroundLoader
+
+ minimumValue: control.minimumValue
+ maximumValue: control.maximumValue
+ stepSize: control.stepSize
+ tickmarksVisible: control.tickmarksVisible
+ minimumValueAngle: circularGaugeStyle.minimumValueAngle
+ maximumValueAngle: circularGaugeStyle.maximumValueAngle
+ tickmarkStepSize: circularGaugeStyle.tickmarkStepSize
+ tickmarkInset: circularGaugeStyle.tickmarkInset
+ minorTickmarkCount: circularGaugeStyle.minorTickmarkCount
+ minorTickmarkInset: circularGaugeStyle.minorTickmarkInset
+ labelInset: circularGaugeStyle.labelInset
+ labelStepSize: circularGaugeStyle.labelStepSize
+
+ style: CircularTickmarkLabelStyle {
+ tickmark: circularGaugeStyle.tickmark
+ minorTickmark: circularGaugeStyle.minorTickmark
+ tickmarkLabel: circularGaugeStyle.tickmarkLabel
+ }
+ }
+
+ Loader {
+ id: needleLoader
+ sourceComponent: circularGaugeStyle.needle
+ transform: [
+ Rotation {
+ angle: needleRotation
+ origin.x: needleLoader.width / 2
+ origin.y: needleLoader.height
+ },
+ Translate {
+ x: panelItem.width / 2 - needleLoader.width / 2
+ y: panelItem.height / 2 - needleLoader.height
+ }
+ ]
+ }
+
+ Loader {
+ id: foreground
+ sourceComponent: circularGaugeStyle.foreground
+ anchors.fill: backgroundLoader
+ }
+ }
+}
diff --git a/src/extras/Styles/Base/CircularTickmarkLabelStyle.qml b/src/extras/Styles/Base/CircularTickmarkLabelStyle.qml
new file mode 100644
index 00000000..010e9245
--- /dev/null
+++ b/src/extras/Styles/Base/CircularTickmarkLabelStyle.qml
@@ -0,0 +1,304 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras.Private 1.0
+import QtQuick.Extras.Private.CppUtils 1.0
+
+Style {
+ id: circularTickmarkLabelStyle
+
+ /*!
+ The distance from the center of the control to the outer edge.
+ */
+ readonly property real outerRadius: Math.min(control.width, control.height) * 0.5
+
+ property QtObject __protectedScope: QtObject {
+ /*!
+ Converts a value expressed as a percentage of \l outerRadius to
+ a pixel value.
+ */
+ function toPixels(percentageOfOuterRadius) {
+ return percentageOfOuterRadius * outerRadius;
+ }
+ }
+
+ /*!
+ This component defines each individual tickmark. The position of each
+ tickmark is already set; only the size needs to be specified.
+ */
+ property Component tickmark: Rectangle {
+ width: outerRadius * 0.02
+ antialiasing: true
+ height: outerRadius * 0.06
+ color: "#c8c8c8"
+ }
+
+ /*!
+ This component defines each individual minor tickmark. The position of
+ each minor tickmark is already set; only the size needs to be specified.
+ */
+ property Component minorTickmark: Rectangle {
+ width: outerRadius * 0.01
+ antialiasing: true
+ height: outerRadius * 0.03
+ color: "#c8c8c8"
+ }
+
+ /*!
+ This defines the text of each tickmark label on the gauge.
+ */
+ property Component tickmarkLabel: Text {
+ font.pixelSize: Math.max(6, __protectedScope.toPixels(0.12))
+ text: styleData.value
+ color: "#c8c8c8"
+ antialiasing: true
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+
+ /*! \internal */
+ property Component panel: Item {
+ id: panelItem
+ implicitWidth: 250
+ implicitHeight: 250
+
+ function rangeUsed(count, stepSize) {
+ return (((count - 1) * stepSize) / (control.maximumValue - control.minimumValue)) * control.angleRange;
+ }
+
+ readonly property real tickmarkSectionSize: rangeUsed(control.tickmarkCount, control.tickmarkStepSize) / (control.tickmarkCount - 1)
+ readonly property real tickmarkSectionValue: (control.maximumValue - control.minimumValue) / (control.tickmarkCount - 1)
+ readonly property real minorTickmarkSectionSize: tickmarkSectionSize / (control.minorTickmarkCount + 1)
+ readonly property real minorTickmarkSectionValue: tickmarkSectionValue / (control.minorTickmarkCount + 1)
+ readonly property int totalMinorTickmarkCount: {
+ // The size of each section within two major tickmarks, expressed as a percentage.
+ var minorSectionPercentage = 1 / (control.minorTickmarkCount + 1);
+ // The amount of major tickmarks not able to be displayed; will be 0 if they all fit.
+ var tickmarksNotDisplayed = control.__tickmarkCount - control.tickmarkCount;
+ var count = control.minorTickmarkCount * (control.tickmarkCount - 1);
+ // We'll try to display as many minor tickmarks as we can to fill up the space.
+ count + tickmarksNotDisplayed / minorSectionPercentage;
+ }
+ readonly property real labelSectionSize: rangeUsed(control.labelCount, control.labelStepSize) / (control.labelCount - 1)
+
+ function toPixels(percentageOfOuterRadius) {
+ return percentageOfOuterRadius * outerRadius;
+ }
+
+ /*!
+ Returns the angle of \a marker (in the range 0 ... n - 1, where n
+ is the amount of markers) on the gauge where sections are of size
+ tickmarkSectionSize.
+ */
+ function tickmarkAngleFromIndex(tickmarkIndex) {
+ return tickmarkIndex * tickmarkSectionSize + control.minimumValueAngle;
+ }
+
+ function labelAngleFromIndex(labelIndex) {
+ return labelIndex * labelSectionSize + control.minimumValueAngle;
+ }
+
+ function labelPosFromIndex(index, labelWidth, labelHeight) {
+ return MathUtils.centerAlongCircle(outerRadius, outerRadius, labelWidth, labelHeight,
+ MathUtils.degToRadOffset(labelAngleFromIndex(index)),
+ outerRadius - control.labelInset)
+ }
+
+ function minorTickmarkAngleFromIndex(minorTickmarkIndex) {
+ var baseAngle = tickmarkAngleFromIndex(Math.floor(minorTickmarkIndex / control.minorTickmarkCount));
+ // + minorTickmarkSectionSize because we don't want the first minor tickmark to start on top of its "parent" tickmark.
+ var relativeMinorAngle = (minorTickmarkIndex % control.minorTickmarkCount * minorTickmarkSectionSize) + minorTickmarkSectionSize;
+ return baseAngle + relativeMinorAngle;
+ }
+
+ function tickmarkValueFromIndex(majorIndex) {
+ return (majorIndex * tickmarkSectionValue) + control.minimumValue;
+ }
+
+ function tickmarkValueFromMinorIndex(minorIndex) {
+ var majorIndex = Math.floor(minorIndex / control.minorTickmarkCount);
+ var relativeMinorIndex = minorIndex % control.minorTickmarkCount;
+ return tickmarkValueFromIndex(majorIndex) + ((relativeMinorIndex * minorTickmarkSectionValue) + minorTickmarkSectionValue);
+ }
+
+ Loader {
+ active: control.tickmarksVisible && tickmark != null
+ width: outerRadius * 2
+ height: outerRadius * 2
+ anchors.centerIn: parent
+
+ sourceComponent: Repeater {
+ id: tickmarkRepeater
+ model: control.tickmarkCount
+ delegate: Loader {
+ id: tickmarkLoader
+ objectName: "tickmark" + styleData.index
+ x: tickmarkRepeater.width / 2
+ y: tickmarkRepeater.height / 2
+
+ transform: [
+ Translate {
+ y: -outerRadius + control.tickmarkInset
+ },
+ Rotation {
+ angle: panelItem.tickmarkAngleFromIndex(styleData.index) - __tickmarkWidthAsAngle / 2
+ }
+ ]
+
+ sourceComponent: tickmark
+
+ property int __index: index
+ property QtObject styleData: QtObject {
+ readonly property alias index: tickmarkLoader.__index
+ readonly property real value: tickmarkValueFromIndex(index)
+ }
+
+ readonly property real __tickmarkWidthAsAngle: MathUtils.radToDeg((width / (MathUtils.pi2 * outerRadius)) * MathUtils.pi2)
+ }
+ }
+ }
+ Loader {
+ active: control.tickmarksVisible && minorTickmark != null
+ width: outerRadius * 2
+ height: outerRadius * 2
+ anchors.centerIn: parent
+
+ sourceComponent: Repeater {
+ id: minorRepeater
+ anchors.fill: parent
+ model: totalMinorTickmarkCount
+ delegate: Loader {
+ id: minorTickmarkLoader
+ objectName: "minorTickmark" + styleData.index
+ x: minorRepeater.width / 2
+ y: minorRepeater.height / 2
+ transform: [
+ Translate {
+ y: -outerRadius + control.minorTickmarkInset
+ },
+ Rotation {
+ angle: panelItem.minorTickmarkAngleFromIndex(styleData.index) - __minorTickmarkWidthAsAngle / 2
+ }
+ ]
+
+ sourceComponent: minorTickmark
+
+ property int __index: index
+ property QtObject styleData: QtObject {
+ readonly property alias index: minorTickmarkLoader.__index
+ readonly property real value: tickmarkValueFromMinorIndex(index)
+ }
+
+ readonly property real __minorTickmarkWidthAsAngle: MathUtils.radToDeg((width / (MathUtils.pi2 * outerRadius)) * MathUtils.pi2)
+ }
+ }
+ }
+ Loader {
+ id: labelLoader
+ active: control.tickmarksVisible && tickmarkLabel != null
+ width: outerRadius * 2
+ height: outerRadius * 2
+ anchors.centerIn: parent
+
+ sourceComponent: Item {
+ id: labelItem
+ width: outerRadius * 2
+ height: outerRadius * 2
+ anchors.centerIn: parent
+
+ Connections {
+ target: control
+ onMinimumValueChanged: valueTextModel.update()
+ onMaximumValueChanged: valueTextModel.update()
+ onTickmarkStepSizeChanged: valueTextModel.update()
+ onLabelStepSizeChanged: valueTextModel.update()
+ }
+
+ Repeater {
+ id: labelItemRepeater
+
+ Component.onCompleted: valueTextModel.update();
+
+ model: ListModel {
+ id: valueTextModel
+
+ function update() {
+ if (control.labelStepSize === 0) {
+ return;
+ }
+
+ // Make bigger if it's too small and vice versa.
+ // +1 because we want to show 11 values, with, for example: 0, 10, 20... 100.
+ var difference = control.labelCount - count;
+ if (difference > 0) {
+ for (; difference > 0; --difference) {
+ append({ value: 0 });
+ }
+ } else if (difference < 0) {
+ for (; difference < 0; ++difference) {
+ remove(count - 1);
+ }
+ }
+
+ var index = 0;
+ for (var value = control.minimumValue;
+ value <= control.maximumValue && index < count;
+ value += control.labelStepSize, ++index) {
+ setProperty(index, "value", value);
+ }
+ }
+ }
+ delegate: Loader {
+ id: tickmarkLabelDelegateLoader
+ sourceComponent: tickmarkLabel
+ x: pos.x
+ y: pos.y
+
+ readonly property point pos: panelItem.labelPosFromIndex(index, width, height);
+
+ readonly property int __index: index
+ property QtObject styleData: QtObject {
+ readonly property var value: index != -1 ? labelItemRepeater.model.get(index).value : 0
+ readonly property alias index: tickmarkLabelDelegateLoader.__index
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/extras/Styles/Base/CommonStyleHelper.qml b/src/extras/Styles/Base/CommonStyleHelper.qml
new file mode 100644
index 00000000..4263a743
--- /dev/null
+++ b/src/extras/Styles/Base/CommonStyleHelper.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+
+QtObject {
+ property Item control
+
+ property color buttonColorUpTop: "#e3e3e3"
+ property color buttonColorUpBottom: "#b3b3b3"
+ property color buttonColorDownTop: "#d3d3d3"
+ property color buttonColorDownBottom: "#939393"
+ property color textColorUp: "#4e4e4e"
+ property color textColorDown: "#303030"
+ property color textRaisedColorUp: "#ffffff"
+ property color textRaisedColorDown: "#e3e3e3"
+ property color offColor: "#ff0000"
+ property color offColorShine: "#ff6666"
+ property color onColor: "#00cc00"
+ property color onColorShine: "#66ff66"
+ property color inactiveColor: "#1f1f1f"
+ property color inactiveColorShine: "#666666"
+}
diff --git a/src/extras/Styles/Base/DelayButtonStyle.qml b/src/extras/Styles/Base/DelayButtonStyle.qml
new file mode 100644
index 00000000..e416550b
--- /dev/null
+++ b/src/extras/Styles/Base/DelayButtonStyle.qml
@@ -0,0 +1,233 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtGraphicalEffects 1.0
+import QtQuick.Controls.Styles 1.1
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Styles 1.3
+import QtQuick.Extras.Private.CppUtils 1.1
+
+/*!
+ \qmltype DelayButtonStyle
+ \inqmlmodule QtQuick.Extras.Styles
+ \since QtQuick.Extras.Styles 1.0
+ \ingroup extrasstyles
+ \brief Provides custom styling for DelayButton.
+
+ You can create a custom DelayButton by replacing the following delegates:
+ \list
+ \li \l foreground
+ \li \l {QtQuick.Controls.Styles::ButtonStyle::label}{label}
+ \endlist
+*/
+
+CircularButtonStyle {
+ id: delayButtonStyle
+
+ /*!
+ \since 1.3
+
+ The \l DelayButton that this style is attached to.
+ */
+ readonly property DelayButton control: __control
+
+ /*!
+ The gradient of the progress bar around the button.
+ */
+ property Gradient progressBarGradient: Gradient {
+ GradientStop {
+ position: 0
+ color: "#ff6666"
+ }
+ GradientStop {
+ position: 1
+ color: "#ff0000"
+ }
+ }
+
+ /*!
+ The color of the drop shadow under the progress bar.
+ */
+ property color progressBarDropShadowColor: "#ff6666"
+
+ background: Item {
+ implicitWidth: __buttonHelper.implicitWidth
+ implicitHeight: __buttonHelper.implicitHeight
+
+ Canvas {
+ id: backgroundCanvas
+ anchors.fill: parent
+
+ Connections {
+ target: control
+ onPressedChanged: backgroundCanvas.requestPaint()
+ onCheckedChanged: backgroundCanvas.requestPaint()
+ }
+
+ onPaint: {
+ var ctx = getContext("2d");
+ __buttonHelper.paintBackground(ctx);
+ }
+ }
+ }
+
+ /*!
+ The foreground of the button.
+
+ The progress bar is drawn here.
+ */
+ property Component foreground: Item {
+ id: foregroundItem
+
+ state: "normal"
+ states: [
+ State {
+ name: "normal"
+
+ PropertyChanges {
+ target: foregroundItem
+ opacity: 1
+ }
+ },
+ State {
+ name: "activated"
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "normal"
+ to: "activated"
+ SequentialAnimation {
+ loops: Animation.Infinite
+
+ NumberAnimation {
+ target: foregroundItem
+ property: "opacity"
+ from: 0.8
+ to: 0
+ duration: 500
+ easing.type: Easing.InOutSine
+ }
+ NumberAnimation {
+ target: foregroundItem
+ property: "opacity"
+ from: 0
+ to: 0.8
+ duration: 500
+ easing.type: Easing.InOutSine
+ }
+ }
+ }
+ ]
+
+ Connections {
+ target: control
+ onActivated: state = "activated"
+ onCheckedChanged: if (!control.checked) state = "normal"
+ }
+
+ CircularProgressBar {
+ id: progressBar
+ visible: false
+ width: Math.min(parent.width, parent.height) + progressBarDropShadow.radius * 3 * 2
+ height: width
+ anchors.centerIn: parent
+ antialiasing: true
+ barWidth: __buttonHelper.outerArcLineWidth
+ inset: progressBarDropShadow.radius * 3
+ minimumValueAngle: -180
+ maximumValueAngle: 180
+
+ progress: control.progress
+
+ // TODO: Add gradient property if/when we drop support for building with 5.1.
+ function updateGradient() {
+ clearStops();
+ for (var i = 0; i < progressBarGradient.stops.length; ++i) {
+ addStop(progressBarGradient.stops[i].position, progressBarGradient.stops[i].color);
+ }
+ }
+
+ Component.onCompleted: updateGradient()
+
+ Connections {
+ target: delayButtonStyle
+ onProgressBarGradientChanged: progressBar.updateGradient()
+ }
+ }
+
+ DropShadow {
+ id: progressBarDropShadow
+ anchors.fill: progressBar
+ fast: true
+ // QTBUG-33747
+// cached: !control.pressed
+ radius: 4
+ samples: radius * 2
+ color: progressBarDropShadowColor
+ source: progressBar
+ }
+ }
+
+ panel: Item {
+ implicitWidth: backgroundLoader.implicitWidth
+ implicitHeight: backgroundLoader.implicitHeight
+
+ Loader {
+ id: backgroundLoader
+ anchors.fill: parent
+ sourceComponent: background
+ }
+
+ Loader {
+ id: foregroundLoader
+ anchors.fill: parent
+ sourceComponent: foreground
+ }
+
+ Loader {
+ id: labelLoader
+ sourceComponent: label
+ anchors.fill: parent
+ anchors.leftMargin: padding.left
+ anchors.topMargin: padding.top
+ anchors.rightMargin: padding.right
+ anchors.bottomMargin: padding.bottom
+ }
+ }
+}
diff --git a/src/extras/Styles/Base/DialStyle.qml b/src/extras/Styles/Base/DialStyle.qml
new file mode 100644
index 00000000..3523f500
--- /dev/null
+++ b/src/extras/Styles/Base/DialStyle.qml
@@ -0,0 +1,392 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Styles 1.3
+import QtQuick.Extras.Private 1.0
+import QtQuick.Extras.Private.CppUtils 1.0
+
+/*!
+ \qmltype DialStyle
+ \inqmlmodule QtQuick.Extras.Styles
+ \since QtQuick.Extras.Styles 1.0
+ \ingroup extrasstyles
+ \brief Provides custom styling for Dial.
+
+ You can create a custom dial by replacing the following delegates:
+ \list
+ \li \l background
+ \endlist
+*/
+
+Style {
+ id: dialStyle
+
+ /*!
+ \since 1.3
+
+ The \l Dial that this style is attached to.
+ */
+ readonly property Dial control: __control
+
+ /*!
+ \since QtQuick.Extras 1.1
+
+ The distance from the center of the dial to the outer edge of the dial.
+
+ This property is useful for determining the size of the various
+ components of the style, in order to ensure that they are scaled
+ proportionately when the dial is resized.
+ */
+ readonly property real outerRadius: Math.min(control.height, control.width) / 2
+
+ /*!
+ \since 1.2
+
+ The distance in pixels from the outside of the dial (outerRadius)
+ to the center of the handle.
+ */
+ property real handleInset: (__tickmarkRadius * 4) + ((__handleRadius * 2) * 0.55)
+
+ /*!
+ \since QtQuick.Extras 1.1
+
+ The interval at which tickmarks are displayed.
+
+ For example, if this property is set to \c 10,
+ control.minimumValue to \c 0, and control.maximumValue to \c 100,
+ the tickmarks displayed will be 0, 10, 20, etc., to 100, along
+ the circumference of the dial.
+ */
+ property real tickmarkStepSize: 1
+
+ /*!
+ \since QtQuick.Extras 1.1
+
+ The distance in pixels from the outside of the dial (outerRadius) at
+ which the outermost point of the tickmark line is drawn.
+ */
+ property real tickmarkInset: 0
+
+
+ /*!
+ \since QtQuick.Extras 1.1
+
+ The amount of tickmarks displayed by the dial, calculated from
+ \l tickmarkStepSize and the control's
+ \l {Dial::minimumValue}{minimumValue} and
+ \l {Dial::maximumValue}{maximumValue}.
+
+ \sa minorTickmarkCount
+ */
+ readonly property int tickmarkCount: control.__panel.circularTickmarkLabel.tickmarkCount
+
+ /*!
+ \since QtQuick.Extras 1.1
+
+ The amount of minor tickmarks between each tickmark.
+
+ \sa tickmarkCount
+ */
+ property int minorTickmarkCount: 0
+
+ /*!
+ \since QtQuick.Extras 1.1
+
+ The distance in pixels from the outside of the dial (outerRadius) at
+ which the outermost point of the minor tickmark line is drawn.
+ */
+ property real minorTickmarkInset: 0
+
+ /*!
+ \since QtQuick.Extras 1.1
+
+ The distance in pixels from the outside of the dial (outerRadius) at
+ which the center of the value marker text is drawn.
+ */
+ property real labelInset: 0
+
+ /*!
+ \since QtQuick.Extras 1.1
+
+ The interval at which tickmark labels are displayed.
+
+ For example, if this property is set to \c 10 (the default),
+ control.minimumValue to \c 0, and control.maximumValue to \c 100, the
+ tickmark labels displayed will be 0, 10, 20, etc., to 100,
+ along the circumference of the dial.
+ */
+ property real labelStepSize: tickmarkStepSize
+
+ /*!
+ \since QtQuick.Extras 1.1
+
+ The amount of tickmark labels displayed by the dial, calculated from
+ \l labelStepSize and the control's
+ \l {Dial::minimumValue}{minimumValue} and
+ \l {Dial::maximumValue}{maximumValue}.
+
+ \sa tickmarkCount, minorTickmarkCount
+ */
+ readonly property int labelCount: control.__panel.circularTickmarkLabel.labelCount
+
+ /*!
+ \since QtQuick.Extras 1.2
+
+ Returns \a value as an angle in degrees.
+
+ This function is useful for custom drawing or positioning of items in
+ the style's components. For example, it can be used to calculate the
+ angles at which to draw an arc around the dial indicating the safe
+ range of values.
+
+ For example, if minimumValueAngle is set to \c 270 and
+ maximumValueAngle is set to \c 90, this function will return \c 270
+ when passed minimumValue and \c 90 when passed maximumValue.
+ */
+ function valueToAngle(value) {
+ return control.__panel.circularTickmarkLabel.valueToAngle(value);
+ }
+
+ /*! \internal */
+ readonly property real __tickmarkRadius: outerRadius * 0.06
+
+ /*! \internal */
+ readonly property real __handleRadius: outerRadius * 0.15
+
+ /*!
+ \internal
+
+ This property determines whether it is possible to change the value of
+ the dial simply by pressing/tapping.
+
+ If \c false, the user must drag to rotate the dial and hence change the
+ value.
+
+ This property is useful for touch devices, where it is easy to
+ accidentally tap while flicking, for example.
+ */
+ property bool __dragToSet: Settings.hasTouchScreen && Settings.isMobile
+
+ /*!
+ The background of the dial.
+
+ The implicit size of the dial is taken from this component.
+ */
+ property Component background: Item {
+ id: backgroundItem
+ implicitWidth: backgroundHelper.implicitWidth
+ implicitHeight: backgroundHelper.implicitHeight
+
+ CircularButtonStyleHelper {
+ id: backgroundHelper
+ control: dialStyle.control
+ property color zeroMarkerColor: "#a8a8a8"
+ property color zeroMarkerColorTransparent: "transparent"
+ property real zeroMarkerLength: outerArcLineWidth * 1.25
+ property real zeroMarkerWidth: outerArcLineWidth * 0.3
+
+ smallestAxis: Math.min(backgroundItem.width, backgroundItem.height) - __tickmarkRadius * 4
+ }
+
+ Canvas {
+ id: backgroundCanvas
+ anchors.fill: parent
+
+ readonly property real xCenter: width / 2
+ readonly property real yCenter: height / 2
+
+ onPaint: {
+ var ctx = getContext("2d");
+ backgroundHelper.paintBackground(ctx);
+ }
+ }
+ }
+
+ /*!
+ \since 1.2
+
+ The handle of the dial.
+
+ The handle is automatically positioned within the dial, based on the
+ \l handleInset and the implicit width and height of the handle itself.
+ */
+ property Component handle: Canvas {
+ implicitWidth: __handleRadius * 2
+ implicitHeight: __handleRadius * 2
+
+ HandleStyleHelper {
+ id: handleHelper
+ }
+
+ onPaint: {
+ var ctx = getContext("2d");
+ handleHelper.paintHandle(ctx, 1, 1, width - 2, height - 2);
+ }
+ }
+
+ /*!
+ \since QtQuick.Extras 1.1
+
+ This component defines each individual tickmark. The position of each
+ tickmark is already set; only the
+ \l {Item::implicitWidth}{implicitWidth} and
+ \l {Item::implicitHeight}{implicitHeight} need to be specified.
+
+ Each instance of this component has access to the following properties:
+
+ \table
+ \row \li \c {readonly property int} \b styleData.index
+ \li The index of this tickmark.
+ \row \li \c {readonly property real} \b styleData.value
+ \li The value that this tickmark represents.
+ \endtable
+ */
+ property Component tickmark: Rectangle {
+ implicitWidth: outerRadius * 0.015 + (styleData.index === 0 || styleData.index === tickmarkCount ? 1 : (styleData.index) / tickmarkCount) * __tickmarkRadius * 0.75
+ implicitHeight: implicitWidth
+ radius: height / 2
+ color: styleData.index === 0 ? "transparent" : Qt.rgba(0, 0, 0, 0.266)
+ antialiasing: true
+ border.width: styleData.index === 0 ? Math.max(1, outerRadius * 0.0075) : 0
+ border.color: Qt.rgba(0, 0, 0, 0.266)
+ }
+
+ /*!
+ \since QtQuick.Extras 1.1
+
+ This component defines each individual minor tickmark. The position of each
+ minor tickmark is already set; only the
+ \l {Item::implicitWidth}{implicitWidth} and
+ \l {Item::implicitHeight}{implicitHeight} need to be specified.
+
+ Each instance of this component has access to the following properties:
+
+ \table
+ \row \li \c {readonly property int} \b styleData.index
+ \li The index of this tickmark.
+ \row \li \c {readonly property real} \b styleData.value
+ \li The value that this tickmark represents.
+ \endtable
+
+ By default, no minor tickmark is defined.
+ */
+ property Component minorTickmark
+
+ /*!
+ \since QtQuick.Extras 1.1
+
+ This defines the text of each tickmark label on the dial.
+
+ Each instance of this component has access to the following properties:
+
+ \table
+ \row \li \c {readonly property int} \b styleData.index
+ \li The index of this label.
+ \row \li \c {readonly property real} \b styleData.value
+ \li The value that this label represents.
+ \endtable
+
+ By default, no label is defined.
+ */
+ property Component tickmarkLabel
+
+ /*! \internal */
+ property Component panel: Item {
+ implicitWidth: backgroundLoader.implicitWidth
+ implicitHeight: backgroundLoader.implicitHeight
+
+ property alias background: backgroundLoader.item
+ property alias circularTickmarkLabel: circularTickmarkLabel_
+
+ Loader {
+ id: backgroundLoader
+ sourceComponent: dialStyle.background
+ width: outerRadius * 2
+ height: width
+ anchors.centerIn: parent
+ }
+
+ Loader {
+ id: handleLoader
+ sourceComponent: dialStyle.handle
+ x: backgroundLoader.x + __pos.x - width / 2
+ y: backgroundLoader.y + __pos.y - height / 2
+
+ readonly property point __pos: {
+ var radians = 0;
+ if (control.__wrap) {
+ radians = (control.value - control.minimumValue) /
+ (control.maximumValue - control.minimumValue) *
+ (MathUtils.pi2) + backgroundHelper.zeroAngle;
+ } else {
+ radians = -(Math.PI * 8 - (control.value - control.minimumValue) * 10 *
+ Math.PI / (control.maximumValue - control.minimumValue)) / 6;
+ }
+
+ return MathUtils.centerAlongCircle(backgroundLoader.width / 2, backgroundLoader.height / 2,
+ 0, 0, radians, outerRadius - handleInset)
+ }
+ }
+
+ CircularTickmarkLabel {
+ id: circularTickmarkLabel_
+ anchors.fill: backgroundLoader
+
+ minimumValue: control.minimumValue
+ maximumValue: control.maximumValue
+ stepSize: control.stepSize
+ tickmarksVisible: control.tickmarksVisible
+ minimumValueAngle: -150
+ maximumValueAngle: 150
+ tickmarkStepSize: dialStyle.tickmarkStepSize
+ tickmarkInset: dialStyle.tickmarkInset
+ minorTickmarkCount: dialStyle.minorTickmarkCount
+ minorTickmarkInset: dialStyle.minorTickmarkInset
+ labelInset: dialStyle.labelInset
+ labelStepSize: dialStyle.labelStepSize
+
+ style: CircularTickmarkLabelStyle {
+ tickmark: dialStyle.tickmark
+ minorTickmark: dialStyle.minorTickmark
+ tickmarkLabel: dialStyle.tickmarkLabel
+ }
+ }
+ }
+}
diff --git a/src/extras/Styles/Base/GaugeStyle.qml b/src/extras/Styles/Base/GaugeStyle.qml
new file mode 100644
index 00000000..49ea6f29
--- /dev/null
+++ b/src/extras/Styles/Base/GaugeStyle.qml
@@ -0,0 +1,545 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Styles 1.1
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Private 1.0
+
+/*!
+ \qmltype GaugeStyle
+ \inqmlmodule QtQuick.Extras.Styles
+ \since QtQuick.Extras.Styles 1.0
+ \ingroup extrasstyles
+ \brief Provides custom styling for Gauge.
+
+ You can create a custom gauge by replacing the following delegates:
+ \list
+ \li \l background
+ \li valueBar
+ \li tickmarkLabel
+ \endlist
+
+ Below, you'll find an example of how to create a temperature gauge that
+ changes color as its value increases:
+
+ \code
+ import QtQuick 2.2
+ import QtQuick.Controls 1.1
+ import QtQuick.Extras 1.3
+ import QtQuick.Extras.Styles 1.3
+
+ Rectangle {
+ width: 80
+ height: 200
+
+ Timer {
+ running: true
+ repeat: true
+ interval: 2000
+ onTriggered: gauge.value = gauge.value == gauge.maximumValue ? 5 : gauge.maximumValue
+ }
+
+ Gauge {
+ id: gauge
+ anchors.fill: parent
+ anchors.margins: 10
+
+ value: 5
+ Behavior on value {
+ NumberAnimation {
+ duration: 1000
+ }
+ }
+
+ style: GaugeStyle {
+ valueBar: Rectangle {
+ implicitWidth: 16
+ color: Qt.rgba(gauge.value / gauge.maximumValue, 0, 1 - gauge.value / gauge.maximumValue, 1)
+ }
+ }
+ }
+ }
+ \endcode
+
+ \image gauge-temperature.png
+ The gauge displaying values at various points during the animation.
+
+ \sa {Styling Gauge}
+*/
+
+Style {
+ id: gaugeStyle
+
+ /*!
+ \since 1.3
+
+ The \l Gauge that this style is attached to.
+ */
+ readonly property Gauge control: __control
+
+ /*!
+ \since QtQuick.Extras.Styles 1.3
+
+ This property holds the value displayed by the gauge as a position in
+ pixels.
+
+ It is useful for custom styling.
+ */
+ readonly property real valuePosition: control.__panel.valuePosition
+
+ /*!
+ The background of the gauge, displayed behind the \l valueBar.
+
+ By default, no background is defined.
+ */
+ property Component background
+
+ /*!
+ Each tickmark displayed by the gauge.
+
+ To set the size of the tickmarks, specify an
+ \l {Item::implicitWidth}{implicitWidth} and
+ \l {Item::implicitHeight}{implicitHeight}.
+
+ The widest tickmark will determine the space set aside for all
+ tickmarks. For this reason, the \c implicitWidth of each tickmark
+ should be greater than or equal to that of each minor tickmark. If you
+ need minor tickmarks to have greater widths than the major tickmarks,
+ set the larger width in a child item of the \l minorTickmark component.
+
+ For layouting reasons, each tickmark should have the same
+ \c implicitHeight. If different heights are needed for individual
+ tickmarks, specify those heights in a child item of the component.
+
+ In the example below, we decrease the height of the tickmarks:
+
+ \code
+ tickmark: Item {
+ implicitWidth: 18
+ implicitHeight: 1
+
+ Rectangle {
+ color: "#c8c8c8"
+ anchors.fill: parent
+ anchors.leftMargin: 3
+ anchors.rightMargin: 3
+ }
+ }
+ \endcode
+
+ \image gauge-tickmark-example.png Gauge tickmark example
+
+ Each instance of this component has access to the following properties:
+
+ \table
+ \row \li \c {readonly property int} \b styleData.index
+ \li The index of this tickmark.
+ \row \li \c {readonly property real} \b styleData.value
+ \li The value that this tickmark represents.
+ \row \li \c {readonly property real} \b styleData.valuePosition
+ \li The value that this tickmark represents as a position in
+ pixels, with 0 being at the bottom of the gauge.
+ \endtable
+
+ \sa minorTickmark
+ */
+ property Component tickmark: Item {
+ implicitWidth: Math.round(TextSingleton.height * 1.1)
+ implicitHeight: Math.max(2, Math.round(TextSingleton.height * 0.1))
+
+ Rectangle {
+ color: "#c8c8c8"
+ anchors.fill: parent
+ anchors.leftMargin: Math.round(TextSingleton.implicitHeight * 0.2)
+ anchors.rightMargin: Math.round(TextSingleton.implicitHeight * 0.2)
+ }
+ }
+
+ /*!
+ Each minor tickmark displayed by the gauge.
+
+ To set the size of the minor tickmarks, specify an
+ \l {Item::implicitWidth}{implicitWidth} and
+ \l {Item::implicitHeight}{implicitHeight}.
+
+ For layouting reasons, each minor tickmark should have the same
+ \c implicitHeight. If different heights are needed for individual
+ tickmarks, specify those heights in a child item of the component.
+
+ In the example below, we decrease the width of the minor tickmarks:
+
+ \code
+ minorTickmark: Item {
+ implicitWidth: 8
+ implicitHeight: 1
+
+ Rectangle {
+ color: "#cccccc"
+ anchors.fill: parent
+ anchors.leftMargin: 2
+ anchors.rightMargin: 4
+ }
+ }
+ \endcode
+
+ \image gauge-minorTickmark-example.png Gauge minorTickmark example
+
+ Each instance of this component has access to the following property:
+
+ \table
+ \row \li \c {readonly property int} \b styleData.index
+ \li The index of this minor tickmark.
+ \row \li \c {readonly property real} \b styleData.value
+ \li The value that this minor tickmark represents.
+ \row \li \c {readonly property real} \b styleData.valuePosition
+ \li The value that this minor tickmark represents as a
+ position in pixels, with 0 being at the bottom of the
+ gauge.
+ \endtable
+
+ \sa tickmark
+ */
+ property Component minorTickmark: Item {
+ implicitWidth: Math.round(TextSingleton.implicitHeight * 0.65)
+ implicitHeight: Math.max(1, Math.round(TextSingleton.implicitHeight * 0.05))
+
+ Rectangle {
+ color: "#c8c8c8"
+ anchors.fill: parent
+ anchors.leftMargin: control.__tickmarkAlignment === Qt.AlignBottom || control.__tickmarkAlignment === Qt.AlignRight
+ ? Math.max(3, Math.round(TextSingleton.implicitHeight * 0.2))
+ : 0
+ anchors.rightMargin: control.__tickmarkAlignment === Qt.AlignBottom || control.__tickmarkAlignment === Qt.AlignRight
+ ? 0
+ : Math.max(3, Math.round(TextSingleton.implicitHeight * 0.2))
+ }
+ }
+
+ /*!
+ This defines the text of each tickmark label on the gauge.
+
+ Each instance of this component has access to the following properties:
+
+ \table
+ \row \li \c {readonly property int} \b styleData.index
+ \li The index of this label.
+ \row \li \c {readonly property real} \b styleData.value
+ \li The value that this label represents.
+ \endtable
+ */
+ property Component tickmarkLabel: Text {
+ text: control.formatValue(styleData.value)
+ font: control.font
+ color: "#c8c8c8"
+ antialiasing: true
+ }
+
+ /*!
+ The bar that represents the value of the gauge.
+
+ To height of the value bar is automatically resized according to
+ \l {Gauge::value}{value}, and does not need to be specified.
+
+ When a custom valueBar is defined, its
+ \l {Item::implicitWidth}{implicitWidth} property must be set.
+ */
+ property Component valueBar: Rectangle {
+ color: "#00bbff"
+ implicitWidth: TextSingleton.implicitHeight
+ }
+
+ /*!
+ The bar that represents the foreground of the gauge.
+
+ This component is drawn above every other component.
+ */
+ property Component foreground: Canvas {
+ readonly property real xCenter: width / 2
+ readonly property real yCenter: height / 2
+ property real shineLength: height * 0.95
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ ctx.beginPath();
+ ctx.rect(0, 0, width, height);
+
+ var gradient = ctx.createLinearGradient(0, yCenter, width, yCenter);
+
+ gradient.addColorStop(0, Qt.rgba(1, 1, 1, 0.08));
+ gradient.addColorStop(1, Qt.rgba(1, 1, 1, 0.20));
+ ctx.fillStyle = gradient;
+ ctx.fill();
+ }
+ }
+
+ /*! \internal */
+ property Component panel: Item {
+ id: panelComponent
+ implicitWidth: control.orientation === Qt.Vertical ? tickmarkLabelBoundsWidth + rawBarWidth : TextSingleton.height * 14
+ implicitHeight: control.orientation === Qt.Vertical ? TextSingleton.height * 14 : tickmarkLabelBoundsWidth + rawBarWidth
+
+ readonly property int tickmarkCount: (control.maximumValue - control.minimumValue) / control.tickmarkStepSize + 1
+ readonly property real tickmarkSpacing: (tickmarkLabelBounds.height - tickmarkWidth * tickmarkCount) / (tickmarkCount - 1)
+
+ property real tickmarkLength: tickmarkColumn.width
+ // Can't deduce this from the column, so we set it from within the first tickmark delegate loader.
+ property real tickmarkWidth: 2
+
+ readonly property real tickmarkOffset: control.orientation === Qt.Vertical ? control.__hiddenText.height / 2 : control.__hiddenText.width / 2
+
+ readonly property real minorTickmarkStep: control.tickmarkStepSize / (control.minorTickmarkCount + 1);
+
+ /*!
+ Returns the marker text that should be displayed based on
+ \a markerPos (\c 0 to \c 1.0).
+ */
+ function markerTextFromPos(markerPos) {
+ return markerPos * (control.maximumValue - control.minimumValue) + control.minimumValue;
+ }
+
+ readonly property real rawBarWidth: valueBarLoader.item.implicitWidth
+ readonly property real barLength: (control.orientation === Qt.Vertical ? control.height : control.width) - (tickmarkOffset * 2 - 2)
+
+ readonly property real tickmarkLabelBoundsWidth: tickmarkLength + (control.orientation === Qt.Vertical ? control.__hiddenText.width : control.__hiddenText.height)
+ readonly property int valuePosition: valueBarLoader.height
+
+ Item {
+ id: container
+
+ width: control.orientation === Qt.Vertical ? parent.width : parent.height
+ height: control.orientation === Qt.Vertical ? parent.height : parent.width
+ rotation: control.orientation === Qt.Horizontal ? 90 : 0
+ transformOrigin: Item.Center
+ anchors.centerIn: parent
+
+ Item {
+ id: valueBarItem
+
+ x: control.__tickmarkAlignment === Qt.AlignLeft || control.__tickmarkAlignment === Qt.AlignTop ? tickmarkLabelBounds.x + tickmarkLabelBounds.width : 0
+ width: rawBarWidth
+ height: barLength
+ anchors.verticalCenter: parent.verticalCenter
+
+ Loader {
+ id: backgroundLoader
+ sourceComponent: background
+ anchors.fill: parent
+ }
+
+ Loader {
+ id: valueBarLoader
+ sourceComponent: valueBar
+
+ readonly property real valueAsPercentage: (control.value - control.minimumValue) / (control.maximumValue - control.minimumValue)
+
+ y: Math.round(parent.height - height)
+ height: Math.round(valueAsPercentage * parent.height)
+ }
+ }
+ Item {
+ id: tickmarkLabelBounds
+
+ x: control.__tickmarkAlignment === Qt.AlignLeft || control.__tickmarkAlignment === Qt.AlignTop ? 0 : valueBarItem.width
+ width: tickmarkLabelBoundsWidth
+ height: barLength
+ anchors.verticalCenter: parent.verticalCenter
+ // We want our items to be laid out from bottom to top, but Column can't do that, so we flip
+ // the whole item containing the tickmarks and labels vertically. Then, we flip each tickmark
+ // and label back again.
+ transform: Rotation {
+ axis.x: 1
+ axis.y: 0
+ axis.z: 0
+ origin.x: tickmarkLabelBounds.width / 2
+ origin.y: tickmarkLabelBounds.height / 2
+ angle: 180
+ }
+
+ Column {
+ id: tickmarkColumn
+ x: control.__tickmarkAlignment === Qt.AlignRight || control.__tickmarkAlignment === Qt.AlignBottom ? 0 : tickmarkLabelBounds.width - width
+ spacing: tickmarkSpacing
+ anchors.verticalCenter: parent.verticalCenter
+
+ Repeater {
+ id: tickmarkRepeater
+ model: tickmarkCount
+ delegate: Loader {
+ id: tickmarkDelegateLoader
+
+ sourceComponent: gaugeStyle.tickmark
+ transform: Rotation {
+ axis.x: 1
+ axis.y: 0
+ axis.z: 0
+ origin.x: tickmarkDelegateLoader.width / 2
+ origin.y: tickmarkDelegateLoader.height / 2
+ angle: 180
+ }
+
+ onHeightChanged: {
+ if (index == 0)
+ tickmarkWidth = height;
+ }
+
+ readonly property int __index: index
+ property QtObject styleData: QtObject {
+ readonly property alias index: tickmarkDelegateLoader.__index
+ readonly property real value: (index / (tickmarkCount - 1)) * (control.maximumValue - control.minimumValue) + control.minimumValue
+ readonly property int valuePosition: Math.round(tickmarkDelegateLoader.y)
+ }
+ }
+ }
+ }
+
+ // Doesn't need to be in a column, since we assume that the major tickmarks will always be longer than us.
+ Repeater {
+ id: minorTickmarkRepeater
+ model: (tickmarkCount - 1) * control.minorTickmarkCount
+ delegate: Loader {
+ id: minorTickmarkDelegateLoader
+
+ x: control.__tickmarkAlignment === Qt.AlignRight || control.__tickmarkAlignment === Qt.AlignBottom ? 0 : tickmarkLabelBounds.width - width
+ y: {
+ var tickmarkWidthOffset = Math.floor(index / control.minorTickmarkCount) * tickmarkWidth + tickmarkWidth;
+ var relativePosition = (index % control.minorTickmarkCount + 1) * (tickmarkSpacing / (control.minorTickmarkCount + 1));
+ var clusterOffset = Math.floor(index / control.minorTickmarkCount) * tickmarkSpacing;
+ // We assume that each minorTickmark's height is the same.
+ return clusterOffset + tickmarkWidthOffset + relativePosition - height / 2;
+ }
+
+ transform: Rotation {
+ axis.x: 1
+ axis.y: 0
+ axis.z: 0
+ origin.x: minorTickmarkDelegateLoader.width / 2
+ origin.y: minorTickmarkDelegateLoader.height / 2
+ angle: 180
+ }
+
+ sourceComponent: gaugeStyle.minorTickmark
+
+ readonly property int __index: index
+ property QtObject styleData: QtObject {
+ readonly property alias index: minorTickmarkDelegateLoader.__index
+ readonly property real value: {
+ var tickmarkIndex = Math.floor(index / control.minorTickmarkCount);
+ return index * minorTickmarkStep + minorTickmarkStep * tickmarkIndex + minorTickmarkStep + control.minimumValue;
+ }
+ readonly property int valuePosition: Math.round(minorTickmarkDelegateLoader.y)
+ }
+ }
+ }
+
+ Item {
+ id: tickmarkLabelItem
+ x: control.__tickmarkAlignment === Qt.AlignRight || control.__tickmarkAlignment === Qt.AlignBottom
+ ? tickmarkLength
+ : tickmarkLabelBounds.width - tickmarkLength - width
+ width: control.__hiddenText.width
+ // Use the bar height instead of the container's, as the labels seem to be translated by 1 when we
+ // flip the control vertically, and this fixes that.
+ height: parent.height
+ anchors.verticalCenter: parent.verticalCenter
+
+ Repeater {
+ id: tickmarkTextRepeater
+ model: tickmarkCount
+ delegate: Item {
+ x: {
+ if (control.orientation === Qt.Vertical)
+ return 0;
+
+ // Align the text to the edge of the tickmarks.
+ return ((width - height) / 2) * (control.__tickmarkAlignment === Qt.AlignBottom ? -1 : 1);
+ }
+ y: index * labelDistance - height / 2
+
+ width: control.__hiddenText.width
+ height: control.__hiddenText.height
+
+ transformOrigin: Item.Center
+ rotation: control.orientation === Qt.Vertical ? 0 : 90
+
+ readonly property real labelDistance: tickmarkLabelBounds.height / (tickmarkCount - 1)
+
+ Loader {
+ id: tickmarkTextRepeaterDelegate
+
+ x: {
+ if (control.orientation === Qt.Horizontal) {
+ return parent.width / 2 - width / 2;
+ }
+
+ return control.__tickmarkAlignment === Qt.AlignRight || control.__tickmarkAlignment === Qt.AlignBottom
+ ? 0
+ : parent.width - width;
+ }
+
+ transform: Rotation {
+ axis.x: 1
+ axis.y: 0
+ axis.z: 0
+ origin.x: tickmarkTextRepeaterDelegate.width / 2
+ origin.y: tickmarkTextRepeaterDelegate.height / 2
+ angle: 180
+ }
+
+ sourceComponent: tickmarkLabel
+
+ readonly property int __index: index
+ property QtObject styleData: QtObject {
+ readonly property alias index: tickmarkTextRepeaterDelegate.__index
+ readonly property real value: markerTextFromPos(index / (tickmarkTextRepeater.count - 1))
+ }
+ }
+ }
+ }
+ }
+ }
+ Loader {
+ id: foregroundLoader
+ sourceComponent: foreground
+ anchors.fill: valueBarItem
+ }
+ }
+ }
+}
diff --git a/src/extras/Styles/Base/HandleStyle.qml b/src/extras/Styles/Base/HandleStyle.qml
new file mode 100644
index 00000000..38588417
--- /dev/null
+++ b/src/extras/Styles/Base/HandleStyle.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras 1.3
+
+Style {
+ id: handleStyle
+ property alias handleColorTop: __helper.handleColorTop
+ property alias handleColorBottom: __helper.handleColorBottom
+ property alias handleColorBottomStop: __helper.handleColorBottomStop
+
+ HandleStyleHelper {
+ id: __helper
+ }
+
+ property Component handle: Item {
+ implicitWidth: 50
+ implicitHeight: 50
+
+ Canvas {
+ id: handleCanvas
+ anchors.fill: parent
+
+ onPaint: {
+ var ctx = getContext("2d");
+ __helper.paintHandle(ctx);
+ }
+ }
+ }
+
+ property Component panel: Item {
+ Loader {
+ id: handleLoader
+ sourceComponent: handle
+ anchors.fill: parent
+ }
+ }
+}
diff --git a/src/extras/Styles/Base/HandleStyleHelper.qml b/src/extras/Styles/Base/HandleStyleHelper.qml
new file mode 100644
index 00000000..61ad3bb3
--- /dev/null
+++ b/src/extras/Styles/Base/HandleStyleHelper.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+
+QtObject {
+ id: handleStyleHelper
+
+ property color handleColorTop: "#969696"
+ property color handleColorBottom: Qt.rgba(0.9, 0.9, 0.9, 0.298)
+ property real handleColorBottomStop: 0.7
+
+ property color handleRingColorTop: "#b0b0b0"
+ property color handleRingColorBottom: "transparent"
+
+ /*!
+ If \a ctx is the only argument, this is equivalent to calling
+ paintHandle(\c ctx, \c 0, \c 0, \c ctx.canvas.width, \c ctx.canvas.height).
+ */
+ function paintHandle(ctx, handleX, handleY, handleWidth, handleHeight) {
+ ctx.reset();
+
+ if (handleWidth < 0)
+ return;
+
+ if (arguments.length == 1) {
+ handleX = 0;
+ handleY = 0;
+ handleWidth = ctx.canvas.width;
+ handleHeight = ctx.canvas.height;
+ }
+
+ ctx.beginPath();
+ var gradient = ctx.createRadialGradient(handleX, handleY, handleWidth / 2,
+ handleX, handleY, handleWidth);
+ gradient.addColorStop(0, handleColorTop);
+ gradient.addColorStop(handleColorBottomStop, handleColorBottom);
+ ctx.ellipse(handleX, handleY, handleWidth, handleHeight);
+ ctx.fillStyle = gradient;
+ ctx.fill();
+
+ /* Draw the ring gradient around the handle. */
+ // Clip first, so we only draw inside the ring.
+ ctx.beginPath();
+ ctx.ellipse(handleX, handleY, handleWidth, handleHeight);
+ ctx.ellipse(handleX + 2, handleY + 2, handleWidth - 4, handleHeight - 4);
+ ctx.clip();
+
+ ctx.beginPath();
+ gradient = ctx.createLinearGradient(handleX + handleWidth / 2, handleY,
+ handleX + handleWidth / 2, handleY + handleHeight);
+ gradient.addColorStop(0, handleRingColorTop);
+ gradient.addColorStop(1, handleRingColorBottom);
+ ctx.ellipse(handleX, handleY, handleWidth, handleHeight);
+ ctx.fillStyle = gradient;
+ ctx.fill();
+ }
+}
diff --git a/src/extras/Styles/Base/PieMenuStyle.qml b/src/extras/Styles/Base/PieMenuStyle.qml
new file mode 100644
index 00000000..c7cd1dda
--- /dev/null
+++ b/src/extras/Styles/Base/PieMenuStyle.qml
@@ -0,0 +1,393 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtGraphicalEffects 1.0
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Styles 1.3
+import QtQuick.Extras.Private 1.0
+import QtQuick.Extras.Private.CppUtils 1.0
+
+/*!
+ \qmltype PieMenuStyle
+ \inqmlmodule QtQuick.Extras.Styles
+ \since QtQuick.Extras.Styles 1.0
+ \ingroup extrasstyles
+ \brief Provides custom styling for PieMenu.
+
+ PieMenuStyle is a style for PieMenu that draws each section of the menu as a
+ filled "slice".
+
+ You can create a custom pie menu by replacing the following delegates:
+ \list
+ \li \l background
+ \li \l cancel
+ \li \l menuItem
+ \li \l title
+ \endlist
+
+ To customize the appearance of each menuItem without having to define your
+ own, you can use the \l backgroundColor and \l selectionColor properties.
+ To customize the drop shadow, use the \l shadowColor, \l shadowRadius and
+ \l shadowSpread properties.
+
+ Icons that are too large for the section that they are in will be scaled
+ down appropriately.
+
+ To style individual sections of the menu, use the menuItem component:
+ \code
+ PieMenuStyle {
+ shadowRadius: 0
+
+ menuItem: Item {
+ id: item
+ rotation: -90 + sectionCenterAngle(styleData.index)
+
+ Rectangle {
+ width: parent.height * 0.2
+ height: width
+ color: "darkorange"
+ radius: width / 2
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+
+ Text {
+ id: textItem
+ text: control.menuItems[styleData.index].text
+ anchors.centerIn: parent
+ color: control.currentIndex === styleData.index ? "red" : "white"
+ rotation: -item.rotation
+ }
+ }
+ }
+ }
+ \endcode
+
+ \image piemenu-menuitem-example.png A custom PieMenu
+*/
+
+Style {
+ id: pieMenuStyle
+
+ /*!
+ \since 1.3
+
+ The \l PieMenu that this style is attached to.
+ */
+ readonly property PieMenu control: __control
+
+ /*! The background color. */
+ property color backgroundColor: Qt.rgba(0.6, 0.6, 0.6, 0.66)
+
+ /*! The selection color. */
+ property color selectionColor: "#eee"
+
+ /*! The shadow color. */
+ property color shadowColor: Qt.rgba(0, 0, 0, 0.26)
+
+ /*! The shadow radius. */
+ property real shadowRadius: 50
+
+ /*! The shadow spread. */
+ property real shadowSpread: 0.3
+
+ /*!
+ The distance from the center of the menu to the outer edge of the menu.
+
+ \sa cancelRadius
+ */
+ readonly property real radius: Math.min(control.width, control.height) * 0.5
+
+ /*!
+ The radius of the area that is used to cancel the menu.
+
+ \sa radius
+ */
+ property real cancelRadius: radius * 0.4
+
+ /*!
+ The angle (in degrees) at which the first menu item will be drawn.
+
+ The absolute range formed by \a startAngle and \l endAngle must be
+ less than or equal to \c 360 degrees.
+
+ Menu items are displayed clockwise when \a startAngle is less than
+ \l endAngle, otherwise they are displayed anti-clockwise.
+
+ \sa endAngle
+ */
+ property real startAngle: -90
+
+ /*!
+ The angle (in degrees) at which the last menu item will be drawn.
+
+ The absolute range formed by \l startAngle and \a endAngle must be
+ less than or equal to \c 360 degrees.
+
+ Menu items are displayed clockwise when \l startAngle is less than
+ \a endAngle, otherwise they are displayed anti-clockwise.
+
+ \sa startAngle
+ */
+ property real endAngle: 90
+
+ /*!
+ Returns the start of the section at \a itemIndex as an angle in degrees.
+ */
+ function sectionStartAngle(itemIndex) {
+ return MathUtils.radToDegOffset(control.__protectedScope.sectionStartAngle(itemIndex));
+ }
+
+ /*!
+ Returns the center of the section at \a itemIndex as an angle in
+ degrees.
+ */
+ function sectionCenterAngle(itemIndex) {
+ return MathUtils.radToDegOffset(control.__protectedScope.sectionCenterAngle(itemIndex));
+ }
+
+ /*!
+ Returns the end of the section at \a itemIndex as an angle in degrees.
+ */
+ function sectionEndAngle(itemIndex) {
+ return MathUtils.radToDegOffset(control.__protectedScope.sectionEndAngle(itemIndex));
+ }
+
+ /*!
+ \internal
+
+ The distance in pixels from the center of each menu item's icon to the
+ center of the menu. A higher value means that the icons will be further
+ from the center of the menu.
+ */
+ readonly property real __iconOffset: cancelRadius + ((radius - cancelRadius) / 2)
+
+ /*! \internal */
+ readonly property real __selectableRadius: radius - cancelRadius
+
+ /*! \internal */
+ property int __implicitWidth: Math.round(TextSingleton.implicitHeight * 12.5)
+
+ /*! \internal */
+ property int __implicitHeight: __implicitWidth
+
+ /*!
+ The background of the menu.
+
+ By default, there is no background defined.
+ */
+ property Component background
+
+ /*!
+ The cancel component of the menu.
+
+ This is an area in the center of the menu that closes the menu when
+ clicked.
+
+ By default, it is not visible.
+ */
+ property Component cancel: null
+
+ /*!
+ \since QtQuick.Extras 1.1
+
+ The component that displays the text of the currently selected menu
+ item, or the title if there is no current item.
+
+ The current item's text is available via the \c styleData.text
+ property.
+ */
+ property Component title: Text {
+ font.pointSize: 20
+ text: styleData.text
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ color: "#ccc"
+ antialiasing: true
+ }
+
+ /*!
+ This component defines each section of the pie menu.
+
+ This component covers the width and height of the control.
+
+ No mouse events are propagated to this component, which means that
+ controls like Button will not function when used within it. You can
+ check if the mouse is over this section by comparing
+ \c control.currentIndex to \c styleData.index.
+
+ Each instance of this component has access to the following properties:
+
+ \table
+ \row \li \c {readonly property int} \b styleData.index
+ \li The index of this menu item.
+ \row \li \c {readonly property bool} \b styleData.hovered
+ \li \c true if this menu item is under the mouse.
+ \row \li \c {readonly property bool} \b styleData.pressed
+ \li \c true if the mouse is pressed down on this menu item.
+ (since QtQuick.Extras 1.3)
+ \endtable
+ */
+ property Component menuItem: Item {
+ id: actionRootDelegateItem
+
+ function drawRingSection(ctx, x, y, section, r, ringWidth, ringColor) {
+ ctx.fillStyle = ringColor;
+
+ // Draw one section.
+ ctx.beginPath();
+ ctx.moveTo(x,y);
+
+ // Canvas draws 0 degrees at 3 o'clock, whereas we want it to draw it at 12.
+ var start = control.__protectedScope.sectionStartAngle(section);
+ var end = control.__protectedScope.sectionEndAngle(section);
+ ctx.arc(x, y, r, start, end, start > end);
+ ctx.fill();
+
+ // Either change this to the background color, or use the global composition.
+ ctx.fillStyle = "black";
+ ctx.globalCompositeOperation = "destination-out";
+ ctx.beginPath();
+ ctx.moveTo(x, y);
+ ctx.arc(x, y, ringWidth, 0, Math.PI * 2);
+ ctx.closePath();
+ ctx.fill();
+
+ // If using the global composition method, make sure to change it back to default.
+ ctx.globalCompositeOperation = "source-over";
+ }
+
+ Canvas {
+ id: actionCanvas
+ anchors.fill: parent
+ property color currentColor: control.currentIndex === styleData.index ? selectionColor : backgroundColor
+
+ Connections {
+ target: pieMenuStyle
+ onStartAngleChanged: actionCanvas.requestPaint()
+ onEndAngleChanged: actionCanvas.requestPaint()
+ }
+
+ Connections {
+ target: control
+ onCurrentIndexChanged: actionCanvas.requestPaint()
+ }
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+ drawRingSection(ctx, width / 2, height / 2, styleData.index, radius, cancelRadius, currentColor);
+ }
+ }
+
+ readonly property var __styleData: styleData
+
+ PieMenuIcon {
+ control: pieMenuStyle.control
+ styleData: __styleData
+ }
+ }
+
+ /*! \internal */
+ property Component panel: Item {
+ implicitWidth: __implicitWidth
+ implicitHeight: __implicitHeight
+
+ property alias titleItem: titleLoader.item
+
+ Item {
+ id: itemgroup
+ anchors.fill: parent
+ visible: false
+
+ Loader {
+ id: backgroundLoader
+ sourceComponent: background
+ anchors.fill: parent
+ }
+
+ Loader {
+ id: cancelLoader
+ sourceComponent: cancel
+ anchors.centerIn: parent
+ }
+
+ Repeater {
+ id: menuItemRepeater
+ model: control.__protectedScope.visibleItems
+
+ delegate: Loader {
+ id: menuItemLoader
+ anchors.fill: parent
+ sourceComponent: menuItem
+
+ readonly property int __index: index
+ property QtObject styleData: QtObject {
+ readonly property alias index: menuItemLoader.__index
+ readonly property bool hovered: control.currentIndex === index
+ readonly property bool pressed: control.__protectedScope.pressedIndex === index
+ }
+ }
+ }
+ }
+ DropShadow {
+ id: dropShadow
+ anchors.fill: itemgroup
+ fast: true
+ radius: shadowRadius
+ spread: shadowSpread
+ transparentBorder: true
+ samples: 12
+ color: shadowColor
+ source: itemgroup
+ }
+
+ Loader {
+ id: titleLoader
+ sourceComponent: title
+ x: parent.x + parent.width / 2 - width / 2
+ y: -height - 10
+
+ property QtObject styleData: QtObject {
+ property string text: control.currentIndex !== -1
+ ? control.__protectedScope.visibleItems[control.currentIndex].text
+ : control.title
+ }
+ }
+ }
+}
diff --git a/src/extras/Styles/Base/StatusIndicatorStyle.qml b/src/extras/Styles/Base/StatusIndicatorStyle.qml
new file mode 100644
index 00000000..ddfd1b45
--- /dev/null
+++ b/src/extras/Styles/Base/StatusIndicatorStyle.qml
@@ -0,0 +1,237 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtGraphicalEffects 1.0
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras 1.3
+
+/*!
+ \qmltype StatusIndicatorStyle
+ \inqmlmodule QtQuick.Extras.Styles
+ \since QtQuick.Extras.Styles 1.1
+ \ingroup extrasstyles
+ \brief Provides custom styling for StatusIndicatorStyle.
+
+ You can create a custom status indicator by defining the \l indicator
+ component.
+*/
+
+Style {
+ id: pieMenuStyle
+
+ /*!
+ \since 1.3
+
+ The \l StatusIndicator that this style is attached to.
+ */
+ readonly property StatusIndicator control: __control
+
+ /*!
+ \since 1.3
+
+ The color that instances of
+ \l {QtQuick.Extras::}{StatusIndicator} will have.
+ The \l {QtQuick.Extras::StatusIndicator::}{color}
+ property in \l {QtQuick.Extras::}{StatusIndicator}
+ will override this property when set.
+ */
+ property color color: "red"
+
+ /*!
+ This defines the indicator in both its on and off status.
+ */
+ property Component indicator: Item {
+ readonly property real shineStep: 0.05
+ readonly property real smallestAxis: Math.min(control.width, control.height)
+ readonly property real shadowRadius: smallestAxis * 0.4
+ readonly property real outerRecessPercentage: 0.11
+ readonly property color offColor: Qt.rgba(0.13, 0.13, 0.13)
+ readonly property color baseColor: control.active ? control.color : offColor
+
+ implicitWidth: TextSingleton.implicitHeight * 2
+ implicitHeight: implicitWidth
+
+ Canvas {
+ id: backgroundCanvas
+ width: Math.min(parent.width, parent.height)
+ // height: width --- QTBUG-42878
+ height: Math.min(parent.width, parent.height)
+ anchors.centerIn: parent
+
+ Connections {
+ target: control
+ onActiveChanged: backgroundCanvas.requestPaint()
+ onColorChanged: backgroundCanvas.requestPaint()
+ }
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ // Draw the semi-transparent background.
+ ctx.beginPath();
+ var gradient = ctx.createLinearGradient(width / 2, 0, width / 2, height * 0.75);
+ gradient.addColorStop(0.0, Qt.rgba(0, 0, 0, control.active ? 0.1 : 0.25));
+ gradient.addColorStop(1.0, control.active ? Qt.rgba(0, 0, 0, 0.1) : Qt.rgba(0.74, 0.74, 0.74, 0.25));
+
+ ctx.fillStyle = gradient;
+ ctx.ellipse(0, 0, width, height);
+ ctx.fill();
+ }
+ }
+
+ Item {
+ id: shadowGuard
+ anchors.fill: backgroundCanvas
+ anchors.margins: -shadowRadius
+
+ Canvas {
+ id: colorCanvas
+ anchors.fill: parent
+ anchors.margins: shadowRadius
+
+ Connections {
+ target: control
+ onActiveChanged: colorCanvas.requestPaint()
+ onColorChanged: colorCanvas.requestPaint()
+ }
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ // Draw the actual color within the circle.
+ ctx.beginPath();
+ ctx.fillStyle = baseColor;
+ var recess = smallestAxis * outerRecessPercentage;
+ ctx.ellipse(recess, recess, width - recess * 2, height - recess * 2);
+ ctx.fill();
+ }
+ }
+ }
+
+ DropShadow {
+ id: shadow
+ source: shadowGuard
+ color: control.color
+ // Don't set fast here because Qt < 5.3 will run into QTBUG-36931
+ radius: shadowRadius
+ samples: Math.min(32, radius)
+ cached: true
+ anchors.fill: shadowGuard
+ visible: control.active
+ }
+
+ Canvas {
+ id: foregroundCanvas
+ anchors.fill: backgroundCanvas
+
+ Connections {
+ target: control
+ onActiveChanged: foregroundCanvas.requestPaint()
+ onColorChanged: foregroundCanvas.requestPaint()
+ }
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ // Draw the first shine.
+ ctx.beginPath();
+ ctx.fillStyle = Qt.rgba(1, 1, 1, 0.03);
+ var recessPercentage = outerRecessPercentage + shineStep * 0.65;
+ var recess = smallestAxis * recessPercentage;
+ ctx.ellipse(recess, recess, width - recess * 2, height - recess * 2);
+ ctx.fill();
+
+ // Draw the second, inner shine.
+ ctx.beginPath();
+ ctx.fillStyle = Qt.rgba(1, 1, 1, 0.06);
+ recessPercentage += shineStep;
+ recess = smallestAxis * recessPercentage;
+ ctx.ellipse(recess, recess, width - recess * 2, height - recess * 2);
+ ctx.fill();
+
+ // Now draw the final arced shine that goes over the first and second shines.
+ // First, clip the entire shine area.
+ ctx.beginPath();
+ recessPercentage -= shineStep;
+ recess = smallestAxis * recessPercentage;
+ ctx.ellipse(recess, recess, width - recess * 2, height - recess * 2);
+ ctx.clip();
+
+ if (!control.active) {
+ // Then, clip the bottom area out of the shine.
+ ctx.ellipse(recess, height * 0.425, width - recess * 2, height - recess * 2);
+ ctx.clip();
+ }
+
+ ctx.beginPath();
+ var gradient;
+ if (!control.active) {
+ // Draw the shine arc.
+ gradient = ctx.createLinearGradient(width / 2, height * 0.2, width / 2, height * 0.65);
+ gradient.addColorStop(0.0, Qt.rgba(1, 1, 1, 0.05));
+ gradient.addColorStop(1.0, "transparent");
+ } else {
+ // Draw the radial shine.
+ gradient = ctx.createRadialGradient(width / 2, height / 2, width * 0.25, width / 2, height / 2, width * 0.25);
+ gradient.addColorStop(0.0, Qt.lighter(baseColor, 1.4));
+ gradient.addColorStop(1.0, "transparent");
+ }
+
+ ctx.fillStyle = gradient;
+ ctx.ellipse(recess, recess, width - recess * 2, height - recess * 2);
+ ctx.fill();
+ }
+ }
+ }
+
+ /*! \internal */
+ property Component panel: Item {
+ implicitWidth: indicatorLoader.implicitWidth
+ implicitHeight: indicatorLoader.implicitHeight
+
+ Loader {
+ id: indicatorLoader
+ width: Math.max(1, parent.width)
+ height: Math.max(1, parent.height)
+ anchors.centerIn: parent
+ sourceComponent: indicator
+ }
+ }
+}
diff --git a/src/extras/Styles/Base/ToggleButtonStyle.qml b/src/extras/Styles/Base/ToggleButtonStyle.qml
new file mode 100644
index 00000000..507c0314
--- /dev/null
+++ b/src/extras/Styles/Base/ToggleButtonStyle.qml
@@ -0,0 +1,294 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtGraphicalEffects 1.0
+import QtQuick.Controls.Styles 1.1
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Styles 1.3
+import QtQuick.Extras.Private 1.0
+import QtQuick.Extras.Private.CppUtils 1.0
+
+/*!
+ \qmltype ToggleButtonStyle
+ \inqmlmodule QtQuick.Extras.Styles
+ \since QtQuick.Extras.Styles 1.0
+ \ingroup extrasstyles
+ \brief Provides custom styling for ToggleButton.
+
+ You can create a custom toggle button by replacing the same delegates that
+ \l {QtQuick.Controls.Styles::ButtonStyle}{ButtonStyle} provides.
+*/
+
+CircularButtonStyle {
+ id: circularButtonStyle
+
+ /*!
+ \since 1.3
+
+ The \l ToggleButton that this style is attached to.
+ */
+ readonly property ToggleButton control: __control
+
+ /*!
+ The gradient that is displayed on the inactive state indicator. The
+ inactive state indicator will be the checked gradient when the button
+ is unchecked, and the unchecked gradient when the button is checked.
+
+ \sa checkedGradient, uncheckedGradient
+ */
+ property Gradient inactiveGradient: Gradient {
+ GradientStop {
+ position: 0
+ color: commonStyleHelper.inactiveColor
+ }
+ GradientStop {
+ position: 1
+ color: commonStyleHelper.inactiveColorShine
+ }
+ }
+
+ /*!
+ The gradient that is displayed on the checked state indicator.
+
+ \sa uncheckedGradient, inactiveGradient
+ */
+ property Gradient checkedGradient: Gradient {
+ GradientStop {
+ position: 0
+ color: commonStyleHelper.onColor
+ }
+ GradientStop {
+ position: 1
+ color: commonStyleHelper.onColorShine
+ }
+ }
+
+ /*!
+ The gradient that is displayed on the unchecked state indicator.
+
+ \sa checkedGradient, inactiveGradient
+ */
+ property Gradient uncheckedGradient: Gradient {
+ GradientStop {
+ position: 0
+ color: commonStyleHelper.offColor
+ }
+ GradientStop {
+ position: 1
+ color: commonStyleHelper.offColorShine
+ }
+ }
+
+ /*!
+ The color that is used for the drop shadow below the checked state
+ indicator.
+
+ \sa uncheckedDropShadowColor
+ */
+ property color checkedDropShadowColor: commonStyleHelper.onColor
+
+ /*!
+ The color that is used for the drop shadow below the checked state
+ indicator.
+
+ \sa checkedDropShadowColor
+ */
+ property color uncheckedDropShadowColor: commonStyleHelper.offColor
+
+ CommonStyleHelper {
+ id: commonStyleHelper
+ }
+
+ background: Item {
+ implicitWidth: __buttonHelper.implicitWidth
+ implicitHeight: __buttonHelper.implicitHeight
+
+ Connections {
+ target: control
+ onPressedChanged: {
+ backgroundCanvas.requestPaint();
+ }
+
+ onCheckedChanged: {
+ uncheckedCanvas.requestPaint();
+ checkedCanvas.requestPaint();
+ }
+ }
+
+ Connections {
+ target: circularButtonStyle
+
+ onCheckedGradientChanged: checkedCanvas.requestPaint()
+ onCheckedDropShadowColorChanged: checkedCanvas.requestPaint()
+ onUncheckedGradientChanged: uncheckedCanvas.requestPaint()
+ onUncheckedDropShadowColorChanged: uncheckedCanvas.requestPaint()
+ onInactiveGradientChanged: {
+ checkedCanvas.requestPaint();
+ uncheckedCanvas.requestPaint();
+ }
+ }
+
+ Connections {
+ target: circularButtonStyle.checkedGradient
+ onUpdated: checkedCanvas.requestPaint()
+ }
+
+ Connections {
+ target: circularButtonStyle.uncheckedGradient
+ onUpdated: uncheckedCanvas.requestPaint()
+ }
+
+ Connections {
+ target: circularButtonStyle.inactiveGradient
+ onUpdated: {
+ uncheckedCanvas.requestPaint();
+ checkedCanvas.requestPaint();
+ }
+ }
+
+ Canvas {
+ id: backgroundCanvas
+ anchors.fill: parent
+
+ onPaint: {
+ var ctx = getContext("2d");
+ __buttonHelper.paintBackground(ctx);
+ }
+ }
+
+ Canvas {
+ id: uncheckedCanvas
+ anchors.fill: parent
+ anchors.margins: -(__buttonHelper.radius * 3)
+ visible: control.checked
+
+ readonly property real xCenter: width / 2
+ readonly property real yCenter: height / 2
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ /* Draw unchecked indicator */
+ ctx.beginPath();
+ ctx.lineWidth = __buttonHelper.outerArcLineWidth - __buttonHelper.innerArcLineWidth;
+ ctx.arc(xCenter, yCenter, __buttonHelper.outerArcRadius + __buttonHelper.innerArcLineWidth / 2,
+ MathUtils.degToRad(180), MathUtils.degToRad(270), false);
+ var gradient = ctx.createLinearGradient(xCenter, yCenter + __buttonHelper.radius,
+ xCenter, yCenter - __buttonHelper.radius);
+ var relevantGradient = control.checked ? inactiveGradient : uncheckedGradient;
+ for (var i = 0; i < relevantGradient.stops.length; ++i) {
+ gradient.addColorStop(relevantGradient.stops[i].position, relevantGradient.stops[i].color);
+ }
+ ctx.strokeStyle = gradient;
+ ctx.stroke();
+ }
+ }
+
+ Canvas {
+ id: checkedCanvas
+ anchors.fill: parent
+ anchors.margins: -(__buttonHelper.radius * 3)
+ visible: !control.checked
+
+ readonly property real xCenter: width / 2
+ readonly property real yCenter: height / 2
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ /* Draw checked indicator */
+ ctx.beginPath();
+ ctx.lineWidth = __buttonHelper.outerArcLineWidth - __buttonHelper.innerArcLineWidth;
+ ctx.arc(xCenter, yCenter, __buttonHelper.outerArcRadius + __buttonHelper.innerArcLineWidth / 2,
+ MathUtils.degToRad(270), MathUtils.degToRad(0), false);
+ var gradient = ctx.createLinearGradient(xCenter, yCenter + __buttonHelper.radius,
+ xCenter, yCenter - __buttonHelper.radius);
+ var relevantGradient = control.checked ? checkedGradient : inactiveGradient;
+ for (var i = 0; i < relevantGradient.stops.length; ++i) {
+ gradient.addColorStop(relevantGradient.stops[i].position, relevantGradient.stops[i].color);
+ }
+ ctx.strokeStyle = gradient;
+ ctx.stroke();
+ }
+ }
+
+ DropShadow {
+ id: uncheckedDropShadow
+ anchors.fill: uncheckedCanvas
+ cached: true
+ radius: 4
+ samples: 8
+ color: uncheckedDropShadowColor
+ source: uncheckedCanvas
+ visible: !control.checked
+ }
+
+ DropShadow {
+ id: checkedDropShadow
+ anchors.fill: checkedCanvas
+ cached: true
+ radius: 4
+ samples: 8
+ color: checkedDropShadowColor
+ source: checkedCanvas
+ visible: control.checked
+ }
+ }
+
+ panel: Item {
+ implicitWidth: backgroundLoader.implicitWidth
+ implicitHeight: backgroundLoader.implicitHeight
+
+ Loader {
+ id: backgroundLoader
+ anchors.fill: parent
+ sourceComponent: background
+ }
+
+ Loader {
+ id: labelLoader
+ sourceComponent: label
+ anchors.fill: parent
+ anchors.leftMargin: padding.left
+ anchors.topMargin: padding.top
+ anchors.rightMargin: padding.right
+ anchors.bottomMargin: padding.bottom
+ }
+ }
+}
diff --git a/src/extras/Styles/Base/TumblerStyle.qml b/src/extras/Styles/Base/TumblerStyle.qml
new file mode 100644
index 00000000..3ebcb7a2
--- /dev/null
+++ b/src/extras/Styles/Base/TumblerStyle.qml
@@ -0,0 +1,330 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtGraphicalEffects 1.0
+import QtQuick.Controls 1.0
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Styles 1.3
+import QtQuick.Extras.Private 1.0
+
+/*!
+ \qmltype TumblerStyle
+ \inqmlmodule QtQuick.Extras.Styles
+ \since QtQuick.Extras.Styles 1.2
+ \ingroup extrasstyles
+ \brief Provides custom styling for Tumbler.
+
+ \note TumblerStyle requires Qt 5.3.2 or later.
+
+ You can create a custom tumbler by replacing the following delegates:
+ \list
+ \li \l background
+ \li \l foreground
+ \li \l separator
+ \li \l delegate
+ \li \l highlight
+ \li \l frame
+ \endlist
+*/
+
+Style {
+ id: tumblerStyle
+
+ padding.left: __padding
+ padding.right: __padding
+ padding.top: __padding
+ padding.bottom: __padding
+
+ /*!
+ \since 1.3
+
+ The \l Tumbler that this style is attached to.
+ */
+ readonly property Tumbler control: __control
+
+ /*!
+ This property holds the spacing between each delegate.
+ */
+ property real spacing: 0
+
+ /*!
+ This property holds the amount of items visible in each column.
+
+ This value should be an odd number.
+ */
+ property int visibleItemCount: 3
+
+ /*!
+ \internal
+
+ TODO: how do we handle differing padding values?
+ */
+ readonly property real __padding: Math.max(6, Math.round(TextSingleton.implicitHeight * 0.4))
+ /*! \internal */
+ property real __delegateHeight: 0
+ /*! \internal */
+ property real __separatorWidth: 0
+
+ /*!
+ The background of the tumbler.
+ */
+ property Component background: Rectangle {
+ gradient: Gradient {
+ GradientStop { position: 0.00; color: "#acacac" }
+ GradientStop { position: 0.12; color: "#d5d5d5" }
+ GradientStop { position: 0.24; color: "#e8e8e8" }
+ GradientStop { position: 0.39; color: "#ffffff" }
+ GradientStop { position: 0.61; color: "#ffffff" }
+ GradientStop { position: 0.76; color: "#e8e8e8" }
+ GradientStop { position: 0.88; color: "#d5d5d5" }
+ GradientStop { position: 1.00; color: "#acacac" }
+ }
+ }
+
+ /*!
+ The foreground of the tumbler.
+ */
+ property Component foreground: Item {
+ clip: true
+
+ Rectangle {
+ id: rect
+ anchors.fill: parent
+ // Go one pixel larger than our parent so that we can hide our one pixel frame
+ // that the shadow is created from.
+ anchors.margins: -1
+ color: "transparent"
+ border.color: "black"
+ visible: false
+ }
+
+ DropShadow {
+ anchors.fill: rect
+ source: rect
+ radius: __padding
+ samples: Math.min(32, radius * 2)
+ }
+ }
+
+ /*!
+ The separator between each column.
+
+ The \l {Item::}{implicitWidth} property must be set, and should be the
+ same value for each separator.
+ */
+ property Component separator: Canvas {
+ implicitWidth: Math.max(10, Math.round(TextSingleton.implicitHeight * 0.4))
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ ctx.fillStyle = "#11000000";
+ ctx.fillRect(0, 0, width, height);
+ ctx.fillStyle = "#11000000";
+ ctx.fillRect(width * 0.2, 0, width * 0.6, height);
+ ctx.fillStyle = "#66000000";
+ ctx.fillRect(width * 0.4, 0, width * 0.2, height);
+ }
+ }
+
+ /*!
+ The foreground of each column.
+
+ In terms of stacking order, this component is displayed above the
+ delegate and highlight components, but below the foreground component.
+
+ \table
+ \row \li \c {readonly property int} \b styleData.column
+ \li The index of the column that contains this item.
+ \row \li \c {readonly property bool} \b styleData.activeFocus
+ \li \c true if the column that contains this item has active focus.
+
+ \endtable
+
+ Delegates for items in specific columns can be defined using
+ TumblerColumn's \l {TumblerColumn::columnForeground}{columnForeground}
+ property, which will be used instead of this component.
+ */
+ property Component columnForeground
+
+ /*!
+ The frame around the tumbler.
+
+ The \l {Item::}{implicitWidth} property must be set, and should be the
+ same value for each separator.
+ */
+ property Component frame: Canvas {
+ onPaint: {
+ // workaround for QTBUG-40792
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ var cornerRadius = Math.max(2, Math.round(TextSingleton.implicitHeight * 0.2));
+ var outerLineWidth = Math.max(1, Math.round(TextSingleton.implicitHeight * 0.05));
+ var innerLineWidth = __padding - outerLineWidth;
+
+ ctx.save();
+ ctx.lineWidth = outerLineWidth;
+ ctx.beginPath();
+ ctx.roundedRect(0, 0, width, height, cornerRadius, cornerRadius);
+ ctx.roundedRect(outerLineWidth, outerLineWidth, width - outerLineWidth * 2, height - outerLineWidth * 2,
+ cornerRadius - outerLineWidth, cornerRadius - outerLineWidth);
+ ctx.clip();
+
+ ctx.beginPath();
+ ctx.rect(0, 0, width, height);
+ var gradient = ctx.createLinearGradient(width / 2, 0, width / 2, height);
+ gradient.addColorStop(0, "#33b3b3b3");
+ gradient.addColorStop(1, "#4ce6e6e6");
+ ctx.fillStyle = gradient;
+ ctx.fill();
+ ctx.restore();
+
+ // The inner stroke must account for its corner radius.
+ cornerRadius -= outerLineWidth;
+
+ ctx.save();
+ ctx.lineWidth = innerLineWidth;
+ ctx.beginPath();
+ ctx.roundedRect(outerLineWidth, outerLineWidth, width - outerLineWidth * 2, height - outerLineWidth * 2,
+ cornerRadius, cornerRadius);
+ ctx.roundedRect(outerLineWidth + innerLineWidth, outerLineWidth + innerLineWidth,
+ width - outerLineWidth * 2 - innerLineWidth * 2, height - outerLineWidth * 2 - innerLineWidth * 2,
+ cornerRadius - innerLineWidth, cornerRadius - innerLineWidth);
+ ctx.clip();
+
+ ctx.beginPath();
+ ctx.rect(0, 0, width, height);
+ gradient = ctx.createLinearGradient(width / 2, 0, width / 2, height);
+ gradient.addColorStop(0, "#4c666666");
+ gradient.addColorStop(1, "#40cccccc");
+ ctx.fillStyle = gradient;
+ ctx.fill();
+ ctx.restore();
+ }
+ }
+
+ /*!
+ The delegate provides a template defining each item instantiated in the
+ column. Each instance of this component has access to the following properties:
+
+ \table
+ \row \li \c {readonly property int} \b styleData.index
+ \li The index of this delegate in the model.
+ \row \li \c {readonly property int} \b styleData.column
+ \li The index of the column that contains this item.
+ \row \li \c {readonly property real} \b styleData.value
+ \li The value for this delegate from the model.
+ \row \li \c {readonly property bool} \b styleData.current
+ \li \c true if this delegate is the current item.
+ \row \li \c {readonly property real} \b styleData.displacement
+ \li \c A value from \c {-visibleItemCount / 2} to
+ \c {visibleItemCount / 2} which represents how far away
+ this item is from being the current item, with \c 0 being
+ completely current.
+
+ For example, the item below will be 40% opaque when
+ it is not the current item, and transition to 100%
+ opacity when it becomes the current item:
+
+ \code
+ delegate: Text {
+ text: styleData.value
+ opacity: 0.4 + Math.max(0, 1 - Math.abs(styleData.displacement)) * 0.6
+ }
+ \endcode
+ \row \li \c {readonly property bool} \b styleData.activeFocus
+ \li \c true if the column that contains this item has active focus.
+
+ \endtable
+
+ Properties of the model are also available depending upon the type of
+ \l {qml-data-models}{Data Model}.
+
+ Delegates for items in specific columns can be defined using
+ TumblerColumn's \l {TumblerColumn::delegate}{delegate} property, which
+ will be used instead of this delegate.
+
+ The \l {Item::}{implicitHeight} property must be set, and it must be
+ the same for each delegate.
+ */
+ property Component delegate: Item {
+ implicitHeight: (control.height - padding.top - padding.bottom) / tumblerStyle.visibleItemCount
+
+ Text {
+ id: label
+ text: styleData.value
+ color: "#666666"
+ opacity: 0.4 + Math.max(0, 1 - Math.abs(styleData.displacement)) * 0.6
+ font.pixelSize: Math.round(TextSingleton.font.pixelSize * 1.25)
+ anchors.centerIn: parent
+ }
+ }
+
+ /*!
+ The delegate for the highlight of each column.
+
+ Delegates for the highlight of specific columns can be defined using
+ TumblerColumn's \l {TumblerColumn::highlight}{highlight} property,
+ which will be used instead of this delegate.
+
+ Each instance of this component has access to the following properties:
+
+ \table
+ \row \li \c {readonly property int} \b styleData.index
+ \li The index of this column in the tumbler.
+ \row \li \c {readonly property int} \b styleData.columnIndex
+ \li The index of the column that contains this highlight.
+ \row \li \c {readonly property bool} \b styleData.activeFocus
+ \li \c true if the column that contains this highlight has active focus.
+ \endtable
+ */
+ property Component highlight
+
+ /*! \internal */
+ property Component panel: Item {
+ implicitWidth: {
+ var w = (__separatorWidth * (control.columnCount - 1)) + tumblerStyle.padding.left + tumblerStyle.padding.right;
+ for (var i = 0; i < control.columnCount; ++i)
+ w += control.getColumn(i).width;
+ return w;
+ }
+ implicitHeight: TextSingleton.implicitHeight * 10 + tumblerStyle.padding.top + tumblerStyle.padding.bottom
+ }
+}
diff --git a/src/extras/Styles/Base/basestyle.qrc b/src/extras/Styles/Base/basestyle.qrc
new file mode 100644
index 00000000..2bcf0328
--- /dev/null
+++ b/src/extras/Styles/Base/basestyle.qrc
@@ -0,0 +1,19 @@
+<RCC>
+ <qresource prefix="/ExtrasImports/QtQuick/Extras/Styles/Base">
+ <file>TumblerStyle.qml</file>
+ <file>ToggleButtonStyle.qml</file>
+ <file>StatusIndicatorStyle.qml</file>
+ <file>PieMenuStyle.qml</file>
+ <file>HandleStyleHelper.qml</file>
+ <file>HandleStyle.qml</file>
+ <file>GaugeStyle.qml</file>
+ <file>DialStyle.qml</file>
+ <file>DelayButtonStyle.qml</file>
+ <file>CommonStyleHelper.qml</file>
+ <file>CircularTickmarkLabelStyle.qml</file>
+ <file>CircularGaugeStyle.qml</file>
+ <file>CircularButtonStyle.qml</file>
+ <file>images/needle.png</file>
+ <file>images/knob.png</file>
+ </qresource>
+</RCC>
diff --git a/src/extras/Styles/Base/basestyleplugin.cpp b/src/extras/Styles/Base/basestyleplugin.cpp
new file mode 100644
index 00000000..ef894910
--- /dev/null
+++ b/src/extras/Styles/Base/basestyleplugin.cpp
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "basestyleplugin.h"
+
+QT_BEGIN_NAMESPACE
+
+QtQuickExtrasStylesPlugin::QtQuickExtrasStylesPlugin(QObject *parent) :
+ QQmlExtensionPlugin(parent)
+{
+}
+
+void QtQuickExtrasStylesPlugin::registerTypes(const char *uri)
+{
+ Q_INIT_RESOURCE(basestyle);
+ const QString prefix = "qrc:/ExtrasImports/QtQuick/Extras/Styles";
+ // register version 1.0
+ qmlRegisterType(QUrl(prefix + "/Base/CircularButtonStyle.qml"), uri, 1, 0, "CircularButtonStyle");
+ qmlRegisterType(QUrl(prefix + "/Base/CircularGaugeStyle.qml"), uri, 1, 0, "CircularGaugeStyle");
+ qmlRegisterType(QUrl(prefix + "/Base/CircularTickmarkLabelStyle.qml"), uri, 1, 0, "CircularTickmarkLabelStyle");
+ qmlRegisterType(QUrl(prefix + "/Base/CommonStyleHelper.qml"), uri, 1, 0, "CommonStyleHelper");
+ qmlRegisterType(QUrl(prefix + "/Base/DelayButtonStyle.qml"), uri, 1, 0, "DelayButtonStyle");
+ qmlRegisterType(QUrl(prefix + "/Base/DialStyle.qml"), uri, 1, 0, "DialStyle");
+ qmlRegisterType(QUrl(prefix + "/Base/GaugeStyle.qml"), uri, 1, 0, "GaugeStyle");
+ qmlRegisterType(QUrl(prefix + "/Base/HandleStyleHelper.qml"), uri, 1, 0, "HandleStyleHelper");
+ qmlRegisterType(QUrl(prefix + "/Base/HandleStyle.qml"), uri, 1, 0, "HandleStyle");
+ qmlRegisterType(QUrl(prefix + "/Base/PieMenuStyle.qml"), uri, 1, 0, "PieMenuStyle");
+ qmlRegisterType(QUrl(prefix + "/Base/ToggleButtonStyle.qml"), uri, 1, 0, "ToggleButtonStyle");
+ // register version 1.1
+ qmlRegisterType(QUrl(prefix + "/Base/DialStyle.qml"), uri, 1, 1, "DialStyle");
+ qmlRegisterType(QUrl(prefix + "/Base/StatusIndicatorStyle.qml"), uri, 1, 1, "StatusIndicatorStyle");
+ // register version 1.2
+ qmlRegisterType(QUrl(prefix + "/Base/TumblerStyle.qml"), uri, 1, 2, "TumblerStyle");
+ // register version 1.3
+ qmlRegisterType(QUrl(prefix + "/Base/PieMenuStyle.qml"), uri, 1, 3, "PieMenuStyle");
+}
+
+QT_END_NAMESPACE
diff --git a/src/extras/Styles/Base/basestyleplugin.h b/src/extras/Styles/Base/basestyleplugin.h
new file mode 100644
index 00000000..4f1fb6d1
--- /dev/null
+++ b/src/extras/Styles/Base/basestyleplugin.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef STYLES_PLUGIN_H
+#define STYLES_PLUGIN_H
+
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include <QtQml/qqmlengine.h>
+
+QT_BEGIN_NAMESPACE
+
+class QtQuickExtrasStylesPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
+public:
+ explicit QtQuickExtrasStylesPlugin(QObject *parent = 0);
+
+ void registerTypes(const char *uri);
+};
+
+QT_END_NAMESPACE
+
+#endif // STYLES_PLUGIN_H
diff --git a/src/extras/Styles/Base/images/knob.png b/src/extras/Styles/Base/images/knob.png
new file mode 100644
index 00000000..ecac4d09
--- /dev/null
+++ b/src/extras/Styles/Base/images/knob.png
Binary files differ
diff --git a/src/extras/Styles/Base/images/needle.png b/src/extras/Styles/Base/images/needle.png
new file mode 100644
index 00000000..8237e516
--- /dev/null
+++ b/src/extras/Styles/Base/images/needle.png
Binary files differ
diff --git a/src/extras/Styles/Base/qmldir b/src/extras/Styles/Base/qmldir
new file mode 100644
index 00000000..509cd05c
--- /dev/null
+++ b/src/extras/Styles/Base/qmldir
@@ -0,0 +1,4 @@
+module QtQuick.Extras.Styles
+plugin qtquickextrasstylesplugin
+classname QtQuickExtrasStylesPlugin
+depends QtGraphicalEffects 1.0
diff --git a/src/extras/Styles/Flat/ApplicationWindowStyle.qml b/src/extras/Styles/Flat/ApplicationWindowStyle.qml
new file mode 100644
index 00000000..8ae620b0
--- /dev/null
+++ b/src/extras/Styles/Flat/ApplicationWindowStyle.qml
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.3 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+
+Base.ApplicationWindowStyle {
+ panel: Item {
+ readonly property alias contentArea: contentArea
+ readonly property alias menuBarArea: menuBarArea
+ readonly property alias toolBarArea: toolBarArea
+ readonly property alias statusBarArea: statusBarArea
+ readonly property bool hasToolBar: !!control.toolBar && control.toolBar.Accessible.role === Accessible.ToolBar
+
+ Rectangle {
+ id: background
+ visible: !styleData.hasColor
+ color: FlatStyle.backgroundColor
+ }
+
+ Item {
+ id: contentArea
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: statusBarArea.top
+ anchors.topMargin: toolBarArea.implicitHeight
+ }
+
+ Item {
+ id: toolBarArea
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ implicitHeight: childrenRect.height
+ height: visibleChildren.length > 0 ? implicitHeight : 0
+
+ Loader {
+ visible: active
+ active: !hasToolBar && !!control.menuBar
+ anchors.left: parent.left
+ anchors.right: parent.right
+ sourceComponent: ToolBar {
+ __menu: proxyMenu.items.length > 1 ? proxyMenu :
+ proxyMenu.items.length === 1 ? proxyMenu.items[0] : null
+ }
+ }
+ }
+
+ Item {
+ id: statusBarArea
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ implicitHeight: childrenRect.height
+ height: visibleChildren.length > 0 ? implicitHeight : 0
+ }
+
+ Item {
+ id: menuBarArea
+ visible: false
+
+ Menu {
+ id: proxyMenu
+ items: control.menuBar ? control.menuBar.menus : []
+ }
+
+ Binding {
+ target: control.toolBar
+ property: "__menu"
+ value: proxyMenu.items.length > 1 ? proxyMenu :
+ proxyMenu.items.length === 1 ? proxyMenu.items[0] : null
+ when: hasToolBar
+ }
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/BusyIndicatorStyle.qml b/src/extras/Styles/Flat/BusyIndicatorStyle.qml
new file mode 100644
index 00000000..d2809b02
--- /dev/null
+++ b/src/extras/Styles/Flat/BusyIndicatorStyle.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls.Styles 1.2 as Base
+
+Base.BusyIndicatorStyle {
+ indicator: Item {
+ id: indicator
+
+ function resolveSize() {
+ // Small: 26, Medium: 52, Large: 104
+ var sizeHint = control.styleHints ? control.styleHints['size'] : undefined
+ if (sizeHint === "small" || !sizeHint && control.width > 0 && control.width < 52)
+ return "Small"
+ if (sizeHint === "large" || !sizeHint && control.width >= 104)
+ return "Large"
+ return "Medium"
+ }
+
+ anchors.centerIn: parent
+ implicitWidth: image.sourceSize.width
+ implicitHeight: image.sourceSize.height
+
+ opacity: control.running ? 1 : 0
+ Behavior on opacity { OpacityAnimator { duration: 250 } }
+
+ Image {
+ id: image
+ anchors.centerIn: parent
+ anchors.alignWhenCentered: true
+ source: "images/BusyIndicator_Normal-" + indicator.resolveSize() + ".png"
+
+ RotationAnimator on rotation {
+ from: 0
+ to: 360
+ duration: 1000
+ loops: Animation.Infinite
+ running: indicator.visible && (control.running || indicator.opacity > 0)
+ }
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/ButtonStyle.qml b/src/extras/Styles/Flat/ButtonStyle.qml
new file mode 100644
index 00000000..d0d4ca7b
--- /dev/null
+++ b/src/extras/Styles/Flat/ButtonStyle.qml
@@ -0,0 +1,194 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Flat 1.0
+
+Base.ButtonStyle {
+ padding { top: 0; left: 0; right: 0; bottom: 0 }
+
+ readonly property bool __hovered: !Settings.hasTouchScreen && control.hovered
+
+ background: Rectangle {
+ property bool down: control.pressed || (control.checkable && control.checked)
+
+ implicitWidth: Math.round(100 * FlatStyle.scaleFactor)
+ implicitHeight: Math.round(26 * FlatStyle.scaleFactor)
+ radius: FlatStyle.radius
+
+ color: {
+ if (control.isDefault) {
+ if (control.checkable && control.checked) {
+ if (!control.enabled)
+ return Qt.rgba(0, 0, 0, 0.25);
+
+ if (control.pressed)
+ return control.activeFocus ? FlatStyle.checkedFocusedAndPressedColor : FlatStyle.checkedAndPressedColorAlt;
+
+ return control.activeFocus ? FlatStyle.checkedFocusedAndPressedColor : FlatStyle.pressedColor;
+ } else {
+ // Normal state.
+ if (!control.enabled)
+ return Qt.rgba(0, 0, 0, 0.15);
+
+ if (control.pressed)
+ return control.activeFocus ? FlatStyle.checkedFocusedAndPressedColor : FlatStyle.pressedColor;
+
+ if (control.activeFocus)
+ return control.pressed ? FlatStyle.checkedFocusedAndPressedColor : FlatStyle.focusedColor;
+
+ return FlatStyle.styleColor;
+ }
+ }
+
+ // Non-default button.
+ if (control.checkable && control.checked) {
+ if (!control.enabled)
+ return Qt.rgba(0, 0, 0, 0.1);
+
+ if (control.pressed)
+ return control.activeFocus ? FlatStyle.checkedFocusedAndPressedColor : FlatStyle.checkedAndPressedColor;
+
+ return control.activeFocus ? FlatStyle.focusedAndPressedColor : FlatStyle.pressedColorAlt;
+ }
+
+ if (control.pressed)
+ return control.activeFocus ? FlatStyle.focusedAndPressedColor : FlatStyle.pressedColorAlt;
+
+ if (!control.activeFocus && __hovered)
+ return FlatStyle.hoveredColor;
+
+ return "transparent";
+ }
+
+ border.color: {
+ if (!control.isDefault) {
+ if (!control.enabled)
+ return Qt.rgba(0, 0, 0, (control.checkable && control.checked ? 0.3 : 0.2));
+
+ if (control.activeFocus && !control.pressed && !control.checked)
+ return FlatStyle.focusedColor;
+
+ if (!__hovered && !control.checked && !control.pressed)
+ return FlatStyle.styleColor;
+ }
+
+ return "transparent";
+ }
+
+ border.width: control.activeFocus ? FlatStyle.twoPixels : FlatStyle.onePixel
+ }
+
+ label: Item {
+ readonly property bool isDown: control.pressed || (control.checkable && control.checked)
+ readonly property bool hasIcon: icon.status === Image.Ready || icon.status === Image.Loading
+ readonly property bool hasMenu: !!control.menu
+ readonly property bool hasText: !!control.text
+ readonly property int labelSpacing: Math.round(10 * FlatStyle.scaleFactor)
+ implicitWidth: icon.implicitWidth + label.implicitWidth + indicator.implicitHeight
+ + (hasIcon || hasText ? labelSpacing : 0) + (hasIcon && hasText ? labelSpacing : 0)
+ implicitHeight: Math.max(Math.max(icon.implicitHeight, label.implicitHeight), indicator.height)
+ baselineOffset: label.y + label.baselineOffset
+ Image {
+ id: icon
+ visible: hasIcon
+ source: control.iconSource
+ // center align when only icon, otherwise left align
+ anchors.left: parent.left
+ anchors.leftMargin: hasMenu || hasText ? labelSpacing : parent.width / 2 - width / 2
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ Text {
+ id: label
+ visible: hasText
+ text: control.text
+ elide: Text.ElideRight
+ font.family: FlatStyle.fontFamily
+ renderType: FlatStyle.__renderType
+ opacity: !enabled && !control.isDefault ? FlatStyle.disabledOpacity : 1.0
+ color: control.isDefault ? FlatStyle.selectedTextColor :
+ !enabled ? FlatStyle.disabledColor :
+ isDown ? FlatStyle.selectedTextColor :
+ control.activeFocus ? FlatStyle.focusedTextColor :
+ __hovered ? FlatStyle.selectedTextColor : FlatStyle.styleColor
+ horizontalAlignment: hasMenu != hasIcon ? Qt.AlignLeft : Qt.AlignHCenter
+ verticalAlignment: Qt.AlignVCenter
+ anchors.fill: parent
+ anchors.leftMargin: labelSpacing + (hasIcon ? labelSpacing + icon.width : 0)
+ anchors.rightMargin: hasMenu ? indicator.width : labelSpacing
+ }
+ Item {
+ id: indicator
+ visible: hasMenu
+ implicitWidth: Math.round(28 * FlatStyle.scaleFactor)
+ implicitHeight: Math.round(26 * FlatStyle.scaleFactor)
+ // center align when only menu, otherwise right align
+ anchors.right: parent.right
+ anchors.rightMargin: !hasIcon && !hasText ? parent.width / 2 - width / 2 : 0
+ anchors.verticalCenter: parent.verticalCenter
+
+ opacity: control.enabled ? 1.0 : 0.2
+ property color color: !control.enabled ? FlatStyle.disabledColor :
+ control.activeFocus && !control.pressed ? FlatStyle.focusedColor :
+ control.activeFocus || control.pressed || __hovered ? FlatStyle.selectedTextColor : FlatStyle.styleColor
+
+ Rectangle {
+ x: Math.round(7 * FlatStyle.scaleFactor)
+ y: Math.round(7 * FlatStyle.scaleFactor)
+ width: Math.round(14 * FlatStyle.scaleFactor)
+ height: FlatStyle.twoPixels
+ color: indicator.color
+ }
+ Rectangle {
+ x: Math.round(7 * FlatStyle.scaleFactor)
+ y: Math.round(12 * FlatStyle.scaleFactor)
+ width: Math.round(14 * FlatStyle.scaleFactor)
+ height: FlatStyle.twoPixels
+ color: indicator.color
+ }
+ Rectangle {
+ x: Math.round(7 * FlatStyle.scaleFactor)
+ y: Math.round(17 * FlatStyle.scaleFactor)
+ width: Math.round(14 * FlatStyle.scaleFactor)
+ height: FlatStyle.twoPixels
+ color: indicator.color
+ }
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/CalendarStyle.qml b/src/extras/Styles/Flat/CalendarStyle.qml
new file mode 100644
index 00000000..b41e3c8e
--- /dev/null
+++ b/src/extras/Styles/Flat/CalendarStyle.qml
@@ -0,0 +1,205 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.3
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Private 1.0
+import QtQuick.Extras.Private.CppUtils 1.0
+
+Base.CalendarStyle {
+ // This style doesn't support a grid.
+ gridVisible: false
+ // gridColor == frame color
+ gridColor: control.enabled ? FlatStyle.mediumFrameColor : FlatStyle.alphaFrameColor
+ // This ensures the week number separator is hidden.
+ __gridLineWidth: 0
+
+ // Used in conjunction with the control height.
+ // These values are taken from the flat style specs.
+ readonly property real __headerFontRatio: 18 / 264
+ readonly property real __weekNumberFontRatio: 9 / 264
+ readonly property real __dayFontRatio: 13 / 264
+
+ navigationBar: Rectangle {
+ implicitHeight: Math.round(control.height * 0.2121)
+ color: control.enabled ? FlatStyle.styleColor : FlatStyle.mediumFrameColor
+
+ MouseArea {
+ id: previousMonth
+ width: parent.height
+ height: width
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ onClicked: control.showPreviousMonth()
+
+ Rectangle {
+ anchors.fill: parent
+ color: FlatStyle.selectedTextColor
+ opacity: previousMonth.pressed ? 0.25 : 0
+
+ Behavior on opacity {
+ NumberAnimation {
+ duration: 80
+ }
+ }
+ }
+
+ LeftArrowIcon {
+ width: Math.round(parent.width * 0.3)
+ height: Math.round(parent.width * 0.3)
+ anchors.centerIn: parent
+ }
+ }
+ Label {
+ id: dateText
+ text: styleData.title
+ color: FlatStyle.selectedTextColor
+ elide: Text.ElideRight
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ font.pixelSize: control.height * __headerFontRatio
+ font.family: FlatStyle.fontFamily
+ font.weight: Font.Light
+ renderType: FlatStyle.__renderType
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: previousMonth.right
+ anchors.leftMargin: 2
+ anchors.right: nextMonth.left
+ anchors.rightMargin: 2
+ }
+ MouseArea {
+ id: nextMonth
+ width: parent.height
+ height: width
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ onClicked: control.showNextMonth()
+
+ Rectangle {
+ anchors.fill: parent
+ color: FlatStyle.selectedTextColor
+ opacity: nextMonth.pressed ? 0.25 : 0
+
+ Behavior on opacity {
+ NumberAnimation {
+ duration: 100
+ }
+ }
+ }
+
+ LeftArrowIcon {
+ width: Math.round(parent.width * 0.3)
+ height: Math.round(parent.width * 0.3)
+ anchors.centerIn: parent
+ scale: -1
+ }
+ }
+ }
+
+ dayDelegate: Item {
+ Rectangle {
+ id: rect
+ // There should always be at least 1 pixel margin between circles.
+ width: MathUtils.roundEven(Math.min(parent.width, parent.height) - 1)
+ height: width
+ anchors.centerIn: parent
+ radius: width / 2
+ color: (styleData.date !== undefined && styleData.selected
+ ? (control.enabled ? FlatStyle.styleColor : FlatStyle.disabledColor)
+ : "transparent")
+ border.width: styleData.today ? FlatStyle.onePixel : 0
+ border.color: !control.enabled ? FlatStyle.alphaFrameColor : FlatStyle.styleColor
+ opacity: control.enabled ? 1 : 0.15
+ }
+
+ Label {
+ id: dayDelegateText
+ text: styleData.date.getDate()
+ anchors.fill: rect
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ fontSizeMode: Text.Fit
+ font.pixelSize: control.height * __dayFontRatio
+ font.family: FlatStyle.fontFamily
+ font.weight: Font.Light
+ renderType: FlatStyle.__renderType
+ opacity: !control.enabled ? (!styleData.valid || !styleData.visibleMonth ? 0.3 : 0.6) :
+ (!styleData.valid || !styleData.visibleMonth ? 0.3 : 1)
+ color: !control.enabled ? FlatStyle.disabledColor
+ : (styleData.selected ? FlatStyle.selectedTextColor : FlatStyle.textColor)
+ }
+ }
+
+ weekNumberDelegate: Item {
+ implicitWidth: control.width * 0.14
+
+ Label {
+ text: styleData.weekNumber
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: control.height * (__dayFontRatio - __weekNumberFontRatio) / 2
+ fontSizeMode: Text.Fit
+ font.pixelSize: control.height * __weekNumberFontRatio
+ renderType: FlatStyle.__renderType
+ color: !control.enabled ? FlatStyle.disabledColor : FlatStyle.styleColor
+ opacity: !control.enabled ? FlatStyle.disabledOpacity : 1
+ }
+ }
+
+ dayOfWeekDelegate: Item {
+ implicitHeight: control.height * 0.13
+
+ Label {
+ text: localeDayName.length == 0 || localeDayName.length > 1
+ ? control.__locale.dayName(styleData.dayOfWeek, Locale.ShortFormat)[0]
+ : localeDayName
+ color: !control.enabled ? FlatStyle.disabledColor : FlatStyle.styleColor
+ opacity: !control.enabled ? FlatStyle.disabledOpacity : 1
+ font.family: FlatStyle.fontFamily
+ anchors.fill: parent
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ fontSizeMode: Text.Fit
+ font.pixelSize: control.height * __headerFontRatio
+ renderType: FlatStyle.__renderType
+
+ property string localeDayName: control.__locale.dayName(styleData.dayOfWeek, Locale.NarrowFormat)
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/CheckBoxDrawer.qml b/src/extras/Styles/Flat/CheckBoxDrawer.qml
new file mode 100644
index 00000000..5955b6fe
--- /dev/null
+++ b/src/extras/Styles/Flat/CheckBoxDrawer.qml
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.3
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Flat 1.0
+
+// Internal, for use with CheckBoxStyle and GroupBoxStyle
+Item {
+ implicitWidth: Math.round(26 * FlatStyle.scaleFactor)
+ implicitHeight: implicitWidth
+
+ property bool controlEnabled: false
+ property bool controlActiveFocus: false
+ property bool controlPressed: false
+ property bool controlHovered: false
+ property bool controlChecked: false
+ property alias backgroundVisible: background.visible
+
+ onControlActiveFocusChanged: checkCanvas.requestPaint()
+ onControlEnabledChanged: checkCanvas.requestPaint()
+ onControlPressedChanged: checkCanvas.requestPaint()
+
+ Rectangle {
+ id: background
+ anchors.centerIn: parent
+ width: Math.round(20 * FlatStyle.scaleFactor)
+ height: width
+ radius: FlatStyle.radius
+ color: controlEnabled ? (controlPressed ? FlatStyle.lightFrameColor : FlatStyle.backgroundColor) : FlatStyle.disabledFillColor
+ border.color: !controlEnabled ? FlatStyle.disabledFillColor :
+ (controlPressed ? FlatStyle.darkFrameColor :
+ (controlActiveFocus ? FlatStyle.focusedColor :
+ (controlHovered ? FlatStyle.styleColor : FlatStyle.lightFrameColor)))
+ border.width: controlActiveFocus &&
+ !controlPressed ? FlatStyle.twoPixels : FlatStyle.onePixel
+ }
+
+ Canvas {
+ id: checkCanvas
+ anchors.centerIn: parent
+ width: Math.round(20 * FlatStyle.scaleFactor)
+ height: width
+ visible: controlChecked
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ ctx.beginPath();
+ ctx.moveTo(0.417 * width, 0.783 * height);
+ ctx.lineTo(0.152 * width, 0.519 * height);
+ ctx.lineTo(0.248 * width, 0.423 * height);
+ ctx.lineTo(0.417 * width, 0.593 * height);
+ ctx.lineTo(0.75 * width, 0.26 * height);
+ ctx.lineTo(0.846 * width, 0.355 * height);
+ ctx.lineTo();
+ ctx.closePath();
+ ctx.fillStyle = !controlEnabled ? FlatStyle.mediumFrameColor :
+ (controlPressed ? FlatStyle.checkedAndPressedColor :
+ (controlActiveFocus ? FlatStyle.focusedColor : FlatStyle.styleColor));
+ ctx.fill();
+ }
+ }
+
+}
diff --git a/src/extras/Styles/Flat/CheckBoxStyle.qml b/src/extras/Styles/Flat/CheckBoxStyle.qml
new file mode 100644
index 00000000..65377365
--- /dev/null
+++ b/src/extras/Styles/Flat/CheckBoxStyle.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+
+Base.CheckBoxStyle {
+ spacing: Math.round(8 * FlatStyle.scaleFactor)
+
+ indicator: CheckBoxDrawer {
+ controlEnabled: control.enabled
+ controlActiveFocus: control.activeFocus
+ controlPressed: control.pressed
+ controlHovered: !Settings.hasTouchScreen && control.hovered
+ controlChecked: control.checked
+ }
+
+ label: Text {
+ text: control.text
+ font.family: FlatStyle.fontFamily
+ renderType: FlatStyle.__renderType
+ anchors.verticalCenter: parent.verticalCenter
+ opacity: enabled ? 1.0 : FlatStyle.disabledOpacity
+ color: !enabled ? FlatStyle.disabledColor :
+ control.activeFocus ? FlatStyle.focusedTextColor : FlatStyle.defaultTextColor
+ }
+}
diff --git a/src/extras/Styles/Flat/CircularButtonStyle.qml b/src/extras/Styles/Flat/CircularButtonStyle.qml
new file mode 100644
index 00000000..774870e6
--- /dev/null
+++ b/src/extras/Styles/Flat/CircularButtonStyle.qml
@@ -0,0 +1,38 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick.Extras.Styles 1.3 as Base
+
+Base.CircularButtonStyle { }
diff --git a/src/extras/Styles/Flat/CircularGaugeStyle.qml b/src/extras/Styles/Flat/CircularGaugeStyle.qml
new file mode 100644
index 00000000..d18cdea5
--- /dev/null
+++ b/src/extras/Styles/Flat/CircularGaugeStyle.qml
@@ -0,0 +1,168 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Extras.Private 1.0
+import QtQuick.Extras.Private.CppUtils 1.1
+import QtQuick.Extras.Styles 1.3 as Base
+
+Base.CircularGaugeStyle {
+ id: circularGaugeStyle
+
+ tickmarkInset: __thickArcTickmarklessMargin + __thickArcLineWidth / 2 - __tickmarkLength / 2
+ minorTickmarkInset: __thickArcTickmarklessMargin + __thickArcLineWidth / 2 - (__tickmarkLength / 2) / 2
+ labelInset: Math.max(textMetrics.width, textMetrics.height) / 2
+
+ // A stroked arc starts losing its shape when it is very thick, so prevent that from happening.
+ readonly property real __thickArcLineWidth: Math.min(22 * FlatStyle.scaleFactor, Math.round(outerRadius * 0.2))
+ readonly property real __thickArcTickmarklessMargin: labelInset * 2
+ readonly property real __tickmarkLength: __thickArcLineWidth * 0.5
+ readonly property real __tickmarkWidth: FlatStyle.onePixel
+ readonly property real __fontSize: Math.max(6, __protectedScope.toPixels(0.12))
+ // TODO: add this to Utils or something; it's not specific to this control
+ readonly property real __antialiasingAdjustment: FlatStyle.onePixel
+
+ Text {
+ id: textMetrics
+ font.pixelSize: __fontSize
+ text: control.maximumValue.toFixed(0)
+ visible: false
+ }
+
+ background: Item {
+ implicitWidth: Math.round(160 * FlatStyle.scaleFactor)
+ implicitHeight: Math.round(160 * FlatStyle.scaleFactor)
+
+ readonly property real thinArcLineWidth: FlatStyle.onePixel
+ readonly property bool tickmarklessVariant: false
+ readonly property real arcDistance: thinArcLineWidth * 3
+
+ Connections {
+ target: control
+ onValueChanged: thickArc.requestPaint()
+ onMinimumValueChanged: thickArc.requestPaint()
+ onMaximumValueChanged: thickArc.requestPaint()
+ onEnabledChanged: {
+ thickArc.requestPaint();
+ thinArc.requestPaint();
+ }
+ }
+
+ // TODO: test performance of this on the Pi
+ Canvas {
+ id: thickArc
+ anchors.fill: parent
+ anchors.margins: Math.floor(tickmarklessVariant ? arcDistance : __thickArcTickmarklessMargin)
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ ctx.lineWidth = __thickArcLineWidth;
+ var radius = Math.floor(width / 2 - ctx.lineWidth / 2 - __antialiasingAdjustment);
+ if (radius < 0)
+ return;
+
+ ctx.beginPath();
+ ctx.globalAlpha = control.enabled ? 1 : 0.2;
+ ctx.strokeStyle = control.enabled ? FlatStyle.styleColor : FlatStyle.disabledColor;
+ var startAngle = MathUtils.degToRad(minimumValueAngle - 90);
+ var endAngle = MathUtils.degToRad(needleRotation - 90);
+ ctx.arc(Math.floor(width / 2), Math.floor(height / 2), radius, startAngle, endAngle, false);
+ ctx.stroke();
+ }
+ }
+
+ Canvas {
+ id: thinArc
+ anchors.fill: parent
+ anchors.margins: Math.floor(tickmarklessVariant ? 0 : thickArc.anchors.margins + __thickArcLineWidth + arcDistance)
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ ctx.lineWidth = thinArcLineWidth;
+ var radius = width / 2 - ctx.lineWidth / 2 - __antialiasingAdjustment;
+ if (radius < 0)
+ return;
+
+ ctx.beginPath();
+ ctx.globalAlpha = control.enabled ? 1 : 0.2;
+ ctx.strokeStyle = control.enabled ? FlatStyle.styleColor : FlatStyle.disabledColor;
+ var startAngle = MathUtils.degToRad(minimumValueAngle - 90);
+ var endAngle = MathUtils.degToRad(maximumValueAngle - 90);
+ ctx.arc(Math.floor(width / 2), Math.floor(height / 2), radius, startAngle, endAngle, false);
+ ctx.stroke();
+ }
+ }
+ }
+
+ needle: null
+ foreground: null
+
+ tickmark: Rectangle {
+ implicitWidth: __tickmarkWidth
+ implicitHeight: __tickmarkLength
+ antialiasing: true
+ color: control.value < styleData.value || isEdgeTickmark ? (control.enabled ? FlatStyle.styleColor : FlatStyle.disabledColor) : FlatStyle.selectedTextColor
+ opacity: control.value < styleData.value || isEdgeTickmark ? (control.enabled ? 1 : 0.2) : 0.5
+ visible: (!isEdgeTickmark) || (control.value < styleData.value)
+ || (styleData.value === control.minimumValue && control.value === control.minimumValue)
+
+ readonly property bool isEdgeTickmark: styleData.value === control.minimumValue || styleData.value === control.maximumValue
+ }
+
+ minorTickmark: Rectangle {
+ implicitWidth: __tickmarkWidth
+ implicitHeight: __tickmarkLength / 2
+ antialiasing: true
+ color: control.enabled ? FlatStyle.styleColor : FlatStyle.disabledColor
+ visible: control.value < styleData.value
+ opacity: control.enabled ? 1 : 0.2
+ }
+
+ tickmarkLabel: Text {
+ font.pixelSize: __fontSize
+ text: styleData.value
+ color: control.enabled ? FlatStyle.defaultTextColor : FlatStyle.disabledColor
+ opacity: control.enabled ? 1 : FlatStyle.disabledOpacity
+ antialiasing: true
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+}
diff --git a/src/extras/Styles/Flat/CircularTickmarkLabelStyle.qml b/src/extras/Styles/Flat/CircularTickmarkLabelStyle.qml
new file mode 100644
index 00000000..8127608b
--- /dev/null
+++ b/src/extras/Styles/Flat/CircularTickmarkLabelStyle.qml
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick.Extras.Styles 1.3 as Base
+
+Base.CircularTickmarkLabelStyle {}
diff --git a/src/extras/Styles/Flat/ComboBoxStyle.qml b/src/extras/Styles/Flat/ComboBoxStyle.qml
new file mode 100644
index 00000000..b263c9cd
--- /dev/null
+++ b/src/extras/Styles/Flat/ComboBoxStyle.qml
@@ -0,0 +1,163 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Extras.Private 1.0
+
+Base.ComboBoxStyle {
+ id: style
+
+ padding {
+ top: 0
+ left: Math.round(FlatStyle.scaleFactor * (control.editable ? 10 : 6))
+ right: 0
+ bottom: 0
+ }
+
+ font.family: FlatStyle.fontFamily
+ textColor: !control.enabled ? FlatStyle.mediumFrameColor :
+ control.editable ? FlatStyle.defaultTextColor :
+ control.pressed ? FlatStyle.selectedTextColor :
+ control.activeFocus ? FlatStyle.focusedTextColor : FlatStyle.styleColor
+ selectionColor: FlatStyle.highlightColor
+ selectedTextColor: FlatStyle.selectedTextColor
+
+ dropDownButtonWidth: Math.round(28 * FlatStyle.scaleFactor)
+
+ background: Item {
+ id: background
+ anchors.fill: parent
+ implicitWidth: Math.round(100 * FlatStyle.scaleFactor)
+ implicitHeight: Math.round(26 * FlatStyle.scaleFactor)
+
+ Rectangle {
+ anchors.fill: parent
+ radius: FlatStyle.radius
+
+ visible: !control.editable
+ opacity: control.enabled ? 1.0 : control.editable ? 0.1 : 0.2
+
+ color: control.editable && !control.enabled ? FlatStyle.disabledColor :
+ control.activeFocus && control.pressed ? FlatStyle.focusedAndPressedColor :
+ control.pressed ? FlatStyle.pressedColorAlt : "transparent"
+
+ border.width: control.activeFocus ? FlatStyle.twoPixels : FlatStyle.onePixel
+ border.color: !control.enabled ? FlatStyle.disabledColor :
+ control.activeFocus && control.pressed ? FlatStyle.focusedAndPressedColor :
+ control.activeFocus ? FlatStyle.highlightColor :
+ control.pressed ? FlatStyle.pressedColorAlt : FlatStyle.styleColor
+ }
+
+ Item {
+ clip: true
+ visible: control.editable
+ width: style.dropDownButtonWidth
+ anchors.top: parent.top
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+
+ Rectangle {
+ width: background.width
+ anchors.top: parent.top
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ radius: FlatStyle.radius
+ color: !control.enabled ? FlatStyle.lightFrameColor :
+ control.activeFocus && control.pressed ? FlatStyle.focusedAndPressedColor :
+ control.activeFocus ? FlatStyle.focusedColor :
+ control.pressed ? FlatStyle.pressedColor : FlatStyle.styleColor
+ }
+ }
+
+ LeftArrowIcon {
+ width: Math.round(14 * FlatStyle.scaleFactor)
+ height: Math.round(14 * FlatStyle.scaleFactor)
+ anchors.right: parent.right
+ anchors.rightMargin: width / 2
+ anchors.verticalCenter: parent.verticalCenter
+ rotation: control.pressed ? 90 : -90
+ color: control.editable || control.pressed ? FlatStyle.selectedTextColor
+ : control.activeFocus ? FlatStyle.focusedColor
+ : control.enabled ? FlatStyle.styleColor : FlatStyle.disabledColor
+ opacity: control.enabled || control.editable ? 1.0 : 0.2
+ }
+ }
+
+ __editor: Item {
+ clip: true
+ anchors.fill: parent
+ anchors.bottomMargin: anchors.margins + 1 // ### FIXME: compensate the -1 margin in ComboBoxStyle:
+ Rectangle {
+ anchors.fill: parent
+ anchors.rightMargin: -Math.round(3 * FlatStyle.scaleFactor)
+
+ radius: FlatStyle.radius
+ color: !control.enabled ? FlatStyle.disabledColor : FlatStyle.backgroundColor
+ opacity: control.enabled ? 1.0 : 0.1
+
+ border.width: control.activeFocus ? FlatStyle.twoPixels : FlatStyle.onePixel
+ border.color: !control.enabled ? FlatStyle.disabledColor :
+ control.activeFocus ? FlatStyle.highlightColor :
+ control.pressed ? FlatStyle.pressedColorAlt : FlatStyle.styleColor
+ }
+ }
+
+ __dropDownStyle: MenuStyle {
+ font: style.font
+ __maxPopupHeight: 600
+ __menuItemType: "comboboxitem"
+ __scrollerStyle: ScrollViewStyle { }
+
+ itemDelegate.background: Item {
+ Rectangle {
+ anchors.fill: parent
+ color: !!styleData.pressed || styleData.selected ? FlatStyle.disabledColor : "transparent"
+ opacity: !!styleData.pressed || styleData.selected ? 0.15 : 1.0
+ }
+ Rectangle {
+ color: FlatStyle.darkFrameColor
+ width: parent.width
+ height: FlatStyle.onePixel
+ anchors.bottom: parent.bottom
+ visible: styleData.index < control.__menu.items.length - 1 // TODO
+ }
+ }
+ }
+
+ __selectionHandle: SelectionHandleStyle { }
+ __cursorHandle: CursorHandleStyle { }
+}
diff --git a/src/extras/Styles/Flat/CursorHandleStyle.qml b/src/extras/Styles/Flat/CursorHandleStyle.qml
new file mode 100644
index 00000000..4efe5c15
--- /dev/null
+++ b/src/extras/Styles/Flat/CursorHandleStyle.qml
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls.Styles.Flat 1.0
+
+TextHandle {
+ x: -Math.round(FlatStyle.scaleFactor)
+ type: TextHandle.CursorHandle
+ color: FlatStyle.selectionHandleColor
+ scaleFactor: FlatStyle.scaleFactor
+ visible: styleData.hasSelection
+}
diff --git a/src/extras/Styles/Flat/DelayButtonStyle.qml b/src/extras/Styles/Flat/DelayButtonStyle.qml
new file mode 100644
index 00000000..2e438497
--- /dev/null
+++ b/src/extras/Styles/Flat/DelayButtonStyle.qml
@@ -0,0 +1,291 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras.Styles 1.1 as Base
+import QtQuick.Extras.Private 1.0
+import QtQuick.Extras.Private.CppUtils 1.1
+
+Base.DelayButtonStyle {
+ id: delayButtonStyle
+
+ StateGroup {
+ id: privateScope
+
+ property color buttonColor
+ property color borderColor
+ property color textColor
+ property color progressBarColor
+ readonly property real progressBarWidth: Math.round(4 * FlatStyle.scaleFactor)
+ readonly property real progressBarSpacing: Math.round(16 * FlatStyle.scaleFactor)
+ readonly property bool hovered: control.hovered && (!Settings.hasTouchScreen && !Settings.isMobile)
+
+ states: [
+ State {
+ name: "normal"
+ when: control.enabled && !control.activeFocus && !control.pressed && !privateScope.hovered && !control.checked
+
+ PropertyChanges {
+ target: privateScope
+ buttonColor: "white"
+ borderColor: FlatStyle.styleColor
+ textColor: FlatStyle.styleColor
+ progressBarColor: borderColor
+ }
+ },
+ State {
+ name: "disabled"
+ when: !control.enabled
+
+ PropertyChanges {
+ target: privateScope
+ buttonColor: FlatStyle.disabledFillColor
+ borderColor: "transparent"
+ textColor: "white"
+ progressBarColor: buttonColor
+ }
+ },
+ State {
+ name: "hovered"
+ when: !control.activeFocus && !control.pressed && privateScope.hovered
+
+ PropertyChanges {
+ target: privateScope
+ buttonColor: FlatStyle.hoveredColor
+ borderColor: "transparent"
+ textColor: "white"
+ progressBarColor: buttonColor
+ }
+ },
+ State {
+ name: "focused"
+ when: control.activeFocus && !control.pressed && !control.checked
+
+ PropertyChanges {
+ target: privateScope
+ buttonColor: "white"
+ borderColor: FlatStyle.highlightColor
+ textColor: borderColor
+ progressBarColor: borderColor
+ }
+ },
+ State {
+ name: "pressed"
+ when: !control.activeFocus && control.pressed && !control.checked
+
+ PropertyChanges {
+ target: privateScope
+ buttonColor: FlatStyle.pressedColorAlt
+ borderColor: "transparent"
+ textColor: "white"
+ progressBarColor: buttonColor
+ }
+ },
+ State {
+ name: "focusedAndPressed"
+ when: control.activeFocus && control.pressed && !control.checked
+
+ PropertyChanges {
+ target: privateScope
+ buttonColor: FlatStyle.focusedAndPressedColor
+ borderColor: "transparent"
+ textColor: "white"
+ progressBarColor: buttonColor
+ }
+ },
+ State {
+ name: "checked"
+ when: !control.activeFocus && !control.pressed && !privateScope.hovered && control.checked
+
+ PropertyChanges {
+ target: privateScope
+ buttonColor: FlatStyle.pressedColorAlt
+ borderColor: "transparent"
+ textColor: "white"
+ progressBarColor: buttonColor
+ }
+ },
+ State {
+ name: "checkedAndPressed"
+ when: !control.activeFocus && control.pressed && control.checked
+
+ PropertyChanges {
+ target: privateScope
+ buttonColor: FlatStyle.checkedAndPressedColorAlt
+ borderColor: "transparent"
+ textColor: "white"
+ progressBarColor: buttonColor
+ }
+ },
+ State {
+ name: "checkedAndFocused"
+ when: control.activeFocus && !control.pressed && control.checked
+
+ PropertyChanges {
+ target: privateScope
+ buttonColor: FlatStyle.focusedAndPressedColor
+ borderColor: "transparent"
+ textColor: "white"
+ progressBarColor: buttonColor
+ }
+ },
+ State {
+ name: "checkedPressedAndFocused"
+ when: control.activeFocus && control.pressed && control.checked
+
+ PropertyChanges {
+ target: privateScope
+ buttonColor: FlatStyle.checkedFocusedAndPressedColor
+ borderColor: "transparent"
+ textColor: "white"
+ progressBarColor: buttonColor
+ }
+ }
+ ]
+ }
+
+ label: Text {
+ text: control.text
+ anchors.fill: parent
+ anchors.margins: privateScope.progressBarWidth + privateScope.progressBarSpacing
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ wrapMode: Text.Wrap
+ fontSizeMode: Text.Fit
+ font.family: FlatStyle.fontFamily
+ font.weight: Font.Light
+ renderType: FlatStyle.__renderType
+ color: privateScope.textColor
+ font.pixelSize: TextSingleton.font.pixelSize * 1.5
+ }
+
+ background: Item {
+ implicitWidth: Math.round(160 * FlatStyle.scaleFactor)
+ implicitHeight: Math.round(160 * FlatStyle.scaleFactor)
+
+ Item {
+ id: container
+ width: Math.min(parent.width, parent.height)
+ height: width
+ anchors.centerIn: parent
+
+ Rectangle {
+ id: body
+ anchors.fill: parent
+ anchors.margins: privateScope.progressBarWidth + privateScope.progressBarSpacing
+ radius: width / 2
+ color: privateScope.buttonColor
+ border.color: privateScope.borderColor
+ border.width: FlatStyle.onePixel
+ }
+
+ CircularProgressBar {
+ id: progressBar
+ anchors.fill: parent
+ antialiasing: true
+ barWidth: privateScope.progressBarWidth
+ progress: control.progress
+ minimumValueAngle: 0
+ maximumValueAngle: 360
+
+ // TODO: Add gradient property if/when we drop support for building with 5.1.
+ Component.onCompleted: {
+ clearStops()
+ addStop(0, privateScope.progressBarColor)
+ redraw()
+ }
+
+ Connections {
+ target: privateScope
+ onProgressBarColorChanged: {
+ progressBar.clearStops()
+ progressBar.addStop(0, privateScope.progressBarColor)
+ progressBar.redraw()
+ }
+ }
+
+ states: [
+ State {
+ name: "normal"
+ when: control.progress < 1
+
+ PropertyChanges {
+ target: progressBar
+ opacity: 1
+ }
+ },
+ State {
+ name: "flashing"
+ when: control.progress === 1
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "normal"
+ to: "flashing"
+
+ SequentialAnimation {
+ loops: Animation.Infinite
+
+ NumberAnimation {
+ target: progressBar
+ property: "opacity"
+ from: 1
+ to: 0
+ duration: 500
+ easing.type: Easing.InOutSine
+ }
+ NumberAnimation {
+ target: progressBar
+ property: "opacity"
+ from: 0
+ to: 1
+ duration: 500
+ easing.type: Easing.InOutSine
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+
+ foreground: null
+}
diff --git a/src/extras/Styles/Flat/DialStyle.qml b/src/extras/Styles/Flat/DialStyle.qml
new file mode 100644
index 00000000..3e841d9b
--- /dev/null
+++ b/src/extras/Styles/Flat/DialStyle.qml
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Private 1.0
+import QtQuick.Extras.Private.CppUtils 1.1
+import QtQuick.Extras.Styles 1.3 as Base
+
+Base.DialStyle {
+ id: dialStyle
+
+ handleInset: handleSize * 1.5 + Math.min(control.width, control.height) * 0.15
+
+ readonly property int handleSize: Math.max(6, Math.round(Math.min(control.width, control.height) * 0.05))
+
+ background: Item {
+ implicitWidth: Math.round(160 * FlatStyle.scaleFactor)
+ implicitHeight: Math.round(160 * FlatStyle.scaleFactor)
+
+ CircularProgressBar {
+ id: progressBar
+ anchors.fill: parent
+ progress: control.value
+ minimumValueAngle: -150
+ maximumValueAngle: 150
+ barWidth: handleSize / 2
+ backgroundColor: FlatStyle.grooveColor
+
+ function updateColor() {
+ clearStops();
+ addStop(0, control.enabled ? (control.activeFocus ? FlatStyle.focusedColor : FlatStyle.styleColor) : FlatStyle.mediumFrameColor);
+ redraw();
+ }
+
+ Component.onCompleted: updateColor()
+
+ Connections {
+ target: control
+ onEnabledChanged: progressBar.updateColor()
+ onActiveFocusChanged: progressBar.updateColor()
+ }
+ }
+
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: parent.width * 0.15
+ radius: width / 2
+ color: "white"
+ border.width: control.enabled && control.activeFocus ? FlatStyle.twoPixels : FlatStyle.onePixel
+ border.color: control.enabled ? (control.activeFocus ? FlatStyle.focusedColor : FlatStyle.styleColor) : FlatStyle.mediumFrameColor
+ }
+ }
+
+ handle: Rectangle {
+ color: control.enabled ? (control.activeFocus ? FlatStyle.focusedColor : FlatStyle.styleColor) : FlatStyle.mediumFrameColor
+ width: handleSize
+ height: width
+ radius: height / 2
+ }
+
+ tickmark: null
+}
diff --git a/src/extras/Styles/Flat/Flat.pro b/src/extras/Styles/Flat/Flat.pro
new file mode 100644
index 00000000..6f70c7a8
--- /dev/null
+++ b/src/extras/Styles/Flat/Flat.pro
@@ -0,0 +1,67 @@
+TARGET = qtquickextrasflatplugin
+TARGETPATH = QtQuick/Controls/Styles/Flat
+
+QT += qml quick
+
+HEADERS += \
+ flatstyleplugin.h \
+ qquicktexthandle.h
+SOURCES += \
+ flatstyleplugin.cpp \
+ qquicktexthandle.cpp
+
+FLAT_STYLE += \
+ $$PWD/FlatStyle.qml \
+ $$PWD/ApplicationWindowStyle.qml \
+ $$PWD/BusyIndicatorStyle.qml \
+ $$PWD/ButtonStyle.qml \
+ $$PWD/CalendarStyle.qml \
+ $$PWD/CheckBoxStyle.qml \
+ $$PWD/CheckBoxDrawer.qml \
+ $$PWD/CircularButtonStyle.qml \
+ $$PWD/CircularGaugeStyle.qml \
+ $$PWD/CircularTickmarkLabelStyle.qml \
+ $$PWD/ComboBoxStyle.qml \
+ $$PWD/CursorHandleStyle.qml \
+ $$PWD/DelayButtonStyle.qml \
+ $$PWD/DialStyle.qml \
+ $$PWD/FocusFrameStyle.qml \
+ $$PWD/GaugeStyle.qml \
+ $$PWD/GroupBoxStyle.qml \
+ $$PWD/LeftArrowIcon.qml \
+ $$PWD/MenuBarStyle.qml \
+ $$PWD/MenuStyle.qml \
+ $$PWD/PieMenuStyle.qml \
+ $$PWD/ProgressBarStyle.qml \
+ $$PWD/RadioButtonStyle.qml \
+ $$PWD/ScrollViewStyle.qml \
+ $$PWD/SelectionHandleStyle.qml \
+ $$PWD/SliderStyle.qml \
+ $$PWD/SpinBoxStyle.qml \
+ $$PWD/StatusBarStyle.qml \
+ $$PWD/StatusIndicatorStyle.qml \
+ $$PWD/SwitchStyle.qml \
+ $$PWD/TabViewStyle.qml \
+ $$PWD/TableViewStyle.qml \
+ $$PWD/TextAreaStyle.qml \
+ $$PWD/TextFieldStyle.qml \
+ $$PWD/ToggleButtonStyle.qml \
+ $$PWD/ToolBarStyle.qml \
+ $$PWD/ToolButtonStyle.qml \
+ $$PWD/ToolButtonBackground.qml \
+ $$PWD/ToolButtonIndicator.qml \
+ $$PWD/TumblerStyle.qml
+
+FLAT_STYLE += \
+ $$PWD/images/BusyIndicator_Normal-Large.png \
+ $$PWD/images/BusyIndicator_Normal-Medium.png \
+ $$PWD/images/BusyIndicator_Normal-Small.png \
+ $$PWD/fonts/OpenSans-Light.ttf \
+ $$PWD/fonts/OpenSans-Regular.ttf \
+ $$PWD/fonts/OpenSans-Semibold.ttf \
+ $$PWD/fonts/LICENSE.txt \
+
+RESOURCES += flatstyle.qrc
+
+CONFIG += no_cxx_module
+load(qml_plugin)
diff --git a/src/extras/Styles/Flat/FlatStyle.qml b/src/extras/Styles/Flat/FlatStyle.qml
new file mode 100644
index 00000000..60e03d4e
--- /dev/null
+++ b/src/extras/Styles/Flat/FlatStyle.qml
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+pragma Singleton
+
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+
+QtObject {
+ readonly property string fontFamily: __openSansRegularLoader.name
+
+ readonly property color backgroundColor: "#ffffff"
+ readonly property color defaultTextColor: "#333333"
+ readonly property color styleColor: "#5caa15"
+ readonly property color strokeColor: "#328930"
+ readonly property color hoveredColor: "#7dbb44"
+ readonly property color focusedColor: "#4da6d8"
+ readonly property color focusedTextColor: "#1288cb"
+ readonly property color focusedAndPressedColor: "#4595c2"
+ readonly property color focusedStrokeColor: "#2f86bb"
+ readonly property color focusedAndPressedStrokeColor: "#266b96"
+ readonly property color checkedFocusedAndPressedColor: "#3a7ca2"
+ readonly property color checkedAndPressedColor: "#4a8811"
+ readonly property color checkedAndPressedColorAlt: "#3c6f0e"
+ readonly property color pressedColor: "#457f10"
+ readonly property color pressedColorAlt: "#539913"
+ readonly property color pressedStrokeColor: "#286e26"
+ readonly property color invalidColor: "#dd0000"
+ readonly property color disabledColor: "#000000"
+ readonly property color disabledFillColor: "#d9d9d9"
+ readonly property color highlightColor: "#4da6d8"
+ readonly property color selectedTextColor: "#ffffff"
+ readonly property color textSelectionColor: "#ceeaff"
+ readonly property color textColor: "#1a1a1a"
+ readonly property color grooveColor: "#14000000"
+ readonly property color lightFrameColor: "#cccccc"
+ readonly property color mediumFrameColor: "#b3b3b3"
+ readonly property color darkFrameColor: "#999999"
+ readonly property color alphaFrameColor: "#33000000"
+ readonly property color selectionHandleColor: "#0668ec"
+ readonly property color flatFrameColor: "#f2f2f2"
+ readonly property real disabledOpacity: 0.3
+ readonly property real defaultFontSize: 13
+
+ // 16 is the implicitHeight of text on a PC monitor. This should scale well
+ // to other devices. For example, if the implicitHeight is 64 on a touch
+ // device, the scale factor will be x4.
+ readonly property real scaleFactor: Math.max(1, TextSingleton.implicitHeight / 16)
+
+ readonly property real onePixel: Math.max(1, Math.round(scaleFactor * 1))
+ readonly property real twoPixels: Math.max(2, Math.round(scaleFactor * 2))
+ readonly property int radius: Math.round(scaleFactor * 3)
+
+ property FontLoader __openSansDemiBoldLoader: FontLoader {
+ source: "fonts/OpenSans-Semibold.ttf"
+ }
+
+ property FontLoader __openSansRegularLoader: FontLoader {
+ source: "fonts/OpenSans-Regular.ttf"
+ }
+
+ property FontLoader __openSansLightLoader: FontLoader {
+ source: "fonts/OpenSans-Light.ttf"
+ }
+
+ readonly property int __renderType: Text.QtRendering
+}
diff --git a/src/extras/Styles/Flat/FocusFrameStyle.qml b/src/extras/Styles/Flat/FocusFrameStyle.qml
new file mode 100644
index 00000000..eb4fa009
--- /dev/null
+++ b/src/extras/Styles/Flat/FocusFrameStyle.qml
@@ -0,0 +1,38 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick.Controls.Private 1.0 as Private
+
+Private.FocusFrameStyle { }
diff --git a/src/extras/Styles/Flat/GaugeStyle.qml b/src/extras/Styles/Flat/GaugeStyle.qml
new file mode 100644
index 00000000..d5bf986b
--- /dev/null
+++ b/src/extras/Styles/Flat/GaugeStyle.qml
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Extras.Styles 1.3 as Base
+import QtQuick.Extras.Private 1.0
+
+Base.GaugeStyle {
+ id: gaugeStyle
+
+ readonly property int __totalValueBarWidth: Math.round(22 * FlatStyle.scaleFactor + __lineSpacing + __lineWidth)
+ readonly property int __actualValueBarWidth: __totalValueBarWidth - __lineSpacing - __lineWidth
+ readonly property int __lineWidth: FlatStyle.onePixel
+ readonly property int __lineSpacing: Math.round(3 * FlatStyle.scaleFactor)
+
+ background: Item {
+ Rectangle {
+ color: control.enabled ? FlatStyle.styleColor : FlatStyle.disabledColor
+ opacity: control.enabled ? 1 : 0.2
+ width: __lineWidth
+ height: parent.height
+ x: control.tickmarkAlignment === Qt.AlignLeft || control.tickmarkAlignment === Qt.AlignTop ? parent.width - width : 0
+ }
+ }
+
+ valueBar: Item {
+ implicitWidth: __totalValueBarWidth
+
+ Rectangle {
+ color: control.enabled ? FlatStyle.styleColor : FlatStyle.disabledColor
+ opacity: control.enabled ? 1 : 0.2
+ x: control.tickmarkAlignment === Qt.AlignRight || control.tickmarkAlignment === Qt.AlignBottom ? __lineWidth + __lineSpacing : 0
+ implicitWidth: __actualValueBarWidth
+ height: parent.height
+ }
+ }
+
+ foreground: null
+
+ tickmark: Item {
+ id: tickmarkItem
+ implicitWidth: Math.round(12 * FlatStyle.scaleFactor)
+ implicitHeight: FlatStyle.onePixel
+
+ Rectangle {
+ x: control.tickmarkAlignment === Qt.AlignLeft || control.tickmarkAlignment === Qt.AlignTop
+ ? parent.width + __actualValueBarWidth / 2 - width / 2
+ : -__actualValueBarWidth / 2 - width / 2
+ // Length of the tickmark is the same as the spacing between the tickmarks and labels.
+ width: parent.width
+ height: parent.height
+ color: gaugeStyle.valuePosition > styleData.valuePosition + height ? FlatStyle.selectedTextColor : (control.enabled ? FlatStyle.styleColor : FlatStyle.disabledColor)
+ opacity: gaugeStyle.valuePosition > styleData.valuePosition + height ? 0.5 : (control.enabled ? 1 : 0.2)
+ visible: (styleData.index === 0 && gaugeStyle.valuePosition === 0) ||
+ (styleData.index !== 0 && (gaugeStyle.valuePosition <= styleData.valuePosition || gaugeStyle.valuePosition > styleData.valuePosition + height))
+ }
+ }
+
+ minorTickmark: Item {
+ implicitWidth: Math.round(6 * FlatStyle.scaleFactor)
+ implicitHeight: FlatStyle.onePixel
+
+ Rectangle {
+ x: control.tickmarkAlignment === Qt.AlignLeft || control.tickmarkAlignment === Qt.AlignTop
+ ? parent.width + __actualValueBarWidth / 2 - width / 2
+ : -__actualValueBarWidth / 2 - width / 2
+ width: parent.width
+ height: parent.height
+ color: control.enabled ? FlatStyle.styleColor : FlatStyle.disabledColor
+ opacity: control.enabled ? 1 : 0.2
+ visible: gaugeStyle.valuePosition <= styleData.valuePosition
+ }
+ }
+
+ tickmarkLabel: Item {
+ implicitWidth: textLabel.implicitWidth
+ implicitHeight: textLabel.implicitHeight
+
+ Label {
+ id: textLabel
+ text: control.formatValue(styleData.value)
+ font: control.font
+ color: control.enabled ? FlatStyle.defaultTextColor : FlatStyle.disabledColor
+ opacity: control.enabled ? 1 : FlatStyle.disabledOpacity
+ renderType: FlatStyle.__renderType
+ Connections {
+ target: control
+ // Setting an anchor to undefined leaves it in the position it was in last.
+ // We don't want that, as we want the label's y pos to be at zero when it's not anchored.
+ // Using a binding here whose when property is true when control.orientation === Qt.Horizontal
+ // doesn't work.
+ onOrientationChanged: textLabel.y = 0
+ }
+ anchors.baseline: control.orientation === Qt.Vertical ? parent.verticalCenter : undefined
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/GroupBoxStyle.qml b/src/extras/Styles/Flat/GroupBoxStyle.qml
new file mode 100644
index 00000000..65f8cf19
--- /dev/null
+++ b/src/extras/Styles/Flat/GroupBoxStyle.qml
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls.Private 1.0 as Private
+import QtQuick.Controls.Styles.Flat 1.0
+
+Private.GroupBoxStyle {
+ id: root
+
+ readonly property int spacing: Math.round(8 * FlatStyle.scaleFactor)
+
+ padding {
+ left: spacing
+ right: spacing
+ bottom: spacing
+ }
+
+ textColor: !control.enabled ? FlatStyle.disabledColor : check.activeFocus ? FlatStyle.focusedTextColor : FlatStyle.defaultTextColor
+
+ panel: Item {
+ anchors.fill: parent
+
+ Rectangle {
+ id: background
+ radius: FlatStyle.radius
+ border.width: control.flat ? 0 : FlatStyle.onePixel
+ border.color: FlatStyle.lightFrameColor
+ color: control.flat ? FlatStyle.flatFrameColor : "transparent"
+ anchors.fill: parent
+ anchors.topMargin: Math.max(indicator.height, label.height) + root.spacing / 2
+ }
+
+ // TODO:
+ Binding {
+ target: root
+ property: "padding.top"
+ value: background.anchors.topMargin + root.spacing
+ }
+
+ CheckBoxDrawer {
+ id: indicator
+ visible: control.checkable
+ controlEnabled: control.enabled
+ controlActiveFocus: check.activeFocus
+ controlPressed: check.pressed
+ controlChecked: control.checked
+ anchors.left: parent.left
+ // compensate padding around check indicator
+ anchors.leftMargin: Math.round(-3 * FlatStyle.scaleFactor)
+ }
+
+ Text {
+ id: label
+ anchors.left: control.checkable ? indicator.right : parent.left
+ anchors.right: parent.right
+ anchors.verticalCenter: indicator.verticalCenter
+ anchors.leftMargin: control.checkable ? root.spacing / 2 : 0
+ text: control.title
+ color: root.textColor
+ renderType: FlatStyle.__renderType
+ elide: Text.ElideRight
+ font.family: FlatStyle.fontFamily
+ font.pixelSize: 16 * FlatStyle.scaleFactor
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/LeftArrowIcon.qml b/src/extras/Styles/Flat/LeftArrowIcon.qml
new file mode 100644
index 00000000..de64f3c9
--- /dev/null
+++ b/src/extras/Styles/Flat/LeftArrowIcon.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.3
+
+Canvas {
+ implicitWidth: 32
+ implicitHeight: 32
+
+ property color color: "white"
+
+ onColorChanged: requestPaint()
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ ctx.beginPath();
+ ctx.moveTo(0.66321495 * width, 0.06548707 * height);
+ ctx.lineTo(0.2191097 * width, 0.50959232 * height);
+ ctx.lineTo(0.66628301 * width, 0.95676556 * height);
+ ctx.lineTo(0.77673409 * width, 0.84631453 * height);
+ ctx.lineTo(0.44001181 * width, 0.50959232 * height);
+ ctx.lineTo(0.77366599 * width, 0.1759381 * height);
+ ctx.fillStyle = color;
+ ctx.fill();
+ }
+}
diff --git a/src/extras/Styles/Flat/MenuBarStyle.qml b/src/extras/Styles/Flat/MenuBarStyle.qml
new file mode 100644
index 00000000..4be92cbc
--- /dev/null
+++ b/src/extras/Styles/Flat/MenuBarStyle.qml
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick.Controls.Styles 1.2 as Base
+
+Base.MenuBarStyle {
+ __isNative: false
+ background: null
+ itemDelegate: null
+}
diff --git a/src/extras/Styles/Flat/MenuStyle.qml b/src/extras/Styles/Flat/MenuStyle.qml
new file mode 100644
index 00000000..54a7e33f
--- /dev/null
+++ b/src/extras/Styles/Flat/MenuStyle.qml
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+
+Base.MenuStyle {
+ id: style
+ font.family: FlatStyle.fontFamily
+ __leftLabelMargin: Math.round(30 * FlatStyle.scaleFactor)
+
+ frame: Rectangle {
+ border.color: FlatStyle.darkFrameColor
+ border.width: FlatStyle.onePixel
+ }
+
+ itemDelegate.background: Rectangle {
+ color: !!styleData.pressed || styleData.selected ? FlatStyle.disabledColor : "transparent"
+ opacity: !!styleData.pressed || styleData.selected ? 0.15 : 1.0
+ }
+
+ itemDelegate.label: Text {
+ text: formatMnemonic(styleData.text, styleData.underlineMnemonic)
+ renderType: FlatStyle.__renderType
+ color: FlatStyle.defaultTextColor
+ font.family: FlatStyle.fontFamily
+ font.pixelSize: FlatStyle.defaultFontSize
+ verticalAlignment: Text.AlignVCenter
+ height: Math.round(26 * FlatStyle.scaleFactor)
+ }
+
+ itemDelegate.shortcut: Text {
+ text: styleData.shortcut
+ renderType: FlatStyle.__renderType
+ color: FlatStyle.defaultTextColor
+ font.family: FlatStyle.fontFamily
+ font.pixelSize: FlatStyle.defaultFontSize
+ }
+
+ itemDelegate.checkmarkIndicator: CheckBoxDrawer {
+ visible: styleData.checked
+ controlEnabled: styleData.enabled
+ controlChecked: styleData.checked
+ backgroundVisible: false
+ x: -4 // ### FIXME: compensate hardcoded "x: 4" in MenuStyle
+ y: FlatStyle.onePixel
+ }
+
+ itemDelegate.submenuIndicator: LeftArrowIcon {
+ scale: -1
+ color: "#000000"
+ width: Math.round(10 * FlatStyle.scaleFactor)
+ height: Math.round(10 * FlatStyle.scaleFactor)
+ baselineOffset: Math.round(7 * FlatStyle.scaleFactor)
+ }
+
+ separator: Rectangle {
+ color: FlatStyle.lightFrameColor
+ width: parent.width
+ implicitHeight: FlatStyle.onePixel
+ }
+}
diff --git a/src/extras/Styles/Flat/PieMenuStyle.qml b/src/extras/Styles/Flat/PieMenuStyle.qml
new file mode 100644
index 00000000..9b314610
--- /dev/null
+++ b/src/extras/Styles/Flat/PieMenuStyle.qml
@@ -0,0 +1,169 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.3
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Extras.Styles 1.3 as Base
+import QtQuick.Extras.Private 1.0
+
+Base.PieMenuStyle {
+ id: pieMenuStyle
+ shadowRadius: 0
+ shadowSpread: 0
+ shadowColor: "transparent"
+ backgroundColor: FlatStyle.styleColor
+ selectionColor: FlatStyle.styleColor
+ startAngle: -78
+ endAngle: 78
+ cancelRadius: radius * 0.4352
+
+ __implicitWidth: Math.round(85 * 2 * FlatStyle.scaleFactor)
+ __implicitHeight: __implicitWidth
+
+ title: null
+
+ menuItem: Item {
+ readonly property var __styleData: styleData
+
+ Canvas {
+ id: actionCanvas
+ antialiasing: true
+ anchors.fill: parent
+ anchors.margins: -1
+
+ Connections {
+ target: pieMenuStyle
+ onStartAngleChanged: actionCanvas.requestPaint()
+ onEndAngleChanged: actionCanvas.requestPaint()
+ }
+
+ Connections {
+ target: __styleData
+ onPressedChanged: actionCanvas.requestPaint()
+ }
+
+ readonly property bool stroke: !__styleData.hovered
+ readonly property real spacingThickness: Math.max(4 * FlatStyle.scaleFactor, radius * 0.05)
+ // It's actually one, but stroking always goes 50/50 on the inside/outside, so this is
+ // an easy way of making it one pixel without having to mess around with more drawing code.
+ // This will work as long as the fill and stroke colors are both completely opaque.
+ readonly property real lineWidth: FlatStyle.twoPixels
+ // The following properties are all for either side of a radius/circumference, so the total is actually double.
+ readonly property real outerMenuItemSpacing: Math.asin(spacingThickness / (2 * radius))
+ readonly property real innerMenuItemSpacing: Math.asin(spacingThickness / (2 * cancelRadius))
+ // The total angle to subtract from the circumference of the inner radius arc
+ readonly property real innerRadiusStrokeCircumferenceAdjustment: Math.asin(lineWidth / (2 * cancelRadius))
+ readonly property real outerRadiusStrokeCircumferenceAdjustment: Math.asin(lineWidth / (2 * radius))
+
+ onStrokeChanged: actionCanvas.requestPaint()
+
+ function drawRingSection(ctx, x, y, section, r, ringWidth, ringColor) {
+ if (stroke) {
+ ctx.strokeStyle = ringColor;
+ ctx.fillStyle = "white";
+ } else {
+ ctx.fillStyle = ringColor;
+ }
+
+ ctx.beginPath();
+
+ if (stroke)
+ ctx.lineWidth = lineWidth;
+ var start = control.__protectedScope.sectionStartAngle(section);
+ var end = control.__protectedScope.sectionEndAngle(section);
+ // Adjust the radius to account for stroke being 50% inside/50% outside.
+ var radius = !stroke ? r : r - ctx.lineWidth / 2;
+ // Add spacing between the items, while still accounting for reversed menus.
+ if (start > end) {
+ start -= outerMenuItemSpacing;
+ end += outerMenuItemSpacing;
+ if (stroke) {
+ start -= outerRadiusStrokeCircumferenceAdjustment;
+ end += outerRadiusStrokeCircumferenceAdjustment;
+ }
+ } else {
+ start += outerMenuItemSpacing;
+ end -= outerMenuItemSpacing;
+ if (stroke) {
+ start += outerRadiusStrokeCircumferenceAdjustment;
+ end -= outerRadiusStrokeCircumferenceAdjustment;
+ }
+ }
+
+ ctx.arc(x, y, radius, start, end, start > end);
+
+ start = control.__protectedScope.sectionStartAngle(section);
+ end = control.__protectedScope.sectionEndAngle(section);
+ radius = !stroke ? ringWidth : ringWidth + ctx.lineWidth / 2;
+ if (start > end) {
+ start -= innerMenuItemSpacing;
+ end += innerMenuItemSpacing;
+ if (stroke) {
+ start -= innerRadiusStrokeCircumferenceAdjustment;
+ end += innerRadiusStrokeCircumferenceAdjustment;
+ }
+ } else {
+ start += innerMenuItemSpacing;
+ end -= innerMenuItemSpacing;
+ if (stroke) {
+ start += innerRadiusStrokeCircumferenceAdjustment;
+ end -= innerRadiusStrokeCircumferenceAdjustment;
+ }
+ }
+
+ ctx.arc(x, y, radius, end, start, start <= end);
+ ctx.closePath();
+
+ if (stroke)
+ ctx.stroke();
+
+ ctx.fill();
+ }
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+ drawRingSection(ctx, width / 2, height / 2, styleData.index, radius, cancelRadius,
+ __styleData.pressed ? FlatStyle.pressedColorAlt : (stroke ? backgroundColor : selectionColor));
+ }
+ }
+
+ PieMenuIcon {
+ control: pieMenuStyle.control
+ styleData: __styleData
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/ProgressBarStyle.qml b/src/extras/Styles/Flat/ProgressBarStyle.qml
new file mode 100644
index 00000000..f0b5bdd4
--- /dev/null
+++ b/src/extras/Styles/Flat/ProgressBarStyle.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Private.CppUtils 1.1
+
+Base.ProgressBarStyle {
+ background: Item {
+ implicitWidth: Math.round(100 * FlatStyle.scaleFactor)
+ implicitHeight: Math.round(16 * FlatStyle.scaleFactor)
+
+ FlatProgressBar {
+ enabled: control.enabled
+ width: Math.round(parent.width)
+ height: Math.round(parent.height)
+ indeterminate: control.indeterminate
+ progress: (control.value - control.minimumValue) / (control.maximumValue - control.minimumValue)
+ }
+ }
+
+ progress: null
+}
diff --git a/src/extras/Styles/Flat/RadioButtonStyle.qml b/src/extras/Styles/Flat/RadioButtonStyle.qml
new file mode 100644
index 00000000..779e8636
--- /dev/null
+++ b/src/extras/Styles/Flat/RadioButtonStyle.qml
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras 1.3
+
+Base.RadioButtonStyle {
+ spacing: Math.round(8 * FlatStyle.scaleFactor)
+
+ indicator: Item {
+ implicitWidth: Math.round(26 * FlatStyle.scaleFactor)
+ implicitHeight: implicitWidth
+
+ Rectangle {
+ id: outer
+ anchors.centerIn: parent
+ width: Math.round(20 * FlatStyle.scaleFactor)
+ height: width
+ radius: width / 2
+ color: control.enabled ? (control.pressed ? FlatStyle.lightFrameColor : FlatStyle.backgroundColor) : FlatStyle.disabledFillColor
+ border.color: !control.enabled ? FlatStyle.disabledFillColor :
+ (control.pressed ? FlatStyle.darkFrameColor :
+ (control.activeFocus ? FlatStyle.focusedColor :
+ (!Settings.hasTouchScreen && control.hovered ? FlatStyle.styleColor : FlatStyle.lightFrameColor)))
+ border.width: control.activeFocus && !control.pressed ? FlatStyle.twoPixels : FlatStyle.onePixel
+ }
+
+ Rectangle {
+ id: inner
+ anchors.centerIn: parent
+ implicitWidth: Math.round(FlatStyle.scaleFactor * 8)
+ width: implicitWidth + (outer.width % 2 + implicitWidth % 2) % 2
+ height: width
+ radius: width / 2
+ visible: control.checked
+ color: !control.enabled ? FlatStyle.mediumFrameColor :
+ (control.activeFocus ? FlatStyle.focusedColor :
+ (control.pressed ? FlatStyle.checkedAndPressedColor : FlatStyle.styleColor))
+ }
+ }
+
+ label: Text {
+ text: control.text
+ font.family: FlatStyle.fontFamily
+ renderType: FlatStyle.__renderType
+ anchors.verticalCenter: parent.verticalCenter
+ opacity: enabled ? 1.0 : FlatStyle.disabledOpacity
+ color: !enabled ? FlatStyle.disabledColor :
+ control.activeFocus ? FlatStyle.focusedTextColor : FlatStyle.defaultTextColor
+ }
+}
diff --git a/src/extras/Styles/Flat/ScrollViewStyle.qml b/src/extras/Styles/Flat/ScrollViewStyle.qml
new file mode 100644
index 00000000..7e94b7db
--- /dev/null
+++ b/src/extras/Styles/Flat/ScrollViewStyle.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+
+Base.ScrollViewStyle {
+ readonly property int barWidth: 2 * Math.round(FlatStyle.scaleFactor)
+ readonly property int frameWidth: control.frameVisible ? Math.max(1, Math.round(FlatStyle.scaleFactor)) : 0
+ padding {
+ top: frameWidth
+ left: frameWidth
+ right: frameWidth
+ bottom: frameWidth
+ }
+ corner: null
+ transientScrollBars: true
+ frame: Rectangle {
+ color: control["backgroundVisible"] ? FlatStyle.backgroundColor : "transparent"
+ border.color: FlatStyle.mediumFrameColor
+ border.width: frameWidth
+ visible: control.frameVisible
+ }
+ scrollBarBackground: Item {
+ implicitWidth: 2 * barWidth
+ implicitHeight: 2 * barWidth
+ }
+ handle: Item {
+ implicitWidth: barWidth
+ implicitHeight: barWidth
+ Rectangle {
+ color: FlatStyle.darkFrameColor
+ radius: barWidth / 2
+ anchors.fill: parent
+ anchors.topMargin: styleData.horizontal ? 0 : barWidth
+ anchors.leftMargin: styleData.horizontal ? barWidth : 0
+ anchors.rightMargin: styleData.horizontal ? barWidth : 0
+ anchors.bottomMargin: styleData.horizontal ? 0 : barWidth
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/SelectionHandleStyle.qml b/src/extras/Styles/Flat/SelectionHandleStyle.qml
new file mode 100644
index 00000000..954e4f8b
--- /dev/null
+++ b/src/extras/Styles/Flat/SelectionHandleStyle.qml
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls.Styles.Flat 1.0
+
+TextHandle {
+ x: -width
+ type: TextHandle.SelectionHandle
+ color: FlatStyle.selectionHandleColor
+ scaleFactor: FlatStyle.scaleFactor
+}
diff --git a/src/extras/Styles/Flat/SliderStyle.qml b/src/extras/Styles/Flat/SliderStyle.qml
new file mode 100644
index 00000000..191612c5
--- /dev/null
+++ b/src/extras/Styles/Flat/SliderStyle.qml
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Private 1.0
+
+Base.SliderStyle {
+ handle: Item {
+ width: Math.round(26 * FlatStyle.scaleFactor)
+ height: width
+
+ readonly property bool focusedOnly: control.activeFocus && !control.pressed
+
+ Rectangle {
+ id: handleBorder
+ width: parent.width
+ height: width
+ radius: width / 2
+ color: focusedOnly ? FlatStyle.focusedColor :
+ control.hovered && !control.pressed ? FlatStyle.styleColor : "#000000"
+ opacity: (control.activeFocus || control.hovered) && !control.pressed ? 1.0 : 0.2
+ }
+
+ Rectangle {
+ id: handleBody
+ readonly property real borderThickness: focusedOnly ? FlatStyle.twoPixels : FlatStyle.onePixel
+ x: borderThickness
+ y: borderThickness
+ width: parent.width - 2 * borderThickness
+ height: width
+ border.color: "white"
+ border.width: (width - parent.width * 10 / 26) / 2
+ radius: width / 2
+ color: !control.enabled ? FlatStyle.disabledFillColor :
+ focusedOnly ? FlatStyle.focusedColor : FlatStyle.styleColor
+ }
+
+ Rectangle {
+ id: pressedDarkness
+ anchors.fill: parent
+ radius: width / 2
+ color: "#000000"
+ opacity: 0.2
+ visible: control.pressed
+ }
+ }
+
+ groove: Item {
+ implicitWidth: Math.round(100 * FlatStyle.scaleFactor)
+ height: Math.round(4 * FlatStyle.scaleFactor)
+ anchors.verticalCenter: parent.verticalCenter
+
+ Rectangle {
+ id: emptyGroove
+ width: parent.width
+ height: parent.height
+ radius: Math.round(2 * FlatStyle.scaleFactor)
+ color: "#000000"
+ opacity: control.enabled ? 0.2 : 0.12
+ }
+
+ Rectangle {
+ id: filledGroove
+ color: control.enabled ? FlatStyle.styleColor : FlatStyle.mediumFrameColor
+ width: styleData.handlePosition
+ height: parent.height
+ radius: emptyGroove.radius
+ }
+ }
+
+ // TODO: tickmarks
+}
diff --git a/src/extras/Styles/Flat/SpinBoxStyle.qml b/src/extras/Styles/Flat/SpinBoxStyle.qml
new file mode 100644
index 00000000..1b182da5
--- /dev/null
+++ b/src/extras/Styles/Flat/SpinBoxStyle.qml
@@ -0,0 +1,153 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+
+Base.SpinBoxStyle {
+ padding { top: 0; left: 0; right: 0; bottom: 0 }
+ renderType: FlatStyle.__renderType
+
+ panel: Item {
+ property int horizontalAlignment: Qt.AlignHCenter
+ property int verticalAlignment: Qt.AlignVCenter
+
+ property color foregroundColor: !control.enabled ? FlatStyle.mediumFrameColor : FlatStyle.defaultTextColor
+ property color selectionColor: FlatStyle.highlightColor
+ property color selectedTextColor: FlatStyle.selectedTextColor
+ property var margins: QtObject {
+ readonly property real top: 2 * FlatStyle.scaleFactor
+ readonly property real left: decrement.width
+ readonly property real right: increment.width
+ readonly property real bottom: 2 * FlatStyle.scaleFactor
+ }
+
+ property rect upRect: Qt.rect(increment.x, increment.y, increment.width, increment.height)
+ property rect downRect: Qt.rect(decrement.x, decrement.y, decrement.width, decrement.height)
+
+ property font font
+ font.family: FlatStyle.fontFamily
+
+ implicitWidth: Math.round(100 * FlatStyle.scaleFactor)
+ implicitHeight: Math.round(26 * FlatStyle.scaleFactor)
+
+ Item {
+ id: decrement
+ clip: true
+ width: Math.round(28 * FlatStyle.scaleFactor)
+ height: parent.height
+
+ Rectangle {
+ width: parent.width + FlatStyle.radius
+ height: parent.height
+ color: !control.enabled ? FlatStyle.lightFrameColor :
+ control.activeFocus && styleData.downPressed ? FlatStyle.checkedFocusedAndPressedColor :
+ control.activeFocus ? FlatStyle.highlightColor :
+ styleData.downPressed ? FlatStyle.checkedAndPressedColor : FlatStyle.styleColor
+ radius: FlatStyle.radius
+ }
+
+ Rectangle {
+ color: FlatStyle.backgroundColor
+ width: Math.round(10 * FlatStyle.scaleFactor)
+ height: Math.round(2 * FlatStyle.scaleFactor)
+ anchors.horizontalCenter: parent.left
+ anchors.horizontalCenterOffset: Math.round(14 * FlatStyle.scaleFactor)
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+
+ Item {
+ id: increment
+ clip: true
+ width: Math.round(28 * FlatStyle.scaleFactor)
+ height: parent.height
+ anchors.right: parent.right
+
+ Rectangle {
+ width: parent.width + FlatStyle.radius
+ height: parent.height
+ anchors.right: parent.right
+ color: !control.enabled ? FlatStyle.lightFrameColor :
+ control.activeFocus && styleData.upPressed ? FlatStyle.checkedFocusedAndPressedColor :
+ control.activeFocus ? FlatStyle.highlightColor :
+ styleData.upPressed ? FlatStyle.checkedAndPressedColor : FlatStyle.styleColor
+ radius: FlatStyle.radius
+ }
+
+ Rectangle {
+ color: FlatStyle.backgroundColor
+ width: Math.round(10 * FlatStyle.scaleFactor)
+ height: Math.round(2 * FlatStyle.scaleFactor)
+ anchors.horizontalCenter: parent.right
+ anchors.horizontalCenterOffset: Math.round(-14 * FlatStyle.scaleFactor)
+ anchors.verticalCenter: parent.verticalCenter
+ }
+
+ Rectangle {
+ color: FlatStyle.backgroundColor
+ width: Math.round(2 * FlatStyle.scaleFactor)
+ height: Math.round(10 * FlatStyle.scaleFactor)
+ anchors.horizontalCenter: parent.right
+ anchors.horizontalCenterOffset: Math.round(-14 * FlatStyle.scaleFactor)
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+
+ Rectangle {
+ id: frame
+ anchors.fill: parent
+ anchors.leftMargin: decrement.width
+ anchors.rightMargin: increment.width
+ color: !control.enabled ? "transparent" :
+ control.activeFocus ? FlatStyle.highlightColor : FlatStyle.mediumFrameColor
+
+ Rectangle {
+ id: field
+ anchors.fill: parent
+ anchors.topMargin: Math.round((!control.enabled ? 0 : control.activeFocus ? 2 : 1) * FlatStyle.scaleFactor)
+ anchors.bottomMargin: Math.round((!control.enabled ? 0 : control.activeFocus ? 2 : 1) * FlatStyle.scaleFactor)
+ color: !control.enabled ? FlatStyle.disabledColor : FlatStyle.backgroundColor
+ opacity: !control.enabled ? 0.1 : 1.0
+ }
+ }
+ }
+
+ __selectionHandle: null
+ __cursorHandle: null
+}
diff --git a/src/extras/Styles/Flat/StatusBarStyle.qml b/src/extras/Styles/Flat/StatusBarStyle.qml
new file mode 100644
index 00000000..e2bc77ff
--- /dev/null
+++ b/src/extras/Styles/Flat/StatusBarStyle.qml
@@ -0,0 +1,38 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick.Controls.Styles 1.2 as Base
+
+Base.StatusBarStyle { }
diff --git a/src/extras/Styles/Flat/StatusIndicatorStyle.qml b/src/extras/Styles/Flat/StatusIndicatorStyle.qml
new file mode 100644
index 00000000..fb527665
--- /dev/null
+++ b/src/extras/Styles/Flat/StatusIndicatorStyle.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.3
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Extras.Styles 1.3 as Base
+import QtQuick.Extras.Private 1.0
+import QtQuick.Extras.Private.CppUtils 1.0
+
+Base.StatusIndicatorStyle {
+ color: FlatStyle.focusedTextColor
+
+ indicator: Item {
+ implicitWidth: Math.max(12, MathUtils.roundEven(12 * FlatStyle.scaleFactor))
+ implicitHeight: MathUtils.roundEven(implicitWidth / 2)
+
+ Rectangle {
+ // Math.max because the control could be manually resized to be too small.
+ width: Math.max(12, MathUtils.roundEven(parent.width))
+ height: MathUtils.roundEven(width / 2)
+ radius: Math.max(2, height * 0.2)
+ anchors.centerIn: parent
+ color: !control.enabled || !control.active ? FlatStyle.disabledColor : control.color
+ opacity: control.enabled ? (control.active ? 1 : 0.3) : (control.active ? FlatStyle.disabledOpacity : 0.15)
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/SwitchStyle.qml b/src/extras/Styles/Flat/SwitchStyle.qml
new file mode 100644
index 00000000..3918c474
--- /dev/null
+++ b/src/extras/Styles/Flat/SwitchStyle.qml
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+
+Base.SwitchStyle {
+ readonly property int __knobHeight: Math.round(26 * FlatStyle.scaleFactor)
+
+ groove: Item {
+ implicitWidth: Math.round(46 * FlatStyle.scaleFactor)
+ implicitHeight: __knobHeight
+ Rectangle {
+ radius: height / 2
+ y: 1 * FlatStyle.scaleFactor
+ implicitWidth: parent.implicitWidth
+ implicitHeight: Math.round(24 * FlatStyle.scaleFactor)
+ border.width: (control.activeFocus ? FlatStyle.twoPixels : FlatStyle.onePixel)
+ border.color: control.activeFocus ? FlatStyle.highlightColor : control.enabled && control.checked ? FlatStyle.styleColor : FlatStyle.mediumFrameColor
+ color: !control.checked ? "transparent" :
+ !control.enabled ? FlatStyle.disabledFillColor :
+ control.activeFocus ? FlatStyle.highlightColor : FlatStyle.styleColor
+ }
+ }
+
+ handle: Item {
+ implicitWidth: __knobHeight
+ implicitHeight: __knobHeight
+ Rectangle {
+ id: knobShadow
+ x: 1 * FlatStyle.scaleFactor
+ y: 1 * FlatStyle.scaleFactor
+ radius: height / 2
+ width: parent.width
+ height: parent.height
+ color: "#000000"
+ opacity: 0.1
+ }
+ Rectangle {
+ id: knob
+ radius: height / 2
+ width: parent.width
+ height: parent.height
+ border.width: (control.activeFocus ? FlatStyle.twoPixels : FlatStyle.onePixel)
+ border.color: !control.enabled ? FlatStyle.mediumFrameColor :
+ control.pressed && control.activeFocus ? FlatStyle.focusedAndPressedStrokeColor :
+ control.activeFocus ? FlatStyle.focusedStrokeColor :
+ control.checked ? FlatStyle.strokeColor : FlatStyle.darkFrameColor
+ color: !control.enabled ? FlatStyle.disabledFillColor : control.pressed ? FlatStyle.lightFrameColor : FlatStyle.backgroundColor
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/TabViewStyle.qml b/src/extras/Styles/Flat/TabViewStyle.qml
new file mode 100644
index 00000000..c680f762
--- /dev/null
+++ b/src/extras/Styles/Flat/TabViewStyle.qml
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+
+Base.TabViewStyle {
+ readonly property int frameWidth: Math.round(FlatStyle.scaleFactor)
+
+ tabOverlap: -frameWidth
+ frameOverlap: frameWidth
+
+ frame: Rectangle {
+ visible: control.frameVisible
+ color: FlatStyle.backgroundColor
+ border.color: FlatStyle.lightFrameColor
+ }
+
+ tab: Item {
+ readonly property int totalWidth: styleData.availableWidth + tabOverlap * (control.count - 1)
+ readonly property int tabWidth: Math.max(1, totalWidth / Math.max(1, control.count))
+ readonly property int remainder: (styleData.index == control.count - 1 && tabWidth > 0) ? totalWidth % tabWidth : 0
+
+ implicitWidth: tabWidth + remainder
+ implicitHeight: Math.round(40 * FlatStyle.scaleFactor)
+
+ Rectangle {
+ anchors.fill: parent
+ visible: styleData.pressed || !styleData.selected || styleData.activeFocus
+ opacity: styleData.enabled ? 1.0 : FlatStyle.disabledOpacity
+ color: styleData.activeFocus ? (styleData.pressed ? FlatStyle.checkedFocusedAndPressedColor : FlatStyle.focusedColor) :
+ styleData.pressed ? FlatStyle.pressedColor :
+ styleData.selected ? FlatStyle.backgroundColor :
+ !styleData.enabled ? FlatStyle.disabledColor : FlatStyle.styleColor
+ }
+
+ Text {
+ text: styleData.title
+ anchors.fill: parent
+ anchors.leftMargin: Math.round(5 * FlatStyle.scaleFactor)
+ anchors.rightMargin: anchors.leftMargin
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ font.family: FlatStyle.fontFamily
+ renderType: FlatStyle.__renderType
+ elide: Text.ElideRight
+ opacity: !styleData.enabled && styleData.selected ? FlatStyle.disabledOpacity : 1.0
+ color: !styleData.enabled && styleData.selected ? FlatStyle.disabledColor :
+ styleData.selected && styleData.enabled && !styleData.activeFocus && !styleData.pressed ? FlatStyle.styleColor : FlatStyle.selectedTextColor
+ }
+ }
+
+ tabBar: Rectangle {
+ color: FlatStyle.backgroundColor
+ border.color: control.frameVisible ? FlatStyle.lightFrameColor : "transparent"
+ anchors.fill: parent
+ Rectangle {
+ height: frameWidth
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.margins: frameWidth
+ y: control.tabPosition == Qt.TopEdge ? parent.height - height : 0
+ color: FlatStyle.backgroundColor
+ visible: control.frameVisible
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/TableViewStyle.qml b/src/extras/Styles/Flat/TableViewStyle.qml
new file mode 100644
index 00000000..c64628e8
--- /dev/null
+++ b/src/extras/Styles/Flat/TableViewStyle.qml
@@ -0,0 +1,163 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 1.3
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Flat 1.0
+
+Base.ScrollViewStyle {
+ readonly property TableView control: __control
+
+ readonly property color backgroundColor: "transparent"
+ readonly property color alternateBackgroundColor: FlatStyle.disabledColor
+
+ readonly property color textColor: FlatStyle.defaultTextColor
+ readonly property color highlightedTextColor: FlatStyle.styleColor
+
+ transientScrollBars: true
+
+ readonly property bool activateItemOnSingleClick: false
+
+ readonly property real __alternateBackgroundOpacity: 0.07
+ readonly property real __selectedBackgroundOpacity: 0.2
+ readonly property real __focusedBackgroundOpacity: 0.4
+ readonly property real __columnMargin: Math.round(20 * FlatStyle.scaleFactor)
+
+ frame: Item {
+ visible: control.frameVisible && control.alternatingRowColors
+ Rectangle {
+ anchors.bottom: parent.bottom
+ width: parent.width
+ height: 1
+ color: FlatStyle.mediumFrameColor
+ }
+ }
+
+ property Component headerDelegate: Rectangle {
+ height: Math.round(56 * FlatStyle.scaleFactor)
+ color: control.enabled ? FlatStyle.styleColor : FlatStyle.mediumFrameColor
+ Text {
+ anchors.fill: parent
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: styleData.textAlignment
+ anchors.leftMargin: __columnMargin
+ text: styleData.value
+ elide: Text.ElideRight
+ color: FlatStyle.selectedTextColor
+ font {
+ family: FlatStyle.fontFamily
+ pixelSize: FlatStyle.defaultFontSize * FlatStyle.scaleFactor
+ }
+
+ renderType: FlatStyle.__renderType
+ }
+
+ Rectangle {
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ height: Math.round(36 * FlatStyle.scaleFactor)
+ width: FlatStyle.onePixel
+ color: "white"
+ opacity: styleData.column !== control.columnCount - 1 ? 0.4 : 0
+ }
+ }
+
+ property Component rowDelegate: Item {
+ height: 46 * FlatStyle.scaleFactor
+ readonly property color selectedColor: styleData.hasActiveFocus ?
+ FlatStyle.focusedColor : FlatStyle.styleColor
+ readonly property bool selected: control.enabled && (styleData.hasActiveFocus || styleData.selected)
+
+ Rectangle {
+ id: bg
+ color: selected ? selectedColor :
+ styleData.alternate ? alternateBackgroundColor : backgroundColor
+ opacity: !control.enabled ? (styleData.alternate ? __alternateBackgroundOpacity : 1.0) :
+ styleData.hasActiveFocus ? __focusedBackgroundOpacity :
+ styleData.selected ? (styleData.alternate ? __selectedBackgroundOpacity : __alternateBackgroundOpacity) :
+ (styleData.alternate ? __alternateBackgroundOpacity : 1.0)
+ anchors.fill: parent
+ }
+
+ Rectangle {
+ // Bottom separator
+ visible: !control.alternatingRowColors
+ color: selected ? selectedColor : FlatStyle.mediumFrameColor
+ height: Math.round(1 * FlatStyle.scaleFactor)
+ width: parent.width
+ anchors.bottom: parent.bottom
+ }
+
+ Rectangle {
+ // Top separator. Only visible if the current row is selected. It hides
+ // the previous row's bottom separator when this row is selected or focused
+ visible: selected && !control.alternatingRowColors
+ color: selectedColor
+ height: Math.round(1 * FlatStyle.scaleFactor)
+ width: parent.width
+ anchors.bottom: parent.top
+ }
+ }
+
+ property Component itemDelegate: Item {
+ height: Math.round(46 * FlatStyle.scaleFactor)
+ implicitWidth: label.implicitWidth + __columnMargin
+
+ Text {
+ id: label
+ text: styleData.value !== undefined ? styleData.value : ""
+ elide: styleData.elideMode
+ color: !control.enabled ? FlatStyle.disabledColor :
+ styleData.hasActiveFocus ? FlatStyle.focusedTextColor :
+ styleData.textColor
+ opacity: !control.enabled ? FlatStyle.disabledOpacity : 1.0
+ font {
+ family: FlatStyle.fontFamily
+ pixelSize: FlatStyle.defaultFontSize * FlatStyle.scaleFactor
+ weight: control.enabled && (styleData.selected || styleData.hasActiveFocus) ?
+ Font.DemiBold : Font.Normal
+ }
+ renderType: FlatStyle.__renderType
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.leftMargin: __columnMargin
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+
+}
diff --git a/src/extras/Styles/Flat/TextAreaStyle.qml b/src/extras/Styles/Flat/TextAreaStyle.qml
new file mode 100644
index 00000000..52275f2f
--- /dev/null
+++ b/src/extras/Styles/Flat/TextAreaStyle.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Flat 1.0
+
+ScrollViewStyle {
+ readonly property TextArea control: __control
+
+ property font font
+ readonly property color textColor: !control.enabled ? FlatStyle.darkFrameColor : FlatStyle.defaultTextColor
+ readonly property color selectionColor: FlatStyle.textSelectionColor
+ readonly property color selectedTextColor: FlatStyle.defaultTextColor
+ readonly property color backgroundColor: "transparent"
+ readonly property int renderType: FlatStyle.__renderType
+ readonly property real textMargin: Math.round(10 * FlatStyle.scaleFactor)
+
+ font.family: FlatStyle.fontFamily
+
+ frame: Rectangle {
+ anchors.fill: parent
+ implicitWidth: Math.round(150 * FlatStyle.scaleFactor)
+ implicitHeight: Math.round(170 * FlatStyle.scaleFactor)
+ radius: control.frameVisible ? FlatStyle.radius : 0
+ border.width: (control.activeFocus ? FlatStyle.twoPixels : enabled ? FlatStyle.onePixel : 0)
+ border.color: !control.frameVisible ? "transparent" : control.activeFocus ? FlatStyle.highlightColor : FlatStyle.darkFrameColor
+ color: !control.backgroundVisible ? "transparent" : enabled ? FlatStyle.backgroundColor : FlatStyle.disabledColor
+ opacity: enabled ? 1.0 : 0.15
+ }
+
+ property Component __selectionHandle: SelectionHandleStyle { }
+ property Component __cursorHandle: CursorHandleStyle { }
+}
diff --git a/src/extras/Styles/Flat/TextFieldStyle.qml b/src/extras/Styles/Flat/TextFieldStyle.qml
new file mode 100644
index 00000000..060e63d1
--- /dev/null
+++ b/src/extras/Styles/Flat/TextFieldStyle.qml
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+
+Base.TextFieldStyle {
+ font.family: FlatStyle.fontFamily
+
+ textColor: !control.enabled ? FlatStyle.mediumFrameColor : FlatStyle.defaultTextColor
+ placeholderTextColor: FlatStyle.mediumFrameColor
+ selectionColor: FlatStyle.textSelectionColor
+ selectedTextColor: FlatStyle.defaultTextColor
+ renderType: FlatStyle.__renderType
+
+ padding {
+ top: 0
+ left: Math.round(FlatStyle.scaleFactor * 10)
+ right: Math.round(FlatStyle.scaleFactor * 10)
+ bottom: 0
+ }
+
+ background: Rectangle {
+ implicitWidth: Math.round(150 * FlatStyle.scaleFactor)
+ implicitHeight: Math.max(Math.round(26 * FlatStyle.scaleFactor), Math.round(control.__contentHeight * 1.2))
+ radius: FlatStyle.radius
+ border.width: (control.activeFocus ? FlatStyle.twoPixels : enabled ? FlatStyle.onePixel : 0)
+ border.color: control.activeFocus ? FlatStyle.highlightColor : FlatStyle.darkFrameColor
+ color: enabled ? FlatStyle.backgroundColor : FlatStyle.disabledColor
+ opacity: enabled ? 1.0 : 0.15
+ }
+
+ __selectionHandle: SelectionHandleStyle { }
+ __cursorHandle: CursorHandleStyle { }
+}
diff --git a/src/extras/Styles/Flat/ToggleButtonStyle.qml b/src/extras/Styles/Flat/ToggleButtonStyle.qml
new file mode 100644
index 00000000..3b120e1d
--- /dev/null
+++ b/src/extras/Styles/Flat/ToggleButtonStyle.qml
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Private 1.0
+import QtQuick.Extras.Styles 1.3 as Base
+
+Base.ToggleButtonStyle {
+ label: Label {
+ text: control.text
+ color: FlatStyle.mediumFrameColor
+ font.family: FlatStyle.fontFamily
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ renderType: FlatStyle.__renderType
+ }
+
+ background: Item {
+ implicitWidth: Math.round(100 * FlatStyle.scaleFactor)
+ implicitHeight: Math.round(52 * FlatStyle.scaleFactor)
+
+ readonly property real outerLightLineWidth: Math.max(4, Math.round(innerRect.radius * 0.5))
+ readonly property real thinDarkLineWidth: Math.max(1, FlatStyle.onePixel)
+ readonly property color indicatorColor: control.enabled ? (control.checked ? FlatStyle.styleColor : FlatStyle.invalidColor) : FlatStyle.lightFrameColor
+ readonly property bool hovered: control.hovered && (!Settings.hasTouchScreen && !Settings.isMobile)
+
+ Rectangle {
+ id: innerRect
+ color: control.enabled ? (control.pressed ? FlatStyle.lightFrameColor : "white") : Qt.rgba(0, 0, 0, 0.07)
+ border.color: control.enabled ? (hovered ? indicatorColor : FlatStyle.mediumFrameColor) : "#d8d8d8" // TODO: specs don't mention having a border for disabled toggle buttons
+ border.width: !control.activeFocus ? thinDarkLineWidth : 0
+ radius: Math.round(3 * FlatStyle.scaleFactor)
+ anchors.fill: parent
+
+ Item {
+ id: clipItem
+ x: control.checked ? width : 0
+ width: indicatorRect.width / 2
+ height: indicatorRect.height / 2
+ clip: true
+
+ Rectangle {
+ id: indicatorRect
+ x: control.checked ? -parent.width : 0
+ color: indicatorColor
+ radius: innerRect.radius
+ width: innerRect.width
+ height: Math.round(8 * FlatStyle.scaleFactor) * 2
+ }
+ }
+ }
+
+ Rectangle {
+ anchors.fill: innerRect
+ color: "transparent"
+ radius: innerRect.radius
+ border.color: FlatStyle.focusedColor
+ border.width: 2 * FlatStyle.scaleFactor
+ visible: control.activeFocus
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/ToolBarStyle.qml b/src/extras/Styles/Flat/ToolBarStyle.qml
new file mode 100644
index 00000000..0b6aa688
--- /dev/null
+++ b/src/extras/Styles/Flat/ToolBarStyle.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+
+Base.ToolBarStyle {
+ padding {
+ top: 0
+ left: Math.round(FlatStyle.scaleFactor * 10)
+ right: Math.round(FlatStyle.scaleFactor * 10)
+ bottom: 0
+ }
+
+ menuButton: Item {
+ implicitWidth: Math.round(FlatStyle.scaleFactor * 26)
+ implicitHeight: Math.round(FlatStyle.scaleFactor * 26)
+
+ ToolButtonBackground {
+ anchors.fill: parent
+ buttonEnabled: control.enabled
+ buttonHasActiveFocus: control.activeFocus
+ buttonPressed: styleData.pressed
+ buttonChecked: false
+ buttonHovered: !Settings.hasTouchScreen && styleData.hovered
+ }
+
+ ToolButtonIndicator {
+ buttonEnabled: control.enabled
+ buttonHasActiveFocus: styleData.activeFocus
+ buttonPressedOrChecked: styleData.pressed
+ anchors.centerIn: parent
+ }
+ }
+
+ background: Rectangle {
+ implicitHeight: Math.max(1, Math.round(FlatStyle.scaleFactor * 40))
+ color: FlatStyle.flatFrameColor
+ }
+}
diff --git a/src/extras/Styles/Flat/ToolButtonBackground.qml b/src/extras/Styles/Flat/ToolButtonBackground.qml
new file mode 100644
index 00000000..7dcd1ee0
--- /dev/null
+++ b/src/extras/Styles/Flat/ToolButtonBackground.qml
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Flat 1.0
+
+// Internal, for use with ToolButtonStyle and ToolBarStyle
+Rectangle {
+ id: background
+
+ property bool buttonEnabled: false
+ property bool buttonHasActiveFocus: false
+ property bool buttonHovered: false
+ property bool buttonChecked: false
+ property bool buttonPressed: false
+
+ color: {
+ if (buttonChecked) {
+ if (!buttonEnabled)
+ return "transparent";
+ if (buttonHasActiveFocus)
+ return buttonPressed ? FlatStyle.checkedFocusedAndPressedColor : FlatStyle.focusedAndPressedColor;
+ if (buttonPressed)
+ return Qt.rgba(0, 0, 0, 0.1);
+ return "transparent";
+ }
+
+ if (!buttonEnabled)
+ return "transparent";
+ if (buttonHasActiveFocus)
+ return buttonPressed ? FlatStyle.focusedAndPressedColor : "transparent";
+ if (buttonPressed)
+ return Qt.rgba(0, 0, 0, 0.1);
+ return "transparent";
+ }
+ border.color: {
+ if (buttonChecked) {
+ if (!buttonEnabled)
+ return Qt.rgba(0, 0, 0, 0.1);
+ if (buttonHasActiveFocus)
+ return "transparent";
+ if (buttonPressed)
+ return Qt.rgba(0, 0, 0, 0.2);
+ if (buttonHovered)
+ return Qt.rgba(0, 0, 0, 0.3);
+ return Qt.rgba(0, 0, 0, 0.2);
+ }
+
+ if (!buttonEnabled)
+ return "transparent";
+ if (buttonHasActiveFocus && !buttonPressed)
+ return FlatStyle.focusedColor;
+ if (buttonHovered && !buttonPressed)
+ return Qt.rgba(0, 0, 0, 0.2);
+ return "transparent";
+ }
+ border.width: buttonHasActiveFocus ? FlatStyle.twoPixels : FlatStyle.onePixel
+ radius: FlatStyle.radius
+}
diff --git a/src/extras/Styles/Flat/ToolButtonIndicator.qml b/src/extras/Styles/Flat/ToolButtonIndicator.qml
new file mode 100644
index 00000000..1c6ffc74
--- /dev/null
+++ b/src/extras/Styles/Flat/ToolButtonIndicator.qml
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Flat 1.0
+
+// Internal, for use with ToolButtonStyle and ToolBarStyle
+Item {
+ id: toolButtonIndicator
+ implicitWidth: Math.round(26 * FlatStyle.scaleFactor)
+ implicitHeight: Math.round(26 * FlatStyle.scaleFactor)
+
+ property bool buttonEnabled: false
+ property bool buttonHasActiveFocus: false
+ property bool buttonPressedOrChecked: false
+
+ Column {
+ anchors.centerIn: parent
+ spacing: Math.round(2 * FlatStyle.scaleFactor)
+
+ Repeater {
+ model: toolButtonIndicator.visible ? 3 : 0
+
+ Rectangle {
+ width: Math.round(4 * FlatStyle.scaleFactor)
+ height: width
+ radius: width / 2
+ color: !buttonEnabled ? FlatStyle.disabledColor : buttonPressedOrChecked && buttonHasActiveFocus
+ ? FlatStyle.selectedTextColor : buttonHasActiveFocus
+ ? FlatStyle.focusedColor : FlatStyle.defaultTextColor
+ opacity: !buttonEnabled ? FlatStyle.disabledOpacity : 1
+ }
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/ToolButtonStyle.qml b/src/extras/Styles/Flat/ToolButtonStyle.qml
new file mode 100644
index 00000000..60866e91
--- /dev/null
+++ b/src/extras/Styles/Flat/ToolButtonStyle.qml
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+
+Base.ButtonStyle {
+ padding { top: 0; left: 0; right: 0; bottom: 0 }
+
+ panel: Item {
+ id: panelItem
+
+ readonly property bool isDown: control.pressed || (control.checkable && control.checked)
+ readonly property bool hasIcon: icon.status === Image.Ready || icon.status === Image.Loading
+ readonly property bool hasMenu: !!control.menu
+ readonly property bool hasText: !!control.text
+ readonly property real margins: 10 * FlatStyle.scaleFactor
+
+ ToolButtonBackground {
+ id: background
+ anchors.fill: parent
+ buttonEnabled: control.enabled
+ buttonHasActiveFocus: control.activeFocus
+ buttonPressed: control.pressed
+ buttonChecked: control.checkable && control.checked
+ buttonHovered: !Settings.hasTouchScreen && control.hovered
+ }
+
+ implicitWidth: icon.implicitWidth + label.implicitWidth + indicator.implicitHeight
+ + (hasIcon || hasText ? panelItem.margins : 0) + (hasIcon && hasText ? panelItem.margins : 0)
+ implicitHeight: Math.max(background.height, Math.max(icon.implicitHeight, Math.max(label.implicitHeight, indicator.height)))
+ baselineOffset: label.y + label.baselineOffset
+
+ Image {
+ id: icon
+ visible: hasIcon
+ source: control.iconSource
+ anchors.leftMargin: panelItem.margins
+ anchors.verticalCenter: parent.verticalCenter
+ // center align when only icon, otherwise left align
+ anchors.left: hasMenu || hasText ? parent.left : undefined
+ anchors.horizontalCenter: !hasMenu && !hasText ? parent.horizontalCenter : undefined
+ }
+ Text {
+ id: label
+ visible: hasText
+ text: control.text
+ elide: Text.ElideRight
+ font.family: FlatStyle.fontFamily
+ renderType: FlatStyle.__renderType
+ color: !enabled ? FlatStyle.disabledColor : panelItem.isDown && control.activeFocus
+ ? FlatStyle.selectedTextColor : control.activeFocus
+ ? FlatStyle.focusedColor : FlatStyle.defaultTextColor
+ opacity: !enabled ? FlatStyle.disabledOpacity : 1.0
+ horizontalAlignment: hasMenu && !hasIcon ? Qt.AlignLeft : Qt.AlignHCenter
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: icon.right
+ anchors.right: indicator.left
+ anchors.leftMargin: hasIcon ? panelItem.margins : 0
+ anchors.rightMargin: hasMenu ? 0 : panelItem.margins
+ }
+ ToolButtonIndicator {
+ id: indicator
+ visible: panelItem.hasMenu
+ buttonEnabled: control.enabled
+ buttonHasActiveFocus: control.activeFocus
+ buttonPressedOrChecked: panelItem.isDown
+ anchors.verticalCenter: parent.verticalCenter
+ // center align when only menu, otherwise right align
+ anchors.right: hasIcon || hasText ? parent.right : undefined
+ anchors.horizontalCenter: !hasIcon && !hasText ? parent.horizontalCenter : undefined
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/TumblerStyle.qml b/src/extras/Styles/Flat/TumblerStyle.qml
new file mode 100644
index 00000000..cede9fee
--- /dev/null
+++ b/src/extras/Styles/Flat/TumblerStyle.qml
@@ -0,0 +1,167 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Extras.Styles 1.3 as Base
+
+Base.TumblerStyle {
+ id: tumblerStyle
+
+ padding.left: 0
+ padding.right: 0
+ padding.top: __frameHeight
+ padding.bottom: __frameHeight
+
+ visibleItemCount: 5
+
+ readonly property real __frameHeight: FlatStyle.onePixel
+
+ background: null
+
+ foreground: null
+
+ columnForeground: Item {
+ Item {
+ anchors.centerIn: parent
+ width: parent.width
+ height: tumblerStyle.__delegateHeight
+
+ Rectangle {
+ width: parent.width * 0.8
+ anchors.horizontalCenter: parent.horizontalCenter
+ height: __frameHeight
+ color: control.enabled ? FlatStyle.styleColor : FlatStyle.disabledColor
+ opacity: control.enabled ? 1 : 0.2
+ anchors.top: parent.top
+ visible: !styleData.activeFocus
+ }
+
+ Rectangle {
+ width: parent.width * 0.8
+ anchors.horizontalCenter: parent.horizontalCenter
+ height: __frameHeight
+ color: control.enabled ? FlatStyle.styleColor : FlatStyle.disabledColor
+ opacity: control.enabled ? 1 : 0.2
+ anchors.top: parent.bottom
+ visible: !styleData.activeFocus
+ }
+ }
+ }
+
+ highlight: Item {
+ id: highlightItem
+ implicitHeight: (control.height - padding.top - padding.bottom) / tumblerStyle.visibleItemCount
+
+ Rectangle {
+ color: styleData.activeFocus ? FlatStyle.highlightColor : "white"
+ width: parent.width
+ height: parent.height
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+
+ separator: null
+
+ frame: Item {
+ Rectangle {
+ height: __frameHeight
+ width: parent.width
+ color: FlatStyle.disabledColor
+ opacity: control.enabled ? 0.2 : 0.1
+ }
+
+ Rectangle {
+ height: __frameHeight
+ width: parent.width
+ anchors.bottom: parent.bottom
+ color: FlatStyle.disabledColor
+ opacity: control.enabled ? 0.2 : 0.1
+ }
+ }
+
+ delegate: Item {
+ id: delegateItem
+ implicitHeight: (control.height - padding.top - padding.bottom) / tumblerStyle.visibleItemCount
+
+ Text {
+ id: label
+ text: styleData.value
+ color: control.enabled ? (styleData.activeFocus ? FlatStyle.focusedTextColor : FlatStyle.defaultTextColor) : FlatStyle.disabledColor
+ opacity: control.enabled ? enabledOpacity : FlatStyle.disabledOpacity
+ font.pixelSize: Math.round(TextSingleton.font.pixelSize * 1.3)
+ font.family: FlatStyle.fontFamily
+ renderType: FlatStyle.__renderType
+ anchors.centerIn: parent
+
+ readonly property real enabledOpacity: 1.1 - Math.abs(styleData.displacement * 2) / tumblerStyle.visibleItemCount * (230 / 255)
+ }
+
+ Loader {
+ id: block
+ y: styleData.displacement < 0 ? 0 : (1 - offset) * parent.height
+ width: parent.width
+ height: parent.height * offset
+ clip: true
+ active: Math.abs(styleData.displacement) <= 1
+
+ property real offset: Math.max(0, 1 - Math.abs(styleData.displacement))
+
+ sourceComponent: Rectangle {
+ // Use a Rectangle that is the same color as the highlight in order to avoid rendering text on top of text.
+ color: styleData.activeFocus ? FlatStyle.highlightColor : "white"
+ anchors.fill: parent
+
+ Text {
+ id: focusText
+ y: styleData.displacement < 0 ? 0 : parent.height - height
+ width: parent.width
+ height: delegateItem.height
+ color: control.enabled ? (styleData.activeFocus ? "white" : FlatStyle.defaultTextColor) : FlatStyle.disabledColor
+ opacity: control.enabled ? 1 : FlatStyle.disabledOpacity
+ text: styleData.value
+ font.pixelSize: Math.round(TextSingleton.font.pixelSize * 1.5)
+ font.family: FlatStyle.fontFamily
+ renderType: FlatStyle.__renderType
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+ }
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/flatstyle.qrc b/src/extras/Styles/Flat/flatstyle.qrc
new file mode 100644
index 00000000..3084d51e
--- /dev/null
+++ b/src/extras/Styles/Flat/flatstyle.qrc
@@ -0,0 +1,51 @@
+<RCC>
+ <qresource prefix="/ExtrasImports/QtQuick/Controls/Styles/Flat">
+ <file>ApplicationWindowStyle.qml</file>
+ <file>BusyIndicatorStyle.qml</file>
+ <file>ButtonStyle.qml</file>
+ <file>CalendarStyle.qml</file>
+ <file>CheckBoxDrawer.qml</file>
+ <file>CheckBoxStyle.qml</file>
+ <file>CircularButtonStyle.qml</file>
+ <file>CircularGaugeStyle.qml</file>
+ <file>CircularTickmarkLabelStyle.qml</file>
+ <file>ComboBoxStyle.qml</file>
+ <file>CursorHandleStyle.qml</file>
+ <file>DelayButtonStyle.qml</file>
+ <file>DialStyle.qml</file>
+ <file>FlatStyle.qml</file>
+ <file>FocusFrameStyle.qml</file>
+ <file>GaugeStyle.qml</file>
+ <file>GroupBoxStyle.qml</file>
+ <file>LeftArrowIcon.qml</file>
+ <file>MenuBarStyle.qml</file>
+ <file>MenuStyle.qml</file>
+ <file>PieMenuStyle.qml</file>
+ <file>ProgressBarStyle.qml</file>
+ <file>RadioButtonStyle.qml</file>
+ <file>ScrollViewStyle.qml</file>
+ <file>SelectionHandleStyle.qml</file>
+ <file>SliderStyle.qml</file>
+ <file>SpinBoxStyle.qml</file>
+ <file>StatusBarStyle.qml</file>
+ <file>StatusIndicatorStyle.qml</file>
+ <file>SwitchStyle.qml</file>
+ <file>TabViewStyle.qml</file>
+ <file>TableViewStyle.qml</file>
+ <file>TextAreaStyle.qml</file>
+ <file>TextFieldStyle.qml</file>
+ <file>ToggleButtonStyle.qml</file>
+ <file>ToolBarStyle.qml</file>
+ <file>ToolButtonBackground.qml</file>
+ <file>ToolButtonIndicator.qml</file>
+ <file>ToolButtonStyle.qml</file>
+ <file>TumblerStyle.qml</file>
+ <file>images/BusyIndicator_Normal-Large.png</file>
+ <file>images/BusyIndicator_Normal-Medium.png</file>
+ <file>images/BusyIndicator_Normal-Small.png</file>
+ <file>fonts/LICENSE.txt</file>
+ <file>fonts/OpenSans-Light.ttf</file>
+ <file>fonts/OpenSans-Regular.ttf</file>
+ <file>fonts/OpenSans-Semibold.ttf</file>
+ </qresource>
+</RCC>
diff --git a/src/extras/Styles/Flat/flatstyleplugin.cpp b/src/extras/Styles/Flat/flatstyleplugin.cpp
new file mode 100644
index 00000000..e3bffd5c
--- /dev/null
+++ b/src/extras/Styles/Flat/flatstyleplugin.cpp
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "flatstyleplugin.h"
+
+#include <QtCore/qglobal.h>
+#include <QtCore/qfile.h>
+#include <QtCore/qdebug.h>
+
+#include "qquicktexthandle.h"
+
+static void initResources()
+{
+ Q_INIT_RESOURCE(flatstyle);
+}
+
+extern "C" {
+ Q_DECL_EXPORT bool qt_quick_controls_style_init()
+ {
+ initResources();
+ return true;
+ }
+
+ Q_DECL_EXPORT const char* qt_quick_controls_style_path()
+ {
+ return "qrc:/ExtrasImports/QtQuick/Controls/Styles/";
+ }
+}
+
+QT_BEGIN_NAMESPACE
+
+QtQuickExtrasStylesPlugin::QtQuickExtrasStylesPlugin(QObject *parent) :
+ QQmlExtensionPlugin(parent)
+{
+}
+
+void QtQuickExtrasStylesPlugin::registerTypes(const char *uri)
+{
+ Q_INIT_RESOURCE(flatstyle);
+
+ const QString prefix = "qrc:/ExtrasImports/QtQuick/Controls/Styles/Flat/";
+ // register version 1.0
+ qmlRegisterSingletonType(QUrl(prefix + "FlatStyle.qml"), uri, 1, 0, "FlatStyle");
+ qmlRegisterType(QUrl(prefix + "ApplicationWindowStyle.qml"), uri, 1, 0, "ApplicationWindowStyle");
+ qmlRegisterType(QUrl(prefix + "BusyIndicatorStyle.qml"), uri, 1, 0, "BusyIndicatorStyle");
+ qmlRegisterType(QUrl(prefix + "ButtonStyle.qml"), uri, 1, 0, "ButtonStyle");
+ qmlRegisterType(QUrl(prefix + "CalendarStyle.qml"), uri, 1, 0, "CalendarStyle");
+ qmlRegisterType(QUrl(prefix + "CheckBoxStyle.qml"), uri, 1, 0, "CheckBoxStyle");
+ qmlRegisterType(QUrl(prefix + "CheckBoxDrawer.qml"), uri, 1, 0, "CheckBoxDrawer");
+ qmlRegisterType(QUrl(prefix + "CircularButtonStyle.qml"), uri, 1, 0, "CircularButtonStyle");
+ qmlRegisterType(QUrl(prefix + "CircularGaugeStyle.qml"), uri, 1, 0, "CircularGaugeStyle");
+ qmlRegisterType(QUrl(prefix + "CircularTickmarkLabelStyle.qml"), uri, 1, 0, "CircularTickmarkLabelStyle");
+ qmlRegisterType(QUrl(prefix + "ComboBoxStyle.qml"), uri, 1, 0, "ComboBoxStyle");
+ qmlRegisterType(QUrl(prefix + "CursorHandleStyle.qml"), uri, 1, 0, "CursorHandleStyle");
+ qmlRegisterType(QUrl(prefix + "DelayButtonStyle.qml"), uri, 1, 0, "DelayButtonStyle");
+ qmlRegisterType(QUrl(prefix + "FocusFrameStyle.qml"), uri, 1, 0, "FocusFrameStyle");
+ qmlRegisterType(QUrl(prefix + "GaugeStyle.qml"), uri, 1, 0, "GaugeStyle");
+ qmlRegisterType(QUrl(prefix + "GroupBoxStyle.qml"), uri, 1, 0, "GroupBoxStyle");
+ qmlRegisterType(QUrl(prefix + "LeftArrowIcon.qml"), uri, 1, 0, "LeftArrowIcon");
+ qmlRegisterType(QUrl(prefix + "MenuBarStyle.qml"), uri, 1, 0, "MenuBarStyle");
+ qmlRegisterType(QUrl(prefix + "PieMenuStyle.qml"), uri, 1, 0, "PieMenuStyle");
+ qmlRegisterType(QUrl(prefix + "ProgressBarStyle.qml"), uri, 1, 0, "ProgressBarStyle");
+ qmlRegisterType(QUrl(prefix + "RadioButtonStyle.qml"), uri, 1, 0, "RadioButtonStyle");
+ qmlRegisterType(QUrl(prefix + "ScrollViewStyle.qml"), uri, 1, 0, "ScrollViewStyle");
+ qmlRegisterType(QUrl(prefix + "SelectionHandleStyle.qml"), uri, 1, 0, "SelectionHandleStyle");
+ qmlRegisterType(QUrl(prefix + "SliderStyle.qml"), uri, 1, 0, "SliderStyle");
+ qmlRegisterType(QUrl(prefix + "SpinBoxStyle.qml"), uri, 1, 0, "SpinBoxStyle");
+ qmlRegisterType(QUrl(prefix + "StatusBarStyle.qml"), uri, 1, 0, "StatusBarStyle");
+ qmlRegisterType(QUrl(prefix + "StatusIndicatorStyle.qml"), uri, 1, 0, "StatusIndicatorStyle");
+ qmlRegisterType(QUrl(prefix + "SwitchStyle.qml"), uri, 1, 0, "SwitchStyle");
+ qmlRegisterType(QUrl(prefix + "TabViewStyle.qml"), uri, 1, 0, "TabViewStyle");
+ qmlRegisterType(QUrl(prefix + "TableViewStyle.qml"), uri, 1, 0, "TableViewStyle");
+ qmlRegisterType(QUrl(prefix + "TextAreaStyle.qml"), uri, 1, 0, "TextAreaStyle");
+ qmlRegisterType(QUrl(prefix + "TextFieldStyle.qml"), uri, 1, 0, "TextFieldStyle");
+ qmlRegisterType(QUrl(prefix + "ToggleButtonStyle.qml"), uri, 1, 0, "ToggleButtonStyle");
+ qmlRegisterType(QUrl(prefix + "ToolBarStyle.qml"), uri, 1, 0, "ToolBarStyle");
+ qmlRegisterType(QUrl(prefix + "ToolButtonStyle.qml"), uri, 1, 0, "ToolButtonStyle");
+ qmlRegisterType(QUrl(prefix + "ToolButtonBackground.qml"), uri, 1, 0, "ToolButtonBackground");
+ qmlRegisterType(QUrl(prefix + "ToolButtonIndicator.qml"), uri, 1, 0, "ToolButtonIndicator");
+ qmlRegisterType(QUrl(prefix + "TumblerStyle.qml"), uri, 1, 0, "TumblerStyle");
+ qmlRegisterType<QQuickTextHandle>("QtQuick.Controls.Styles.Flat", 1, 0, "TextHandle");
+}
+
+QT_END_NAMESPACE
diff --git a/src/extras/Styles/Flat/flatstyleplugin.h b/src/extras/Styles/Flat/flatstyleplugin.h
new file mode 100644
index 00000000..4f1fb6d1
--- /dev/null
+++ b/src/extras/Styles/Flat/flatstyleplugin.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef STYLES_PLUGIN_H
+#define STYLES_PLUGIN_H
+
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include <QtQml/qqmlengine.h>
+
+QT_BEGIN_NAMESPACE
+
+class QtQuickExtrasStylesPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
+public:
+ explicit QtQuickExtrasStylesPlugin(QObject *parent = 0);
+
+ void registerTypes(const char *uri);
+};
+
+QT_END_NAMESPACE
+
+#endif // STYLES_PLUGIN_H
diff --git a/src/extras/Styles/Flat/fonts/LICENSE.txt b/src/extras/Styles/Flat/fonts/LICENSE.txt
new file mode 100644
index 00000000..d6456956
--- /dev/null
+++ b/src/extras/Styles/Flat/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/src/extras/Styles/Flat/fonts/OpenSans-Light.ttf b/src/extras/Styles/Flat/fonts/OpenSans-Light.ttf
new file mode 100644
index 00000000..0d381897
--- /dev/null
+++ b/src/extras/Styles/Flat/fonts/OpenSans-Light.ttf
Binary files differ
diff --git a/src/extras/Styles/Flat/fonts/OpenSans-Regular.ttf b/src/extras/Styles/Flat/fonts/OpenSans-Regular.ttf
new file mode 100644
index 00000000..db433349
--- /dev/null
+++ b/src/extras/Styles/Flat/fonts/OpenSans-Regular.ttf
Binary files differ
diff --git a/src/extras/Styles/Flat/fonts/OpenSans-Semibold.ttf b/src/extras/Styles/Flat/fonts/OpenSans-Semibold.ttf
new file mode 100644
index 00000000..1a7679e3
--- /dev/null
+++ b/src/extras/Styles/Flat/fonts/OpenSans-Semibold.ttf
Binary files differ
diff --git a/src/extras/Styles/Flat/images/BusyIndicator_Normal-Large.png b/src/extras/Styles/Flat/images/BusyIndicator_Normal-Large.png
new file mode 100644
index 00000000..6f9e6e25
--- /dev/null
+++ b/src/extras/Styles/Flat/images/BusyIndicator_Normal-Large.png
Binary files differ
diff --git a/src/extras/Styles/Flat/images/BusyIndicator_Normal-Medium.png b/src/extras/Styles/Flat/images/BusyIndicator_Normal-Medium.png
new file mode 100644
index 00000000..2922e2a3
--- /dev/null
+++ b/src/extras/Styles/Flat/images/BusyIndicator_Normal-Medium.png
Binary files differ
diff --git a/src/extras/Styles/Flat/images/BusyIndicator_Normal-Small.png b/src/extras/Styles/Flat/images/BusyIndicator_Normal-Small.png
new file mode 100644
index 00000000..c1e1b1f1
--- /dev/null
+++ b/src/extras/Styles/Flat/images/BusyIndicator_Normal-Small.png
Binary files differ
diff --git a/src/extras/Styles/Flat/qmldir b/src/extras/Styles/Flat/qmldir
new file mode 100644
index 00000000..2b6390a4
--- /dev/null
+++ b/src/extras/Styles/Flat/qmldir
@@ -0,0 +1,3 @@
+module QtQuick.Controls.Styles.Flat
+plugin qtquickextrasflatplugin
+classname QtQuickExtrasFlatPlugin
diff --git a/src/extras/Styles/Flat/qquicktexthandle.cpp b/src/extras/Styles/Flat/qquicktexthandle.cpp
new file mode 100644
index 00000000..57029b8f
--- /dev/null
+++ b/src/extras/Styles/Flat/qquicktexthandle.cpp
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquicktexthandle.h"
+
+QQuickTextHandle::QQuickTextHandle(QQuickItem *parent) :
+ QQuickPaintedItem(parent)
+{
+ setAntialiasing(true);
+}
+
+QQuickTextHandle::~QQuickTextHandle()
+{
+}
+
+void QQuickTextHandle::paint(QPainter *painter)
+{
+ painter->save();
+ paintBulb(painter, QColor(0, 0, 0, 38), true);
+ painter->restore();
+
+ paintBulb(painter, mColor, false);
+ painter->fillRect((mType == SelectionHandle ? 10 : 1), 0, 2, 23, mColor);
+}
+
+QQuickTextHandle::TextHandleType QQuickTextHandle::type() const
+{
+ return mType;
+}
+
+void QQuickTextHandle::setType(QQuickTextHandle::TextHandleType type)
+{
+ if (mType != type) {
+ mType = type;
+ update();
+ emit typeChanged();
+ }
+}
+
+QColor QQuickTextHandle::color() const
+{
+ return mColor;
+}
+
+void QQuickTextHandle::setColor(const QColor &color)
+{
+ if (mColor != color) {
+ mColor = color;
+ update();
+ emit colorChanged();
+ }
+}
+
+qreal QQuickTextHandle::scaleFactor() const
+{
+ return mScaleFactor;
+}
+
+void QQuickTextHandle::setScaleFactor(qreal scaleFactor)
+{
+ if (mScaleFactor != scaleFactor) {
+ mScaleFactor = scaleFactor;
+ setImplicitWidth(qRound(28 * mScaleFactor));
+ // + 2 for shadows
+ setImplicitHeight(qRound((32 + 2) * mScaleFactor));
+ update();
+ emit scaleFactorChanged();
+ }
+}
+
+void QQuickTextHandle::paintBulb(QPainter *painter, const QColor &color, bool isShadow)
+{
+ painter->scale(mScaleFactor, mScaleFactor);
+ QPainterPath path;
+
+ if (mType == SelectionHandle) {
+ painter->translate(16, isShadow ? 2 : 0);
+ path.moveTo(10.242, 28.457);
+ path.cubicTo(7.8980000000000015, 30.799, 4.099000000000001, 30.799,1.7560000000000002, 28.457);
+ path.cubicTo(-0.5859999999999999, 26.115000000000002, -0.5859999999999999,22.314, 1.7560000000000002, 19.973);
+ path.cubicTo(4.748, 16.980999999999998, 11.869, 18.343999999999998, 11.869, 18.343999999999998);
+ path.cubicTo(11.869, 18.343999999999998, 13.244, 25.455, 10.242, 28.457);
+
+ } else {
+ if (isShadow)
+ painter->translate(0, 2);
+ path.moveTo(2.757,28.457);
+ path.cubicTo(5.101,30.799,8.899000000000001,30.799,11.243,28.457);
+ path.cubicTo(13.585,26.115000000000002,13.585,22.314,11.243,19.973);
+ path.cubicTo(8.251,16.98,1.13,18.344,1.13,18.344);
+ path.cubicTo(1.13,18.344,-0.245,25.455,2.757,28.457);
+ }
+
+ painter->fillPath(path, QBrush(color));
+}
+
diff --git a/src/extras/Styles/Flat/qquicktexthandle.h b/src/extras/Styles/Flat/qquicktexthandle.h
new file mode 100644
index 00000000..4df6d42d
--- /dev/null
+++ b/src/extras/Styles/Flat/qquicktexthandle.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKTEXTHANDLE_H
+#define QQUICKTEXTHANDLE_H
+
+#include <QPainter>
+#include <QQuickPaintedItem>
+
+class QQuickTextHandle : public QQuickPaintedItem
+{
+ Q_OBJECT
+ Q_PROPERTY(TextHandleType type READ type WRITE setType NOTIFY typeChanged)
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+ Q_PROPERTY(qreal scaleFactor READ scaleFactor WRITE setScaleFactor NOTIFY scaleFactorChanged)
+ Q_ENUMS(TextHandleType)
+public:
+ enum TextHandleType {
+ CursorHandle = 0,
+ SelectionHandle = 1
+ };
+
+ QQuickTextHandle(QQuickItem *parent = 0);
+ ~QQuickTextHandle();
+
+ void paint(QPainter *painter) Q_DECL_OVERRIDE;
+
+ TextHandleType type() const;
+ void setType(TextHandleType type);
+
+ QColor color() const;
+ void setColor(const QColor &color);
+
+ qreal scaleFactor() const;
+ void setScaleFactor(qreal scaleFactor);
+
+Q_SIGNALS:
+ void typeChanged();
+ void colorChanged();
+ void scaleFactorChanged();
+
+private:
+ void paintBulb(QPainter *painter, const QColor &color, bool isShadow);
+
+ TextHandleType mType;
+ QColor mColor;
+ qreal mScaleFactor;
+};
+
+#endif // QQUICKTEXTHANDLE_H
diff --git a/src/extras/Styles/styles.pro b/src/extras/Styles/styles.pro
new file mode 100644
index 00000000..8f05bcd0
--- /dev/null
+++ b/src/extras/Styles/styles.pro
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+
+SUBDIRS += Base \
+ Flat
diff --git a/src/extras/ToggleButton.qml b/src/extras/ToggleButton.qml
new file mode 100644
index 00000000..8e0d313e
--- /dev/null
+++ b/src/extras/ToggleButton.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Styles 1.3
+import QtQuick.Extras.Private 1.0
+
+/*!
+ \qmltype ToggleButton
+ \inqmlmodule QtQuick.Extras
+ \since QtQuick.Extras 1.0
+ \ingroup extras
+ \ingroup extras-interactive
+ \brief A push button that toggles between two states.
+
+ \image togglebutton-unchecked.png An unchecked ToggleButton
+ An unchecked ToggleButton.
+ \image togglebutton-checked.png A checked ToggleButton
+ A checked ToggleButton.
+
+ The ToggleButton is a simple extension of Qt Quick Controls' Button, using
+ the checked property to toggle between two states: \e checked and
+ \e unchecked. It enhances the visibility of a checkable button's state by
+ placing color-coded indicators around the button.
+
+ You can create a custom appearance for a ToggleButton by assigning a
+ \l {QtQuick.Extras.Styles::}{ToggleButtonStyle}.
+*/
+
+Button {
+ id: button
+ checkable: true
+ style: Qt.createComponent(StyleSettings.style + "/ToggleButtonStyle.qml", button)
+}
diff --git a/src/extras/Tumbler.qml b/src/extras/Tumbler.qml
new file mode 100644
index 00000000..cdf21c4d
--- /dev/null
+++ b/src/extras/Tumbler.qml
@@ -0,0 +1,464 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.0
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Private 1.0
+import QtQuick.Extras.Styles 1.3
+import QtQuick.Layouts 1.0
+
+/*!
+ \qmltype Tumbler
+ \inqmlmodule QtQuick.Extras
+ \since QtQuick.Extras 1.2
+ \ingroup extras
+ \ingroup extras-interactive
+ \brief A control that can have several spinnable wheels, each with items
+ that can be selected.
+
+ \image tumbler.png A Tumbler
+
+ \note Tumbler requires Qt 5.3.2 or later.
+
+ The Tumbler control is used with one or more TumblerColumn items, which
+ define the content of each column:
+
+ \code
+ Tumbler {
+ TumblerColumn {
+ model: 5
+ }
+ TumblerColumn {
+ model: [0, 1, 2, 3, 4]
+ }
+ TumblerColumn {
+ model: ["A", "B", "C", "D", "E]
+ }
+ }
+ \endcode
+
+ You can also use a traditional model with roles:
+
+ \code
+ Rectangle {
+ width: 220
+ height: 350
+ color: "#494d53"
+
+ ListModel {
+ id: listModel
+
+ ListElement {
+ foo: "A"
+ bar: "B"
+ baz: "C"
+ }
+ ListElement {
+ foo: "A"
+ bar: "B"
+ baz: "C"
+ }
+ ListElement {
+ foo: "A"
+ bar: "B"
+ baz: "C"
+ }
+ }
+
+ Tumbler {
+ anchors.centerIn: parent
+
+ TumblerColumn {
+ model: listModel
+ role: "foo"
+ }
+ TumblerColumn {
+ model: listModel
+ role: "bar"
+ }
+ TumblerColumn {
+ model: listModel
+ role: "baz"
+ }
+ }
+ }
+ \endcode
+
+ \section1 Limitations
+
+ For technical reasons, the model count must be equal to or greater than
+ \l {QtQuick.Extras.Styles::TumblerStyle}{visibleItemCount}
+ plus one. The
+ \l {QtQuick.Extras.Styles::TumblerStyle::}{visibleItemCount}
+ must also be an odd number.
+
+ You can create a custom appearance for a Tumbler by assigning a
+ \l {QtQuick.Extras.Styles::}{TumblerStyle}. To style
+ individual columns, use the \l {TumblerColumn::delegate}{delegate} and
+ \l {TumblerColumn::highlight}{highlight} properties of TumblerColumn.
+*/
+
+Control {
+ id: tumbler
+
+ style: Qt.createComponent(StyleSettings.style + "/TumblerStyle.qml", tumbler)
+
+ ListModel {
+ id: columnModel
+ }
+
+ /*!
+ \qmlproperty int Tumbler::columnCount
+
+ The number of columns in the Tumbler.
+ */
+ readonly property alias columnCount: columnModel.count
+
+ /*! \internal */
+ function __isValidColumnIndex(index) {
+ return index >= 0 && index < columnCount/* && columnRepeater.children.length === columnCount*/;
+ }
+
+ /*! \internal */
+ function __isValidColumnAndItemIndex(columnIndex, itemIndex) {
+ return __isValidColumnIndex(columnIndex) && itemIndex >= 0 && itemIndex < __viewAt(columnIndex).count;
+ }
+
+ /*!
+ Returns the current index of the column at \a columnIndex, or \c null
+ if the \a index is invalid.
+ */
+ function currentIndexAt(columnIndex) {
+ if (!__isValidColumnIndex(columnIndex))
+ return -1;
+
+ return columnModel.get(columnIndex).columnObject.currentIndex;
+ }
+
+ /*!
+ Sets the current index of the column at \a columnIndex to \a itemIndex.
+
+ Does nothing if \a columnIndex or \a itemIndex are invalid.
+ */
+ function setCurrentIndexAt(columnIndex, itemIndex) {
+ if (!__isValidColumnAndItemIndex(columnIndex, itemIndex))
+ return;
+
+ var view = columnRepeater.itemAt(columnIndex).view;
+ if (view.currentIndex !== itemIndex) {
+ // Hack to work around the pathview jumping when the index is changed.
+ // TODO: doesn't seem to be necessary anymore?
+ view.highlightMoveDuration = 0;
+ view.currentIndex = itemIndex;
+ view.highlightMoveDuration = Qt.binding(function(){ return __highlightMoveDuration; });
+ }
+ }
+
+ /*!
+ Returns the column at \a columnIndex or \c null if the \a index is
+ invalid.
+ */
+ function getColumn(columnIndex) {
+ if (!__isValidColumnIndex(columnIndex))
+ return null;
+
+ return columnModel.get(columnIndex).columnObject;
+ }
+
+ /*!
+ Adds a \a column and returns the added column.
+
+ The \a column argument can be an instance of TumblerColumn,
+ or a Component. The component has to contain a TumblerColumn.
+ Otherwise \c null is returned.
+ */
+ function addColumn(column) {
+ return insertColumn(columnCount, column);
+ }
+
+ /*!
+ Inserts a \a column at the given \a index and returns the inserted column.
+
+ The \a column argument can be an instance of TumblerColumn,
+ or a Component. The component has to contain a TumblerColumn.
+ Otherwise, \c null is returned.
+ */
+ function insertColumn(index, column) {
+ var object = column;
+ if (typeof column["createObject"] === "function") {
+ object = column.createObject(root);
+ } else if (object.__tumbler) {
+ console.warn("Tumbler::insertColumn(): you cannot add a column to multiple Tumblers")
+ return null;
+ }
+ if (index >= 0 && index <= columnCount && object.Accessible.role === Accessible.ColumnHeader) {
+ object.__tumbler = tumbler;
+ object.__index = index;
+ columnModel.insert(index, { columnObject: object });
+ return object;
+ }
+
+ if (object !== column)
+ object.destroy();
+ console.warn("Tumbler::insertColumn(): invalid argument");
+ return null;
+ }
+
+ /*
+ Try making one selection bar by invisible highlight item hack, so that bars go across separators
+ */
+
+ Component.onCompleted: {
+ for (var i = 0; i < data.length; ++i) {
+ var column = data[i];
+ if (column.Accessible.role === Accessible.ColumnHeader)
+ addColumn(column);
+ }
+ }
+
+ /*! \internal */
+ readonly property alias __columnRow: columnRow
+ /*! \internal */
+ property int __highlightMoveDuration: 300
+
+ /*! \internal */
+ function __viewAt(index) {
+ if (!__isValidColumnIndex(index))
+ return null;
+
+ return columnRepeater.itemAt(index).view;
+ }
+
+ /*! \internal */
+ readonly property alias __movementDelayTimer: movementDelayTimer
+
+ // When the up/down arrow keys are held down on a PathView,
+ // the movement of the items is limited to the highlightMoveDuration,
+ // but there is no built-in guard against trying to move the items at
+ // the speed of the auto-repeat key presses. This results in sluggish
+ // movement, so we enforce a delay with a timer to avoid this.
+ Timer {
+ id: movementDelayTimer
+ interval: __highlightMoveDuration
+ }
+
+ Loader {
+ id: backgroundLoader
+ sourceComponent: __style.background
+ anchors.fill: columnRow
+ }
+
+ Loader {
+ id: frameLoader
+ sourceComponent: __style.frame
+ anchors.fill: columnRow
+ anchors.leftMargin: -__style.padding.left
+ anchors.rightMargin: -__style.padding.right
+ anchors.topMargin: -__style.padding.top
+ anchors.bottomMargin: -__style.padding.bottom
+ }
+
+ Row {
+ id: columnRow
+ x: __style.padding.left
+ y: __style.padding.top
+
+ Repeater {
+ id: columnRepeater
+ model: columnModel
+ delegate: Item {
+ id: columnItem
+ width: columnPathView.width + separatorDelegateLoader.width
+ height: columnPathView.height
+
+ readonly property int __columnIndex: index
+ // For index-related functions and tests.
+ readonly property alias view: columnPathView
+ readonly property alias separator: separatorDelegateLoader.item
+
+ PathView {
+ id: columnPathView
+ width: columnObject.width
+ height: tumbler.height - tumbler.__style.padding.top - tumbler.__style.padding.bottom
+ visible: columnObject.visible
+ clip: true
+
+ Binding {
+ target: columnObject
+ property: "__currentIndex"
+ value: columnPathView.currentIndex
+ }
+
+ // We add one here so that the delegate's don't just appear in the view instantly,
+ // but rather come from the top/bottom. To account for this adjustment elsewhere,
+ // we extend the path height by half an item's height at the top and bottom.
+ pathItemCount: tumbler.__style.visibleItemCount + 1
+ preferredHighlightBegin: 0.5
+ preferredHighlightEnd: 0.5
+ highlightMoveDuration: tumbler.__highlightMoveDuration
+ highlight: Loader {
+ id: highlightLoader
+ objectName: "highlightLoader"
+ sourceComponent: columnObject.highlight ? columnObject.highlight : __style.highlight
+ width: columnPathView.width
+
+ readonly property int __index: index
+
+ property QtObject styleData: QtObject {
+ readonly property alias index: highlightLoader.__index
+ readonly property int column: columnItem.__columnIndex
+ readonly property bool activeFocus: columnPathView.activeFocus
+ }
+ }
+ dragMargin: width / 2
+
+ activeFocusOnTab: true
+ Keys.onDownPressed: {
+ if (!movementDelayTimer.running) {
+ columnPathView.incrementCurrentIndex();
+ movementDelayTimer.start();
+ }
+ }
+ Keys.onUpPressed: {
+ if (!movementDelayTimer.running) {
+ columnPathView.decrementCurrentIndex();
+ movementDelayTimer.start();
+ }
+ }
+
+ path: Path {
+ startX: columnPathView.width / 2
+ startY: -tumbler.__style.__delegateHeight / 2
+ PathLine {
+ x: columnPathView.width / 2
+ y: columnPathView.pathItemCount * tumbler.__style.__delegateHeight - tumbler.__style.__delegateHeight / 2
+ }
+ }
+
+ model: columnObject.model
+
+ delegate: Item {
+ id: delegateRootItem
+ property var itemModel: model
+
+ implicitWidth: itemDelegateLoader.width
+ implicitHeight: itemDelegateLoader.height
+
+ Loader {
+ id: itemDelegateLoader
+ sourceComponent: columnObject.delegate ? columnObject.delegate : __style.delegate
+ width: columnObject.width
+
+ onHeightChanged: tumbler.__style.__delegateHeight = height;
+
+ property var model: itemModel
+
+ readonly property var __modelData: modelData
+ readonly property int __columnDelegateIndex: index
+ property QtObject styleData: QtObject {
+ readonly property var modelData: itemDelegateLoader.__modelData
+ readonly property alias index: itemDelegateLoader.__columnDelegateIndex
+ readonly property int column: columnItem.__columnIndex
+ readonly property bool activeFocus: columnPathView.activeFocus
+ readonly property real displacement: {
+ var count = delegateRootItem.PathView.view.count;
+ var offset = delegateRootItem.PathView.view.offset;
+
+ var d = count - index - offset;
+ var halfVisibleItems = Math.floor(tumbler.__style.visibleItemCount / 2) + 1;
+ if (d > halfVisibleItems)
+ d -= count;
+ else if (d < -halfVisibleItems)
+ d += count;
+ return d;
+ }
+ readonly property bool current: delegateRootItem.PathView.isCurrentItem
+ readonly property string role: columnObject.role
+ readonly property var value: (itemModel && itemModel.hasOwnProperty(role))
+ ? itemModel[role] // Qml ListModel and QAbstractItemModel
+ : modelData && modelData.hasOwnProperty(role)
+ ? modelData[role] // QObjectList/QObject
+ : modelData != undefined ? modelData : "" // Models without role
+ }
+ }
+ }
+ }
+
+ Loader {
+ anchors.fill: columnPathView
+ sourceComponent: columnObject.columnForeground ? columnObject.columnForeground : __style.columnForeground
+
+ property QtObject styleData: QtObject {
+ readonly property int column: columnItem.__columnIndex
+ readonly property bool activeFocus: columnPathView.activeFocus
+ }
+ }
+
+ Loader {
+ id: separatorDelegateLoader
+ objectName: "separatorDelegateLoader"
+ sourceComponent: __style.separator
+ // Don't need a separator after the last delegate.
+ active: __columnIndex < tumbler.columnCount - 1
+ anchors.left: columnPathView.right
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ visible: columnObject.visible
+
+ // Use the width of the first separator to help us
+ // determine the default separator width.
+ onWidthChanged: {
+ if (__columnIndex == 0) {
+ tumbler.__style.__separatorWidth = width;
+ }
+ }
+
+ property QtObject styleData: QtObject {
+ readonly property int index: __columnIndex
+ }
+ }
+ }
+ }
+ }
+
+ Loader {
+ id: foregroundLoader
+ sourceComponent: __style.foreground
+ anchors.fill: backgroundLoader
+ }
+}
diff --git a/src/extras/TumblerColumn.qml b/src/extras/TumblerColumn.qml
new file mode 100644
index 00000000..95bcae85
--- /dev/null
+++ b/src/extras/TumblerColumn.qml
@@ -0,0 +1,170 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+
+/*!
+ \qmltype TumblerColumn
+ \inqmlmodule QtQuick.Extras
+ \since QtQuick.Extras 1.2
+ \ingroup extras
+ \brief A column within a tumbler.
+
+ \note TumblerColumn requires Qt 5.3.2 or later.
+
+ TumblerColumn represents a column within a tumbler, providing the interface
+ to define the items and width of each column.
+
+ \code
+ Tumbler {
+ TumblerColumn {
+ model: [1, 2, 3]
+ }
+
+ TumblerColumn {
+ model: ["A", "B", "C"]
+ visible: false
+ }
+ }
+ \endcode
+
+ You can create a custom appearance for a Tumbler by assigning a
+ \l {QtQuick.Extras.Styles::}{TumblerStyle}.
+*/
+
+QtObject {
+ id: tumblerColumn
+
+ /*! \internal */
+ property Item __tumbler: null
+
+ /*!
+ \internal
+
+ The index of this column within the tumbler.
+ */
+ property int __index: -1
+
+ /*!
+ \internal
+
+ The index of the current item, if the PathView has items instantiated,
+ or the last current index if it doesn't.
+ */
+ property int __currentIndex: -1
+
+ Accessible.role: Accessible.ColumnHeader
+
+ /*!
+ \qmlproperty readonly int TumblerColumn::currentIndex
+
+ This read-only property holds the index of the current item for this
+ column. If the model count is reduced, the current index will be
+ reduced to the new count minus one.
+
+ \sa {Tumbler::currentIndexAt}, {Tumbler::setCurrentIndexAt}
+ */
+ readonly property alias currentIndex: tumblerColumn.__currentIndex
+
+ /*!
+ This property holds the model that provides data for this column.
+ */
+ property var model: null
+
+ /*!
+ This property holds the model role of this column.
+ */
+ property string role: ""
+
+ /*!
+ The item delegate for this column.
+
+ If set, this delegate will be used to display items in this column,
+ instead of the
+ \l {QtQuick.Extras.Styles::TumblerStyle::delegate}{delegate}
+ property in \l {QtQuick.Extras.Styles::}{TumblerStyle}.
+
+ The \l {Item::implicitHeight}{implicitHeight} property must be set,
+ and it must be the same for each delegate.
+ */
+ property Component delegate
+
+ /*!
+ The highlight delegate for this column.
+
+ If set, this highlight will be used to display the highlight in this
+ column, instead of the
+ \l {QtQuick.Extras.Styles::TumblerStyle::highlight}{highlight}
+ property in \l {QtQuick.Extras.Styles::}{TumblerStyle}.
+ */
+ property Component highlight
+
+ /*!
+ The foreground of this column.
+
+ If set, this component will be used to display the foreground in this
+ column, instead of the
+ \l {QtQuick.Extras.Styles::TumblerStyle::columnForeground}{columnForeground}
+ property in \l {QtQuick.Extras.Styles::}{TumblerStyle}.
+ */
+ property Component columnForeground
+
+ /*!
+ This property holds the visibility of this column.
+ */
+ property bool visible: true
+
+ /*!
+ This read-only property indicates whether the item has active focus.
+
+ See Item's \l {Item::activeFocus}{activeFocus} property for more
+ information.
+ */
+ readonly property bool activeFocus: {
+ if (__tumbler === null)
+ return null;
+
+ var view = __tumbler.__viewAt(__index);
+ return view && view.activeFocus ? true : false;
+ }
+
+ /*!
+ This property holds the width of this column.
+ */
+ property real width: TextSingleton.implicitHeight * 4
+}
diff --git a/src/extras/designer/CircularGaugeSpecifics.qml b/src/extras/designer/CircularGaugeSpecifics.qml
new file mode 100644
index 00000000..0be31366
--- /dev/null
+++ b/src/extras/designer/CircularGaugeSpecifics.qml
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import HelperWidgets 2.0
+import QtQuick.Layouts 1.0
+
+Column {
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ Section {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ caption: qsTr("CircularGauge")
+
+ SectionLayout {
+ Label {
+ text: qsTr("Value")
+ tooltip: qsTr("Value")
+ }
+ SecondColumnLayout {
+ SpinBox {
+ backendValue: backendValues.value
+ minimumValue: backendValues.minimumValue.value
+ maximumValue: backendValues.maximumValue.value
+ }
+ ExpandingSpacer {
+ }
+ }
+
+ Label {
+ text: qsTr("Minimum Value")
+ tooltip: qsTr("Minimum Value")
+ }
+ SecondColumnLayout {
+ SpinBox {
+ id: minimumValueSpinBox
+ backendValue: backendValues.minimumValue
+ minimumValue: 0
+ maximumValue: backendValues.maximumValue.value
+ }
+ ExpandingSpacer {
+ }
+ }
+
+ Label {
+ text: qsTr("Maximum Value")
+ tooltip: qsTr("Maximum Value")
+ }
+ SecondColumnLayout {
+ SpinBox {
+ id: maximumValueSpinBox
+ backendValue: backendValues.maximumValue
+ minimumValue: backendValues.minimumValue.value
+ maximumValue: 1000
+ }
+ ExpandingSpacer {
+ }
+ }
+
+ Label {
+ text: qsTr("Step Size")
+ tooltip: qsTr("Step Size")
+ }
+ SecondColumnLayout {
+ SpinBox {
+ backendValue: backendValues.stepSize
+ minimumValue: 0
+ maximumValue: backendValues.maximumValue.value
+ }
+ ExpandingSpacer {
+ }
+ }
+ }
+ }
+}
+
diff --git a/src/extras/designer/DelayButtonSpecifics.qml b/src/extras/designer/DelayButtonSpecifics.qml
new file mode 100644
index 00000000..06dc9daa
--- /dev/null
+++ b/src/extras/designer/DelayButtonSpecifics.qml
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import HelperWidgets 2.0
+import QtQuick.Layouts 1.0
+
+Column {
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ Section {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ caption: qsTr("DelayButton")
+
+ SectionLayout {
+ Label {
+ text: qsTr("Text")
+ tooltip: qsTr("Text")
+ }
+ SecondColumnLayout {
+ LineEdit {
+ backendValue: backendValues.text
+ showTranslateCheckBox: true
+ implicitWidth: 180
+ }
+ ExpandingSpacer {
+ }
+ }
+
+// Label {
+// text: qsTr("Disable Button")
+// tooltip: qsTr("Disable Button")
+// }
+// SecondColumnLayout {
+// CheckBox {
+// backendValue: backendValues.disabled
+// implicitWidth: 180
+// }
+// ExpandingSpacer {
+// }
+// }
+
+ Label {
+ text: qsTr("Delay")
+ tooltip: qsTr("Delay")
+ }
+ SecondColumnLayout {
+ SpinBox {
+ backendValue: backendValues.delay
+ minimumValue: 0
+ maximumValue: 60000
+ }
+ ExpandingSpacer {
+ }
+ }
+ }
+ }
+}
diff --git a/src/extras/designer/DialSpecifics.qml b/src/extras/designer/DialSpecifics.qml
new file mode 100644
index 00000000..b68e6e04
--- /dev/null
+++ b/src/extras/designer/DialSpecifics.qml
@@ -0,0 +1,128 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import HelperWidgets 2.0
+import QtQuick.Layouts 1.0
+
+Column {
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ Section {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ caption: qsTr("Dial")
+
+ SectionLayout {
+ Label {
+ text: qsTr("Value")
+ tooltip: qsTr("Value")
+ }
+ SecondColumnLayout {
+ SpinBox {
+ backendValue: backendValues.value
+ minimumValue: backendValues.minimumValue.value
+ maximumValue: backendValues.maximumValue.value
+ stepSize: 0.01
+ decimals: 2
+ }
+ ExpandingSpacer {
+ }
+ }
+
+ Label {
+ text: qsTr("Minimum Value")
+ tooltip: qsTr("Minimum Value")
+ }
+ SecondColumnLayout {
+ SpinBox {
+ backendValue: backendValues.minimumValue
+ minimumValue: -1000
+ maximumValue: backendValues.maximumValue.value
+ stepSize: 0.01
+ decimals: 2
+ }
+ ExpandingSpacer {
+ }
+ }
+
+ Label {
+ text: qsTr("Maximum Value")
+ tooltip: qsTr("Maximum Value")
+ }
+ SecondColumnLayout {
+ SpinBox {
+ backendValue: backendValues.maximumValue
+ minimumValue: backendValues.minimumValue.value
+ maximumValue: 1000
+ stepSize: 0.01
+ decimals: 2
+ }
+ ExpandingSpacer {
+ }
+ }
+
+ Label {
+ text: qsTr("Step Size")
+ tooltip: qsTr("Step Size")
+ }
+ SecondColumnLayout {
+ SpinBox {
+ backendValue: backendValues.stepSize
+ minimumValue: 0
+ maximumValue: backendValues.maximumValue.value
+ stepSize: 0.01
+ decimals: 2
+ }
+ ExpandingSpacer {
+ }
+ }
+
+ Label {
+ text: qsTr("Tickmarks Visible")
+ tooltip: qsTr("Tickmarks Visible")
+ }
+ SecondColumnLayout {
+ CheckBox {
+ backendValue: backendValues.tickmarksVisible
+ }
+ ExpandingSpacer {
+ }
+ }
+ }
+ }
+}
diff --git a/src/extras/designer/GaugeSpecifics.qml b/src/extras/designer/GaugeSpecifics.qml
new file mode 100644
index 00000000..13febbdd
--- /dev/null
+++ b/src/extras/designer/GaugeSpecifics.qml
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import HelperWidgets 2.0
+import QtQuick.Layouts 1.0
+
+Column {
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ Section {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ caption: qsTr("Gauge")
+
+ SectionLayout {
+
+ Label {
+ text: qsTr("Value")
+ tooltip: qsTr("Value")
+ }
+ SecondColumnLayout {
+ SpinBox {
+ backendValue: backendValues.value
+ minimumValue: backendValues.minimumValue.value
+ maximumValue: backendValues.maximumValue.value
+ stepSize: 0.01
+ decimals: 2
+ }
+ ExpandingSpacer {
+ }
+ }
+
+ Label {
+ text: qsTr("Minimum Value")
+ tooltip: qsTr("Minimum Value")
+ }
+ SecondColumnLayout {
+ SpinBox {
+ backendValue: backendValues.minimumValue
+ minimumValue: 0
+ maximumValue: backendValues.maximumValue.value
+ stepSize: 0.01
+ decimals: 2
+ }
+ ExpandingSpacer {
+ }
+ }
+
+ Label {
+ text: qsTr("Maximum Value")
+ tooltip: qsTr("Maximum Value")
+ }
+ SecondColumnLayout {
+ SpinBox {
+ backendValue: backendValues.maximumValue
+ minimumValue: backendValues.minimumValue.value
+ maximumValue: 1000
+ stepSize: 0.01
+ decimals: 2
+ }
+ ExpandingSpacer {
+ }
+ }
+
+// Label {
+// text: qsTr("Orientation")
+// tooltip: qsTr("Orientation")
+// }
+// SecondColumnLayout {
+// ComboBox {
+// id: orientationComboBox
+// backendValue: backendValues.orientation
+// implicitWidth: 180
+// model: ["Vertical", "Horizontal"]
+// }
+// ExpandingSpacer {
+// }
+// }
+
+// Label {
+// text: qsTr("Tickmark Alignment")
+// tooltip: qsTr("Tickmark Alignment")
+// }
+
+// SecondColumnLayout {
+// ComboBox {
+// backendValue: backendValues.orientation
+// implicitWidth: 180
+// model: orientationComboBox.currentText === "Vertical" ? ["AlignLeft", "AlignRight"] : ["AlignTop", "AlignBottom"]
+// }
+// ExpandingSpacer {
+// }
+// }
+ }
+ }
+}
diff --git a/src/extras/designer/PictureSpecifics.qml b/src/extras/designer/PictureSpecifics.qml
new file mode 100644
index 00000000..538614e4
--- /dev/null
+++ b/src/extras/designer/PictureSpecifics.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import HelperWidgets 2.0
+import QtQuick.Layouts 1.0
+import QtQuick.Controls 1.1 as Controls
+import QtQuick.Controls.Styles 1.1
+
+Column {
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ Section {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ caption: qsTr("Picture")
+
+ SectionLayout {
+ Label {
+ text: qsTr("Source")
+ toolTip: qsTr("Source")
+ }
+ SecondColumnLayout {
+ LineEdit {
+ backendValue: backendValues.source
+ showTranslateCheckBox: false
+ implicitWidth: 180
+ }
+ ExpandingSpacer {
+ }
+ }
+ }
+ }
+ Section {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ caption: qsTr("Color")
+
+ ColorEditor {
+ caption: qsTr("Color")
+ backendValue: backendValues.color
+ supportGradient: false
+ }
+ }
+}
+
diff --git a/src/extras/designer/PieMenuSpecifics.qml b/src/extras/designer/PieMenuSpecifics.qml
new file mode 100644
index 00000000..b6c9d325
--- /dev/null
+++ b/src/extras/designer/PieMenuSpecifics.qml
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import HelperWidgets 2.0
+import QtQuick.Layouts 1.0
+import QtQuick.Controls 1.1 as Controls
+import QtQuick.Controls.Styles 1.1
+
+Column {
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ Section {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ caption: qsTr("PieMenu")
+
+ SectionLayout {
+ Label {
+ text: qsTr("Trigger Mode")
+ tooltip: qsTr("Trigger Mode")
+ }
+ SecondColumnLayout {
+ // Work around ComboBox string => int problem.
+ Controls.ComboBox {
+ id: comboBox
+
+ property variant backendValue: backendValues.triggerMode
+
+ property color textColor: "white"
+ implicitWidth: 180
+ model: ["TriggerOnPress", "TriggerOnRelease", "TriggerOnClick"]
+
+ QtObject {
+ property variant valueFromBackend: comboBox.backendValue
+ onValueFromBackendChanged: {
+ comboBox.currentIndex = comboBox.find(comboBox.backendValue.valueToString);
+ }
+ }
+
+ onCurrentTextChanged: {
+ if (backendValue === undefined)
+ return;
+
+ if (backendValue.value !== currentText)
+ backendValue.value = comboBox.currentIndex
+ }
+
+ style: CustomComboBoxStyle {
+ textColor: comboBox.textColor
+ }
+
+ ExtendedFunctionButton {
+ x: 2
+ y: 4
+ backendValue: comboBox.backendValue
+ visible: comboBox.enabled
+ }
+ }
+ ExpandingSpacer {
+ }
+ }
+ }
+ }
+}
+
diff --git a/src/extras/designer/StatusIndicatorSpecifics.qml b/src/extras/designer/StatusIndicatorSpecifics.qml
new file mode 100644
index 00000000..b2a43362
--- /dev/null
+++ b/src/extras/designer/StatusIndicatorSpecifics.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import HelperWidgets 2.0
+import QtQuick.Layouts 1.0
+
+Column {
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ Section {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ caption: qsTr("StatusIndicator")
+
+ SectionLayout {
+ Label {
+ text: qsTr("Active")
+ tooltip: qsTr("Active")
+ }
+ SecondColumnLayout {
+ CheckBox {
+ backendValue: backendValues.active
+ implicitWidth: 100
+ }
+ ExpandingSpacer {
+ }
+ }
+ }
+ }
+ Section {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ caption: qsTr("Color")
+
+ ColorEditor {
+ caption: qsTr("Color")
+ backendValue: backendValues.color
+ supportGradient: false
+ }
+ }
+}
diff --git a/src/extras/designer/ToggleButtonSpecifics.qml b/src/extras/designer/ToggleButtonSpecifics.qml
new file mode 100644
index 00000000..abb0d06d
--- /dev/null
+++ b/src/extras/designer/ToggleButtonSpecifics.qml
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import HelperWidgets 2.0
+import QtQuick.Layouts 1.0
+
+Column {
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ Section {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ caption: qsTr("ToggleButton")
+
+ SectionLayout {
+ Label {
+ text: qsTr("Text")
+ tooltip: qsTr("Text")
+ }
+ SecondColumnLayout {
+ LineEdit {
+ backendValue: backendValues.text
+ showTranslateCheckBox: true
+ implicitWidth: 180
+ }
+ ExpandingSpacer {
+ }
+ }
+
+// Label {
+// text: qsTr("Disable Button")
+// tooltip: qsTr("Disable Button")
+// }
+// SecondColumnLayout {
+// CheckBox {
+// backendValue: backendValues.disabled
+// implicitWidth: 180
+// }
+// ExpandingSpacer {
+// }
+// }
+
+ Label {
+ text: qsTr("Checked")
+ tooltip: qsTr("Checked")
+ }
+ SecondColumnLayout {
+ CheckBox {
+ backendValue: backendValues.checked
+ implicitWidth: 180
+ }
+ ExpandingSpacer {
+ }
+ }
+ }
+ }
+}
diff --git a/src/extras/designer/TumblerSpecifics.qml b/src/extras/designer/TumblerSpecifics.qml
new file mode 100644
index 00000000..8d3986aa
--- /dev/null
+++ b/src/extras/designer/TumblerSpecifics.qml
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import HelperWidgets 2.0
+import QtQuick.Layouts 1.0
+
+Column {
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ Section {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ caption: qsTr("Tumbler")
+ }
+}
diff --git a/src/extras/designer/designer.pri b/src/extras/designer/designer.pri
new file mode 100644
index 00000000..790e0c0f
--- /dev/null
+++ b/src/extras/designer/designer.pri
@@ -0,0 +1,33 @@
+QML_FILES += \
+ $$PWD/CircularGaugeSpecifics.qml \
+ $$PWD/DelayButtonSpecifics.qml \
+ $$PWD/DialSpecifics.qml \
+ $$PWD/GaugeSpecifics.qml \
+ $$PWD/PictureSpecifics.qml \
+ $$PWD/PieMenuSpecifics.qml \
+ $$PWD/StatusIndicatorSpecifics.qml \
+ $$PWD/ToggleButtonSpecifics.qml
+
+QML_FILES += $$PWD/qtquickextras.metainfo
+
+# Images
+QML_FILES += \
+ $$PWD/images/circulargauge-icon.png \
+ $$PWD/images/circulargauge-icon16.png \
+ $$PWD/images/delaybutton-icon.png \
+ $$PWD/images/delaybutton-icon16.png \
+ $$PWD/images/dial-icon.png \
+ $$PWD/images/dial-icon16.png \
+ $$PWD/images/gauge-icon.png \
+ $$PWD/images/gauge-icon16.png \
+ $$PWD/images/picture-icon.png \
+ $$PWD/images/picture-icon16.png \
+ $$PWD/images/piemenu-icon.png \
+ $$PWD/images/piemenu-icon16.png \
+ $$PWD/images/statusindicator-icon.png \
+ $$PWD/images/statusindicator-icon16.png \
+ $$PWD/images/togglebutton-icon.png \
+ $$PWD/images/togglebutton-icon16.png \
+ $$PWD/images/tumbler-icon.png \
+ $$PWD/images/tumbler-icon16.png
+
diff --git a/src/extras/designer/images/circulargauge-icon.png b/src/extras/designer/images/circulargauge-icon.png
new file mode 100644
index 00000000..9f8eaab2
--- /dev/null
+++ b/src/extras/designer/images/circulargauge-icon.png
Binary files differ
diff --git a/src/extras/designer/images/circulargauge-icon16.png b/src/extras/designer/images/circulargauge-icon16.png
new file mode 100644
index 00000000..cde29aeb
--- /dev/null
+++ b/src/extras/designer/images/circulargauge-icon16.png
Binary files differ
diff --git a/src/extras/designer/images/delaybutton-icon.png b/src/extras/designer/images/delaybutton-icon.png
new file mode 100644
index 00000000..8b421f55
--- /dev/null
+++ b/src/extras/designer/images/delaybutton-icon.png
Binary files differ
diff --git a/src/extras/designer/images/delaybutton-icon16.png b/src/extras/designer/images/delaybutton-icon16.png
new file mode 100644
index 00000000..f14b3f89
--- /dev/null
+++ b/src/extras/designer/images/delaybutton-icon16.png
Binary files differ
diff --git a/src/extras/designer/images/dial-icon.png b/src/extras/designer/images/dial-icon.png
new file mode 100644
index 00000000..2c1031c2
--- /dev/null
+++ b/src/extras/designer/images/dial-icon.png
Binary files differ
diff --git a/src/extras/designer/images/dial-icon16.png b/src/extras/designer/images/dial-icon16.png
new file mode 100644
index 00000000..df938396
--- /dev/null
+++ b/src/extras/designer/images/dial-icon16.png
Binary files differ
diff --git a/src/extras/designer/images/gauge-icon.png b/src/extras/designer/images/gauge-icon.png
new file mode 100644
index 00000000..3bcdf27b
--- /dev/null
+++ b/src/extras/designer/images/gauge-icon.png
Binary files differ
diff --git a/src/extras/designer/images/gauge-icon16.png b/src/extras/designer/images/gauge-icon16.png
new file mode 100644
index 00000000..eae1bc37
--- /dev/null
+++ b/src/extras/designer/images/gauge-icon16.png
Binary files differ
diff --git a/src/extras/designer/images/picture-icon.png b/src/extras/designer/images/picture-icon.png
new file mode 100644
index 00000000..0fc54462
--- /dev/null
+++ b/src/extras/designer/images/picture-icon.png
Binary files differ
diff --git a/src/extras/designer/images/picture-icon16.png b/src/extras/designer/images/picture-icon16.png
new file mode 100644
index 00000000..58335819
--- /dev/null
+++ b/src/extras/designer/images/picture-icon16.png
Binary files differ
diff --git a/src/extras/designer/images/piemenu-icon.png b/src/extras/designer/images/piemenu-icon.png
new file mode 100644
index 00000000..0bde71fb
--- /dev/null
+++ b/src/extras/designer/images/piemenu-icon.png
Binary files differ
diff --git a/src/extras/designer/images/piemenu-icon16.png b/src/extras/designer/images/piemenu-icon16.png
new file mode 100644
index 00000000..d7b6e03d
--- /dev/null
+++ b/src/extras/designer/images/piemenu-icon16.png
Binary files differ
diff --git a/src/extras/designer/images/statusindicator-icon.png b/src/extras/designer/images/statusindicator-icon.png
new file mode 100644
index 00000000..4a148262
--- /dev/null
+++ b/src/extras/designer/images/statusindicator-icon.png
Binary files differ
diff --git a/src/extras/designer/images/statusindicator-icon16.png b/src/extras/designer/images/statusindicator-icon16.png
new file mode 100644
index 00000000..df41baf2
--- /dev/null
+++ b/src/extras/designer/images/statusindicator-icon16.png
Binary files differ
diff --git a/src/extras/designer/images/togglebutton-icon.png b/src/extras/designer/images/togglebutton-icon.png
new file mode 100644
index 00000000..b57ac871
--- /dev/null
+++ b/src/extras/designer/images/togglebutton-icon.png
Binary files differ
diff --git a/src/extras/designer/images/togglebutton-icon16.png b/src/extras/designer/images/togglebutton-icon16.png
new file mode 100644
index 00000000..eb42b855
--- /dev/null
+++ b/src/extras/designer/images/togglebutton-icon16.png
Binary files differ
diff --git a/src/extras/designer/images/tumbler-icon.png b/src/extras/designer/images/tumbler-icon.png
new file mode 100644
index 00000000..f5d7c0d4
--- /dev/null
+++ b/src/extras/designer/images/tumbler-icon.png
Binary files differ
diff --git a/src/extras/designer/images/tumbler-icon16.png b/src/extras/designer/images/tumbler-icon16.png
new file mode 100644
index 00000000..4ac31735
--- /dev/null
+++ b/src/extras/designer/images/tumbler-icon16.png
Binary files differ
diff --git a/src/extras/designer/qtquickextras.metainfo b/src/extras/designer/qtquickextras.metainfo
new file mode 100644
index 00000000..20e02ffb
--- /dev/null
+++ b/src/extras/designer/qtquickextras.metainfo
@@ -0,0 +1,122 @@
+MetaInfo {
+ Type {
+ name: "QtQuick.Extras.DelayButton"
+ icon: "images/delaybutton-icon16.png"
+
+ ItemLibraryEntry {
+ name: "DelayButton"
+ category: "Qt Quick - Extras"
+ libraryIcon: "images/delaybutton-icon.png"
+ version: "1.0"
+ requiredImport: "QtQuick.Extras"
+
+ Property {
+ name: "text"
+ type: "binding"
+ value: "qsTr(\"Button\")"
+ }
+ }
+ }
+ Type {
+ name: "QtQuick.Extras.ToggleButton"
+ icon: "images/togglebutton-icon16.png"
+
+ ItemLibraryEntry {
+ name: "ToggleButton"
+ category: "Qt Quick - Extras"
+ libraryIcon: "images/togglebutton-icon.png"
+ version: "1.0"
+ requiredImport: "QtQuick.Extras"
+
+ Property {
+ name: "text"
+ type: "binding"
+ value: "qsTr(\"Button\")"
+ }
+ }
+ }
+ Type {
+ name: "QtQuick.Extras.Gauge"
+ icon: "images/gauge-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Gauge"
+ category: "Qt Quick - Extras"
+ libraryIcon: "images/gauge-icon.png"
+ version: "1.0"
+ requiredImport: "QtQuick.Extras"
+ }
+ }
+ Type {
+ name: "QtQuick.Extras.CircularGauge"
+ icon: "images/circulargauge-icon16.png"
+
+ ItemLibraryEntry {
+ name: "CircularGauge"
+ category: "Qt Quick - Extras"
+ libraryIcon: "images/circulargauge-icon.png"
+ version: "1.0"
+ requiredImport: "QtQuick.Extras"
+ }
+ }
+ Type {
+ name: "QtQuick.Extras.PieMenu"
+ icon: "images/piemenu-icon16.png"
+
+ ItemLibraryEntry {
+ name: "PieMenu"
+ category: "Qt Quick - Extras"
+ libraryIcon: "images/piemenu-icon.png"
+ version: "1.0"
+ requiredImport: "QtQuick.Extras"
+ }
+ }
+ Type {
+ name: "QtQuick.Extras.Dial"
+ icon: "images/dial-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Dial"
+ category: "Qt Quick - Extras"
+ libraryIcon: "images/dial-icon.png"
+ version: "1.0"
+ requiredImport: "QtQuick.Extras"
+ }
+ }
+ Type {
+ name: "QtQuick.Extras.StatusIndicator"
+ icon: "images/statusindicator-icon16.png"
+
+ ItemLibraryEntry {
+ name: "StatusIndicator"
+ category: "Qt Quick - Extras"
+ libraryIcon: "images/statusindicator-icon.png"
+ version: "1.1"
+ requiredImport: "QtQuick.Extras"
+ }
+ }
+ Type {
+ name: "QtQuick.Extras.Tumbler"
+ icon: "images/tumbler-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Tumbler"
+ category: "Qt Quick - Extras"
+ libraryIcon: "images/tumbler-icon.png"
+ version: "1.2"
+ requiredImport: "QtQuick.Extras"
+ }
+ }
+ Type {
+ name: "QtQuick.Extras.Picture"
+ icon: "images/picture-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Picture"
+ category: "Qt Quick - Extras"
+ libraryIcon: "images/picture-icon.png"
+ version: "1.3"
+ requiredImport: "QtQuick.Extras"
+ }
+ }
+}
diff --git a/src/extras/doc/compat/qtquickextras.qdocconf b/src/extras/doc/compat/qtquickextras.qdocconf
new file mode 100644
index 00000000..d36fd909
--- /dev/null
+++ b/src/extras/doc/compat/qtquickextras.qdocconf
@@ -0,0 +1,5 @@
+include(../qtquickextras-compat.qdocconf)
+
+# Workaround for qdoc not parsing relative include paths correctly
+exampledirs += ../../../../examples
+imagedirs += ../images
diff --git a/src/extras/doc/images/circulargauge-angles.png b/src/extras/doc/images/circulargauge-angles.png
new file mode 100644
index 00000000..fb93bcaa
--- /dev/null
+++ b/src/extras/doc/images/circulargauge-angles.png
Binary files differ
diff --git a/src/extras/doc/images/circulargauge-needle-example-2.png b/src/extras/doc/images/circulargauge-needle-example-2.png
new file mode 100644
index 00000000..a2b5f322
--- /dev/null
+++ b/src/extras/doc/images/circulargauge-needle-example-2.png
Binary files differ
diff --git a/src/extras/doc/images/circulargauge-needle.png b/src/extras/doc/images/circulargauge-needle.png
new file mode 100644
index 00000000..b2780b41
--- /dev/null
+++ b/src/extras/doc/images/circulargauge-needle.png
Binary files differ
diff --git a/src/extras/doc/images/circulargauge-reversed.png b/src/extras/doc/images/circulargauge-reversed.png
new file mode 100644
index 00000000..aeadfbcc
--- /dev/null
+++ b/src/extras/doc/images/circulargauge-reversed.png
Binary files differ
diff --git a/src/extras/doc/images/circulargauge-tickmark-indices-values.png b/src/extras/doc/images/circulargauge-tickmark-indices-values.png
new file mode 100644
index 00000000..d117f483
--- /dev/null
+++ b/src/extras/doc/images/circulargauge-tickmark-indices-values.png
Binary files differ
diff --git a/src/extras/doc/images/circulargauge.png b/src/extras/doc/images/circulargauge.png
new file mode 100644
index 00000000..f88aa01f
--- /dev/null
+++ b/src/extras/doc/images/circulargauge.png
Binary files differ
diff --git a/src/extras/doc/images/delaybutton-activated.png b/src/extras/doc/images/delaybutton-activated.png
new file mode 100644
index 00000000..d78d7738
--- /dev/null
+++ b/src/extras/doc/images/delaybutton-activated.png
Binary files differ
diff --git a/src/extras/doc/images/delaybutton-progress.png b/src/extras/doc/images/delaybutton-progress.png
new file mode 100644
index 00000000..07a13256
--- /dev/null
+++ b/src/extras/doc/images/delaybutton-progress.png
Binary files differ
diff --git a/src/extras/doc/images/delaybutton.png b/src/extras/doc/images/delaybutton.png
new file mode 100644
index 00000000..510abc0b
--- /dev/null
+++ b/src/extras/doc/images/delaybutton.png
Binary files differ
diff --git a/src/extras/doc/images/dial.png b/src/extras/doc/images/dial.png
new file mode 100644
index 00000000..d0e4d5ac
--- /dev/null
+++ b/src/extras/doc/images/dial.png
Binary files differ
diff --git a/src/extras/doc/images/gauge-minorTickmark-example.png b/src/extras/doc/images/gauge-minorTickmark-example.png
new file mode 100644
index 00000000..591120d6
--- /dev/null
+++ b/src/extras/doc/images/gauge-minorTickmark-example.png
Binary files differ
diff --git a/src/extras/doc/images/gauge-temperature.png b/src/extras/doc/images/gauge-temperature.png
new file mode 100644
index 00000000..95fc1679
--- /dev/null
+++ b/src/extras/doc/images/gauge-temperature.png
Binary files differ
diff --git a/src/extras/doc/images/gauge-tickmark-example.png b/src/extras/doc/images/gauge-tickmark-example.png
new file mode 100644
index 00000000..c46fb8a5
--- /dev/null
+++ b/src/extras/doc/images/gauge-tickmark-example.png
Binary files differ
diff --git a/src/extras/doc/images/gauge.png b/src/extras/doc/images/gauge.png
new file mode 100644
index 00000000..7e03307b
--- /dev/null
+++ b/src/extras/doc/images/gauge.png
Binary files differ
diff --git a/src/extras/doc/images/piemenu-boundingItem-example.png b/src/extras/doc/images/piemenu-boundingItem-example.png
new file mode 100644
index 00000000..f5c312b6
--- /dev/null
+++ b/src/extras/doc/images/piemenu-boundingItem-example.png
Binary files differ
diff --git a/src/extras/doc/images/piemenu-boundingItem-null-example.png b/src/extras/doc/images/piemenu-boundingItem-null-example.png
new file mode 100644
index 00000000..9ddb4f67
--- /dev/null
+++ b/src/extras/doc/images/piemenu-boundingItem-null-example.png
Binary files differ
diff --git a/src/extras/doc/images/piemenu-menuitem-example.png b/src/extras/doc/images/piemenu-menuitem-example.png
new file mode 100644
index 00000000..57a2f956
--- /dev/null
+++ b/src/extras/doc/images/piemenu-menuitem-example.png
Binary files differ
diff --git a/src/extras/doc/images/piemenu.png b/src/extras/doc/images/piemenu.png
new file mode 100644
index 00000000..95078eae
--- /dev/null
+++ b/src/extras/doc/images/piemenu.png
Binary files differ
diff --git a/src/extras/doc/images/qtquickextras-example-dashboard.png b/src/extras/doc/images/qtquickextras-example-dashboard.png
new file mode 100644
index 00000000..979a2d03
--- /dev/null
+++ b/src/extras/doc/images/qtquickextras-example-dashboard.png
Binary files differ
diff --git a/src/extras/doc/images/qtquickextras-example-flat.png b/src/extras/doc/images/qtquickextras-example-flat.png
new file mode 100644
index 00000000..f10bdc18
--- /dev/null
+++ b/src/extras/doc/images/qtquickextras-example-flat.png
Binary files differ
diff --git a/src/extras/doc/images/qtquickextras-example-gallery.png b/src/extras/doc/images/qtquickextras-example-gallery.png
new file mode 100644
index 00000000..1895912c
--- /dev/null
+++ b/src/extras/doc/images/qtquickextras-example-gallery.png
Binary files differ
diff --git a/src/extras/doc/images/statusindicator-active.png b/src/extras/doc/images/statusindicator-active.png
new file mode 100644
index 00000000..c5ebc09d
--- /dev/null
+++ b/src/extras/doc/images/statusindicator-active.png
Binary files differ
diff --git a/src/extras/doc/images/statusindicator-green.png b/src/extras/doc/images/statusindicator-green.png
new file mode 100644
index 00000000..88dcb1ed
--- /dev/null
+++ b/src/extras/doc/images/statusindicator-green.png
Binary files differ
diff --git a/src/extras/doc/images/statusindicator-inactive.png b/src/extras/doc/images/statusindicator-inactive.png
new file mode 100644
index 00000000..27488d5e
--- /dev/null
+++ b/src/extras/doc/images/statusindicator-inactive.png
Binary files differ
diff --git a/src/extras/doc/images/styling-circulargauge-background-example.png b/src/extras/doc/images/styling-circulargauge-background-example.png
new file mode 100644
index 00000000..e816c6f6
--- /dev/null
+++ b/src/extras/doc/images/styling-circulargauge-background-example.png
Binary files differ
diff --git a/src/extras/doc/images/styling-circulargauge-knob-example.png b/src/extras/doc/images/styling-circulargauge-knob-example.png
new file mode 100644
index 00000000..793a36c2
--- /dev/null
+++ b/src/extras/doc/images/styling-circulargauge-knob-example.png
Binary files differ
diff --git a/src/extras/doc/images/styling-circulargauge-minorTickmark-example.png b/src/extras/doc/images/styling-circulargauge-minorTickmark-example.png
new file mode 100644
index 00000000..f3f2d8d7
--- /dev/null
+++ b/src/extras/doc/images/styling-circulargauge-minorTickmark-example.png
Binary files differ
diff --git a/src/extras/doc/images/styling-circulargauge-needle-example.png b/src/extras/doc/images/styling-circulargauge-needle-example.png
new file mode 100644
index 00000000..08049fc9
--- /dev/null
+++ b/src/extras/doc/images/styling-circulargauge-needle-example.png
Binary files differ
diff --git a/src/extras/doc/images/styling-circulargauge-tickmark-example.png b/src/extras/doc/images/styling-circulargauge-tickmark-example.png
new file mode 100644
index 00000000..01c71cd1
--- /dev/null
+++ b/src/extras/doc/images/styling-circulargauge-tickmark-example.png
Binary files differ
diff --git a/src/extras/doc/images/styling-circulargauge-tickmarkLabel-example.png b/src/extras/doc/images/styling-circulargauge-tickmarkLabel-example.png
new file mode 100644
index 00000000..7520827e
--- /dev/null
+++ b/src/extras/doc/images/styling-circulargauge-tickmarkLabel-example.png
Binary files differ
diff --git a/src/extras/doc/images/styling-gauge-font-size.png b/src/extras/doc/images/styling-gauge-font-size.png
new file mode 100644
index 00000000..97d7ebb2
--- /dev/null
+++ b/src/extras/doc/images/styling-gauge-font-size.png
Binary files differ
diff --git a/src/extras/doc/images/styling-gauge-foreground.png b/src/extras/doc/images/styling-gauge-foreground.png
new file mode 100644
index 00000000..5a4f65b9
--- /dev/null
+++ b/src/extras/doc/images/styling-gauge-foreground.png
Binary files differ
diff --git a/src/extras/doc/images/styling-gauge-minorTickmark.png b/src/extras/doc/images/styling-gauge-minorTickmark.png
new file mode 100644
index 00000000..34e36192
--- /dev/null
+++ b/src/extras/doc/images/styling-gauge-minorTickmark.png
Binary files differ
diff --git a/src/extras/doc/images/styling-gauge-tickmark.png b/src/extras/doc/images/styling-gauge-tickmark.png
new file mode 100644
index 00000000..1cd4fb8b
--- /dev/null
+++ b/src/extras/doc/images/styling-gauge-tickmark.png
Binary files differ
diff --git a/src/extras/doc/images/styling-gauge-valueBar.png b/src/extras/doc/images/styling-gauge-valueBar.png
new file mode 100644
index 00000000..581b8240
--- /dev/null
+++ b/src/extras/doc/images/styling-gauge-valueBar.png
Binary files differ
diff --git a/src/extras/doc/images/togglebutton-checked.png b/src/extras/doc/images/togglebutton-checked.png
new file mode 100644
index 00000000..d40b382b
--- /dev/null
+++ b/src/extras/doc/images/togglebutton-checked.png
Binary files differ
diff --git a/src/extras/doc/images/togglebutton-unchecked.png b/src/extras/doc/images/togglebutton-unchecked.png
new file mode 100644
index 00000000..7db5b84b
--- /dev/null
+++ b/src/extras/doc/images/togglebutton-unchecked.png
Binary files differ
diff --git a/src/extras/doc/images/tumbler-flat-style.png b/src/extras/doc/images/tumbler-flat-style.png
new file mode 100644
index 00000000..9ec5402a
--- /dev/null
+++ b/src/extras/doc/images/tumbler-flat-style.png
Binary files differ
diff --git a/src/extras/doc/images/tumbler.png b/src/extras/doc/images/tumbler.png
new file mode 100644
index 00000000..5b15c57f
--- /dev/null
+++ b/src/extras/doc/images/tumbler.png
Binary files differ
diff --git a/src/extras/doc/qtquickextras-compat.qdocconf b/src/extras/doc/qtquickextras-compat.qdocconf
new file mode 100644
index 00000000..ad171f47
--- /dev/null
+++ b/src/extras/doc/qtquickextras-compat.qdocconf
@@ -0,0 +1,17 @@
+include($QT_INSTALL_DOCS/global/qt-defines.qdocconf)
+include($QT_INSTALL_DOCS/global/qt-cpp-ignore.qdocconf)
+
+naturallanguage = en_US
+outputencoding = UTF-8
+sourceencoding = UTF-8
+
+examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml *.css"
+examples.imageextensions = "*.png *.jpg *.gif"
+
+headers.fileextensions = "*.ch *.h *.h++ *.hh *.hpp *.hxx"
+sources.fileextensions = "*.c++ *.cc *.cpp *.cxx *.mm *.qml *.qdoc"
+
+#include the external websites
+sourcedirs += externalsites
+
+include(qtquickextras-project.qdocconf)
diff --git a/src/extras/doc/qtquickextras-project.qdocconf b/src/extras/doc/qtquickextras-project.qdocconf
new file mode 100644
index 00000000..0e0104c1
--- /dev/null
+++ b/src/extras/doc/qtquickextras-project.qdocconf
@@ -0,0 +1,59 @@
+include($QT_INSTALL_DOCS/global/macros.qdocconf)
+include($QT_INSTALL_DOCS/global/compat.qdocconf)
+#include($QT_INSTALL_DOCS/global/manifest-meta.qdocconf)
+include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
+
+project = QtQuickExtras
+description = Qt Quick Extras Reference Documentation
+url = http://doc.qt.digia.com/QtQuickExtras/
+version = 1.3
+
+qhp.projects = QtQuickExtras
+
+qhp.QtQuickExtras.file = qtquickextras.qhp
+qhp.QtQuickExtras.namespace = org.qt-project.qtquickextras.1.3
+qhp.QtQuickExtras.virtualFolder = qtquickextras
+qhp.QtQuickExtras.indexTitle = Qt Quick Extras
+qhp.QtQuickExtras.indexRoot =
+#qhp.QtQuickExtras.extraFiles = style/qtquickextras.css
+
+qhp.QtQuickExtras.filterAttributes = qtquickextras 1.3 qtrefdoc
+qhp.QtQuickExtras.customFilters.Qt.name = QtQuickExtras 1.3
+qhp.QtQuickExtras.customFilters.Qt.filterAttributes = qtquickextras 1.3
+
+qhp.QtQuickExtras.subprojects = qtquickextrasstyles
+
+qhp.QtQuickExtras.subprojects.qtquickextrasqmltypes.title = Controls QML Types
+qhp.QtQuickExtras.subprojects.qtquickextrasqmltypes.indexTitle = Qt Quick Controls QML Types
+qhp.QtQuickExtras.subprojects.qtquickextrasqmltypes.selectors = fake:qmlclass # cannot choose qmltypes from a specific group QTBUG-32985
+qhp.QtQuickExtras.subprojects.qtquickextrasqmltypes.sortPages = true
+
+qhp.QtQuickExtras.subprojects.qtquickextrasstyles.title = Qt Quick Extras Styles Structure
+qhp.QtQuickExtras.subprojects.qtquickextrasstyles.indexTitle = Qt Quick Extras Styles Structure
+qhp.QtQuickExtras.subprojects.qtquickextrasstyles.type = manual
+
+# QTBUG-35596: If you're using a shadow build of Qt >= 5.3.1, then uncomment the following line and comment out indexes += ...
+#depends = qtqml qtquick qtdoc qtquickcontrols
+indexes += $QT_INSTALL_DOCS/qtqml/qtqml.index \
+ $QT_INSTALL_DOCS/qtquick/qtquick.index \
+ $QT_INSTALL_DOCS/qtdoc/qtdoc.index \
+ $QT_INSTALL_DOCS/qtquickcontrols/qtquickcontrols.index
+
+# Specify the install path under QT_INSTALL_EXAMPLES
+# Examples will be installed under quick/extras -
+# 'extras' subdirectory is given as part of \example commands
+exampledirs += ../../../examples/quick \
+ snippets
+examplesinstallpath = quick
+
+headerdirs += ../
+
+sourcedirs += ../
+
+#sources += ../Private/<stuff> \
+
+imagedirs += images
+
+navigation.landingpage = "Qt Quick Extras"
+navigation.qmltypespage = "Qt Quick Extras QML Types"
+buildversion = "Qt Quick Extras 1.3"
diff --git a/src/extras/doc/qtquickextras.qdocconf b/src/extras/doc/qtquickextras.qdocconf
new file mode 100644
index 00000000..10117442
--- /dev/null
+++ b/src/extras/doc/qtquickextras.qdocconf
@@ -0,0 +1,4 @@
+include($QT_INSTALL_DOCS/global/qt-cpp-defines.qdocconf)
+include($QT_INSTALL_DOCS/global/fileextensions.qdocconf)
+
+include(qtquickextras-project.qdocconf)
diff --git a/src/extras/doc/snippets/circulargauge-background-range.qml b/src/extras/doc/snippets/circulargauge-background-range.qml
new file mode 100644
index 00000000..619fc465
--- /dev/null
+++ b/src/extras/doc/snippets/circulargauge-background-range.qml
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [range]
+import QtQuick 2.0
+import QtQuick.Controls 1.1
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Styles 1.3
+import QtQuick.Extras.Private 1.0
+
+Rectangle {
+ width: 300
+ height: 300
+ color: "#494d53"
+
+ CircularGauge {
+ id: gauge
+ anchors.centerIn: parent
+ style: CircularGaugeStyle {
+ id: style
+
+ //! [background]
+ function degreesToRadians(degrees) {
+ return degrees * (Math.PI / 180);
+ }
+
+
+ background: Canvas {
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ ctx.beginPath();
+ ctx.strokeStyle = "#e34c22";
+ ctx.lineWidth = outerRadius * 0.02;
+
+ ctx.arc(outerRadius, outerRadius, outerRadius - ctx.lineWidth / 2,
+ degreesToRadians(valueToAngle(80) - 90), degreesToRadians(valueToAngle(100) - 90));
+ ctx.stroke();
+ }
+ }
+ //! [background]
+
+ //! [tickmark]
+ tickmark: Rectangle {
+ visible: styleData.value < 80 || styleData.value % 10 == 0
+ implicitWidth: outerRadius * 0.02
+ antialiasing: true
+ implicitHeight: outerRadius * 0.06
+ color: styleData.value >= 80 ? "#e34c22" : "#e5e5e5"
+ }
+ //! [tickmark]
+
+ //! [minorTickmark]
+ minorTickmark: Rectangle {
+ visible: styleData.value < 80
+ implicitWidth: outerRadius * 0.01
+ antialiasing: true
+ implicitHeight: outerRadius * 0.03
+ color: "#e5e5e5"
+ }
+ //! [minorTickmark]
+
+ //! [tickmarkLabel]
+ tickmarkLabel: Text {
+ font.pixelSize: Math.max(6, outerRadius * 0.1)
+ text: styleData.value
+ color: styleData.value >= 80 ? "#e34c22" : "#e5e5e5"
+ antialiasing: true
+ }
+ //! [tickmarkLabel]
+
+ //! [needle]
+ needle: Rectangle {
+ y: outerRadius * 0.15
+ implicitWidth: outerRadius * 0.03
+ implicitHeight: outerRadius * 0.9
+ antialiasing: true
+ color: "#e5e5e5"
+ }
+ //! [needle]
+
+ //! [foreground]
+ foreground: Item {
+ Rectangle {
+ width: outerRadius * 0.2
+ height: width
+ radius: width / 2
+ color: "#e5e5e5"
+ anchors.centerIn: parent
+ }
+ }
+ //! [foreground]
+ }
+ }
+}
+//! [range]
diff --git a/src/extras/doc/snippets/circulargauge-tickmark-indices-values.qml b/src/extras/doc/snippets/circulargauge-tickmark-indices-values.qml
new file mode 100644
index 00000000..33781baa
--- /dev/null
+++ b/src/extras/doc/snippets/circulargauge-tickmark-indices-values.qml
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [tickmarks]
+import QtQuick 2.0
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Styles 1.3
+
+Rectangle {
+ width: 400
+ height: 400
+
+ CircularGauge {
+ id: gauge
+ anchors.fill: parent
+ style: CircularGaugeStyle {
+ labelInset: outerRadius * 0.2
+
+ tickmarkLabel: null
+
+ tickmark: Text {
+ text: styleData.value
+
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: parent.bottom
+ text: styleData.index
+ color: "blue"
+ }
+ }
+
+ minorTickmark: Text {
+ text: styleData.value
+ font.pixelSize: 8
+
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: parent.bottom
+ text: styleData.index
+ font.pixelSize: 8
+ color: "blue"
+ }
+ }
+ }
+
+ Text {
+ id: indexText
+ text: "Major and minor indices"
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: valueText.top
+ color: "blue"
+ }
+ Text {
+ id: valueText
+ text: "Major and minor values"
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ }
+ }
+}
+//! [tickmarks]
diff --git a/src/extras/doc/snippets/styling-gauge.qml b/src/extras/doc/snippets/styling-gauge.qml
new file mode 100644
index 00000000..48cb95ed
--- /dev/null
+++ b/src/extras/doc/snippets/styling-gauge.qml
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [all]
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Styles 1.3
+
+Rectangle {
+ width: 100
+ height: 220
+ color: "#494d53"
+
+ Gauge {
+ value: 50
+ tickmarkStepSize: 20
+ minorTickmarkCount: 1
+ //! [font-size]
+ font.pixelSize: 15
+ //! [font-size]
+ anchors.centerIn: parent
+ anchors.horizontalCenterOffset: -4
+
+ style: GaugeStyle {
+ //! [valueBar]
+ valueBar: Rectangle {
+ color: "#e34c22"
+ implicitWidth: 28
+ }
+ //! [valueBar]
+
+ //! [foreground]
+ foreground: null
+ //! [foreground]
+
+ //! [tickmark]
+ tickmark: Item {
+ implicitWidth: 8
+ implicitHeight: 4
+
+ Rectangle {
+ x: control.tickmarkAlignment === Qt.AlignLeft
+ || control.tickmarkAlignment === Qt.AlignTop ? parent.implicitWidth : -28
+ width: 28
+ height: parent.height
+ color: "#ffffff"
+ }
+ }
+ //! [tickmark]
+
+ //! [minorTickmark]
+ minorTickmark: Item {
+ implicitWidth: 8
+ implicitHeight: 2
+
+ Rectangle {
+ x: control.tickmarkAlignment === Qt.AlignLeft
+ || control.tickmarkAlignment === Qt.AlignTop ? parent.implicitWidth : -28
+ width: 28
+ height: parent.height
+ color: "#ffffff"
+ }
+ }
+ //! [minorTickmark]
+ }
+ }
+}
+//! [all]
diff --git a/src/extras/doc/src/qtquickextras-examples.qdoc b/src/extras/doc/src/qtquickextras-examples.qdoc
new file mode 100644
index 00000000..c966e48d
--- /dev/null
+++ b/src/extras/doc/src/qtquickextras-examples.qdoc
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \group qtquickextras-examples
+ \ingroup all-examples
+ \title Qt Quick Extras Examples
+ \brief A collection of examples for \l{Qt Quick Extras}.
+
+ Below is a listing of the examples for \l{Qt Quick Extras}.
+*/
+
+/*!
+ \example extras/gallery
+ \title Qt Quick Extras - Gallery
+ \ingroup qtquickextras-examples
+ \brief An interactive showcase of the various controls.
+ \image qtquickextras-example-gallery.png
+
+ This example project demonstrates the various UI controls provided by
+ \l{Qt Quick Extras}.
+*/
+
+/*!
+ \example extras/dashboard
+ \title Qt Quick Extras - Dashboard
+ \ingroup qtquickextras-examples
+ \brief A car dashboard created using several CircularGauge controls.
+ \image qtquickextras-example-dashboard.png
+
+ This example project demonstrates the use of \l CircularGauge to create a car dashboard.
+*/
+
+/*!
+ \example extras/flat
+ \title Qt Quick Extras - Flat
+ \ingroup qtquickextras-examples
+ \brief An interactive showcase of the flat style.
+ \image qtquickextras-example-flat.png
+
+ This example project demonstrates the Flat style, a modern look for
+ both the Qt Quick Controls and Qt Quick Extras.
+*/
diff --git a/src/extras/doc/src/qtquickextras-index.qdoc b/src/extras/doc/src/qtquickextras-index.qdoc
new file mode 100644
index 00000000..18e40711
--- /dev/null
+++ b/src/extras/doc/src/qtquickextras-index.qdoc
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page index.html
+ \title Qt Quick Extras
+
+ \brief The Qt Quick Extras module provides a set of UI controls for Qt
+ Quick.
+
+ The Qt Quick Extras module provides a specialized set of
+ controls that can be used to build interfaces in Qt Quick.
+
+ The module requires \l{Qt Quick} 2.2, and \l{Qt Quick Controls} 1.1.
+
+ Visit the \l{Qt Quick Extras Overview} page to get started.
+
+ \section1 Controls
+ Controls are typically items that are used to present or receive input from
+ the user.
+ \annotatedlist extras
+
+ \section1 Related information
+
+ \list
+ \li \l{Qt Quick}
+ \li \l{Qt Quick Extras Overview}
+ \li \l{Qt Quick Extras QML Types}{Qt Quick Extras QML Types}
+ \li \l{Qt Quick Extras Examples}
+ \li \l{Qt Quick Extras Styles}
+ \endlist
+*/
diff --git a/src/extras/doc/src/qtquickextras-overview.qdoc b/src/extras/doc/src/qtquickextras-overview.qdoc
new file mode 100644
index 00000000..63732c50
--- /dev/null
+++ b/src/extras/doc/src/qtquickextras-overview.qdoc
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickextras-overview.html
+ \title Qt Quick Extras Overview
+ \brief A set of UI controls to create user interfaces in Qt Quick
+
+ Qt Quick Extras provide a set of UI controls to create user
+ interfaces in Qt Quick.
+
+ \section1 Getting Started
+
+ \section2 Building
+
+ If you are building Qt Quick Extras from source, you can follow
+ the steps used for most Qt modules:
+
+ \code
+ qmake
+ make
+ make install
+ \endcode
+
+ \section2 Documentation
+
+ To build this documentation, you should use an in-source build of Qt or
+ install Qt from a binary package.
+
+ The steps to build the documentation are:
+
+ \code
+ qmake
+ make docs
+ \endcode
+
+ \section2 Using the Controls
+
+ The QML types can be imported into your application using the following
+ import statement in your \c {.qml} file.
+
+ \code
+ import QtQuick.Extras 1.3
+ \endcode
+
+ \section1 Interactive controls
+
+ \annotatedlist extras-interactive
+
+ \section1 Non-interactive controls
+
+ \annotatedlist extras-non-interactive
+
+ \section1 Creating a basic example
+
+ A basic example of a QML file that makes use of controls is shown here:
+
+ \code
+ import QtQuick 2.2
+ import QtQuick.Extras 1.3
+
+ Rectangle {
+ DelayButton {
+ anchors.centerIn: parent
+ }
+ }
+ \endcode
+
+ For an interactive showcase of the controls provided by
+ \l{Qt Quick Extras}, you can look at
+ the \l{Qt Quick Extras - Gallery}{Gallery} example.
+
+ \image qtquickextras-example-gallery.png
+
+ \section1 Related information
+
+ \list
+ \li \l{Qt Quick}
+ \li \l{Qt Quick Extras}
+ \li \l{Qt Quick Extras Examples}
+ \endlist
+*/
diff --git a/src/extras/doc/src/qtquickextras.qdoc b/src/extras/doc/src/qtquickextras.qdoc
new file mode 100644
index 00000000..835b14fd
--- /dev/null
+++ b/src/extras/doc/src/qtquickextras.qdoc
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \qmlmodule QtQuick.Extras 1.3
+ \title Qt Quick Extras QML Types
+ \ingroup qmlmodules
+ \brief Provides QML types for user interfaces.
+
+ The \l{Qt Quick Extras} module provides specialized controls
+ for creating user interfaces. These QML types work in conjunction with
+ \l{Qt Quick} and \l{Qt Quick Controls}.
+
+ Controls can be styled using the
+ \l{Qt Quick Extras Styles QML Types}{Styles QML Types}.
+
+ The QML types can be imported into your application using the
+ following import statement in your .qml file.
+
+ \code
+ import QtQuick.Extras 1.3
+ \endcode
+
+*/
diff --git a/src/extras/doc/src/qtquickextrasstyles-index.qdoc b/src/extras/doc/src/qtquickextrasstyles-index.qdoc
new file mode 100644
index 00000000..6af24bb7
--- /dev/null
+++ b/src/extras/doc/src/qtquickextrasstyles-index.qdoc
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \group extrasstyling
+ \title Styling Extras Controls
+*/
+
+/*!
+ \page qtquickextrasstyles-index.html
+ \title Qt Quick Extras Styles
+ \brief The Qt Quick Extras Styles submodule provides custom
+ styles for Qt Quick Extras.
+
+ The Qt Quick Extras Styles module allows custom styling for
+ \l {Qt Quick Extras}.
+
+ The submodule requires \l{Qt Quick} 2.2.
+
+ \section1 Getting started
+
+ The QML types can be imported into your application using the following
+ import statement in your \c {.qml} file.
+
+ \code
+ import QtQuick.Extras.Styles 1.3
+ \endcode
+
+ \section1 Styles
+
+ \section2 Base Style
+
+ The Base Style is the default style used when none is specified. It is also
+ used as a fallback when the specified style cannot be found.
+
+ \image tumbler.png
+ \caption The Base Style Tumbler.
+
+ \section2 Flat Style
+
+ The Flat Style is designed for touch devices. It was introduced in Qt Quick
+ Extras Controls 1.3 and requires Qt 5.4.
+
+ \image tumbler-flat-style.png
+ \caption The Flat Style Tumbler.
+
+ \section2 Selecting Styles
+
+ Qt Quick Extras follow Qt Quick Controls' styling system. You
+ can apply a different style to the controls by setting the
+ \e QT_QUICK_CONTROLS_STYLE environment variable to the name of the style.
+ For example, to use the Flat style, you can do the following:
+
+ \code
+ QT_QUICK_CONTROLS_STYLE=Flat ./app
+ \endcode
+
+ This can also be done in C++, using qputenv():
+
+ \code
+ qputenv("QT_QUICK_CONTROLS_STYLE", "Flat");
+ \endcode
+
+ \section1 Control Styles
+ \annotatedlist extrasstyles
+
+ \section1 Styling Tutorials
+ \annotatedlist extrasstyling
+
+ \section1 Related information
+
+ \list
+ \li \l{Qt Quick}
+ \li \l{Qt Quick Extras}
+ \li \l{Qt Quick Extras Styles QML Types}
+ \endlist
+*/
+
+/*!
+ \page qtquickextrasstyles-structure.html
+ \title Qt Quick Extras Styles Structure
+ \list
+ \li \l{Qt Quick Extras Styles}
+ \list
+ \li \l{Qt Quick Extras Styles QML Types}{Styles QMl Types}
+ \endlist
+ \endlist
+*/
+
+/*!
+ \qmlmodule QtQuick.Extras.Styles 1.0
+ \title Qt Quick Extras Styles QML Types
+ \ingroup qmlmodules
+ \brief Provides QML types for Qt Quick Extras styles.
+
+ The \l{Qt Quick Extras} module provides a set of QML types for
+ handling styles.
+
+ Some of the controls allow custom styling similar to widget style sheets.
+ A styling object is usually a collection of properties that control behavior
+ and simple delegates that can be replaced with custom QML snippets.
+
+ \code
+ import QtQuick.Extras.Styles 1.3
+ \endcode
+*/
diff --git a/src/extras/doc/src/styling-circulargauge.qdoc b/src/extras/doc/src/styling-circulargauge.qdoc
new file mode 100644
index 00000000..9cf94087
--- /dev/null
+++ b/src/extras/doc/src/styling-circulargauge.qdoc
@@ -0,0 +1,145 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page styling-circulargauge.html
+ \title Styling CircularGauge
+ \brief Tutorial for styling CircularGauge.
+ \ingroup extrasstyling
+
+ \target styling-circulargauge-needle
+ \section2 The Needle Component
+
+ The \l {QtQuick.Extras.Styles::CircularGaugeStyle::}{needle}
+ component is rotated around the gauge to represent the current value.
+
+ Starting from the default style, we'll add a very basic white needle:
+
+ \snippet circulargauge-background-range.qml needle
+
+ \image styling-circulargauge-needle-example.png
+
+ As mentioned in the documentation for \l {QtQuick.Extras.Styles::}
+ {CircularGaugeStyle}, \c implicitWidth
+ and \c implicitHeight properties need to be set. This is so that the needle
+ can be positioned properly. We always scale items by the
+ \l {QtQuick.Extras.Styles::CircularGaugeStyle::}{outerRadius}
+ property of the style, ensuring the control resizes gracefully.
+
+ We offset the needle vertically so that its back sits beyond the knob.
+
+ \target styling-circulargauge-foreground
+ \section2 The Foreground Component
+
+ We've now changed the needle, but the default knob is still there; let's
+ replace it. The \l {QtQuick.Extras.Styles::CircularGaugeStyle::}
+ {foreground} component defines the default knob, so we can specify our own by
+ overriding it (note that we could also set it to \c null if we didn't want a
+ foreground):
+
+ \snippet circulargauge-background-range.qml foreground
+
+ \image styling-circulargauge-knob-example.png
+
+ Firstly, we create a circle from the Rectangle item by setting the radius to
+ be half the width (either width or height will work here; they are always
+ equal in this case). We make it a child of the Item, because the foreground
+ fills the gauge. We then center it within the Item.
+
+ We set the color of the knob to the same white that we used before.
+
+ \target styling-circulargauge-tickmarkLabel
+ \section2 The Tickmark Label Component
+
+ Suppose we want to caution the user if the value displayed by the gauge goes
+ above or below a certain range. We could present this range to the user in
+ several ways:
+
+ \list A
+ \li Change the color of the tickmarks depending on \c styleData.value
+ \li Add an image to the background
+ \li Draw it with \l {QtQuick::}{Canvas}
+ \endlist
+
+ We'll choose options 1 and 3, as they are more flexible than using an
+ image.
+
+ Firstly, let's change the color of the three highest tickmark labels:
+
+ \snippet circulargauge-background-range.qml tickmarkLabel
+
+ \image styling-circulargauge-tickmarkLabel-example.png tickmarkLabel
+
+ We also change the color of the rest of the labels to the same white that
+ we used for the needle and knob.
+
+ \target styling-circulargauge-tickmark
+ \section2 The Tickmark Component
+
+ Now let's do the same for the three highest tickmarks:
+
+ \snippet circulargauge-background-range.qml tickmark
+
+ \image styling-circulargauge-tickmark-example.png tickmark
+
+ \target styling-circulargauge-minorTickmark
+ \section2 The Minor Tickmark Component
+
+ For the minor tickmarks, we'll only show those which are not higher than
+ \c 80:
+
+ \snippet circulargauge-background-range.qml minorTickmark
+
+ \image styling-circulargauge-minorTickmark-example.png minorTickmark
+
+ This is because we'll draw something between that range in the next section.
+
+ \target styling-circulargauge-background
+ \section2 The Background Component
+
+ We'll display the range that indicates caution with an orange arc:
+
+ \snippet circulargauge-background-range.qml background
+
+ We define a function to convert degrees to radians, which are the
+ units used by \l {QtQuick::}{Canvas}.
+
+ Next, we do the drawing of the range using Canvas. We draw an arc between
+ \c 80 and \c 100, using the
+ \l {QtQuick.Extras.Styles::CircularGaugeStyle::}{valueToAngle()}
+ function provided by CircularGaugeStyle. Note that we subtract \c 90 degrees
+ before converting to radians, as our origin is north and Canvas' is east.
+
+ The finished product:
+
+ \image styling-circulargauge-background-example.png background
+
+ The complete code for this example is as follows:
+
+ \snippet circulargauge-background-range.qml range
+*/
+
diff --git a/src/extras/doc/src/styling-gauge.qdoc b/src/extras/doc/src/styling-gauge.qdoc
new file mode 100644
index 00000000..accdd425
--- /dev/null
+++ b/src/extras/doc/src/styling-gauge.qdoc
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page styling-gauge.html
+ \title Styling Gauge
+ \brief Tutorial for styling the Gauge control.
+ \ingroup extrasstyling
+
+ As GaugeStyle's documentation adequately covers common use cases, this
+ tutorial will cover a different scenario: one where the gauge's tickmarks
+ cover the value bar, instead of being aligned to the left or right of it.
+
+ \target styling-gauge-valueBar
+ \section2 The Value Bar Component
+
+ The \l {QtQuick.Extras.Styles::GaugeStyle::}{valueBar}
+ component is resized according to the gauge's value; if the value is low,
+ the bar will be small, and vice versa.
+
+ Starting from the default style, we'll change the color of the value bar to
+ orange, and increase its width slightly:
+
+ \snippet styling-gauge.qml valueBar
+
+ \image styling-gauge-valueBar.png
+
+ As mentioned in the documentation for GaugeStyle, \c implicitWidth needs to
+ be set when defining your own value bar.
+
+ \target styling-gauge-foreground
+ \section2 The Foreground Component
+
+ The \l {QtQuick.Extras.Styles::GaugeStyle::}{foreground}
+ component covers the full width and height of the value bar, even when the
+ value bar is not at its highest. By default, the foreground component
+ provides a "sheen". We'll choose to discard this, and leave it empty
+ instead:
+
+ \snippet styling-gauge.qml foreground
+
+ \image styling-gauge-foreground.png
+
+ \target styling-gauge-tickmark
+ \section2 The Tickmark Component
+
+ The \l {QtQuick.Extras.Styles::GaugeStyle::}{tickmark}
+ component sits to the left or right of the value bar, depending on the
+ control's \l {Gauge::tickmarkAlignment}{tickmarkAlignment}. In order to
+ have the tickmarks cover the width of the value bar instead, we need to do
+ two things:
+ \list 1
+ \li Remove the space the tickmarks previously assumed so that there is
+ just enough space for margins between the tickmarks and value bar.
+ \li Position the tickmarks according to the control's orientation and
+ tickmark alignment.
+ \endlist
+
+ \snippet styling-gauge.qml tickmark
+
+ In this case we chose \c 8 pixel margins, so we set the \c implicitWidth of
+ the tickmarks to that.
+
+ We account for every possible orientation and tickmark alignment, something
+ that is not necessary if the gauge will only ever have one orientation and
+ alignment. For example, if the gauge will always be of a vertical
+ orientation and the tickmarks left-aligned, then it is enough to set the
+ \c x property of the \c Rectangle to the following:
+
+ \code
+ x: parent.implicitWidth
+ \endcode
+
+ The value bar is \c 28 pixels wide, so we give the same width to our
+ tickmarks so that they cover the width of it.
+
+ \image styling-gauge-tickmark.png
+
+ \target styling-gauge-minorTickmark
+ \section2 The Minor Tickmark Component
+
+ The \l {QtQuick.Extras.Styles::GaugeStyle::}{minorTickmark}
+ component is almost identical to its larger counterpart, except that its
+ width does not affect the layout of the gauge's components. We'll do
+ similar adjustments to the ones in the previous section - the only
+ difference being the height:
+
+ \snippet styling-gauge.qml minorTickmark
+
+ \image styling-gauge-minorTickmark.png
+
+ \target styling-gauge-font-size
+ \section2 Adjusting Font Size
+
+ Finally, we increase the \l {Gauge::font}{font} size to \c 15 pixels:
+
+ \snippet styling-gauge.qml font-size
+ \image styling-gauge-font-size.png
+
+ \target styling-gauge-complete
+ \section2 Complete Source Code
+
+ \snippet styling-gauge.qml all
+*/
+
diff --git a/src/extras/extras.pro b/src/extras/extras.pro
new file mode 100644
index 00000000..dacadf1f
--- /dev/null
+++ b/src/extras/extras.pro
@@ -0,0 +1,39 @@
+TARGET = qtquickextrasplugin
+TARGETPATH = QtQuick/Extras
+IMPORT_VERSION = 1.3
+
+QT += qml
+
+# Qt 5.1 requires a different set of includes for .qdocconf
+equals(QT_MAJOR_VERSION, 5):!greaterThan(QT_MINOR_VERSION, 1) {
+ QMAKE_DOCS = $$PWD/doc/compat/qtquickextras.qdocconf
+} else {
+ QMAKE_DOCS = $$PWD/doc/qtquickextras.qdocconf
+}
+
+CONTROLS_QML_FILES = \
+ CircularGauge.qml \
+ DelayButton.qml \
+ Dial.qml \
+ Gauge.qml \
+ StatusIndicator.qml \
+ PieMenu.qml \
+ ToggleButton.qml \
+ Tumbler.qml \
+ TumblerColumn.qml
+
+HEADERS += plugin.h \
+ qquicktriggermode_p.h \
+ qquickpicture_p.h
+SOURCES += plugin.cpp \
+ qquickpicture.cpp
+
+include(Private/private.pri)
+include(designer/designer.pri)
+
+OTHER_FILES += doc/src/*
+
+RESOURCES += extras.qrc
+
+CONFIG += no_cxx_module
+load(qml_plugin)
diff --git a/src/extras/extras.qrc b/src/extras/extras.qrc
new file mode 100644
index 00000000..fcb8da57
--- /dev/null
+++ b/src/extras/extras.qrc
@@ -0,0 +1,19 @@
+<RCC>
+ <qresource prefix="/ExtrasImports/QtQuick/Extras">
+ <file>StatusIndicator.qml</file>
+ <file>ToggleButton.qml</file>
+ <file>Tumbler.qml</file>
+ <file>PieMenu.qml</file>
+ <file>Gauge.qml</file>
+ <file>Dial.qml</file>
+ <file>CircularGauge.qml</file>
+ <file>TumblerColumn.qml</file>
+ <file>DelayButton.qml</file>
+ <file>Private/CircularButton.qml</file>
+ <file>Private/Handle.qml</file>
+ <file>Private/PieMenuIcon.qml</file>
+ <file>Private/CircularButtonStyleHelper.qml</file>
+ <file>Private/CircularTickmarkLabel.qml</file>
+ <file>Private/TextSingleton.qml</file>
+ </qresource>
+</RCC>
diff --git a/src/extras/generateresource.prf b/src/extras/generateresource.prf
new file mode 100644
index 00000000..f84f1d87
--- /dev/null
+++ b/src/extras/generateresource.prf
@@ -0,0 +1,27 @@
+defineReplace(generate_resource) {
+ GENERATED_FILE = $$OUT_PWD/$$1
+ INCLUDED_FILES = $$2
+ GENERATED_CONTENT = \
+ "<RCC>"
+
+ RESOURCE_PREFIX = ""
+ for (FILE, INCLUDED_FILES) {
+ RELATIVE_PATH = $$relative_path($$absolute_path($$FILE), $$_PRO_FILE_PWD_)
+ SUB_FOLDER = /$$dirname(RELATIVE_PATH)
+ !equals(SUB_FOLDER, $$RESOURCE_PREFIX) {
+ !isEmpty(RESOURCE_PREFIX): GENERATED_CONTENT += "</qresource>"
+ RESOURCE_PREFIX = "ExtrasImports"/$$TARGETPATH$$SUB_FOLDER
+ GENERATED_CONTENT += "<qresource prefix=\"$$RESOURCE_PREFIX\">"
+ }
+ ABSOLUTE_PATH = $$absolute_path($$FILE)
+ ALIAS_NAME = $$basename(FILE)
+ GENERATED_CONTENT += "<file alias=\"$$ALIAS_NAME\">$$ABSOLUTE_PATH</file>"
+ }
+ !isEmpty(RESOURCE_PREFIX): GENERATED_CONTENT += "</qresource>"
+
+ GENERATED_CONTENT += \
+ "</RCC>"
+ write_file($$GENERATED_FILE, GENERATED_CONTENT)|error("Failed to write resource file!")
+
+ return($$GENERATED_FILE)
+}
diff --git a/src/extras/plugin.cpp b/src/extras/plugin.cpp
new file mode 100644
index 00000000..7ac942bd
--- /dev/null
+++ b/src/extras/plugin.cpp
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "plugin.h"
+
+#include <QtCore/qfile.h>
+
+#include "qquickpicture_p.h"
+#include "qquicktriggermode_p.h"
+#include "Private/qquickcircularprogressbar_p.h"
+#include "Private/qquickflatprogressbar_p.h"
+#include "Private/qquickmousethief_p.h"
+#include "Private/qquickstylesettings_p.h"
+#include "Private/qquickmathutils_p.h"
+
+QT_BEGIN_NAMESPACE
+
+static QObject *registerMathUtilsSingleton(QQmlEngine *engine, QJSEngine *jsEngine)
+{
+ Q_UNUSED(engine);
+ Q_UNUSED(jsEngine);
+ return new QQuickMathUtils();
+}
+
+QtQuickExtrasPlugin::QtQuickExtrasPlugin(QObject *parent) :
+ QQmlExtensionPlugin(parent)
+{
+}
+
+void QtQuickExtrasPlugin::registerTypes(const char *uri)
+{
+ Q_INIT_RESOURCE(extras);
+ const QString prefix = "qrc:///ExtrasImports/QtQuick/Extras";
+ // Register public API.
+ qmlRegisterUncreatableType<QQuickActivationMode>(uri, 1, 0, "ActivationMode", QLatin1String("Do not create objects of type ActivationMode"));
+ // register 1.0
+ qmlRegisterType(QUrl(prefix + "/CircularGauge.qml"), uri, 1, 0, "CircularGauge");
+ qmlRegisterType(QUrl(prefix + "/DelayButton.qml"), uri, 1, 0, "DelayButton");
+ qmlRegisterType(QUrl(prefix + "/Dial.qml"), uri, 1, 0, "Dial");
+ qmlRegisterType(QUrl(prefix + "/Gauge.qml"), uri, 1, 0, "Gauge");
+ qmlRegisterType(QUrl(prefix + "/PieMenu.qml"), uri, 1, 0, "PieMenu");
+ qmlRegisterType(QUrl(prefix + "/StatusIndicator.qml"), uri, 1, 0, "StatusIndicator");
+ qmlRegisterType(QUrl(prefix + "/ToggleButton.qml"), uri, 1, 0, "ToggleButton");
+ // register 1.1
+ qmlRegisterType(QUrl(prefix + "/Dial.qml"), uri, 1, 1, "Dial");
+ qmlRegisterType(QUrl(prefix + "/StatusIndicator.qml"), uri, 1, 1, "StatusIndicator");
+ // register 1.2
+ qmlRegisterType(QUrl(prefix + "/Tumbler.qml"), uri, 1, 2, "Tumbler");
+ qmlRegisterType(QUrl(prefix + "/TumblerColumn.qml"), uri, 1, 2, "TumblerColumn");
+ // register 1.3
+ qmlRegisterUncreatableType<QQuickTriggerMode>(uri, 1, 3, "TriggerMode", QLatin1String("Do not create objects of type TriggerMode"));
+ // register 1.4
+ qmlRegisterType<QQuickPicture>(uri, 1, /*TODO: 4*/3, "Picture");
+}
+
+void QtQuickExtrasPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
+{
+ Q_UNUSED(uri);
+ Q_UNUSED(engine);
+ qmlRegisterType<QQuickMouseThief>("QtQuick.Extras.Private.CppUtils", 1, 0, "MouseThief");
+ qmlRegisterType<QQuickCircularProgressBar>("QtQuick.Extras.Private.CppUtils", 1, 1, "CircularProgressBar");
+ qmlRegisterType<QQuickFlatProgressBar>("QtQuick.Extras.Private.CppUtils", 1, 1, "FlatProgressBar");
+ qmlRegisterSingletonType<QQuickStyleSettings>("QtQuick.Extras.Private", 1, 0, "StyleSettings", registerSettingsModule);
+ qmlRegisterSingletonType<QQuickMathUtils>("QtQuick.Extras.Private.CppUtils", 1, 0, "MathUtils", registerMathUtilsSingleton);
+
+ const QString prefix = "qrc:///ExtrasImports/QtQuick/Extras";
+ const char *private_uri = "QtQuick.Extras.Private";
+ qmlRegisterType(QUrl(prefix + "/Private/CircularButton.qml"), private_uri, 1, 0, "CircularButton");
+ qmlRegisterType(QUrl(prefix + "/Private/CircularButtonStyleHelper.qml"), private_uri, 1, 0, "CircularButtonStyleHelper");
+ qmlRegisterType(QUrl(prefix + "/Private/CircularTickmarkLabel.qml"), private_uri, 1, 0, "CircularTickmarkLabel");
+ qmlRegisterType(QUrl(prefix + "/Private/Handle.qml"), private_uri, 1, 0, "Handle");
+ qmlRegisterType(QUrl(prefix + "/Private/PieMenuIcon.qml"), private_uri, 1, 0, "PieMenuIcon");
+ qmlRegisterSingletonType(QUrl(prefix + "/Private/TextSingleton.qml"), private_uri, 1, 0, "TextSingleton");
+}
+
+QObject *QtQuickExtrasPlugin::registerSettingsModule(QQmlEngine *engine, QJSEngine *jsEngine)
+{
+ Q_UNUSED(engine);
+ Q_UNUSED(jsEngine);
+ return new QQuickStyleSettings(engine);
+}
+
+QT_END_NAMESPACE
diff --git a/src/extras/plugin.h b/src/extras/plugin.h
new file mode 100644
index 00000000..c613739f
--- /dev/null
+++ b/src/extras/plugin.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef PLUGIN_H
+#define PLUGIN_H
+
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include <QtQml/qqmlengine.h>
+
+QT_BEGIN_NAMESPACE
+
+class QtQuickExtrasPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
+public:
+ explicit QtQuickExtrasPlugin(QObject *parent = 0);
+
+ void registerTypes(const char *uri);
+ void initializeEngine(QQmlEngine *engine, const char *uri);
+private:
+ static QObject *registerSettingsModule(QQmlEngine *engine, QJSEngine *jsEngine);
+};
+
+QT_END_NAMESPACE
+
+#endif // PLUGIN_H
diff --git a/src/extras/plugins.qmltypes b/src/extras/plugins.qmltypes
new file mode 100644
index 00000000..3421236e
--- /dev/null
+++ b/src/extras/plugins.qmltypes
@@ -0,0 +1,619 @@
+import QtQuick.tooling 1.1
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable QtQuick.Extras 1.3'
+
+Module {
+ Component {
+ name: "QQuickActivationMode"
+ exports: ["QtQuick.Extras/ActivationMode 1.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "ActivationMode"
+ values: {
+ "ActivateOnPress": 0,
+ "ActivateOnRelease": 1,
+ "ActivateOnClick": 2
+ }
+ }
+ }
+ Component {
+ name: "QQuickCircularProgressBar"
+ defaultProperty: "data"
+ prototype: "QQuickPaintedItem"
+ exports: ["QtQuick.Extras.Private.CppUtils/CircularProgressBar 1.1"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "progress"; type: "double" }
+ Property { name: "barWidth"; type: "double" }
+ Property { name: "inset"; type: "double" }
+ Property { name: "minimumValueAngle"; type: "double" }
+ Property { name: "maximumValueAngle"; type: "double" }
+ Property { name: "backgroundColor"; type: "QColor" }
+ Signal {
+ name: "progressChanged"
+ Parameter { name: "progress"; type: "double" }
+ }
+ Signal {
+ name: "barWidthChanged"
+ Parameter { name: "barWidth"; type: "double" }
+ }
+ Signal {
+ name: "insetChanged"
+ Parameter { name: "inset"; type: "double" }
+ }
+ Signal {
+ name: "minimumValueAngleChanged"
+ Parameter { name: "minimumValueAngle"; type: "double" }
+ }
+ Signal {
+ name: "maximumValueAngleChanged"
+ Parameter { name: "maximumValueAngle"; type: "double" }
+ }
+ Signal {
+ name: "backgroundColorChanged"
+ Parameter { name: "backgroundColor"; type: "QColor" }
+ }
+ Method { name: "clearStops" }
+ Method {
+ name: "addStop"
+ Parameter { name: "position"; type: "double" }
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Method { name: "redraw" }
+ }
+ Component {
+ name: "QQuickFlatProgressBar"
+ defaultProperty: "data"
+ prototype: "QQuickPaintedItem"
+ exports: ["QtQuick.Extras.Private.CppUtils/FlatProgressBar 1.1"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "stripeOffset"; type: "double" }
+ Property { name: "progress"; type: "double" }
+ Property { name: "indeterminate"; type: "bool" }
+ Signal {
+ name: "stripeOffsetChanged"
+ Parameter { name: "stripeOffset"; type: "double" }
+ }
+ Signal {
+ name: "progressChanged"
+ Parameter { name: "progress"; type: "double" }
+ }
+ Signal {
+ name: "indeterminateChanged"
+ Parameter { name: "indeterminate"; type: "bool" }
+ }
+ Method { name: "repaint" }
+ Method { name: "restartAnimation" }
+ Method { name: "onVisibleChanged" }
+ Method { name: "onWidthChanged" }
+ Method { name: "onHeightChanged" }
+ }
+ Component {
+ name: "QQuickMathUtils"
+ prototype: "QObject"
+ exports: ["QtQuick.Extras.Private.CppUtils/MathUtils 1.0"]
+ isCreatable: false
+ isSingleton: true
+ exportMetaObjectRevisions: [0]
+ Property { name: "pi2"; type: "double"; isReadonly: true }
+ Method {
+ name: "degToRad"
+ type: "double"
+ Parameter { name: "degrees"; type: "double" }
+ }
+ Method {
+ name: "degToRadOffset"
+ type: "double"
+ Parameter { name: "degrees"; type: "double" }
+ }
+ Method {
+ name: "radToDeg"
+ type: "double"
+ Parameter { name: "radians"; type: "double" }
+ }
+ Method {
+ name: "radToDegOffset"
+ type: "double"
+ Parameter { name: "radians"; type: "double" }
+ }
+ Method {
+ name: "centerAlongCircle"
+ type: "QPointF"
+ Parameter { name: "xCenter"; type: "double" }
+ Parameter { name: "yCenter"; type: "double" }
+ Parameter { name: "width"; type: "double" }
+ Parameter { name: "height"; type: "double" }
+ Parameter { name: "angleOnCircle"; type: "double" }
+ Parameter { name: "distanceAlongRadius"; type: "double" }
+ }
+ Method {
+ name: "roundEven"
+ type: "double"
+ Parameter { name: "number"; type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickMouseThief"
+ prototype: "QObject"
+ exports: ["QtQuick.Extras.Private.CppUtils/MouseThief 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "receivedPressEvent"; type: "bool" }
+ Signal {
+ name: "pressed"
+ Parameter { name: "mouseX"; type: "int" }
+ Parameter { name: "mouseY"; type: "int" }
+ }
+ Signal {
+ name: "released"
+ Parameter { name: "mouseX"; type: "int" }
+ Parameter { name: "mouseY"; type: "int" }
+ }
+ Signal {
+ name: "clicked"
+ Parameter { name: "mouseX"; type: "int" }
+ Parameter { name: "mouseY"; type: "int" }
+ }
+ Signal {
+ name: "touchUpdate"
+ Parameter { name: "mouseX"; type: "int" }
+ Parameter { name: "mouseY"; type: "int" }
+ }
+ Signal { name: "handledEventChanged" }
+ Method {
+ name: "grabMouse"
+ Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
+ }
+ Method { name: "ungrabMouse" }
+ Method { name: "acceptCurrentEvent" }
+ }
+ Component {
+ name: "QQuickPicture"
+ defaultProperty: "data"
+ prototype: "QQuickPaintedItem"
+ exports: ["QtQuick.Extras/Picture 1.3"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "source"; type: "QUrl" }
+ Property { name: "color"; type: "QColor" }
+ }
+ Component {
+ name: "QQuickStyleSettings"
+ prototype: "QObject"
+ exports: ["QtQuick.Extras.Private/StyleSettings 1.0"]
+ isCreatable: false
+ isSingleton: true
+ exportMetaObjectRevisions: [0]
+ Property { name: "style"; type: "QUrl"; isReadonly: true }
+ Property { name: "styleName"; type: "string" }
+ Property { name: "stylePath"; type: "string" }
+ }
+ Component {
+ name: "QQuickTriggerMode"
+ exports: ["QtQuick.Extras/TriggerMode 1.3"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "TriggerMode"
+ values: {
+ "TriggerOnPress": 0,
+ "TriggerOnRelease": 1,
+ "TriggerOnClick": 2
+ }
+ }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Extras.Private/CircularButton"
+ exports: ["QtQuick.Extras.Private/CircularButton 1.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "isDefault"; type: "bool" }
+ Property { name: "menu"; type: "Menu_QMLTYPE_29"; isPointer: true }
+ Property { name: "checkable"; type: "bool" }
+ Property { name: "checked"; type: "bool" }
+ Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true }
+ Property { name: "action"; type: "QQuickAction"; isPointer: true }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "text"; type: "string" }
+ Property { name: "tooltip"; type: "string" }
+ Property { name: "iconSource"; type: "QUrl" }
+ Property { name: "iconName"; type: "string" }
+ Property { name: "__position"; type: "string" }
+ Property { name: "__iconOverriden"; type: "bool"; isReadonly: true }
+ Property { name: "__action"; type: "QQuickAction"; isPointer: true }
+ Property { name: "__iconAction"; type: "QQuickAction"; isReadonly: true; isPointer: true }
+ Property { name: "__effectivePressed"; type: "bool" }
+ Property { name: "__behavior"; type: "QVariant" }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Signal { name: "clicked" }
+ Method { name: "accessiblePressAction"; type: "QVariant" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QObject"
+ name: "QtQuick.Extras.Private/CircularButtonStyleHelper"
+ exports: ["QtQuick.Extras.Private/CircularButtonStyleHelper 1.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ Property { name: "control"; type: "QQuickItem"; isPointer: true }
+ Property { name: "buttonColorUpTop"; type: "QColor" }
+ Property { name: "buttonColorUpBottom"; type: "QColor" }
+ Property { name: "buttonColorDownTop"; type: "QColor" }
+ Property { name: "buttonColorDownBottom"; type: "QColor" }
+ Property { name: "outerArcColorTop"; type: "QColor" }
+ Property { name: "outerArcColorBottom"; type: "QColor" }
+ Property { name: "innerArcColorTop"; type: "QColor" }
+ Property { name: "innerArcColorBottom"; type: "QColor" }
+ Property { name: "innerArcColorBottomStop"; type: "double" }
+ Property { name: "shineColor"; type: "QColor" }
+ Property { name: "smallestAxis"; type: "double" }
+ Property { name: "outerArcLineWidth"; type: "double" }
+ Property { name: "innerArcLineWidth"; type: "double" }
+ Property { name: "shineArcLineWidth"; type: "double" }
+ Property { name: "implicitWidth"; type: "double" }
+ Property { name: "implicitHeight"; type: "double" }
+ Property { name: "textColorUp"; type: "QColor" }
+ Property { name: "textColorDown"; type: "QColor" }
+ Property { name: "textRaisedColorUp"; type: "QColor" }
+ Property { name: "textRaisedColorDown"; type: "QColor" }
+ Property { name: "radius"; type: "double" }
+ Property { name: "halfRadius"; type: "double" }
+ Property { name: "outerArcRadius"; type: "double" }
+ Property { name: "innerArcRadius"; type: "double" }
+ Property { name: "shineArcRadius"; type: "double" }
+ Property { name: "zeroAngle"; type: "double" }
+ Property { name: "buttonColorTop"; type: "QColor" }
+ Property { name: "buttonColorBottom"; type: "QColor" }
+ Method {
+ name: "toPixels"
+ type: "QVariant"
+ Parameter { name: "percentageOfSmallestAxis"; type: "QVariant" }
+ }
+ Method {
+ name: "paintBackground"
+ type: "QVariant"
+ Parameter { name: "ctx"; type: "QVariant" }
+ }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Extras/CircularGauge"
+ exports: ["QtQuick.Extras/CircularGauge 1.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "tickmarksVisible"; type: "bool" }
+ Property { name: "minimumValue"; type: "double" }
+ Property { name: "maximumValue"; type: "double" }
+ Property { name: "value"; type: "double" }
+ Property { name: "stepSize"; type: "double" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Extras.Private/CircularTickmarkLabel"
+ exports: ["QtQuick.Extras.Private/CircularTickmarkLabel 1.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "minimumValueAngle"; type: "double" }
+ Property { name: "maximumValueAngle"; type: "double" }
+ Property { name: "angleRange"; type: "double"; isReadonly: true }
+ Property { name: "tickmarkStepSize"; type: "double" }
+ Property { name: "tickmarkInset"; type: "double" }
+ Property { name: "tickmarkCount"; type: "int"; isReadonly: true }
+ Property { name: "minorTickmarkCount"; type: "int" }
+ Property { name: "minorTickmarkInset"; type: "double" }
+ Property { name: "labelInset"; type: "double" }
+ Property { name: "labelStepSize"; type: "double" }
+ Property { name: "labelCount"; type: "int"; isReadonly: true }
+ Property { name: "__tickmarkCount"; type: "double"; isReadonly: true }
+ Property { name: "tickmarksVisible"; type: "bool" }
+ Property { name: "minimumValue"; type: "double" }
+ Property { name: "maximumValue"; type: "double" }
+ Property { name: "stepSize"; type: "double" }
+ Method {
+ name: "valueToAngle"
+ type: "QVariant"
+ Parameter { name: "value"; type: "QVariant" }
+ }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Extras/DelayButton"
+ exports: ["QtQuick.Extras/DelayButton 1.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "delay"; type: "int" }
+ Property { name: "__progress"; type: "double" }
+ Property { name: "progress"; type: "double"; isReadonly: true }
+ Signal { name: "activated" }
+ Property { name: "isDefault"; type: "bool" }
+ Property { name: "menu"; type: "Menu_QMLTYPE_29"; isPointer: true }
+ Property { name: "checkable"; type: "bool" }
+ Property { name: "checked"; type: "bool" }
+ Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true }
+ Property { name: "action"; type: "QQuickAction"; isPointer: true }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "text"; type: "string" }
+ Property { name: "tooltip"; type: "string" }
+ Property { name: "iconSource"; type: "QUrl" }
+ Property { name: "iconName"; type: "string" }
+ Property { name: "__position"; type: "string" }
+ Property { name: "__iconOverriden"; type: "bool"; isReadonly: true }
+ Property { name: "__action"; type: "QQuickAction"; isPointer: true }
+ Property { name: "__iconAction"; type: "QQuickAction"; isReadonly: true; isPointer: true }
+ Property { name: "__effectivePressed"; type: "bool" }
+ Property { name: "__behavior"; type: "QVariant" }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Signal { name: "clicked" }
+ Method { name: "accessiblePressAction"; type: "QVariant" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Extras/Dial"
+ exports: ["QtQuick.Extras/Dial 1.1"]
+ exportMetaObjectRevisions: [1]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "__wrap"; type: "bool" }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "tickmarksVisible"; type: "bool" }
+ Property { name: "value"; type: "double" }
+ Property { name: "minimumValue"; type: "double" }
+ Property { name: "maximumValue"; type: "double" }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Property { name: "stepSize"; type: "double" }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Extras/Gauge"
+ exports: ["QtQuick.Extras/Gauge 1.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "orientation"; type: "int" }
+ Property { name: "tickmarkAlignment"; type: "int" }
+ Property { name: "__tickmarkAlignment"; type: "int" }
+ Property { name: "__tickmarksInside"; type: "bool" }
+ Property { name: "tickmarkStepSize"; type: "double" }
+ Property { name: "minorTickmarkCount"; type: "int" }
+ Property { name: "formatValue"; type: "QVariant" }
+ Property { name: "minimumValue"; type: "double" }
+ Property { name: "value"; type: "double" }
+ Property { name: "maximumValue"; type: "double" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "__hiddenText"; type: "QQuickText"; isReadonly: true; isPointer: true }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Extras/PieMenu"
+ exports: ["QtQuick.Extras/PieMenu 1.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "menuItems"
+ Property { name: "selectionAngle"; type: "double"; isReadonly: true }
+ Property { name: "triggerMode"; type: "int" }
+ Property { name: "title"; type: "string" }
+ Property { name: "boundingItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__protectedScope"; type: "QObject"; isPointer: true }
+ Property { name: "activationMode"; type: "int" }
+ Property { name: "menuItems"; type: "QQuickMenuItem"; isList: true; isReadonly: true }
+ Property { name: "currentIndex"; type: "int"; isReadonly: true }
+ Property { name: "currentItem"; type: "QQuickMenuItem"; isReadonly: true; isPointer: true }
+ Property { name: "__mouseThief"; type: "QQuickMouseThief"; isReadonly: true; isPointer: true }
+ Method {
+ name: "popup"
+ type: "QVariant"
+ Parameter { name: "x"; type: "QVariant" }
+ Parameter { name: "y"; type: "QVariant" }
+ }
+ Method {
+ name: "addItem"
+ type: "QVariant"
+ Parameter { name: "text"; type: "QVariant" }
+ }
+ Method {
+ name: "insertItem"
+ type: "QVariant"
+ Parameter { name: "before"; type: "QVariant" }
+ Parameter { name: "text"; type: "QVariant" }
+ }
+ Method {
+ name: "removeItem"
+ type: "QVariant"
+ Parameter { name: "item"; type: "QVariant" }
+ }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickLoader"
+ name: "QtQuick.Extras.Private/PieMenuIcon"
+ exports: ["QtQuick.Extras.Private/PieMenuIcon 1.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "control"; type: "PieMenu_QMLTYPE_93"; isPointer: true }
+ Property { name: "styleData"; type: "QObject"; isPointer: true }
+ Property { name: "iconSource"; type: "string"; isReadonly: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Extras/StatusIndicator"
+ exports: ["QtQuick.Extras/StatusIndicator 1.1"]
+ exportMetaObjectRevisions: [1]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "active"; type: "bool" }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "on"; type: "bool" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickText"
+ name: "QtQuick.Extras.Private/TextSingleton"
+ exports: ["QtQuick.Extras.Private/TextSingleton 1.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ isCreatable: false
+ isSingleton: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Extras/ToggleButton"
+ exports: ["QtQuick.Extras/ToggleButton 1.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "isDefault"; type: "bool" }
+ Property { name: "menu"; type: "Menu_QMLTYPE_29"; isPointer: true }
+ Property { name: "checkable"; type: "bool" }
+ Property { name: "checked"; type: "bool" }
+ Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true }
+ Property { name: "action"; type: "QQuickAction"; isPointer: true }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "text"; type: "string" }
+ Property { name: "tooltip"; type: "string" }
+ Property { name: "iconSource"; type: "QUrl" }
+ Property { name: "iconName"; type: "string" }
+ Property { name: "__position"; type: "string" }
+ Property { name: "__iconOverriden"; type: "bool"; isReadonly: true }
+ Property { name: "__action"; type: "QQuickAction"; isPointer: true }
+ Property { name: "__iconAction"; type: "QQuickAction"; isReadonly: true; isPointer: true }
+ Property { name: "__effectivePressed"; type: "bool" }
+ Property { name: "__behavior"; type: "QVariant" }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Signal { name: "clicked" }
+ Method { name: "accessiblePressAction"; type: "QVariant" }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickFocusScope"
+ name: "QtQuick.Extras/Tumbler"
+ exports: ["QtQuick.Extras/Tumbler 1.2"]
+ exportMetaObjectRevisions: [2]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "__highlightMoveDuration"; type: "int" }
+ Property { name: "columnCount"; type: "int"; isReadonly: true }
+ Property { name: "__columnRow"; type: "QQuickRow"; isReadonly: true; isPointer: true }
+ Property { name: "__movementDelayTimer"; type: "QQmlTimer"; isReadonly: true; isPointer: true }
+ Method {
+ name: "__isValidColumnIndex"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ }
+ Method {
+ name: "__isValidColumnAndItemIndex"
+ type: "QVariant"
+ Parameter { name: "columnIndex"; type: "QVariant" }
+ Parameter { name: "itemIndex"; type: "QVariant" }
+ }
+ Method {
+ name: "currentIndexAt"
+ type: "QVariant"
+ Parameter { name: "columnIndex"; type: "QVariant" }
+ }
+ Method {
+ name: "setCurrentIndexAt"
+ type: "QVariant"
+ Parameter { name: "columnIndex"; type: "QVariant" }
+ Parameter { name: "itemIndex"; type: "QVariant" }
+ }
+ Method {
+ name: "getColumn"
+ type: "QVariant"
+ Parameter { name: "columnIndex"; type: "QVariant" }
+ }
+ Method {
+ name: "addColumn"
+ type: "QVariant"
+ Parameter { name: "column"; type: "QVariant" }
+ }
+ Method {
+ name: "insertColumn"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ Parameter { name: "column"; type: "QVariant" }
+ }
+ Method {
+ name: "__viewAt"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QVariant" }
+ }
+ Property { name: "style"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "__style"; type: "QObject"; isPointer: true }
+ Property { name: "__panel"; type: "QQuickItem"; isPointer: true }
+ Property { name: "styleHints"; type: "QVariant" }
+ Property { name: "__styleData"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QObject"
+ name: "QtQuick.Extras/TumblerColumn"
+ exports: ["QtQuick.Extras/TumblerColumn 1.2"]
+ exportMetaObjectRevisions: [2]
+ isComposite: true
+ Property { name: "__tumbler"; type: "QQuickItem"; isPointer: true }
+ Property { name: "__index"; type: "int" }
+ Property { name: "__currentIndex"; type: "int" }
+ Property { name: "role"; type: "string" }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "highlight"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "columnForeground"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "activeFocus"; type: "bool"; isReadonly: true }
+ Property { name: "width"; type: "double" }
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "currentIndex"; type: "int"; isReadonly: true }
+ }
+}
diff --git a/src/extras/qmldir b/src/extras/qmldir
new file mode 100644
index 00000000..8cf21310
--- /dev/null
+++ b/src/extras/qmldir
@@ -0,0 +1,4 @@
+module QtQuick.Extras
+plugin qtquickextrasplugin
+classname QtQuickExtrasPlugin
+#typeinfo plugins.qmltypes
diff --git a/src/extras/qquickpicture.cpp b/src/extras/qquickpicture.cpp
new file mode 100644
index 00000000..fd8846a2
--- /dev/null
+++ b/src/extras/qquickpicture.cpp
@@ -0,0 +1,158 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickpicture_p.h"
+
+#include <QQmlFile>
+
+/*!
+ \qmltype Picture
+ \inherits QQuickPaintedItem
+ \inqmlmodule QtQuick.Extras
+ \since QtQuick.Extras 1.4
+ \ingroup extras
+ \ingroup extras-non-interactive
+ \brief An indicator that displays a colorized ISO 7000 icon
+
+ Picture displays icons in a scalable vector format. It can also colorize
+ the icons via the \l color property.
+
+ The icon to display is set with the \l source property.
+*/
+
+QQuickPicture::QQuickPicture(QQuickItem *parent)
+ : QQuickPaintedItem(parent)
+{
+ const qreal defaultFontHeight = QFontMetricsF(QFont()).height();
+ setImplicitWidth(defaultFontHeight * 4);
+ setImplicitHeight(defaultFontHeight * 4);
+}
+
+QQuickPicture::~QQuickPicture()
+{
+}
+
+void QQuickPicture::paint(QPainter *painter)
+{
+ const QSize size = boundingRect().size().toSize();
+ // Don't want the scale to apply to the fill.
+ painter->save();
+ painter->scale(qreal(size.width()) / mPicture.boundingRect().width(),
+ qreal(size.height()) / mPicture.boundingRect().height());
+ painter->drawPicture(0, 0, mPicture);
+ painter->restore();
+
+ if (mColor.isValid()) {
+ painter->setCompositionMode(QPainter::CompositionMode_SourceIn);
+ painter->fillRect(0, 0, size.width(), size.height(), mColor);
+ }
+}
+
+/*!
+ \qmlproperty url Picture::source
+
+ This property specifies the URL of the icon to use. The URL must point to a
+ local file that contains \l QPicture data.
+
+ For example, if you have the \l <NewControlName> from \l
+ <NewEnterpriseControlsName>, you can specify the following URL:
+
+ \code
+ "qrc:/iso-icons/iso_grs_7000_4_0001.dat"
+ \endcode
+
+ Due to the
+ \l {http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=65977}
+ {large selection of icons} available in this package, it is advisable to
+ use Qt Creator's Qt Quick Designer tool to browse and select icons, as this
+ property will then be set automatically.
+
+ If you have your own picture that you'd like to display, you can set the
+ following URL:
+
+ \code
+ "mypicture.dat"
+ \endcode
+*/
+QUrl QQuickPicture::source() const
+{
+ return mSource;
+}
+
+void QQuickPicture::setSource(const QUrl &source)
+{
+ if (mSource != source) {
+ mSource = source;
+ const QString fileName = QQmlFile::urlToLocalFileOrQrc(source);
+ if (!mPicture.load(fileName)) {
+ qWarning().nospace() << "Failed to load " << fileName << "; does it exist?";
+ mPicture = QPicture();
+ }
+
+ setImplicitWidth(mPicture.boundingRect().width());
+ setImplicitHeight(mPicture.boundingRect().height());
+
+ update();
+ emit sourceChanged();
+ }
+}
+
+/*!
+ \qmlproperty color Picture::color
+
+ This property specifies the color of the indicator.
+
+ The default value is \c "black".
+*/
+QColor QQuickPicture::color() const
+{
+ return mColor;
+}
+
+void QQuickPicture::setColor(const QColor &color)
+{
+ if (mColor != color) {
+ mColor = color;
+ update();
+ emit colorChanged();
+ }
+}
+
+void QQuickPicture::resetColor()
+{
+ setColor(QColor());
+}
+
diff --git a/src/extras/qquickpicture_p.h b/src/extras/qquickpicture_p.h
new file mode 100644
index 00000000..ee299cd2
--- /dev/null
+++ b/src/extras/qquickpicture_p.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPICTURE_H
+#define QQUICKPICTURE_H
+
+#include <QQuickPaintedItem>
+#include <QPainter>
+#include <QPicture>
+
+class QQuickPicture : public QQuickPaintedItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged RESET resetColor)
+public:
+ explicit QQuickPicture(QQuickItem *parent = 0);
+ ~QQuickPicture();
+
+ void paint(QPainter *painter) Q_DECL_OVERRIDE;
+
+ QUrl source() const;
+ void setSource(const QUrl &source);
+
+ QColor color() const;
+ void setColor(const QColor &color);
+ void resetColor();
+
+Q_SIGNALS:
+ void sourceChanged();
+ void colorChanged();
+
+private:
+ QUrl mSource;
+ QColor mColor;
+ QPicture mPicture;
+};
+
+#endif // QQUICKPICTURE_H
diff --git a/src/extras/qquicktriggermode_p.h b/src/extras/qquicktriggermode_p.h
new file mode 100644
index 00000000..a6f2f404
--- /dev/null
+++ b/src/extras/qquicktriggermode_p.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TRIGGERMODE_P_H
+#define TRIGGERMODE_P_H
+
+#include <QtCore/qglobal.h>
+#include <QtCore/qobjectdefs.h>
+
+QT_BEGIN_NAMESPACE
+
+// TODO: Remove with v2.0
+class QQuickActivationMode
+{
+ Q_GADGET
+ Q_ENUMS(ActivationMode)
+public:
+ enum ActivationMode {
+ ActivateOnPress = 0,
+ ActivateOnRelease = 1,
+ ActivateOnClick = 2
+ };
+};
+
+class QQuickTriggerMode
+{
+ Q_GADGET
+ Q_ENUMS(TriggerMode)
+public:
+ enum TriggerMode {
+ TriggerOnPress = 0,
+ TriggerOnRelease = 1,
+ TriggerOnClick = 2
+ };
+};
+
+QT_END_NAMESPACE
+
+#endif // TRIGGERMODE_P_H