aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-10-17 17:34:31 +0200
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-11-12 09:21:47 +0000
commitbf55d2b1659290753641ee862f814ab8781cfa94 (patch)
treef0c6f65c589d0e7971977771444375c00390e86d
parentfe483bcaa4c5259777c7b1ea83772e041bea8738 (diff)
Add Universal style
https://dev.windows.com/design Change-Id: I1d8c633ae246724649a6ed71b300a56ba9572405 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
-rw-r--r--.gitignore1
-rw-r--r--src/imports/controls/universal/ApplicationWindow.qml45
-rw-r--r--src/imports/controls/universal/BusyIndicator.qml66
-rw-r--r--src/imports/controls/universal/Button.qml85
-rw-r--r--src/imports/controls/universal/CheckBox.qml113
-rw-r--r--src/imports/controls/universal/Dial.qml80
-rw-r--r--src/imports/controls/universal/Frame.qml65
-rw-r--r--src/imports/controls/universal/GroupBox.qml87
-rw-r--r--src/imports/controls/universal/Label.qml50
-rw-r--r--src/imports/controls/universal/PageIndicator.qml73
-rw-r--r--src/imports/controls/universal/ProgressBar.qml92
-rw-r--r--src/imports/controls/universal/README.md9
-rw-r--r--src/imports/controls/universal/RadioButton.qml119
-rw-r--r--src/imports/controls/universal/RangeSlider.qml118
-rw-r--r--src/imports/controls/universal/ScrollBar.qml99
-rw-r--r--src/imports/controls/universal/ScrollIndicator.qml86
-rw-r--r--src/imports/controls/universal/Slider.qml101
-rw-r--r--src/imports/controls/universal/SpinBox.qml149
-rw-r--r--src/imports/controls/universal/StackView.qml88
-rw-r--r--src/imports/controls/universal/Switch.qml111
-rw-r--r--src/imports/controls/universal/TabBar.qml79
-rw-r--r--src/imports/controls/universal/TabButton.qml71
-rw-r--r--src/imports/controls/universal/TextArea.qml97
-rw-r--r--src/imports/controls/universal/TextField.qml98
-rw-r--r--src/imports/controls/universal/ToolBar.qml60
-rw-r--r--src/imports/controls/universal/ToolButton.qml80
-rw-r--r--src/imports/controls/universal/Tumbler.qml86
-rw-r--r--src/imports/controls/universal/images/checkmark.pngbin0 -> 243 bytes
-rw-r--r--src/imports/controls/universal/images/checkmark@2x.pngbin0 -> 367 bytes
-rw-r--r--src/imports/controls/universal/images/checkmark@3x.pngbin0 -> 817 bytes
-rw-r--r--src/imports/controls/universal/images/checkmark@4x.pngbin0 -> 634 bytes
-rw-r--r--src/imports/controls/universal/images/leftarrow.pngbin0 -> 179 bytes
-rw-r--r--src/imports/controls/universal/images/leftarrow@2x.pngbin0 -> 243 bytes
-rw-r--r--src/imports/controls/universal/images/leftarrow@3x.pngbin0 -> 304 bytes
-rw-r--r--src/imports/controls/universal/images/leftarrow@4x.pngbin0 -> 343 bytes
-rw-r--r--src/imports/controls/universal/images/rightarrow.pngbin0 -> 173 bytes
-rw-r--r--src/imports/controls/universal/images/rightarrow@2x.pngbin0 -> 247 bytes
-rw-r--r--src/imports/controls/universal/images/rightarrow@3x.pngbin0 -> 279 bytes
-rw-r--r--src/imports/controls/universal/images/rightarrow@4x.pngbin0 -> 359 bytes
-rw-r--r--src/imports/controls/universal/qmldir4
-rw-r--r--src/imports/controls/universal/qquickuniversalimageprovider.cpp79
-rw-r--r--src/imports/controls/universal/qquickuniversalimageprovider_p.h67
-rw-r--r--src/imports/controls/universal/qquickuniversalprogressring.cpp269
-rw-r--r--src/imports/controls/universal/qquickuniversalprogressring_p.h100
-rw-r--r--src/imports/controls/universal/qquickuniversalprogressstrip.cpp304
-rw-r--r--src/imports/controls/universal/qquickuniversalprogressstrip_p.h94
-rw-r--r--src/imports/controls/universal/qquickuniversalstyle.cpp412
-rw-r--r--src/imports/controls/universal/qquickuniversalstyle_p.h221
-rw-r--r--src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp79
-rw-r--r--src/imports/controls/universal/qtlabsuniversalstyleplugin.qrc16
-rw-r--r--src/imports/controls/universal/universal.pri38
-rw-r--r--src/imports/controls/universal/universal.pro21
-rw-r--r--src/imports/imports.pro3
-rw-r--r--tests/auto/auto.pro3
-rw-r--r--tests/auto/universal/data/tst_universal.qml225
-rw-r--r--tests/auto/universal/tst_universal.cpp38
-rw-r--r--tests/auto/universal/universal.pro12
-rw-r--r--tests/benchmarks/creationtime/tst_creationtime.cpp17
-rw-r--r--tests/benchmarks/objectcount/tst_objectcount.cpp15
-rw-r--r--tests/manual/testbench/main.qml4
60 files changed, 4226 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index b02fb5f6..15114f6f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,6 +20,7 @@
/tests/auto/sanity/tst_sanity
/tests/auto/snippets/tst_snippets
/tests/auto/theme/tst_theme
+/tests/auto/universal/tst_universal
/tests/benchmarks/creationtime/tst_creationtime
/tests/benchmarks/objectcount/tst_objectcount
/tests/manual/gifs/tst_gifs
diff --git a/src/imports/controls/universal/ApplicationWindow.qml b/src/imports/controls/universal/ApplicationWindow.qml
new file mode 100644
index 00000000..46b8e740
--- /dev/null
+++ b/src/imports/controls/universal/ApplicationWindow.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 Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.ApplicationWindow {
+ id: window
+
+ color: Universal.altHighColor
+}
diff --git a/src/imports/controls/universal/BusyIndicator.qml b/src/imports/controls/universal/BusyIndicator.qml
new file mode 100644
index 00000000..3e0e1f89
--- /dev/null
+++ b/src/imports/controls/universal/BusyIndicator.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+import Qt.labs.controls.universal.impl 1.0
+
+T.BusyIndicator {
+ id: control
+
+ implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding
+ implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding
+
+ //! [contentItem]
+ contentItem: ProgressRing {
+ id: ring
+
+ implicitWidth: 20
+ implicitHeight: 20
+
+ readonly property real size: Math.min(control.availableWidth, control.availableHeight)
+
+ count: size < 60 ? 5 : 6 // "Small" vs. "Large"
+ color: control.Universal.accentColor
+
+ ProgressRingAnimator {
+ target: ring
+ running: control.visible && control.running
+ }
+ }
+ //! [contentItem]
+}
diff --git a/src/imports/controls/universal/Button.qml b/src/imports/controls/universal/Button.qml
new file mode 100644
index 00000000..617d8a03
--- /dev/null
+++ b/src/imports/controls/universal/Button.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 Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.Button {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ label ? label.implicitWidth + leftPadding + rightPadding : 0)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ label ? label.implicitHeight + topPadding + bottomPadding : 0)
+
+ topPadding: 4
+ leftPadding: 8
+ rightPadding: 8
+ bottomPadding: 4
+
+ font.pixelSize: Universal.fontSize
+ font.family: Universal.fontFamily
+
+ //! [label]
+ label: Text {
+ x: control.leftPadding
+ y: control.topPadding
+ width: control.availableWidth
+ height: control.availableHeight
+
+ text: control.text
+ font: control.font
+ elide: Text.ElideRight
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ renderType: Text.NativeRendering
+
+ color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor
+ }
+ //! [label]
+
+ //! [background]
+ background: Rectangle {
+ implicitWidth: 32
+ implicitHeight: 32
+
+ color: control.pressed ? control.Universal.baseMediumLowColor :
+ control.enabled && control.checkable && control.checked ? control.Universal.accentColor :
+ control.Universal.baseLowColor
+ }
+ //! [background]
+}
diff --git a/src/imports/controls/universal/CheckBox.qml b/src/imports/controls/universal/CheckBox.qml
new file mode 100644
index 00000000..5feba9db
--- /dev/null
+++ b/src/imports/controls/universal/CheckBox.qml
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.CheckBox {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ (label ? label.implicitWidth : 0) +
+ (indicator ? indicator.implicitWidth : 0) +
+ (label && indicator ? spacing : 0) + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ Math.max(label ? label.implicitHeight : 0,
+ indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
+
+ padding: 6
+ spacing: 8
+
+ font.pixelSize: Universal.fontSize
+ font.family: Universal.fontFamily
+
+ //! [indicator]
+ indicator: Rectangle {
+ id: normalRectangle
+ implicitWidth: 20
+ implicitHeight: 20
+ x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ y: control.topPadding + (control.availableHeight - height) / 2
+
+ color: !control.enabled ? "transparent" :
+ control.pressed && control.checkState !== Qt.PartiallyChecked ? control.Universal.baseMediumColor :
+ control.checkState === Qt.Checked ? control.Universal.accentColor : "transparent"
+ border.color: !control.enabled ? control.Universal.baseLowColor :
+ control.pressed ? control.Universal.baseMediumColor :
+ control.checked ? control.Universal.accentColor : control.Universal.baseMediumHighColor
+ border.width: 2 // CheckBoxBorderThemeThickness
+
+ Image {
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+
+ visible: control.checkState === Qt.Checked
+ source: "image://universal/checkmark/" + (!control.enabled ? control.Universal.baseLowColor : control.Universal.chromeWhiteColor)
+ }
+
+ Rectangle {
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: parent.width / 2
+ height: parent.height / 2
+
+ visible: control.checkState === Qt.PartiallyChecked
+ color: !control.enabled ? control.Universal.baseLowColor :
+ control.pressed ? control.Universal.baseMediumColor : control.Universal.baseMediumHighColor
+ }
+ }
+ //! [indicator]
+
+ //! [label]
+ label: Text {
+ x: control.mirrored ? control.leftPadding : (indicator.x + indicator.width + control.spacing)
+ y: control.topPadding
+ width: control.availableWidth - indicator.width - control.spacing
+ height: control.availableHeight
+
+ text: control.text
+ font: control.font
+ elide: Text.ElideRight
+ visible: control.text
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ renderType: Text.NativeRendering
+
+ color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor
+ }
+ //! [label]
+}
diff --git a/src/imports/controls/universal/Dial.qml b/src/imports/controls/universal/Dial.qml
new file mode 100644
index 00000000..f80ff18b
--- /dev/null
+++ b/src/imports/controls/universal/Dial.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 Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.Dial {
+ id: control
+
+ implicitWidth: 100
+ implicitHeight: 100
+
+ //! [background]
+ background: Rectangle {
+ radius: width / 2
+ color: "transparent"
+ border.color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseMediumColor
+ border.width: 2
+ }
+ //! [background]
+
+ //! [handle]
+ handle: Rectangle {
+ implicitWidth: 20
+ implicitHeight: 20
+
+ x: background.width / 2 - handle.width / 2
+ y: background.height / 2 - handle.height / 2
+
+ radius: width / 2
+ color: !control.enabled ? control.Universal.baseLowColor :
+ control.pressed ? control.Universal.baseMediumColor : control.Universal.baseMediumHighColor
+
+ transform: [
+ Translate {
+ y: -control.height * 0.35
+ },
+ Rotation {
+ angle: control.angle
+ origin.x: handle.width / 2
+ origin.y: handle.height / 2
+ }
+ ]
+ }
+ //! [handle]
+}
diff --git a/src/imports/controls/universal/Frame.qml b/src/imports/controls/universal/Frame.qml
new file mode 100644
index 00000000..47e9e389
--- /dev/null
+++ b/src/imports/controls/universal/Frame.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.Frame {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
+
+ contentWidth: contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0
+ contentHeight: contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0
+
+ padding: 12
+
+ //! [contentItem]
+ contentItem: Item { }
+ //! [contentItem]
+
+ //! [frame]
+ frame: Rectangle {
+ width: parent.width
+ height: parent.height
+
+ color: "transparent"
+ border.color: control.Universal.chromeDisabledLowColor
+ }
+ //! [frame]
+}
diff --git a/src/imports/controls/universal/GroupBox.qml b/src/imports/controls/universal/GroupBox.qml
new file mode 100644
index 00000000..7f61f438
--- /dev/null
+++ b/src/imports/controls/universal/GroupBox.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 Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.GroupBox {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
+
+ contentWidth: contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0
+ contentHeight: contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0
+
+ spacing: 12
+ padding: 12
+ topPadding: 12 + (label && title ? label.implicitHeight + spacing : 0)
+
+ font.pixelSize: Universal.fontSize
+ font.family: Universal.fontFamily
+// font.weight: Font.DemiBold (TODO: don't want this to inherit...)
+
+ //! [contentItem]
+ contentItem: Item { }
+ //! [contentItem]
+
+ //! [label]
+ label: Text {
+ x: control.leftPadding
+ width: control.availableWidth
+
+ text: control.title
+ font: control.font
+ color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor
+ elide: Text.ElideRight
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ renderType: Text.NativeRendering
+ }
+ //! [label]
+
+ //! [frame]
+ frame: Rectangle {
+ y: control.topPadding - control.padding
+ width: parent.width
+ height: parent.height - control.topPadding + control.padding
+
+ color: "transparent"
+ border.color: control.Universal.chromeDisabledLowColor
+ }
+ //! [frame]
+}
diff --git a/src/imports/controls/universal/Label.qml b/src/imports/controls/universal/Label.qml
new file mode 100644
index 00000000..490a55c0
--- /dev/null
+++ b/src/imports/controls/universal/Label.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 Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.Label {
+ id: control
+
+ font.pixelSize: Universal.fontSize
+ font.family: Universal.fontFamily
+
+ color: !control.enabled ? Universal.baseLowColor : Universal.baseHighColor
+ linkColor: Universal.accentColor
+ renderType: Text.NativeRendering
+}
diff --git a/src/imports/controls/universal/PageIndicator.qml b/src/imports/controls/universal/PageIndicator.qml
new file mode 100644
index 00000000..f3ec9a7b
--- /dev/null
+++ b/src/imports/controls/universal/PageIndicator.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 Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.PageIndicator {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentItem.implicitHeight + topPadding + bottomPadding)
+
+ padding: 6
+ spacing: 7
+
+ //! [delegate]
+ delegate: Rectangle {
+ implicitWidth: 5
+ implicitHeight: 5
+
+ radius: width / 2
+ color: index === control.currentIndex ? control.Universal.baseMediumHighColor :
+ pressed ? control.Universal.baseMediumLowColor : control.Universal.baseLowColor
+ }
+ //! [delegate]
+
+ //! [contentItem]
+ contentItem: Row {
+ spacing: control.spacing
+
+ Repeater {
+ model: control.count
+ delegate: control.delegate
+ }
+ }
+ //! [contentItem]
+}
diff --git a/src/imports/controls/universal/ProgressBar.qml b/src/imports/controls/universal/ProgressBar.qml
new file mode 100644
index 00000000..14fd9bd7
--- /dev/null
+++ b/src/imports/controls/universal/ProgressBar.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 Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+import Qt.labs.controls.universal.impl 1.0
+
+T.ProgressBar {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ indicator ? indicator.implicitWidth : 0) + leftPadding + rightPadding
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding
+
+ //! [indicator]
+ indicator: Rectangle {
+ x: control.leftPadding
+ y: control.topPadding
+ width: control.indeterminate ? 0 : control.position * control.availableWidth
+ height: control.availableHeight
+
+ scale: control.mirrored ? -1 : 1
+ color: control.Universal.accentColor
+
+ ProgressStrip {
+ id: strip
+
+ width: control.availableWidth
+ height: control.availableHeight
+
+ clip: control.indeterminate
+ visible: control.indeterminate
+ color: control.Universal.accentColor
+
+ ProgressStripAnimator {
+ target: strip
+ running: strip.visible
+ }
+ }
+ }
+ //! [indicator]
+
+ //! [background]
+ background: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 10
+
+ x: control.leftPadding
+ y: control.topPadding
+ width: control.availableWidth
+ height: control.availableHeight
+
+ visible: !control.indeterminate
+ color: control.Universal.baseLowColor
+ }
+ //! [background]
+}
diff --git a/src/imports/controls/universal/README.md b/src/imports/controls/universal/README.md
new file mode 100644
index 00000000..8d02d18b
--- /dev/null
+++ b/src/imports/controls/universal/README.md
@@ -0,0 +1,9 @@
+# Universal Style
+
+This style is based on the [Microsoft Universal Design Guidelines](https://dev.windows.com/design).
+
+The colors and metrics used all around the QML and C++ files originate from the Windows 10 SDK. The files are called **generic.xaml** and **themeresources.xml**, and they are located in the following folder:
+
+ \(Program Files)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\<SDK version>\Generic
+
+See also [XAML theme resources](https://msdn.microsoft.com/en-us/library/windows/apps/mt187274.aspx).
diff --git a/src/imports/controls/universal/RadioButton.qml b/src/imports/controls/universal/RadioButton.qml
new file mode 100644
index 00000000..30607ec0
--- /dev/null
+++ b/src/imports/controls/universal/RadioButton.qml
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.RadioButton {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ (label ? label.implicitWidth : 0) +
+ (indicator ? indicator.implicitWidth : 0) +
+ (label && indicator ? spacing : 0) + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ Math.max(label ? label.implicitHeight : 0,
+ indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
+
+ padding: 6
+ spacing: 8
+
+ font.pixelSize: Universal.fontSize
+ font.family: Universal.fontFamily
+
+ //! [indicator]
+ indicator: Rectangle {
+ id: outerEllipse
+ implicitWidth: 20
+ implicitHeight: 20
+ x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ y: control.topPadding + (control.availableHeight - height) / 2
+
+ radius: width / 2
+ color: "transparent"
+ border.width: 2 // RadioButtonBorderThemeThickness
+ border.color: control.checked ? "transparent" :
+ !control.enabled ? control.Universal.baseLowColor :
+ control.pressed ? control.Universal.baseMediumColor : control.Universal.baseMediumHighColor
+
+ Rectangle {
+ id: checkOuterEllipse
+ width: parent.width
+ height: parent.height
+
+ radius: width / 2
+ opacity: control.checked ? 1 : 0
+ color: "transparent"
+ border.width: 2 // RadioButtonBorderThemeThickness
+ border.color: !control.enabled ? control.Universal.baseLowColor :
+ control.pressed ? control.Universal.baseMediumColor : control.Universal.accentColor
+ }
+
+ Rectangle {
+ id: checkGlyph
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: parent.width / 2
+ height: parent.height / 2
+
+ radius: width / 2
+ opacity: control.checked ? 1 : 0
+ color: !control.enabled ? control.Universal.baseLowColor :
+ control.pressed ? control.Universal.baseMediumColor : control.Universal.baseMediumHighColor
+ }
+ }
+ //! [indicator]
+
+ //! [label]
+ label: Text {
+ x: control.mirrored ? control.leftPadding : (indicator.x + indicator.width + control.spacing)
+ y: control.topPadding
+ width: control.availableWidth - indicator.width - control.spacing
+ height: control.availableHeight
+
+ text: control.text
+ font: control.font
+ elide: Text.ElideRight
+ visible: control.text
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ renderType: Text.NativeRendering
+
+ color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor
+ }
+ //! [label]
+}
diff --git a/src/imports/controls/universal/RangeSlider.qml b/src/imports/controls/universal/RangeSlider.qml
new file mode 100644
index 00000000..285a04a7
--- /dev/null
+++ b/src/imports/controls/universal/RangeSlider.qml
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.RangeSlider {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ Math.max(track ? track.implicitWidth : 0,
+ first.handle ? first.handle.implicitWidth : 0,
+ second.handle ? second.handle.implicitWidth : 0) + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ Math.max(track ? track.implicitHeight : 0,
+ first.handle ? first.handle.implicitHeight : 0,
+ second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding)
+
+ padding: 6
+
+ //! [firstHandle]
+ first.handle: Rectangle {
+ implicitWidth: horizontal ? 8 : 24
+ implicitHeight: horizontal ? 24 : 8
+
+ readonly property bool horizontal: control.orientation === Qt.Horizontal
+
+ x: control.leftPadding + (horizontal ? control.first.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)
+ y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.first.visualPosition * (control.availableHeight - height))
+
+ radius: 4
+ color: control.first.pressed ? control.Universal.chromeHighColor : control.enabled ? control.Universal.accentColor : control.Universal.chromeDisabledHighColor
+ }
+ //! [firstHandle]
+
+ //! [secondHandle]
+ second.handle: Rectangle {
+ implicitWidth: horizontal ? 8 : 24
+ implicitHeight: horizontal ? 24 : 8
+
+ readonly property bool horizontal: control.orientation === Qt.Horizontal
+
+ x: control.leftPadding + (horizontal ? control.second.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)
+ y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.second.visualPosition * (control.availableHeight - height))
+
+ radius: 4
+ color: control.second.pressed ? control.Universal.chromeHighColor : control.enabled ? control.Universal.accentColor : control.Universal.chromeDisabledHighColor
+ }
+ //! [secondHandle]
+
+ //! [track]
+ track: Item {
+ implicitWidth: horizontal ? 200 : 18
+ implicitHeight: horizontal ? 18 : 200
+
+ readonly property bool horizontal: control.orientation === Qt.Horizontal
+
+ x: control.leftPadding + (horizontal ? 0 : (control.availableWidth - width) / 2)
+ y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : 0)
+ width: horizontal ? control.availableWidth : implicitWidth
+ height: horizontal ? implicitHeight : control.availableHeight
+
+ scale: horizontal && control.mirrored ? -1 : 1
+
+ Rectangle {
+ x: parent.horizontal ? 0 : (parent.width - width) / 2
+ y: parent.horizontal ? (parent.height - height) / 2 : 0
+ width: parent.horizontal ? parent.width : 2 // SliderTrackThemeHeight
+ height: !parent.horizontal ? parent.height : 2 // SliderTrackThemeHeight
+
+ color: control.enabled ? control.Universal.baseMediumLowColor : control.Universal.chromeDisabledHighColor
+ }
+
+ Rectangle {
+ x: parent.horizontal ? control.first.position * parent.width : 0
+ y: parent.horizontal ? (parent.height - height) / 2 : control.second.visualPosition * parent.height
+ width: parent.horizontal ? control.second.position * parent.width - control.first.position * parent.width : 2 // SliderTrackThemeHeight
+ height: !parent.horizontal ? control.second.position * parent.height - control.first.position * parent.height : 2 // SliderTrackThemeHeight
+
+ color: control.enabled ? control.Universal.accentColor : control.Universal.chromeDisabledHighColor
+ }
+ }
+ //! [track]
+}
diff --git a/src/imports/controls/universal/ScrollBar.qml b/src/imports/controls/universal/ScrollBar.qml
new file mode 100644
index 00000000..b1bc8f6a
--- /dev/null
+++ b/src/imports/controls/universal/ScrollBar.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 Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.ScrollBar {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ handle.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ handle.implicitHeight + topPadding + bottomPadding)
+
+ // TODO: arrows
+
+ //! [handle]
+ handle: Rectangle {
+ implicitWidth: 12
+ implicitHeight: 12
+
+ color: control.pressed ? control.Universal.baseMediumColor : control.Universal.chromeHighColor
+ visible: control.size < 1.0
+ opacity: 0.0
+
+ readonly property bool horizontal: control.orientation === Qt.Horizontal
+ x: control.leftPadding + (horizontal ? control.position * control.width : 0)
+ y: control.topPadding + (horizontal ? 0 : control.position * control.height)
+ width: horizontal ? control.size * control.availableWidth : implicitWidth
+ height: horizontal ? implicitHeight : control.size * control.availableHeight
+ }
+ //! [handle]
+
+ //! [background]
+ background: Rectangle {
+ implicitWidth: 12
+ implicitHeight: 12
+
+ color: control.Universal.chromeLowColor
+ visible: control.size < 1.0
+ opacity: 0.0
+ }
+ //! [background]
+
+ states: [
+ State {
+ name: "active"
+ when: control.active
+ }
+ ]
+
+ transitions: [
+ Transition {
+ to: "active"
+ NumberAnimation { targets: [handle, background]; property: "opacity"; to: 1.0 }
+ },
+ Transition {
+ from: "active"
+ SequentialAnimation {
+ PauseAnimation { duration: 3000 }
+ NumberAnimation { targets: [handle, background]; property: "opacity"; to: 0.0 }
+ }
+ }
+ ]
+}
diff --git a/src/imports/controls/universal/ScrollIndicator.qml b/src/imports/controls/universal/ScrollIndicator.qml
new file mode 100644
index 00000000..5787b60a
--- /dev/null
+++ b/src/imports/controls/universal/ScrollIndicator.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 Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.ScrollIndicator {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ indicator.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ indicator.implicitHeight + topPadding + bottomPadding)
+
+ //! [indicator]
+ indicator: Rectangle {
+ implicitWidth: 6
+ implicitHeight: 6
+
+ color: control.Universal.baseMediumLowColor
+ visible: control.size < 1.0
+ opacity: 0.0
+
+ readonly property bool horizontal: control.orientation === Qt.Horizontal
+ x: control.leftPadding + (horizontal ? control.position * control.width : 0)
+ y: control.topPadding + (horizontal ? 0 : control.position * control.height)
+ width: horizontal ? control.size * control.availableWidth : implicitWidth
+ height: horizontal ? implicitHeight : control.size * control.availableHeight
+
+ states: [
+ State {
+ name: "active"
+ when: control.active
+ }
+ ]
+
+ transitions: [
+ Transition {
+ to: "active"
+ NumberAnimation { target: indicator; property: "opacity"; to: 1.0 }
+ },
+ Transition {
+ from: "active"
+ SequentialAnimation {
+ PauseAnimation { duration: 5000 }
+ NumberAnimation { target: indicator; property: "opacity"; to: 0.0 }
+ }
+ }
+ ]
+ }
+ //! [indicator]
+}
diff --git a/src/imports/controls/universal/Slider.qml b/src/imports/controls/universal/Slider.qml
new file mode 100644
index 00000000..6a4107e6
--- /dev/null
+++ b/src/imports/controls/universal/Slider.qml
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.Slider {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ Math.max(track ? track.implicitWidth : 0,
+ handle ? handle.implicitWidth : 0) + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ Math.max(track ? track.implicitHeight : 0,
+ handle ? handle.implicitHeight : 0) + topPadding + bottomPadding)
+
+ padding: 6
+
+ //! [handle]
+ handle: Rectangle {
+ implicitWidth: horizontal ? 8 : 24
+ implicitHeight: horizontal ? 24 : 8
+
+ readonly property bool horizontal: control.orientation === Qt.Horizontal
+
+ x: control.leftPadding + (horizontal ? control.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)
+ y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height))
+
+ radius: 4
+ color: control.pressed ? control.Universal.chromeHighColor : control.enabled ? control.Universal.accentColor : control.Universal.chromeDisabledHighColor
+ }
+ //! [handle]
+
+ //! [track]
+ track: Item {
+ implicitWidth: horizontal ? 200 : 18
+ implicitHeight: horizontal ? 18 : 200
+
+ readonly property bool horizontal: control.orientation === Qt.Horizontal
+
+ x: control.leftPadding + (horizontal ? 0 : (control.availableWidth - width) / 2)
+ y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : 0)
+ width: horizontal ? control.availableWidth : implicitWidth
+ height: horizontal ? implicitHeight : control.availableHeight
+
+ scale: horizontal && control.mirrored ? -1 : 1
+
+ Rectangle {
+ x: parent.horizontal ? 0 : (parent.width - width) / 2
+ y: parent.horizontal ? (parent.height - height) / 2 : 0
+ width: parent.horizontal ? parent.width : 2 // SliderTrackThemeHeight
+ height: !parent.horizontal ? parent.height : 2 // SliderTrackThemeHeight
+
+ color: control.enabled ? control.Universal.baseMediumLowColor : control.Universal.chromeDisabledHighColor
+ }
+
+ Rectangle {
+ x: parent.horizontal ? 0 : (parent.width - width) / 2
+ y: parent.horizontal ? (parent.height - height) / 2 : control.visualPosition * parent.height
+ width: parent.horizontal ? control.position * parent.width : 2 // SliderTrackThemeHeight
+ height: !parent.horizontal ? control.position * parent.height : 2 // SliderTrackThemeHeight
+
+ color: control.enabled ? control.Universal.accentColor : control.Universal.chromeDisabledHighColor
+ }
+ }
+ //! [track]
+}
diff --git a/src/imports/controls/universal/SpinBox.qml b/src/imports/controls/universal/SpinBox.qml
new file mode 100644
index 00000000..75298895
--- /dev/null
+++ b/src/imports/controls/universal/SpinBox.qml
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.SpinBox {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentItem.implicitWidth + 16 +
+ (up.indicator ? up.indicator.implicitWidth : 0) +
+ (down.indicator ? down.indicator.implicitWidth : 0))
+ implicitHeight: Math.max(contentItem.implicitHeight + topPadding + bottomPadding,
+ background ? background.implicitHeight : 0,
+ up.indicator ? up.indicator.implicitHeight : 0,
+ down.indicator ? down.indicator.implicitHeight : 0)
+
+ // TextControlThemePadding + 2 (border)
+ topPadding: 5
+ bottomPadding: 7
+ leftPadding: 12 + (control.mirrored ? (up.indicator ? up.indicator.width : 0) : (down.indicator ? down.indicator.width : 0))
+ rightPadding: 8 + (control.mirrored ? (down.indicator ? down.indicator.width : 0) : (up.indicator ? up.indicator.width : 0))
+
+ Universal.theme: activeFocus ? Universal.Light : undefined
+
+ font.pixelSize: Universal.fontSize
+ font.family: Universal.fontFamily
+
+ //! [validator]
+ validator: IntValidator {
+ locale: control.locale.name
+ bottom: Math.min(control.from, control.to)
+ top: Math.max(control.from, control.to)
+ }
+ //! [validator]
+
+ //! [contentItem]
+ contentItem: TextInput {
+ text: control.textFromValue(control.value, control.locale)
+
+ font: control.font
+ color: !enabled ? control.Universal.chromeDisabledLowColor :
+ activeFocus ? control.Universal.chromeBlackHighColor : control.Universal.baseHighColor
+ selectionColor: control.Universal.accentColor
+ selectedTextColor: control.Universal.chromeWhiteColor
+ horizontalAlignment: Qt.AlignHCenter
+ verticalAlignment: TextInput.AlignVCenter
+ renderType: Text.NativeRendering
+
+ validator: control.validator
+ inputMethodHints: Qt.ImhFormattedNumbersOnly
+ }
+ //! [contentItem]
+
+ //! [up.indicator]
+ up.indicator: Item {
+ implicitWidth: 26
+ height: parent.height
+ x: control.mirrored ? 0 : parent.width - width
+
+ Rectangle {
+ x: 2; y: 2
+ width: parent.width - 4
+ height: parent.height - 4
+ color: !control.up.pressed ? "transparent" :
+ control.activeFocus ? control.Universal.accentColor
+ : control.Universal.chromeDisabledLowColor
+ }
+
+ Image {
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ source: "image://universal/rightarrow/" + (!control.enabled ? control.Universal.chromeDisabledLowColor :
+ control.activeFocus ? control.Universal.chromeBlackHighColor : control.Universal.baseHighColor)
+ }
+ }
+ //! [up.indicator]
+
+ //! [down.indicator]
+ down.indicator: Item {
+ implicitWidth: 26
+ height: parent.height
+ x: control.mirrored ? parent.width - width : 0
+
+ Rectangle {
+ x: 2; y: 2
+ width: parent.width - 4
+ height: parent.height - 4
+ color: !control.down.pressed ? "transparent" :
+ control.activeFocus ? control.Universal.accentColor
+ : control.Universal.chromeDisabledLowColor
+ }
+
+ Image {
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ source: "image://universal/leftarrow/" + (!control.enabled ? control.Universal.chromeDisabledLowColor :
+ control.activeFocus ? control.Universal.chromeBlackHighColor : control.Universal.baseHighColor)
+ }
+ }
+ //! [down.indicator]
+
+ //! [background]
+ background: Rectangle {
+ implicitWidth: 60 + 26 // TextControlThemeMinWidth - 4 (border)
+ implicitHeight: 28 // TextControlThemeMinHeight - 4 (border)
+
+ border.width: 2 // TextControlBorderThemeThickness
+ border.color: !control.enabled ? control.Universal.baseLowColor :
+ control.activeFocus ? control.Universal.accentColor : control.Universal.chromeDisabledLowColor
+ color: control.enabled ? control.Universal.altHighColor : control.Universal.baseLowColor
+ }
+ //! [background]
+}
diff --git a/src/imports/controls/universal/StackView.qml b/src/imports/controls/universal/StackView.qml
new file mode 100644
index 00000000..b09359b6
--- /dev/null
+++ b/src/imports/controls/universal/StackView.qml
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.StackView {
+ id: root
+
+ //! [popEnter]
+ popEnter: Transition {
+ ParallelAnimation {
+ NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 200; easing.type: Easing.InQuint }
+ NumberAnimation { property: "x"; from: -root.width / 3; to: 0; duration: 400; easing.type: Easing.OutCubic }
+ }
+ }
+ //! [popEnter]
+
+ //! [popExit]
+ popExit: Transition {
+ NumberAnimation { property: "opacity"; from: 1; to: 0; duration: 200; easing.type: Easing.OutQuint }
+ }
+ //! [popExit]
+
+ //! [pushEnter]
+ pushEnter: Transition {
+ ParallelAnimation {
+ NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 200; easing.type: Easing.InQuint }
+ NumberAnimation { property: "x"; from: root.width / 3; to: 0; duration: 400; easing.type: Easing.OutCubic }
+ }
+ }
+ //! [pushEnter]
+
+ //! [pushExit]
+ pushExit: Transition {
+ NumberAnimation { property: "opacity"; from: 1; to: 0; duration: 200; easing.type: Easing.OutQuint }
+ }
+ //! [pushExit]
+
+ //! [replaceEnter]
+ replaceEnter: Transition {
+ ParallelAnimation {
+ NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 200; easing.type: Easing.InQuint }
+ NumberAnimation { property: "x"; from: root.width / 3; to: 0; duration: 400; easing.type: Easing.OutCubic }
+ }
+ }
+ //! [replaceEnter]
+
+ //! [replaceExit]
+ replaceExit: Transition {
+ NumberAnimation { property: "opacity"; from: 1; to: 0; duration: 200; easing.type: Easing.OutQuint }
+ }
+ //! [replaceExit]
+}
diff --git a/src/imports/controls/universal/Switch.qml b/src/imports/controls/universal/Switch.qml
new file mode 100644
index 00000000..5a28b031
--- /dev/null
+++ b/src/imports/controls/universal/Switch.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 Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.Switch {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ (label ? label.implicitWidth : 0) +
+ (indicator ? indicator.implicitWidth : 0) +
+ (label && indicator ? spacing : 0) + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ Math.max(label ? label.implicitHeight : 0,
+ indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
+
+ padding: 5
+ spacing: 8
+
+ font.pixelSize: Universal.fontSize
+ font.family: Universal.fontFamily
+
+ //! [indicator]
+ indicator: Rectangle {
+ implicitWidth: 44
+ implicitHeight: 20
+ x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ y: control.topPadding + (control.availableHeight - height) / 2
+
+ radius: 10
+ color: !control.enabled ? "transparent" :
+ control.pressed ? control.Universal.baseMediumColor :
+ control.checked ? control.Universal.accentColor : "transparent"
+ border.color: !control.enabled ? control.Universal.baseLowColor :
+ control.checked && !control.pressed ? control.Universal.accentColor : control.Universal.baseMediumColor
+ border.width: 2
+
+ Rectangle {
+ width: 10
+ height: 10
+ radius: 5
+
+ color: !control.enabled ? control.Universal.baseLowColor :
+ control.pressed || control.checked ? control.Universal.chromeWhiteColor : control.Universal.baseMediumHighColor
+
+ x: Math.max(5, Math.min(parent.width - width - 5,
+ control.visualPosition * parent.width - (width / 2)))
+ y: (parent.height - height) / 2
+
+ Behavior on x {
+ enabled: !control.pressed
+ SmoothedAnimation { velocity: 200 }
+ }
+ }
+ }
+ //! [indicator]
+
+ //! [label]
+ label: Text {
+ x: control.mirrored ? control.leftPadding : (indicator.x + indicator.width + control.spacing)
+ y: control.topPadding
+ width: control.availableWidth - indicator.width - control.spacing
+ height: control.availableHeight
+
+ text: control.text
+ font: control.font
+ elide: Text.ElideRight
+ visible: control.text
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ renderType: Text.NativeRendering
+
+ color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor
+ }
+ //! [label]
+}
diff --git a/src/imports/controls/universal/TabBar.qml b/src/imports/controls/universal/TabBar.qml
new file mode 100644
index 00000000..1eee3b06
--- /dev/null
+++ b/src/imports/controls/universal/TabBar.qml
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.TabBar {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentItem.implicitHeight + topPadding + bottomPadding)
+
+ //! [contentItem]
+ contentItem: PathView {
+ implicitWidth: 200
+ implicitHeight: 48
+
+ model: control.contentModel
+ currentIndex: control.currentIndex
+
+ interactive: false
+ snapMode: PathView.SnapToItem
+ highlightMoveDuration: 100
+
+ path: Path {
+ startX: control.count ? control.availableWidth / control.count / 2 : 0
+ startY: control.availableHeight / 2
+ PathLine {
+ x: control.count ? control.availableWidth + (control.availableWidth / control.count / 2) : 0
+ y: control.availableHeight / 2
+ }
+ }
+ }
+ //! [contentItem]
+
+ //! [background]
+ background: Rectangle {
+ implicitWidth: 200
+ implicitHeight: 48
+ color: control.Universal.altHighColor
+ }
+ //! [background]
+}
diff --git a/src/imports/controls/universal/TabButton.qml b/src/imports/controls/universal/TabButton.qml
new file mode 100644
index 00000000..667aecbf
--- /dev/null
+++ b/src/imports/controls/universal/TabButton.qml
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.TabButton {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ label ? label.implicitWidth + leftPadding + rightPadding : 0)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ label ? label.implicitHeight + topPadding + bottomPadding : 0)
+
+ padding: 12 // PivotItemMargin
+
+ font.pixelSize: 24 // PivotHeaderItemFontSize
+ font.family: Universal.fontFamily
+ font.weight: Font.Light
+
+ //! [label]
+ label: Text {
+ x: control.leftPadding
+ y: control.topPadding
+ width: control.availableWidth
+ height: control.availableHeight
+
+ text: control.text
+ font: control.font
+ elide: Text.ElideRight
+ color: control.checked || control.pressed ? control.Universal.baseHighColor : control.Universal.baseLowColor
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ renderType: Text.NativeRendering
+ }
+ //! [label]
+}
diff --git a/src/imports/controls/universal/TextArea.qml b/src/imports/controls/universal/TextArea.qml
new file mode 100644
index 00000000..0fb88c78
--- /dev/null
+++ b/src/imports/controls/universal/TextArea.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 Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.TextArea {
+ id: control
+
+ implicitWidth: Math.max(contentWidth + leftPadding + rightPadding,
+ background ? background.implicitWidth : 0,
+ placeholder.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
+ background ? background.implicitHeight : 0,
+ placeholder.implicitHeight + topPadding + bottomPadding)
+
+ // TextControlThemePadding + 2 (border)
+ topPadding: 5
+ leftPadding: 12
+ rightPadding: 8
+ bottomPadding: 7
+
+ Universal.theme: activeFocus ? Universal.Light : undefined
+
+ font.pixelSize: Universal.fontSize
+ font.family: Universal.fontFamily
+
+ color: !enabled ? Universal.chromeDisabledLowColor :
+ activeFocus ? Universal.chromeBlackHighColor : Universal.baseHighColor
+ selectionColor: Universal.accentColor
+ selectedTextColor: Universal.chromeWhiteColor
+ renderType: Text.NativeRendering
+
+ Text {
+ id: placeholder
+ x: control.leftPadding
+ y: control.topPadding
+ width: control.width - (control.leftPadding + control.rightPadding)
+ height: control.height - (control.topPadding + control.bottomPadding)
+
+ text: control.placeholderText
+ font: control.font
+ color: !control.enabled ? control.Universal.chromeDisabledLowColor :
+ control.activeFocus ? control.Universal.chromeBlackMediumLowColor : control.Universal.baseMediumColor
+ visible: !control.length && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
+ horizontalAlignment: control.horizontalAlignment
+ verticalAlignment: control.verticalAlignment
+ renderType: Text.NativeRendering
+ elide: Text.ElideRight
+ }
+
+ //! [background]
+ background: Rectangle {
+ implicitWidth: 60 // TextControlThemeMinWidth - 4 (border)
+ implicitHeight: 28 // TextControlThemeMinHeight - 4 (border)
+
+ border.width: 2 // TextControlBorderThemeThickness
+ border.color: !control.enabled ? control.Universal.baseLowColor :
+ control.activeFocus ? control.Universal.accentColor : control.Universal.chromeDisabledLowColor
+ color: control.enabled ? control.Universal.altHighColor : control.Universal.baseLowColor
+ }
+ //! [background]
+}
diff --git a/src/imports/controls/universal/TextField.qml b/src/imports/controls/universal/TextField.qml
new file mode 100644
index 00000000..56601660
--- /dev/null
+++ b/src/imports/controls/universal/TextField.qml
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.TextField {
+ id: control
+
+ implicitWidth: Math.max(contentWidth + leftPadding + rightPadding,
+ background ? background.implicitWidth : 0,
+ placeholder.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
+ background ? background.implicitHeight : 0,
+ placeholder.implicitHeight + topPadding + bottomPadding)
+
+ // TextControlThemePadding + 2 (border)
+ topPadding: 5
+ leftPadding: 12
+ rightPadding: 8
+ bottomPadding: 7
+
+ Universal.theme: activeFocus ? Universal.Light : undefined
+
+ font.pixelSize: Universal.fontSize
+ font.family: Universal.fontFamily
+
+ color: !enabled ? Universal.chromeDisabledLowColor :
+ activeFocus ? Universal.chromeBlackHighColor : Universal.baseHighColor
+ selectionColor: Universal.accentColor
+ selectedTextColor: Universal.chromeWhiteColor
+ verticalAlignment: TextInput.AlignVCenter
+ renderType: Text.NativeRendering
+
+ Text {
+ id: placeholder
+ x: control.leftPadding
+ y: control.topPadding
+ width: control.width - (control.leftPadding + control.rightPadding)
+ height: control.height - (control.topPadding + control.bottomPadding)
+
+ text: control.placeholderText
+ font: control.font
+ color: !control.enabled ? control.Universal.chromeDisabledLowColor :
+ control.activeFocus ? control.Universal.chromeBlackMediumLowColor : control.Universal.baseMediumColor
+ visible: !control.displayText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
+ horizontalAlignment: control.horizontalAlignment
+ verticalAlignment: control.verticalAlignment
+ renderType: Text.NativeRendering
+ elide: Text.ElideRight
+ }
+
+ //! [background]
+ background: Rectangle {
+ implicitWidth: 60 // TextControlThemeMinWidth - 4 (border)
+ implicitHeight: 28 // TextControlThemeMinHeight - 4 (border)
+
+ border.width: 2 // TextControlBorderThemeThickness
+ border.color: !control.enabled ? control.Universal.baseLowColor :
+ control.activeFocus ? control.Universal.accentColor : control.Universal.chromeDisabledLowColor
+ color: control.enabled ? control.Universal.altHighColor : control.Universal.baseLowColor
+ }
+ //! [background]
+}
diff --git a/src/imports/controls/universal/ToolBar.qml b/src/imports/controls/universal/ToolBar.qml
new file mode 100644
index 00000000..e83fcc1d
--- /dev/null
+++ b/src/imports/controls/universal/ToolBar.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 Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.ToolBar {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
+
+ contentWidth: contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0
+ contentHeight: contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0
+
+ //! [contentItem]
+ contentItem: Item { }
+ //! [contentItem]
+
+ //! [background]
+ background: Rectangle {
+ implicitHeight: 48 // AppBarThemeCompactHeight
+ color: control.Universal.chromeMediumColor
+ }
+ //! [background]
+}
diff --git a/src/imports/controls/universal/ToolButton.qml b/src/imports/controls/universal/ToolButton.qml
new file mode 100644
index 00000000..f4a2b3c8
--- /dev/null
+++ b/src/imports/controls/universal/ToolButton.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 Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.ToolButton {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ label ? label.implicitWidth + leftPadding + rightPadding : 0)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ label ? label.implicitHeight + topPadding + bottomPadding : 0)
+
+ padding: 6
+
+ font.pixelSize: Universal.fontSize
+ font.family: Universal.fontFamily
+
+ //! [label]
+ label: Text {
+ x: control.leftPadding
+ y: control.topPadding
+ width: control.availableWidth
+ height: control.availableHeight
+
+ text: control.text
+ font: control.font
+ color: control.enabled ? control.Universal.baseHighColor : control.Universal.baseLowColor
+ elide: Text.ElideRight
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ renderType: Text.NativeRendering
+ }
+ //! [label]
+
+ //! [background]
+ background: Rectangle {
+ implicitWidth: 68
+ implicitHeight: 48 // AppBarThemeCompactHeight
+
+ color: control.pressed ? control.Universal.listMediumColor :
+ control.checkable && control.checked ? control.Universal.accentColor : "transparent"
+ }
+ //! [background]
+}
diff --git a/src/imports/controls/universal/Tumbler.qml b/src/imports/controls/universal/Tumbler.qml
new file mode 100644
index 00000000..3fded6db
--- /dev/null
+++ b/src/imports/controls/universal/Tumbler.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 Labs Controls 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.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+import Qt.labs.controls 1.0
+
+T.Tumbler {
+ id: control
+
+ implicitWidth: 60
+ implicitHeight: 200
+
+ font.pixelSize: Universal.fontSize
+ font.family: Universal.fontFamily
+
+ //! [delegate]
+ delegate: Text {
+ text: modelData
+ color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor
+ font: control.font
+ opacity: 0.4 + Math.max(0, 1 - Math.abs(Tumbler.displacement)) * 0.6
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ renderType: Text.NativeRendering
+ }
+ //! [delegate]
+
+ //! [contentItem]
+ contentItem: PathView {
+ id: pathView
+ model: control.model
+ delegate: control.delegate
+ clip: true
+ pathItemCount: control.visibleItemCount + 1
+ preferredHighlightBegin: 0.5
+ preferredHighlightEnd: 0.5
+ dragMargin: width / 2
+
+ path: Path {
+ startX: pathView.width / 2
+ startY: -pathView.delegateHeight / 2
+ PathLine {
+ x: pathView.width / 2
+ y: pathView.pathItemCount * pathView.delegateHeight - pathView.delegateHeight / 2
+ }
+ }
+
+ property real delegateHeight: control.availableHeight / control.visibleItemCount
+ }
+ //! [contentItem]
+}
diff --git a/src/imports/controls/universal/images/checkmark.png b/src/imports/controls/universal/images/checkmark.png
new file mode 100644
index 00000000..4397f3b4
--- /dev/null
+++ b/src/imports/controls/universal/images/checkmark.png
Binary files differ
diff --git a/src/imports/controls/universal/images/checkmark@2x.png b/src/imports/controls/universal/images/checkmark@2x.png
new file mode 100644
index 00000000..1e3a41fc
--- /dev/null
+++ b/src/imports/controls/universal/images/checkmark@2x.png
Binary files differ
diff --git a/src/imports/controls/universal/images/checkmark@3x.png b/src/imports/controls/universal/images/checkmark@3x.png
new file mode 100644
index 00000000..d69ebb2e
--- /dev/null
+++ b/src/imports/controls/universal/images/checkmark@3x.png
Binary files differ
diff --git a/src/imports/controls/universal/images/checkmark@4x.png b/src/imports/controls/universal/images/checkmark@4x.png
new file mode 100644
index 00000000..0837c6a5
--- /dev/null
+++ b/src/imports/controls/universal/images/checkmark@4x.png
Binary files differ
diff --git a/src/imports/controls/universal/images/leftarrow.png b/src/imports/controls/universal/images/leftarrow.png
new file mode 100644
index 00000000..2646aafc
--- /dev/null
+++ b/src/imports/controls/universal/images/leftarrow.png
Binary files differ
diff --git a/src/imports/controls/universal/images/leftarrow@2x.png b/src/imports/controls/universal/images/leftarrow@2x.png
new file mode 100644
index 00000000..500396f7
--- /dev/null
+++ b/src/imports/controls/universal/images/leftarrow@2x.png
Binary files differ
diff --git a/src/imports/controls/universal/images/leftarrow@3x.png b/src/imports/controls/universal/images/leftarrow@3x.png
new file mode 100644
index 00000000..7ae2cafd
--- /dev/null
+++ b/src/imports/controls/universal/images/leftarrow@3x.png
Binary files differ
diff --git a/src/imports/controls/universal/images/leftarrow@4x.png b/src/imports/controls/universal/images/leftarrow@4x.png
new file mode 100644
index 00000000..ade9df95
--- /dev/null
+++ b/src/imports/controls/universal/images/leftarrow@4x.png
Binary files differ
diff --git a/src/imports/controls/universal/images/rightarrow.png b/src/imports/controls/universal/images/rightarrow.png
new file mode 100644
index 00000000..2e730d46
--- /dev/null
+++ b/src/imports/controls/universal/images/rightarrow.png
Binary files differ
diff --git a/src/imports/controls/universal/images/rightarrow@2x.png b/src/imports/controls/universal/images/rightarrow@2x.png
new file mode 100644
index 00000000..a089d030
--- /dev/null
+++ b/src/imports/controls/universal/images/rightarrow@2x.png
Binary files differ
diff --git a/src/imports/controls/universal/images/rightarrow@3x.png b/src/imports/controls/universal/images/rightarrow@3x.png
new file mode 100644
index 00000000..2e8921a9
--- /dev/null
+++ b/src/imports/controls/universal/images/rightarrow@3x.png
Binary files differ
diff --git a/src/imports/controls/universal/images/rightarrow@4x.png b/src/imports/controls/universal/images/rightarrow@4x.png
new file mode 100644
index 00000000..9ecb8e88
--- /dev/null
+++ b/src/imports/controls/universal/images/rightarrow@4x.png
Binary files differ
diff --git a/src/imports/controls/universal/qmldir b/src/imports/controls/universal/qmldir
new file mode 100644
index 00000000..ebf841fb
--- /dev/null
+++ b/src/imports/controls/universal/qmldir
@@ -0,0 +1,4 @@
+module Qt.labs.controls.universal
+plugin qtlabsuniversalstyleplugin
+classname QtLabsUniversalStylePlugin
+depends Qt.labs.controls 1.0
diff --git a/src/imports/controls/universal/qquickuniversalimageprovider.cpp b/src/imports/controls/universal/qquickuniversalimageprovider.cpp
new file mode 100644
index 00000000..a7e2411b
--- /dev/null
+++ b/src/imports/controls/universal/qquickuniversalimageprovider.cpp
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls 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 "qquickuniversalimageprovider_p.h"
+
+#include <QtCore/qdebug.h>
+#include <QtGui/qpainter.h>
+#include <QtGui/qguiapplication.h>
+#include <QtGui/qscreen.h>
+#include <QtGui/qicon.h>
+
+QT_BEGIN_NAMESPACE
+
+QQuickUniversalImageProvider::QQuickUniversalImageProvider() : QQuickImageProvider(Image)
+{
+}
+
+QImage QQuickUniversalImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
+{
+ Q_UNUSED(requestedSize);
+
+ int sep = id.indexOf('/');
+ QString name = id.left(sep);
+ QString color = id.mid(sep + 1);
+ qreal dpr = qApp->primaryScreen()->devicePixelRatio();
+ QString file = qt_findAtNxFile(":/org.qt-project/imports/Qt/labs/controls/universal/images/" + name + ".png", dpr);
+
+ QImage image(file);
+ if (image.isNull()) {
+ qWarning() << "QQuickUniversalImageProvider: unknown id:" << id;
+ return QImage();
+ }
+
+ if (size)
+ *size = image.size();
+
+ if (!color.isEmpty()) {
+ QPainter painter(&image);
+ painter.setCompositionMode(QPainter::CompositionMode_SourceIn);
+ painter.fillRect(image.rect(), QColor(color));
+ }
+
+ return image;
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/controls/universal/qquickuniversalimageprovider_p.h b/src/imports/controls/universal/qquickuniversalimageprovider_p.h
new file mode 100644
index 00000000..374d842d
--- /dev/null
+++ b/src/imports/controls/universal/qquickuniversalimageprovider_p.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls 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 QQUICKUNIVERSALIMAGEPROVIDER_P_H
+#define QQUICKUNIVERSALIMAGEPROVIDER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/qquickimageprovider.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickUniversalImageProvider : public QQuickImageProvider
+{
+public:
+ QQuickUniversalImageProvider();
+
+ QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) Q_DECL_OVERRIDE;
+};
+
+Q_DECLARE_TYPEINFO(QQuickUniversalImageProvider, Q_COMPLEX_TYPE);
+
+QT_END_NAMESPACE
+
+#endif // QQUICKUNIVERSALIMAGEPROVIDER_P_H
diff --git a/src/imports/controls/universal/qquickuniversalprogressring.cpp b/src/imports/controls/universal/qquickuniversalprogressring.cpp
new file mode 100644
index 00000000..2fe66047
--- /dev/null
+++ b/src/imports/controls/universal/qquickuniversalprogressring.cpp
@@ -0,0 +1,269 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls 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 "qquickuniversalprogressring_p.h"
+
+#include <QtCore/qmath.h>
+#include <QtCore/qeasingcurve.h>
+#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuick/private/qquickanimatorjob_p.h>
+#include <QtQuick/private/qsgadaptationlayer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+static const int PhaseCount = 6;
+static const int Interval = 167;
+static const int TotalDuration = 4052;
+
+class QQuickUniversalProgressRingAnimatorJob : public QQuickAnimatorJob
+{
+public:
+ QQuickUniversalProgressRingAnimatorJob();
+
+ void initialize(QQuickAnimatorController *controller) Q_DECL_OVERRIDE;
+ void updateCurrentTime(int time) Q_DECL_OVERRIDE;
+ void writeBack() Q_DECL_OVERRIDE;
+ void nodeWasDestroyed() Q_DECL_OVERRIDE;
+ void afterNodeSync() Q_DECL_OVERRIDE;
+
+private:
+ struct Phase {
+ Phase() : duration(0), from(0), to(0), curve(QEasingCurve::Linear) { }
+ Phase(int d, qreal f, qreal t, QEasingCurve::Type c) : duration(d), from(f), to(t), curve(c) { }
+ int duration;
+ qreal from;
+ qreal to;
+ QEasingCurve curve;
+ };
+
+ QSGNode *m_node;
+ Phase m_phases[PhaseCount];
+};
+
+QQuickUniversalProgressRingAnimatorJob::QQuickUniversalProgressRingAnimatorJob() : m_node(Q_NULLPTR)
+{
+ m_phases[0] = Phase(433, -110, 10, QEasingCurve::BezierSpline);
+ m_phases[1] = Phase(767, 10, 93, QEasingCurve::Linear );
+ m_phases[2] = Phase(417, 93, 205, QEasingCurve::BezierSpline);
+ m_phases[3] = Phase(400, 205, 357, QEasingCurve::BezierSpline);
+ m_phases[4] = Phase(766, 357, 439, QEasingCurve::Linear );
+ m_phases[5] = Phase(434, 439, 585, QEasingCurve::BezierSpline);
+
+ m_phases[0].curve.addCubicBezierSegment(QPointF(0.02, 0.33), QPointF(0.38, 0.77), QPointF(1.00, 1.00));
+ m_phases[2].curve.addCubicBezierSegment(QPointF(0.57, 0.17), QPointF(0.95, 0.75), QPointF(1.00, 1.00));
+ m_phases[3].curve.addCubicBezierSegment(QPointF(0.00, 0.19), QPointF(0.07, 0.72), QPointF(1.00, 1.00));
+ m_phases[5].curve.addCubicBezierSegment(QPointF(0.00, 0.00), QPointF(0.95, 0.37), QPointF(1.00, 1.00));
+}
+
+void QQuickUniversalProgressRingAnimatorJob::initialize(QQuickAnimatorController *controller)
+{
+ QQuickAnimatorJob::initialize(controller);
+ m_node = QQuickItemPrivate::get(m_target)->childContainerNode();
+}
+
+void QQuickUniversalProgressRingAnimatorJob::updateCurrentTime(int time)
+{
+ if (!m_node)
+ return;
+
+ QSGNode *containerNode = m_node->firstChild();
+ Q_ASSERT(!containerNode || containerNode->type() == QSGNode::TransformNodeType);
+ if (!containerNode)
+ return;
+
+ int nodeIndex = 0;
+ int count = containerNode->childCount();
+ QSGTransformNode *transformNode = static_cast<QSGTransformNode *>(containerNode->firstChild());
+ while (transformNode) {
+ Q_ASSERT(transformNode->type() == QSGNode::TransformNodeType);
+
+ QSGOpacityNode *opacityNode = static_cast<QSGOpacityNode *>(transformNode->firstChild());
+ Q_ASSERT(opacityNode->type() == QSGNode::OpacityNodeType);
+
+ int begin = nodeIndex * Interval;
+ int end = TotalDuration - (PhaseCount - nodeIndex - 1) * Interval;
+
+ bool visible = time >= begin && time <= end;
+ opacityNode->setOpacity(visible ? 1.0 : 0.0);
+
+ if (visible) {
+ int phaseIndex, remain = time, elapsed = 0;
+ for (phaseIndex = 0; phaseIndex < PhaseCount; ++phaseIndex) {
+ if (remain <= m_phases[phaseIndex].duration + begin)
+ break;
+ remain -= m_phases[phaseIndex].duration;
+ elapsed += m_phases[phaseIndex].duration;
+ }
+
+ const Phase &phase = m_phases[phaseIndex];
+
+ qreal from = phase.from - nodeIndex * count;
+ qreal to = phase.to - nodeIndex * count;
+ qreal pos = time - elapsed - begin;
+
+ qreal value = phase.curve.valueForProgress(pos / phase.duration);
+ qreal rotation = from + (to - from) * value;
+
+ QMatrix4x4 matrix;
+ matrix.rotate(rotation, 0, 0, 1);
+ transformNode->setMatrix(matrix);
+ }
+
+ transformNode = static_cast<QSGTransformNode *>(transformNode->nextSibling());
+ ++nodeIndex;
+ }
+}
+
+void QQuickUniversalProgressRingAnimatorJob::writeBack()
+{
+}
+
+void QQuickUniversalProgressRingAnimatorJob::nodeWasDestroyed()
+{
+ m_node = Q_NULLPTR;
+}
+
+void QQuickUniversalProgressRingAnimatorJob::afterNodeSync()
+{
+ m_node = QQuickItemPrivate::get(m_target)->childContainerNode();
+}
+
+QQuickUniversalProgressRingAnimator::QQuickUniversalProgressRingAnimator(QObject *parent)
+ : QQuickAnimator(parent)
+{
+ setDuration(TotalDuration);
+ setLoops(QQuickAnimator::Infinite);
+}
+
+QString QQuickUniversalProgressRingAnimator::propertyName() const
+{
+ return QString();
+}
+
+QQuickAnimatorJob *QQuickUniversalProgressRingAnimator::createJob() const
+{
+ return new QQuickUniversalProgressRingAnimatorJob;
+}
+
+QQuickUniversalProgressRing::QQuickUniversalProgressRing(QQuickItem *parent)
+ : QQuickItem(parent), m_count(5), m_color(Qt::black)
+{
+ setFlag(ItemHasContents);
+}
+
+int QQuickUniversalProgressRing::count() const
+{
+ return m_count;
+}
+
+void QQuickUniversalProgressRing::setCount(int count)
+{
+ if (m_count != count) {
+ m_count = count;
+ update();
+ emit countChanged();
+ }
+}
+
+QColor QQuickUniversalProgressRing::color() const
+{
+ return m_color;
+}
+
+void QQuickUniversalProgressRing::setColor(const QColor &color)
+{
+ if (m_color != color) {
+ m_color = color;
+ update();
+ emit colorChanged();
+ }
+}
+
+QSGNode *QQuickUniversalProgressRing::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
+{
+ QQuickItemPrivate *d = QQuickItemPrivate::get(this);
+
+ if (!oldNode)
+ oldNode = new QSGTransformNode;
+ Q_ASSERT(oldNode->type() == QSGNode::TransformNodeType);
+
+ QMatrix4x4 matrix;
+ matrix.translate(width() / 2, height() / 2);
+ static_cast<QSGTransformNode *>(oldNode)->setMatrix(matrix);
+
+ qreal size = qMin(width(), height());
+ qreal diameter = size / 10.0;
+ qreal radius = diameter / 2;
+ qreal offset = (size - diameter * 2) / M_PI;
+
+ QSGNode *transformNode = oldNode->firstChild();
+ for (int i = 0; i < m_count; ++i) {
+ if (!transformNode) {
+ transformNode = new QSGTransformNode;
+ oldNode->appendChildNode(transformNode);
+
+ QSGOpacityNode *opacityNode = new QSGOpacityNode;
+ transformNode->appendChildNode(opacityNode);
+
+ QSGRectangleNode *rectNode = d->sceneGraphContext()->createRectangleNode();
+ rectNode->setAntialiasing(true);
+ opacityNode->appendChildNode(rectNode);
+ }
+
+ QSGNode *opacityNode = transformNode->firstChild();
+ Q_ASSERT(opacityNode->type() == QSGNode::OpacityNodeType);
+
+ QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(opacityNode->firstChild());
+ Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType);
+
+ rectNode->setRect(QRectF(offset, offset, diameter, diameter));
+ rectNode->setColor(m_color);
+ rectNode->setRadius(radius);
+ rectNode->update();
+
+ transformNode = transformNode->nextSibling();
+ }
+
+ while (transformNode) {
+ QSGNode *nextSibling = transformNode->nextSibling();
+ delete transformNode;
+ transformNode = nextSibling;
+ }
+
+ return oldNode;
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/controls/universal/qquickuniversalprogressring_p.h b/src/imports/controls/universal/qquickuniversalprogressring_p.h
new file mode 100644
index 00000000..f8ed212c
--- /dev/null
+++ b/src/imports/controls/universal/qquickuniversalprogressring_p.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls 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 QQUICKUNIVERSALPROGRESSRING_P_H
+#define QQUICKUNIVERSALPROGRESSRING_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/qquickitem.h>
+#include <QtQuick/private/qquickanimator_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickUniversalProgressRing : public QQuickItem
+{
+ Q_OBJECT
+ Q_PROPERTY(int count READ count WRITE setCount NOTIFY countChanged FINAL)
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged FINAL)
+
+public:
+ QQuickUniversalProgressRing(QQuickItem *parent = Q_NULLPTR);
+
+ int count() const;
+ void setCount(int count);
+
+ QColor color() const;
+ void setColor(const QColor &color);
+
+Q_SIGNALS:
+ void countChanged();
+ void colorChanged();
+
+protected:
+ QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
+
+private:
+ int m_count;
+ QColor m_color;
+};
+
+class QQuickUniversalProgressRingAnimator : public QQuickAnimator
+{
+ Q_OBJECT
+
+public:
+ QQuickUniversalProgressRingAnimator(QObject *parent = Q_NULLPTR);
+
+protected:
+ QString propertyName() const Q_DECL_OVERRIDE;
+ QQuickAnimatorJob *createJob() const Q_DECL_OVERRIDE;
+};
+
+Q_DECLARE_TYPEINFO(QQuickUniversalProgressRing, Q_COMPLEX_TYPE);
+Q_DECLARE_TYPEINFO(QQuickUniversalProgressRingAnimator, Q_COMPLEX_TYPE);
+
+QT_END_NAMESPACE
+
+#endif // QQUICKUNIVERSALPROGRESSRING_P_H
diff --git a/src/imports/controls/universal/qquickuniversalprogressstrip.cpp b/src/imports/controls/universal/qquickuniversalprogressstrip.cpp
new file mode 100644
index 00000000..39ce1b5c
--- /dev/null
+++ b/src/imports/controls/universal/qquickuniversalprogressstrip.cpp
@@ -0,0 +1,304 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls 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 "qquickuniversalprogressstrip_p.h"
+
+#include <QtCore/qmath.h>
+#include <QtCore/qeasingcurve.h>
+#include <QtQuick/qsgsimplerectnode.h>
+#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuick/private/qquickanimatorjob_p.h>
+#include <QtQuick/private/qsgadaptationlayer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+static const int PhaseCount = 4;
+static const int EllipseCount = 5;
+static const int Interval = 167;
+static const int TotalDuration = 3917;
+static const int VisibleDuration = 3000;
+static const qreal EllipseDiameter = 4;
+static const qreal EllipseOffset = 4;
+static const qreal ContainerAnimationStartPosition = -34; // absolute
+static const qreal ContainerAnimationEndPosition = 0.435222; // relative
+static const qreal EllipseAnimationWellPosition = 0.333333333333333; // relative
+static const qreal EllipseAnimationEndPosition = 0.666666666666667; // relative
+
+class QQuickUniversalProgressStripAnimatorJob : public QQuickAnimatorJob
+{
+public:
+ QQuickUniversalProgressStripAnimatorJob();
+
+ void initialize(QQuickAnimatorController *controller) Q_DECL_OVERRIDE;
+ void updateCurrentTime(int time) Q_DECL_OVERRIDE;
+ void writeBack() Q_DECL_OVERRIDE;
+ void nodeWasDestroyed() Q_DECL_OVERRIDE;
+ void afterNodeSync() Q_DECL_OVERRIDE;
+
+private:
+ struct Phase {
+ Phase() : duration(0), from(0), to(0) { }
+ Phase(int d, qreal f, qreal t) : duration(d), from(f), to(t) { }
+ int duration;
+ qreal from;
+ qreal to;
+ };
+
+ QSGNode *m_node;
+ Phase m_borderPhases[PhaseCount];
+ Phase m_ellipsePhases[PhaseCount];
+};
+
+QQuickUniversalProgressStripAnimatorJob::QQuickUniversalProgressStripAnimatorJob() : m_node(Q_NULLPTR)
+{
+ m_borderPhases[0] = Phase( 500, -50, 0);
+ m_borderPhases[1] = Phase(1500, 0, 0);
+ m_borderPhases[2] = Phase(1000, 0, 100);
+ m_borderPhases[3] = Phase( 917, 100, 100);
+
+ m_ellipsePhases[0] = Phase(1000, 0, EllipseAnimationWellPosition);
+ m_ellipsePhases[1] = Phase(1000, EllipseAnimationWellPosition, EllipseAnimationWellPosition);
+ m_ellipsePhases[2] = Phase(1000, EllipseAnimationWellPosition, EllipseAnimationEndPosition);
+ m_ellipsePhases[3] = Phase(1000, EllipseAnimationWellPosition, EllipseAnimationEndPosition);
+}
+
+void QQuickUniversalProgressStripAnimatorJob::initialize(QQuickAnimatorController *controller)
+{
+ QQuickAnimatorJob::initialize(controller);
+ m_node = QQuickItemPrivate::get(m_target)->childContainerNode();
+}
+
+void QQuickUniversalProgressStripAnimatorJob::updateCurrentTime(int time)
+{
+ if (!m_node)
+ return;
+
+ QSGSimpleRectNode *geometryNode = static_cast<QSGSimpleRectNode *>(m_node->firstChild());
+ Q_ASSERT(!geometryNode || geometryNode->type() == QSGNode::GeometryNodeType);
+ if (!geometryNode)
+ return;
+
+ QSGTransformNode *gridNode = static_cast<QSGTransformNode *>(geometryNode->firstChild());
+ Q_ASSERT(!gridNode || gridNode->type() == QSGNode::TransformNodeType);
+ if (!gridNode)
+ return;
+
+ qreal width = geometryNode->rect().width();
+ {
+ qreal from = ContainerAnimationStartPosition;
+ qreal to = from + ContainerAnimationEndPosition * width;
+ qreal progress = static_cast<qreal>(time) / TotalDuration;
+ qreal dx = from + (to - from) * progress;
+
+ QMatrix4x4 matrix;
+ matrix.translate(dx, 0);
+ gridNode->setMatrix(matrix);
+ }
+
+ int nodeIndex = 0;
+ QSGTransformNode *borderNode = static_cast<QSGTransformNode *>(gridNode->firstChild());
+ while (borderNode) {
+ Q_ASSERT(borderNode->type() == QSGNode::TransformNodeType);
+
+ QSGTransformNode *ellipseNode = static_cast<QSGTransformNode *>(borderNode->firstChild());
+ Q_ASSERT(ellipseNode->type() == QSGNode::TransformNodeType);
+
+ QSGOpacityNode *opacityNode = static_cast<QSGOpacityNode *>(ellipseNode->firstChild());
+ Q_ASSERT(opacityNode->type() == QSGNode::OpacityNodeType);
+
+ int begin = nodeIndex * Interval;
+ int end = VisibleDuration + nodeIndex * Interval;
+
+ bool visible = time >= begin && time <= end;
+ opacityNode->setOpacity(visible ? 1.0 : 0.0);
+
+ if (visible) {
+ {
+ int phaseIndex, remain = time, elapsed = 0;
+ for (phaseIndex = 0; phaseIndex < PhaseCount; ++phaseIndex) {
+ if (remain <= m_borderPhases[phaseIndex].duration + begin)
+ break;
+ remain -= m_borderPhases[phaseIndex].duration;
+ elapsed += m_borderPhases[phaseIndex].duration;
+ }
+
+ const Phase &phase = m_borderPhases[phaseIndex];
+
+ qreal pos = time - elapsed - begin;
+ qreal progress = pos / phase.duration;
+ qreal dx = phase.from + (phase.to - phase.from) * progress;
+
+ QMatrix4x4 matrix;
+ matrix.translate(dx, 0);
+ borderNode->setMatrix(matrix);
+ }
+
+ {
+ QEasingCurve curve(QEasingCurve::BezierSpline);
+ curve.addCubicBezierSegment(QPointF(0.4, 0.0), QPointF(0.6, 1.0), QPointF(1.0, 1.0));
+
+ int phaseIndex, remain = time, elapsed = 0;
+ for (phaseIndex = 0; phaseIndex < PhaseCount; ++phaseIndex) {
+ if (remain <= m_ellipsePhases[phaseIndex].duration + begin)
+ break;
+ remain -= m_ellipsePhases[phaseIndex].duration;
+ elapsed += m_ellipsePhases[phaseIndex].duration;
+ }
+
+ const Phase &phase = m_ellipsePhases[phaseIndex];
+
+ qreal from = phase.from * width;
+ qreal to = phase.to * width;
+ qreal pos = time - elapsed - begin;
+ qreal progress = curve.valueForProgress(pos / phase.duration);
+ qreal dx = from + (to - from) * progress;
+
+ QMatrix4x4 matrix;
+ matrix.translate(dx, 0);
+ ellipseNode->setMatrix(matrix);
+ }
+ }
+
+ borderNode = static_cast<QSGTransformNode *>(borderNode->nextSibling());
+ ++nodeIndex;
+ }
+}
+
+void QQuickUniversalProgressStripAnimatorJob::writeBack()
+{
+}
+
+void QQuickUniversalProgressStripAnimatorJob::nodeWasDestroyed()
+{
+ m_node = Q_NULLPTR;
+}
+
+void QQuickUniversalProgressStripAnimatorJob::afterNodeSync()
+{
+ m_node = QQuickItemPrivate::get(m_target)->childContainerNode();
+}
+
+QQuickUniversalProgressStripAnimator::QQuickUniversalProgressStripAnimator(QObject *parent)
+ : QQuickAnimator(parent)
+{
+ setDuration(TotalDuration);
+ setLoops(QQuickAnimator::Infinite);
+}
+
+QString QQuickUniversalProgressStripAnimator::propertyName() const
+{
+ return QString();
+}
+
+QQuickAnimatorJob *QQuickUniversalProgressStripAnimator::createJob() const
+{
+ return new QQuickUniversalProgressStripAnimatorJob;
+}
+
+QQuickUniversalProgressStrip::QQuickUniversalProgressStrip(QQuickItem *parent)
+ : QQuickItem(parent), m_color(Qt::black)
+{
+ setFlag(ItemHasContents);
+}
+
+QColor QQuickUniversalProgressStrip::color() const
+{
+ return m_color;
+}
+
+void QQuickUniversalProgressStrip::setColor(const QColor &color)
+{
+ if (m_color != color) {
+ m_color = color;
+ update();
+ emit colorChanged();
+ }
+}
+
+QSGNode *QQuickUniversalProgressStrip::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
+{
+ QQuickItemPrivate *d = QQuickItemPrivate::get(this);
+
+ if (!oldNode)
+ oldNode = new QSGSimpleRectNode(boundingRect(), Qt::transparent);
+ static_cast<QSGSimpleRectNode *>(oldNode)->setRect(boundingRect());
+
+ QSGTransformNode *gridNode = static_cast<QSGTransformNode *>(oldNode->firstChild());
+ if (!gridNode) {
+ gridNode = new QSGTransformNode;
+ oldNode->appendChildNode(gridNode);
+ }
+ Q_ASSERT(gridNode->type() == QSGNode::TransformNodeType);
+
+ QSGNode *borderNode = gridNode->firstChild();
+ for (int i = 0; i < EllipseCount; ++i) {
+ if (!borderNode) {
+ borderNode = new QSGTransformNode;
+ gridNode->appendChildNode(borderNode);
+
+ QSGTransformNode *ellipseNode = new QSGTransformNode;
+ borderNode->appendChildNode(ellipseNode);
+
+ QSGOpacityNode *opacityNode = new QSGOpacityNode;
+ ellipseNode->appendChildNode(opacityNode);
+
+ QSGRectangleNode *rectNode = d->sceneGraphContext()->createRectangleNode();
+ rectNode->setAntialiasing(true);
+ rectNode->setRadius(EllipseDiameter / 2);
+ opacityNode->appendChildNode(rectNode);
+ }
+ Q_ASSERT(borderNode->type() == QSGNode::TransformNodeType);
+
+ QSGNode *ellipseNode = borderNode->firstChild();
+ Q_ASSERT(ellipseNode->type() == QSGNode::TransformNodeType);
+
+ QSGNode *opacityNode = ellipseNode->firstChild();
+ Q_ASSERT(opacityNode->type() == QSGNode::OpacityNodeType);
+
+ QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(opacityNode->firstChild());
+ Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType);
+
+ rectNode->setRect(QRectF((EllipseCount - i - 1) * (EllipseDiameter + EllipseOffset), (height() - EllipseDiameter) / 2, EllipseDiameter, EllipseDiameter));
+ rectNode->setColor(m_color);
+ rectNode->update();
+
+ borderNode = borderNode->nextSibling();
+ }
+
+ return oldNode;
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/controls/universal/qquickuniversalprogressstrip_p.h b/src/imports/controls/universal/qquickuniversalprogressstrip_p.h
new file mode 100644
index 00000000..f7c063b6
--- /dev/null
+++ b/src/imports/controls/universal/qquickuniversalprogressstrip_p.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls 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 QQUICKUNIVERSALPROGRESSSTRIP_P_H
+#define QQUICKUNIVERSALPROGRESSSTRIP_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/qquickitem.h>
+#include <QtQuick/private/qquickanimator_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickUniversalProgressStrip : public QQuickItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged FINAL)
+
+public:
+ QQuickUniversalProgressStrip(QQuickItem *parent = Q_NULLPTR);
+
+ QColor color() const;
+ void setColor(const QColor &color);
+
+Q_SIGNALS:
+ void colorChanged();
+
+protected:
+ QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
+
+private:
+ QColor m_color;
+};
+
+class QQuickUniversalProgressStripAnimator : public QQuickAnimator
+{
+ Q_OBJECT
+
+public:
+ QQuickUniversalProgressStripAnimator(QObject *parent = Q_NULLPTR);
+
+protected:
+ QString propertyName() const Q_DECL_OVERRIDE;
+ QQuickAnimatorJob *createJob() const Q_DECL_OVERRIDE;
+};
+
+Q_DECLARE_TYPEINFO(QQuickUniversalProgressStrip, Q_COMPLEX_TYPE);
+Q_DECLARE_TYPEINFO(QQuickUniversalProgressStripAnimator, Q_COMPLEX_TYPE);
+
+QT_END_NAMESPACE
+
+#endif // QQUICKUNIVERSALPROGRESSSTRIP_P_H
diff --git a/src/imports/controls/universal/qquickuniversalstyle.cpp b/src/imports/controls/universal/qquickuniversalstyle.cpp
new file mode 100644
index 00000000..4b7542c6
--- /dev/null
+++ b/src/imports/controls/universal/qquickuniversalstyle.cpp
@@ -0,0 +1,412 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls 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 "qquickuniversalstyle_p.h"
+#include "qquickstyle_p.h"
+
+#include <QtGui/qfont.h>
+#include <QtGui/qguiapplication.h>
+#include <QtQuick/private/qquickitem_p.h>
+
+QT_BEGIN_NAMESPACE
+
+static const QQuickUniversalStyle::Theme DefaultTheme = QQuickUniversalStyle::Light;
+static const QQuickUniversalStyle::Accent DefaultAccent = QQuickUniversalStyle::Cobalt;
+
+static QColor qquickuniversal_light_color(QQuickUniversalStyle::SystemColor role)
+{
+ static const QColor colors[] = {
+ "#FFFFFFFF", // SystemAltHighColor
+ "#33FFFFFF", // SystemAltLowColor
+ "#99FFFFFF", // SystemAltMediumColor
+ "#CCFFFFFF", // SystemAltMediumHighColor
+ "#66FFFFFF", // SystemAltMediumLowColor
+ "#FF000000", // SystemBaseHighColor
+ "#33000000", // SystemBaseLowColor
+ "#99000000", // SystemBaseMediumColor
+ "#CC000000", // SystemBaseMediumHighColor
+ "#66000000", // SystemBaseMediumLowColor
+ "#FF171717", // SystemChromeAltLowColor
+ "#FF000000", // SystemChromeBlackHighColor
+ "#33000000", // SystemChromeBlackLowColor
+ "#66000000", // SystemChromeBlackMediumLowColor
+ "#CC000000", // SystemChromeBlackMediumColor
+ "#FFCCCCCC", // SystemChromeDisabledHighColor
+ "#FF7A7A7A", // SystemChromeDisabledLowColor
+ "#FFCCCCCC", // SystemChromeHighColor
+ "#FFF2F2F2", // SystemChromeLowColor
+ "#FFE6E6E6", // SystemChromeMediumColor
+ "#FFF2F2F2", // SystemChromeMediumLowColor
+ "#FFFFFFFF", // SystemChromeWhiteColor
+ "#19000000", // SystemListLowColor
+ "#33000000" // SystemListMediumColor
+ };
+ return colors[role];
+}
+
+static QColor qquickuniversal_dark_color(QQuickUniversalStyle::SystemColor role)
+{
+ static const QColor colors[] = {
+ "#FF000000", // SystemAltHighColor
+ "#33000000", // SystemAltLowColor
+ "#99000000", // SystemAltMediumColor
+ "#CC000000", // SystemAltMediumHighColor
+ "#66000000", // SystemAltMediumLowColor
+ "#FFFFFFFF", // SystemBaseHighColor
+ "#33FFFFFF", // SystemBaseLowColor
+ "#99FFFFFF", // SystemBaseMediumColor
+ "#CCFFFFFF", // SystemBaseMediumHighColor
+ "#66FFFFFF", // SystemBaseMediumLowColor
+ "#FFF2F2F2", // SystemChromeAltLowColor
+ "#FF000000", // SystemChromeBlackHighColor
+ "#33000000", // SystemChromeBlackLowColor
+ "#66000000", // SystemChromeBlackMediumLowColor
+ "#CC000000", // SystemChromeBlackMediumColor
+ "#FF333333", // SystemChromeDisabledHighColor
+ "#FF858585", // SystemChromeDisabledLowColor
+ "#FF767676", // SystemChromeHighColor
+ "#FF171717", // SystemChromeLowColor
+ "#FF1F1F1F", // SystemChromeMediumColor
+ "#FF2B2B2B", // SystemChromeMediumLowColor
+ "#FFFFFFFF", // SystemChromeWhiteColor
+ "#19FFFFFF", // SystemListLowColor
+ "#33FFFFFF" // SystemListMediumColor
+ };
+ return colors[role];
+}
+
+static QColor qquickuniversal_accent_color(QQuickUniversalStyle::Accent accent)
+{
+ static const QColor colors[] = {
+ "#A4C400", // Lime
+ "#60A917", // Green
+ "#008A00", // Emerald
+ "#00ABA9", // Teal
+ "#1BA1E2", // Cyan
+ "#3E65FF", // Cobalt
+ "#6A00FF", // Indigo
+ "#AA00FF", // Violet
+ "#F472D0", // Pink
+ "#D80073", // Magenta
+ "#A20025", // Crimson
+ "#E51400", // Red
+ "#FA6800", // Orange
+ "#F0A30A", // Amber
+ "#E3C800", // Yellow
+ "#825A2C", // Brown
+ "#6D8764", // Olive
+ "#647687", // Steel
+ "#76608A", // Mauve
+ "#87794E" // Taupe
+ };
+ return colors[accent];
+}
+
+QQuickUniversalStyle::QQuickUniversalStyle(QObject *parent) : QObject(parent),
+ m_hasTheme(false), m_hasAccent(false), m_theme(DefaultTheme), m_accent(DefaultAccent)
+{
+ QQuickItem *item = qobject_cast<QQuickItem *>(parent);
+ if (item)
+ QQuickItemPrivate::get(item)->addItemChangeListener(this, QQuickItemPrivate::Parent);
+}
+
+QQuickUniversalStyle::~QQuickUniversalStyle()
+{
+ QQuickItem *item = qobject_cast<QQuickItem *>(parent());
+ if (item)
+ QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Parent);
+
+ reparent(Q_NULLPTR);
+}
+
+QQuickUniversalStyle *QQuickUniversalStyle::qmlAttachedProperties(QObject *object)
+{
+ QQuickUniversalStyle *style = new QQuickUniversalStyle(object);
+ QQuickUniversalStyle *parentStyle = QQuickStyle::findParent<QQuickUniversalStyle>(object);
+ if (parentStyle)
+ style->reparent(parentStyle);
+
+ QList<QQuickUniversalStyle *> children = QQuickStyle::findChildren<QQuickUniversalStyle>(object);
+ foreach (QQuickUniversalStyle *child, children)
+ child->reparent(style);
+ return style;
+}
+
+QQuickUniversalStyle::Theme QQuickUniversalStyle::theme() const
+{
+ return m_theme;
+}
+
+void QQuickUniversalStyle::setTheme(Theme theme)
+{
+ m_hasTheme = true;
+ if (m_theme != theme) {
+ m_theme = theme;
+ foreach (QQuickUniversalStyle *child, m_childStyles)
+ child->inheritTheme(theme);
+ emit themeChanged();
+ emit paletteChanged();
+ }
+}
+
+void QQuickUniversalStyle::inheritTheme(Theme theme)
+{
+ if (!m_hasTheme && m_theme != theme) {
+ m_theme = theme;
+ foreach (QQuickUniversalStyle *child, m_childStyles)
+ child->inheritTheme(theme);
+ emit themeChanged();
+ emit paletteChanged();
+ }
+}
+
+void QQuickUniversalStyle::resetTheme()
+{
+ if (m_hasTheme) {
+ m_hasTheme = false;
+ QQuickUniversalStyle *parentStyle = QQuickStyle::findParent<QQuickUniversalStyle>(parent());
+ inheritTheme(parentStyle ? parentStyle->theme() : DefaultTheme);
+ }
+}
+
+QQuickUniversalStyle::Accent QQuickUniversalStyle::accent() const
+{
+ return m_accent;
+}
+
+void QQuickUniversalStyle::setAccent(Accent accent)
+{
+ if (accent < Lime || accent > Taupe) {
+ qWarning() << "QQuickUniversalStyle: unknown accent" << accent;
+ return;
+ }
+ m_hasAccent = true;
+ if (m_accent != accent) {
+ m_accent = accent;
+ foreach (QQuickUniversalStyle *child, m_childStyles)
+ child->inheritAccent(accent);
+ emit accentChanged();
+ }
+}
+
+void QQuickUniversalStyle::inheritAccent(Accent accent)
+{
+ if (!m_hasAccent && m_accent != accent) {
+ m_accent = accent;
+ foreach (QQuickUniversalStyle *child, m_childStyles)
+ child->inheritAccent(accent);
+ emit accentChanged();
+ }
+}
+
+void QQuickUniversalStyle::resetAccent()
+{
+ if (m_hasAccent) {
+ m_hasAccent = false;
+ QQuickUniversalStyle *parentStyle = QQuickStyle::findParent<QQuickUniversalStyle>(parent());
+ inheritAccent(parentStyle ? parentStyle->accent() : DefaultAccent);
+ }
+}
+
+QColor QQuickUniversalStyle::accentColor() const
+{
+ return qquickuniversal_accent_color(m_accent);
+}
+
+QColor QQuickUniversalStyle::altHighColor() const
+{
+ return getColor(AltHigh);
+}
+
+QColor QQuickUniversalStyle::altLowColor() const
+{
+ return getColor(AltLow);
+}
+
+QColor QQuickUniversalStyle::altMediumColor() const
+{
+ return getColor(AltMedium);
+}
+
+QColor QQuickUniversalStyle::altMediumHighColor() const
+{
+ return getColor(AltMediumHigh);
+}
+
+QColor QQuickUniversalStyle::altMediumLowColor() const
+{
+ return getColor(AltMediumLow);
+}
+
+QColor QQuickUniversalStyle::baseHighColor() const
+{
+ return getColor(BaseHighColor);
+}
+
+QColor QQuickUniversalStyle::baseLowColor() const
+{
+ return getColor(BaseLow);
+}
+
+QColor QQuickUniversalStyle::baseMediumColor() const
+{
+ return getColor(BaseMedium);
+}
+
+QColor QQuickUniversalStyle::baseMediumHighColor() const
+{
+ return getColor(BaseMediumHigh);
+}
+
+QColor QQuickUniversalStyle::baseMediumLowColor() const
+{
+ return getColor(BaseMediumLow);
+}
+
+QColor QQuickUniversalStyle::chromeAltLowColor() const
+{
+ return getColor(ChromeAltLow);
+}
+
+QColor QQuickUniversalStyle::chromeBlackHighColor() const
+{
+ return getColor(ChromeBlackHigh);
+}
+
+QColor QQuickUniversalStyle::chromeBlackLowColor() const
+{
+ return getColor(ChromeBlackLow);
+}
+
+QColor QQuickUniversalStyle::chromeBlackMediumLowColor() const
+{
+ return getColor(ChromeBlackMediumLow);
+}
+
+QColor QQuickUniversalStyle::chromeBlackMediumColor() const
+{
+ return getColor(ChromeBlackMedium);
+}
+
+QColor QQuickUniversalStyle::chromeDisabledHighColor() const
+{
+ return getColor(ChromeDisabledHigh);
+}
+
+QColor QQuickUniversalStyle::chromeDisabledLowColor() const
+{
+ return getColor(ChromeDisabledLow);
+}
+
+QColor QQuickUniversalStyle::chromeHighColor() const
+{
+ return getColor(ChromeHigh);
+}
+
+QColor QQuickUniversalStyle::chromeLowColor() const
+{
+ return getColor(ChromeLow);
+}
+
+QColor QQuickUniversalStyle::chromeMediumColor() const
+{
+ return getColor(ChromeMedium);
+}
+
+QColor QQuickUniversalStyle::chromeMediumLowColor() const
+{
+ return getColor(ChromeMediumLow);
+}
+
+QColor QQuickUniversalStyle::chromeWhiteColor() const
+{
+ return getColor(ChromeWhite);
+}
+
+QColor QQuickUniversalStyle::listLowColor() const
+{
+ return getColor(ListLow);
+}
+
+QColor QQuickUniversalStyle::listMediumColor() const
+{
+ return getColor(ListMedium);
+}
+
+QColor QQuickUniversalStyle::getColor(SystemColor role) const
+{
+ return m_theme == QQuickUniversalStyle::Dark ? qquickuniversal_dark_color(role) : qquickuniversal_light_color(role);
+}
+
+int QQuickUniversalStyle::fontSize() const
+{
+ return 15; // ControlContentThemeFontSize
+}
+
+QString QQuickUniversalStyle::fontFamily() const
+{
+#ifdef Q_OS_WIN
+ return QStringLiteral("Segoe UI"); // ContentControlThemeFontFamily
+#else
+ return QGuiApplication::font().family();
+#endif
+}
+
+void QQuickUniversalStyle::reparent(QQuickUniversalStyle *style)
+{
+ if (m_parentStyle != style) {
+ if (m_parentStyle)
+ m_parentStyle->m_childStyles.remove(this);
+ m_parentStyle = style;
+ if (style) {
+ style->m_childStyles.insert(this);
+ inheritTheme(style->theme());
+ inheritAccent(style->accent());
+ }
+ }
+}
+
+void QQuickUniversalStyle::itemParentChanged(QQuickItem *item, QQuickItem *parent)
+{
+ QQuickUniversalStyle *style = QQuickStyle::instance<QQuickUniversalStyle>(item);
+ if (style) {
+ QQuickUniversalStyle *parentStyle = QQuickStyle::findParent<QQuickUniversalStyle>(parent);
+ if (parentStyle)
+ style->reparent(parentStyle);
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/controls/universal/qquickuniversalstyle_p.h b/src/imports/controls/universal/qquickuniversalstyle_p.h
new file mode 100644
index 00000000..60572252
--- /dev/null
+++ b/src/imports/controls/universal/qquickuniversalstyle_p.h
@@ -0,0 +1,221 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls 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 QQUICKUNIVERSALSTYLE_P_H
+#define QQUICKUNIVERSALSTYLE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qset.h>
+#include <QtCore/qpointer.h>
+#include <QtCore/qobject.h>
+#include <QtGui/qcolor.h>
+#include <QtQml/qqml.h>
+#include <QtQuick/private/qquickitemchangelistener_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickUniversalStylePrivate;
+
+class QQuickUniversalStyle : public QObject, public QQuickItemChangeListener
+{
+ Q_OBJECT
+ Q_PROPERTY(Theme theme READ theme WRITE setTheme RESET resetTheme NOTIFY themeChanged FINAL)
+ Q_PROPERTY(Accent accent READ accent WRITE setAccent RESET resetAccent NOTIFY accentChanged FINAL)
+
+ Q_PROPERTY(QColor accentColor READ accentColor NOTIFY accentChanged FINAL)
+ Q_PROPERTY(QColor altHighColor READ altHighColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor altLowColor READ altLowColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor altMediumColor READ altMediumColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor altMediumHighColor READ altMediumHighColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor altMediumLowColor READ altMediumLowColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor baseHighColor READ baseHighColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor baseLowColor READ baseLowColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor baseMediumColor READ baseMediumColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor baseMediumHighColor READ baseMediumHighColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor baseMediumLowColor READ baseMediumLowColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor chromeAltLowColor READ chromeAltLowColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor chromeBlackHighColor READ chromeBlackHighColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor chromeBlackLowColor READ chromeBlackLowColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor chromeBlackMediumLowColor READ chromeBlackMediumLowColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor chromeBlackMediumColor READ chromeBlackMediumColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor chromeDisabledHighColor READ chromeDisabledHighColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor chromeDisabledLowColor READ chromeDisabledLowColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor chromeHighColor READ chromeHighColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor chromeLowColor READ chromeLowColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor chromeMediumColor READ chromeMediumColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor chromeMediumLowColor READ chromeMediumLowColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor chromeWhiteColor READ chromeWhiteColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor listLowColor READ listLowColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor listMediumColor READ listMediumColor NOTIFY paletteChanged FINAL)
+
+ Q_PROPERTY(int fontSize READ fontSize CONSTANT FINAL)
+ Q_PROPERTY(QString fontFamily READ fontFamily CONSTANT FINAL)
+
+public:
+ explicit QQuickUniversalStyle(QObject *parent = Q_NULLPTR);
+ ~QQuickUniversalStyle();
+
+ static QQuickUniversalStyle *qmlAttachedProperties(QObject *object);
+
+ enum Theme { Light, Dark };
+ Q_ENUM(Theme)
+
+ Theme theme() const;
+ void setTheme(Theme theme);
+ void inheritTheme(Theme theme);
+ void resetTheme();
+
+ enum Accent {
+ Lime,
+ Green,
+ Emerald,
+ Teal,
+ Cyan,
+ Cobalt,
+ Indigo,
+ Violet,
+ Pink,
+ Magenta,
+ Crimson,
+ Red,
+ Orange,
+ Amber,
+ Yellow,
+ Brown,
+ Olive,
+ Steel,
+ Mauve,
+ Taupe
+ };
+ Q_ENUM(Accent)
+
+ Accent accent() const;
+ void setAccent(Accent accent);
+ void inheritAccent(Accent accent);
+ void resetAccent();
+
+ QColor accentColor() const;
+
+ QColor altHighColor() const;
+ QColor altLowColor() const;
+ QColor altMediumColor() const;
+ QColor altMediumHighColor() const;
+ QColor altMediumLowColor() const;
+ QColor baseHighColor() const;
+ QColor baseLowColor() const;
+ QColor baseMediumColor() const;
+ QColor baseMediumHighColor() const;
+ QColor baseMediumLowColor() const;
+ QColor chromeAltLowColor() const;
+ QColor chromeBlackHighColor() const;
+ QColor chromeBlackLowColor() const;
+ QColor chromeBlackMediumLowColor() const;
+ QColor chromeBlackMediumColor() const;
+ QColor chromeDisabledHighColor() const;
+ QColor chromeDisabledLowColor() const;
+ QColor chromeHighColor() const;
+ QColor chromeLowColor() const;
+ QColor chromeMediumColor() const;
+ QColor chromeMediumLowColor() const;
+ QColor chromeWhiteColor() const;
+ QColor listLowColor() const;
+ QColor listMediumColor() const;
+
+ enum SystemColor {
+ AltHigh,
+ AltLow,
+ AltMedium,
+ AltMediumHigh,
+ AltMediumLow,
+ BaseHighColor,
+ BaseLow,
+ BaseMedium,
+ BaseMediumHigh,
+ BaseMediumLow,
+ ChromeAltLow,
+ ChromeBlackHigh,
+ ChromeBlackLow,
+ ChromeBlackMediumLow,
+ ChromeBlackMedium,
+ ChromeDisabledHigh,
+ ChromeDisabledLow,
+ ChromeHigh,
+ ChromeLow,
+ ChromeMedium,
+ ChromeMediumLow,
+ ChromeWhite,
+ ListLow,
+ ListMedium
+ };
+
+ QColor getColor(SystemColor role) const;
+
+ int fontSize() const;
+ QString fontFamily() const;
+
+Q_SIGNALS:
+ void themeChanged();
+ void accentChanged();
+ void paletteChanged();
+
+protected:
+ void reparent(QQuickUniversalStyle *parent);
+ void itemParentChanged(QQuickItem *item, QQuickItem *parent) Q_DECL_OVERRIDE;
+
+private:
+ bool m_hasTheme;
+ bool m_hasAccent;
+ QQuickUniversalStyle::Theme m_theme;
+ QQuickUniversalStyle::Accent m_accent;
+ QPointer<QQuickUniversalStyle> m_parentStyle;
+ QSet<QQuickUniversalStyle *> m_childStyles;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPEINFO(QQuickUniversalStyle, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif // QQUICKUNIVERSALSTYLE_P_H
diff --git a/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp b/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp
new file mode 100644
index 00000000..835a250a
--- /dev/null
+++ b/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls 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 <QtQml/qqmlextensionplugin.h>
+#include "qquickuniversalimageprovider_p.h"
+#include "qquickuniversalprogressring_p.h"
+#include "qquickuniversalprogressstrip_p.h"
+#include "qquickuniversalstyle_p.h"
+
+void initResources()
+{
+ Q_INIT_RESOURCE(qtlabsuniversalstyleplugin);
+}
+
+QT_BEGIN_NAMESPACE
+
+class QtLabsUniversalStylePlugin: public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
+
+public:
+ void registerTypes(const char *uri) Q_DECL_OVERRIDE;
+ void initializeEngine(QQmlEngine *engine, const char *uri) Q_DECL_OVERRIDE;
+};
+
+void QtLabsUniversalStylePlugin::registerTypes(const char *uri)
+{
+ qmlRegisterUncreatableType<QQuickUniversalStyle>(uri, 1, 0, "Universal", "Universal is an attached property");
+}
+
+void QtLabsUniversalStylePlugin::initializeEngine(QQmlEngine *engine, const char *uri)
+{
+ initResources();
+ engine->addImageProvider("universal", new QQuickUniversalImageProvider);
+
+ QByteArray import = QByteArray(uri) + ".impl";
+ qmlRegisterType<QQuickUniversalProgressRing>(import, 1, 0, "ProgressRing");
+ qmlRegisterType<QQuickUniversalProgressRingAnimator>(import, 1, 0, "ProgressRingAnimator");
+ qmlRegisterType<QQuickUniversalProgressStrip>(import, 1, 0, "ProgressStrip");
+ qmlRegisterType<QQuickUniversalProgressStripAnimator>(import, 1, 0, "ProgressStripAnimator");
+}
+
+QT_END_NAMESPACE
+
+#include "qtlabsuniversalstyleplugin.moc"
diff --git a/src/imports/controls/universal/qtlabsuniversalstyleplugin.qrc b/src/imports/controls/universal/qtlabsuniversalstyleplugin.qrc
new file mode 100644
index 00000000..6cd57f89
--- /dev/null
+++ b/src/imports/controls/universal/qtlabsuniversalstyleplugin.qrc
@@ -0,0 +1,16 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="org.qt-project/imports/Qt/labs/controls/universal">
+ <file>images/checkmark.png</file>
+ <file>images/checkmark@2x.png</file>
+ <file>images/checkmark@3x.png</file>
+ <file>images/checkmark@4x.png</file>
+ <file>images/leftarrow.png</file>
+ <file>images/leftarrow@2x.png</file>
+ <file>images/leftarrow@3x.png</file>
+ <file>images/leftarrow@4x.png</file>
+ <file>images/rightarrow.png</file>
+ <file>images/rightarrow@2x.png</file>
+ <file>images/rightarrow@3x.png</file>
+ <file>images/rightarrow@4x.png</file>
+</qresource>
+</RCC>
diff --git a/src/imports/controls/universal/universal.pri b/src/imports/controls/universal/universal.pri
new file mode 100644
index 00000000..38e94fb5
--- /dev/null
+++ b/src/imports/controls/universal/universal.pri
@@ -0,0 +1,38 @@
+QML_FILES += \
+ $$PWD/ApplicationWindow.qml \
+ $$PWD/BusyIndicator.qml \
+ $$PWD/Button.qml \
+ $$PWD/CheckBox.qml \
+ $$PWD/Dial.qml \
+ $$PWD/Frame.qml \
+ $$PWD/GroupBox.qml \
+ $$PWD/Label.qml \
+ $$PWD/PageIndicator.qml \
+ $$PWD/ProgressBar.qml \
+ $$PWD/RadioButton.qml \
+ $$PWD/RangeSlider.qml \
+ $$PWD/ScrollBar.qml \
+ $$PWD/ScrollIndicator.qml \
+ $$PWD/Slider.qml \
+ $$PWD/SpinBox.qml \
+ $$PWD/StackView.qml \
+ $$PWD/Switch.qml \
+ $$PWD/TabBar.qml \
+ $$PWD/TabButton.qml \
+ $$PWD/TextArea.qml \
+ $$PWD/TextField.qml \
+ $$PWD/ToolBar.qml \
+ $$PWD/ToolButton.qml \
+ $$PWD/Tumbler.qml
+
+HEADERS += \
+ $$PWD/qquickuniversalimageprovider_p.h \
+ $$PWD/qquickuniversalprogressring_p.h \
+ $$PWD/qquickuniversalprogressstrip_p.h \
+ $$PWD/qquickuniversalstyle_p.h
+
+SOURCES += \
+ $$PWD/qquickuniversalimageprovider.cpp \
+ $$PWD/qquickuniversalprogressring.cpp \
+ $$PWD/qquickuniversalprogressstrip.cpp \
+ $$PWD/qquickuniversalstyle.cpp
diff --git a/src/imports/controls/universal/universal.pro b/src/imports/controls/universal/universal.pro
new file mode 100644
index 00000000..c4a4304b
--- /dev/null
+++ b/src/imports/controls/universal/universal.pro
@@ -0,0 +1,21 @@
+TARGET = qtlabsuniversalstyleplugin
+TARGETPATH = Qt/labs/controls/universal
+IMPORT_VERSION = 1.0
+
+QT += qml quick
+QT += core-private gui-private qml-private quick-private labstemplates-private
+
+OTHER_FILES += \
+ qmldir
+
+SOURCES += \
+ $$PWD/qtlabsuniversalstyleplugin.cpp
+
+RESOURCES += \
+ $$PWD/qtlabsuniversalstyleplugin.qrc
+
+include(universal.pri)
+include(../shared/shared.pri)
+
+CONFIG += no_cxx_module
+load(qml_plugin)
diff --git a/src/imports/imports.pro b/src/imports/imports.pro
index ad8f4645..3865bdb3 100644
--- a/src/imports/imports.pro
+++ b/src/imports/imports.pro
@@ -4,3 +4,6 @@ SUBDIRS += \
controls/material/material.pro \
calendar \
templates
+
+SUBDIRS += \
+ controls/universal/universal.pro
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 6cf2045f..65a43402 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -8,4 +8,5 @@ SUBDIRS += \
pressandhold \
sanity \
snippets \
- theme
+ theme \
+ universal
diff --git a/tests/auto/universal/data/tst_universal.qml b/tests/auto/universal/data/tst_universal.qml
new file mode 100644
index 00000000..912b2117
--- /dev/null
+++ b/tests/auto/universal/data/tst_universal.qml
@@ -0,0 +1,225 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Window 2.2
+import QtTest 1.0
+import Qt.labs.controls 1.0
+import Qt.labs.controls.universal 1.0
+
+TestCase {
+ id: testCase
+ width: 200
+ height: 200
+ visible: true
+ when: windowShown
+ name: "Universal"
+
+ Component {
+ id: button
+ Button { }
+ }
+
+ Component {
+ id: styledButton
+ Button {
+ Universal.theme: Universal.Dark
+ Universal.accent: Universal.Violet
+ }
+ }
+
+ Component {
+ id: window
+ Window { }
+ }
+
+ Component {
+ id: styledWindow
+ Window {
+ Universal.theme: Universal.Dark
+ Universal.accent: Universal.Green
+ }
+ }
+
+ Component {
+ id: loader
+ Loader {
+ active: false
+ sourceComponent: Button { }
+ }
+ }
+
+ Component {
+ id: swipeView
+ SwipeView {
+ Universal.theme: Universal.Dark
+ Button { }
+ }
+ }
+
+ function test_defaults() {
+ var control = button.createObject(testCase)
+ verify(control)
+ verify(control.Universal)
+ compare(control.Universal.accent, Universal.Cobalt)
+ compare(control.Universal.theme, Universal.Light)
+ control.destroy()
+ }
+
+ function test_set() {
+ var control = button.createObject(testCase)
+ verify(control)
+ control.Universal.accent = Universal.Steel
+ control.Universal.theme = Universal.Dark
+ compare(control.Universal.accent, Universal.Steel)
+ compare(control.Universal.theme, Universal.Dark)
+ control.destroy()
+ }
+
+ function test_reset() {
+ var control = styledButton.createObject(testCase)
+ verify(control)
+ compare(control.Universal.accent, Universal.Violet)
+ compare(control.Universal.theme, Universal.Dark)
+ control.Universal.accent = undefined
+ control.Universal.theme = undefined
+ compare(control.Universal.accent, testCase.Universal.accent)
+ compare(control.Universal.theme, testCase.Universal.theme)
+ control.destroy()
+ }
+
+ function test_inheritance_data() {
+ return [
+ { tag: "accent", value1: Universal.Crimson, value2: Universal.Indigo },
+ { tag: "theme", value1: Universal.Dark, value2: Universal.Light },
+ ]
+ }
+
+ function test_inheritance(data) {
+ var prop = data.tag
+ var parent = button.createObject(testCase)
+ parent.Universal[prop] = data.value1
+ compare(parent.Universal[prop], data.value1)
+
+ var child1 = button.createObject(parent)
+ compare(child1.Universal[prop], data.value1)
+
+ parent.Universal[prop] = data.value2
+ compare(parent.Universal[prop], data.value2)
+ compare(child1.Universal[prop], data.value2)
+
+ var child2 = button.createObject(parent)
+ compare(child2.Universal[prop], data.value2)
+
+ child2.Universal[prop] = data.value1
+ compare(child2.Universal[prop], data.value1)
+ compare(child1.Universal[prop], data.value2)
+ compare(parent.Universal[prop], data.value2)
+
+ parent.Universal[prop] = undefined
+ verify(parent.Universal[prop] !== data.value1)
+ verify(parent.Universal[prop] !== undefined)
+ compare(child1.Universal[prop], parent.Universal[prop])
+ verify(child2.Universal[prop] !== parent.Universal[prop])
+
+ var grandChild1 = button.createObject(child1)
+ var grandChild2 = button.createObject(child2)
+ compare(grandChild1.Universal[prop], child1.Universal[prop])
+ compare(grandChild2.Universal[prop], child2.Universal[prop])
+
+ var themelessGrandGrandChild = button.createObject(grandChild1)
+ var grandGrandGrandChild1 = button.createObject(themelessGrandGrandChild)
+ compare(grandGrandGrandChild1.Universal[prop], parent.Universal[prop])
+
+ child1.Universal[prop] = data.value2
+ compare(child1.Universal[prop], data.value2)
+ compare(grandChild1.Universal[prop], data.value2)
+ compare(grandGrandGrandChild1.Universal[prop], data.value2)
+
+ parent.destroy()
+ }
+
+ function test_window() {
+ var parent = window.createObject()
+
+ var control = button.createObject(parent.contentItem)
+ compare(control.Universal.accent, parent.Universal.accent)
+ compare(control.Universal.theme, parent.Universal.theme)
+
+ var styledChild = styledWindow.createObject(window)
+ verify(styledChild.Universal.accent !== parent.Universal.accent)
+ verify(styledChild.Universal.theme !== parent.Universal.theme)
+
+ var unstyledChild = window.createObject(window)
+ compare(unstyledChild.Universal.accent, parent.Universal.accent)
+ compare(unstyledChild.Universal.theme, parent.Universal.theme)
+
+ parent.Universal.accent = Universal.Cyan
+ compare(control.Universal.accent, Universal.Cyan)
+ verify(styledChild.Universal.accent !== Universal.Cyan)
+ // ### TODO: compare(unstyledChild.Universal.accent, Universal.Cyan)
+
+ parent.destroy()
+ }
+
+ function test_loader() {
+ var control = loader.createObject(testCase)
+ control.Universal.accent = Universal.Lime
+ control.active = true
+ compare(control.item.Universal.accent, Universal.Lime)
+ control.Universal.accent = Universal.Pink
+ compare(control.item.Universal.accent, Universal.Pink)
+ control.active = false
+ control.Universal.accent = Universal.Brown
+ control.active = true
+ compare(control.item.Universal.accent, Universal.Brown)
+ control.destroy()
+ }
+
+ function test_swipeView() {
+ var control = swipeView.createObject(testCase)
+ verify(control)
+ var child = control.itemAt(0)
+ verify(child)
+ compare(control.Universal.theme, Universal.Dark)
+ compare(child.Universal.theme, Universal.Dark)
+ control.destroy()
+ }
+}
diff --git a/tests/auto/universal/tst_universal.cpp b/tests/auto/universal/tst_universal.cpp
new file mode 100644
index 00000000..ea42cc5e
--- /dev/null
+++ b/tests/auto/universal/tst_universal.cpp
@@ -0,0 +1,38 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite 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 <QtQuickTest/quicktest.h>
+QUICK_TEST_MAIN(tst_universal)
diff --git a/tests/auto/universal/universal.pro b/tests/auto/universal/universal.pro
new file mode 100644
index 00000000..3a21957c
--- /dev/null
+++ b/tests/auto/universal/universal.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+TARGET = tst_universal
+CONFIG += qmltestcase
+
+SOURCES += \
+ $$PWD/tst_universal.cpp
+
+OTHER_FILES += \
+ $$PWD/data/*
+
+TESTDATA += \
+ $$PWD/data/tst_*
diff --git a/tests/benchmarks/creationtime/tst_creationtime.cpp b/tests/benchmarks/creationtime/tst_creationtime.cpp
index 3eccc654..7ce6947b 100644
--- a/tests/benchmarks/creationtime/tst_creationtime.cpp
+++ b/tests/benchmarks/creationtime/tst_creationtime.cpp
@@ -47,6 +47,9 @@ private slots:
void controls();
void controls_data();
+ void universal();
+ void universal_data();
+
void calendar();
void calendar_data();
@@ -93,6 +96,20 @@ void tst_CreationTime::controls_data()
addTestRows(QQC2_IMPORT_PATH "/controls");
}
+void tst_CreationTime::universal()
+{
+ QFETCH(QUrl, url);
+ QQmlComponent component(&engine);
+ component.loadUrl(url);
+ doBenchmark(&component);
+}
+
+void tst_CreationTime::universal_data()
+{
+ QTest::addColumn<QUrl>("url");
+ addTestRows(QQC2_IMPORT_PATH "/controls/universal");
+}
+
void tst_CreationTime::calendar()
{
QFETCH(QUrl, url);
diff --git a/tests/benchmarks/objectcount/tst_objectcount.cpp b/tests/benchmarks/objectcount/tst_objectcount.cpp
index 641d78d1..f2998708 100644
--- a/tests/benchmarks/objectcount/tst_objectcount.cpp
+++ b/tests/benchmarks/objectcount/tst_objectcount.cpp
@@ -69,6 +69,9 @@ private slots:
void controls();
void controls_data();
+ void universal();
+ void universal_data();
+
private:
QQmlEngine engine;
};
@@ -216,6 +219,18 @@ void tst_ObjectCount::controls_data()
addTestRows(QQC2_IMPORT_PATH "/controls");
}
+void tst_ObjectCount::universal()
+{
+ QFETCH(QUrl, url);
+ doBenchmark(&engine, url);
+}
+
+void tst_ObjectCount::universal_data()
+{
+ QTest::addColumn<QUrl>("url");
+ addTestRows(QQC2_IMPORT_PATH "/controls/universal");
+}
+
QTEST_MAIN(tst_ObjectCount)
#include "tst_objectcount.moc"
diff --git a/tests/manual/testbench/main.qml b/tests/manual/testbench/main.qml
index 4158fbf8..86326dec 100644
--- a/tests/manual/testbench/main.qml
+++ b/tests/manual/testbench/main.qml
@@ -43,7 +43,7 @@ import QtQuick.Window 2.2
import QtQuick.Layouts 1.0
import Qt.labs.controls 1.0
//import Qt.labs.controls.material 1.0
-//import Qt.labs.controls.universal 1.0
+import Qt.labs.controls.universal 1.0
ApplicationWindow {
id: window
@@ -58,7 +58,7 @@ ApplicationWindow {
Theme.baseColor: themeSwitch.checked ? "#444" : "#eee"
// Material.theme: themeSwitch.checked ? Material.Dark : Material.Light
-// Universal.theme: themeSwitch.checked ? Universal.Dark : Universal.Light
+ Universal.theme: themeSwitch.checked ? Universal.Dark : Universal.Light
property int controlSpacing: 10