summaryrefslogtreecommitdiff
path: root/src/extras/Styles/Flat
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@theqtcompany.com>2015-02-12 13:55:22 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-02-13 12:01:33 +0000
commit6f15c206b069ed0fcf48a285bfcc4ad636927df0 (patch)
tree6150e262bc2d049219981a4cb1e1deeeeed5d636 /src/extras/Styles/Flat
parentd28a02aec9a1632f2263d9276099454b33fb6741 (diff)
downloadqtquickcontrols-6f15c206b069ed0fcf48a285bfcc4ad636927df0.tar.gz
Import Qt Quick Extras (the former Qt Quick Enterprise Controls)
Change-Id: I59c5c97c564f707da4ce617e25e13ff8124f7d4b Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/extras/Styles/Flat')
-rw-r--r--src/extras/Styles/Flat/ApplicationWindowStyle.qml111
-rw-r--r--src/extras/Styles/Flat/BusyIndicatorStyle.qml75
-rw-r--r--src/extras/Styles/Flat/ButtonStyle.qml194
-rw-r--r--src/extras/Styles/Flat/CalendarStyle.qml205
-rw-r--r--src/extras/Styles/Flat/CheckBoxDrawer.qml100
-rw-r--r--src/extras/Styles/Flat/CheckBoxStyle.qml62
-rw-r--r--src/extras/Styles/Flat/CircularButtonStyle.qml38
-rw-r--r--src/extras/Styles/Flat/CircularGaugeStyle.qml168
-rw-r--r--src/extras/Styles/Flat/CircularTickmarkLabelStyle.qml39
-rw-r--r--src/extras/Styles/Flat/ComboBoxStyle.qml163
-rw-r--r--src/extras/Styles/Flat/CursorHandleStyle.qml45
-rw-r--r--src/extras/Styles/Flat/DelayButtonStyle.qml291
-rw-r--r--src/extras/Styles/Flat/DialStyle.qml97
-rw-r--r--src/extras/Styles/Flat/Flat.pro67
-rw-r--r--src/extras/Styles/Flat/FlatStyle.qml100
-rw-r--r--src/extras/Styles/Flat/FocusFrameStyle.qml38
-rw-r--r--src/extras/Styles/Flat/GaugeStyle.qml132
-rw-r--r--src/extras/Styles/Flat/GroupBoxStyle.qml99
-rw-r--r--src/extras/Styles/Flat/LeftArrowIcon.qml61
-rw-r--r--src/extras/Styles/Flat/MenuBarStyle.qml42
-rw-r--r--src/extras/Styles/Flat/MenuStyle.qml95
-rw-r--r--src/extras/Styles/Flat/PieMenuStyle.qml169
-rw-r--r--src/extras/Styles/Flat/ProgressBarStyle.qml60
-rw-r--r--src/extras/Styles/Flat/RadioButtonStyle.qml87
-rw-r--r--src/extras/Styles/Flat/ScrollViewStyle.qml76
-rw-r--r--src/extras/Styles/Flat/SelectionHandleStyle.qml44
-rw-r--r--src/extras/Styles/Flat/SliderStyle.qml110
-rw-r--r--src/extras/Styles/Flat/SpinBoxStyle.qml153
-rw-r--r--src/extras/Styles/Flat/StatusBarStyle.qml38
-rw-r--r--src/extras/Styles/Flat/StatusIndicatorStyle.qml62
-rw-r--r--src/extras/Styles/Flat/SwitchStyle.qml86
-rw-r--r--src/extras/Styles/Flat/TabViewStyle.qml102
-rw-r--r--src/extras/Styles/Flat/TableViewStyle.qml163
-rw-r--r--src/extras/Styles/Flat/TextAreaStyle.qml67
-rw-r--r--src/extras/Styles/Flat/TextFieldStyle.qml70
-rw-r--r--src/extras/Styles/Flat/ToggleButtonStyle.qml99
-rw-r--r--src/extras/Styles/Flat/ToolBarStyle.qml75
-rw-r--r--src/extras/Styles/Flat/ToolButtonBackground.qml94
-rw-r--r--src/extras/Styles/Flat/ToolButtonIndicator.qml70
-rw-r--r--src/extras/Styles/Flat/ToolButtonStyle.qml110
-rw-r--r--src/extras/Styles/Flat/TumblerStyle.qml167
-rw-r--r--src/extras/Styles/Flat/flatstyle.qrc51
-rw-r--r--src/extras/Styles/Flat/flatstyleplugin.cpp117
-rw-r--r--src/extras/Styles/Flat/flatstyleplugin.h58
-rw-r--r--src/extras/Styles/Flat/fonts/LICENSE.txt202
-rw-r--r--src/extras/Styles/Flat/fonts/OpenSans-Light.ttfbin0 -> 222412 bytes
-rw-r--r--src/extras/Styles/Flat/fonts/OpenSans-Regular.ttfbin0 -> 217360 bytes
-rw-r--r--src/extras/Styles/Flat/fonts/OpenSans-Semibold.ttfbin0 -> 221328 bytes
-rw-r--r--src/extras/Styles/Flat/images/BusyIndicator_Normal-Large.pngbin0 -> 4377 bytes
-rw-r--r--src/extras/Styles/Flat/images/BusyIndicator_Normal-Medium.pngbin0 -> 2526 bytes
-rw-r--r--src/extras/Styles/Flat/images/BusyIndicator_Normal-Small.pngbin0 -> 1591 bytes
-rw-r--r--src/extras/Styles/Flat/qmldir3
-rw-r--r--src/extras/Styles/Flat/qquicktexthandle.cpp129
-rw-r--r--src/extras/Styles/Flat/qquicktexthandle.h83
54 files changed, 4767 insertions, 0 deletions
diff --git a/src/extras/Styles/Flat/ApplicationWindowStyle.qml b/src/extras/Styles/Flat/ApplicationWindowStyle.qml
new file mode 100644
index 00000000..8ae620b0
--- /dev/null
+++ b/src/extras/Styles/Flat/ApplicationWindowStyle.qml
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.3 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+
+Base.ApplicationWindowStyle {
+ panel: Item {
+ readonly property alias contentArea: contentArea
+ readonly property alias menuBarArea: menuBarArea
+ readonly property alias toolBarArea: toolBarArea
+ readonly property alias statusBarArea: statusBarArea
+ readonly property bool hasToolBar: !!control.toolBar && control.toolBar.Accessible.role === Accessible.ToolBar
+
+ Rectangle {
+ id: background
+ visible: !styleData.hasColor
+ color: FlatStyle.backgroundColor
+ }
+
+ Item {
+ id: contentArea
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: statusBarArea.top
+ anchors.topMargin: toolBarArea.implicitHeight
+ }
+
+ Item {
+ id: toolBarArea
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ implicitHeight: childrenRect.height
+ height: visibleChildren.length > 0 ? implicitHeight : 0
+
+ Loader {
+ visible: active
+ active: !hasToolBar && !!control.menuBar
+ anchors.left: parent.left
+ anchors.right: parent.right
+ sourceComponent: ToolBar {
+ __menu: proxyMenu.items.length > 1 ? proxyMenu :
+ proxyMenu.items.length === 1 ? proxyMenu.items[0] : null
+ }
+ }
+ }
+
+ Item {
+ id: statusBarArea
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ implicitHeight: childrenRect.height
+ height: visibleChildren.length > 0 ? implicitHeight : 0
+ }
+
+ Item {
+ id: menuBarArea
+ visible: false
+
+ Menu {
+ id: proxyMenu
+ items: control.menuBar ? control.menuBar.menus : []
+ }
+
+ Binding {
+ target: control.toolBar
+ property: "__menu"
+ value: proxyMenu.items.length > 1 ? proxyMenu :
+ proxyMenu.items.length === 1 ? proxyMenu.items[0] : null
+ when: hasToolBar
+ }
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/BusyIndicatorStyle.qml b/src/extras/Styles/Flat/BusyIndicatorStyle.qml
new file mode 100644
index 00000000..d2809b02
--- /dev/null
+++ b/src/extras/Styles/Flat/BusyIndicatorStyle.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls.Styles 1.2 as Base
+
+Base.BusyIndicatorStyle {
+ indicator: Item {
+ id: indicator
+
+ function resolveSize() {
+ // Small: 26, Medium: 52, Large: 104
+ var sizeHint = control.styleHints ? control.styleHints['size'] : undefined
+ if (sizeHint === "small" || !sizeHint && control.width > 0 && control.width < 52)
+ return "Small"
+ if (sizeHint === "large" || !sizeHint && control.width >= 104)
+ return "Large"
+ return "Medium"
+ }
+
+ anchors.centerIn: parent
+ implicitWidth: image.sourceSize.width
+ implicitHeight: image.sourceSize.height
+
+ opacity: control.running ? 1 : 0
+ Behavior on opacity { OpacityAnimator { duration: 250 } }
+
+ Image {
+ id: image
+ anchors.centerIn: parent
+ anchors.alignWhenCentered: true
+ source: "images/BusyIndicator_Normal-" + indicator.resolveSize() + ".png"
+
+ RotationAnimator on rotation {
+ from: 0
+ to: 360
+ duration: 1000
+ loops: Animation.Infinite
+ running: indicator.visible && (control.running || indicator.opacity > 0)
+ }
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/ButtonStyle.qml b/src/extras/Styles/Flat/ButtonStyle.qml
new file mode 100644
index 00000000..d0d4ca7b
--- /dev/null
+++ b/src/extras/Styles/Flat/ButtonStyle.qml
@@ -0,0 +1,194 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Flat 1.0
+
+Base.ButtonStyle {
+ padding { top: 0; left: 0; right: 0; bottom: 0 }
+
+ readonly property bool __hovered: !Settings.hasTouchScreen && control.hovered
+
+ background: Rectangle {
+ property bool down: control.pressed || (control.checkable && control.checked)
+
+ implicitWidth: Math.round(100 * FlatStyle.scaleFactor)
+ implicitHeight: Math.round(26 * FlatStyle.scaleFactor)
+ radius: FlatStyle.radius
+
+ color: {
+ if (control.isDefault) {
+ if (control.checkable && control.checked) {
+ if (!control.enabled)
+ return Qt.rgba(0, 0, 0, 0.25);
+
+ if (control.pressed)
+ return control.activeFocus ? FlatStyle.checkedFocusedAndPressedColor : FlatStyle.checkedAndPressedColorAlt;
+
+ return control.activeFocus ? FlatStyle.checkedFocusedAndPressedColor : FlatStyle.pressedColor;
+ } else {
+ // Normal state.
+ if (!control.enabled)
+ return Qt.rgba(0, 0, 0, 0.15);
+
+ if (control.pressed)
+ return control.activeFocus ? FlatStyle.checkedFocusedAndPressedColor : FlatStyle.pressedColor;
+
+ if (control.activeFocus)
+ return control.pressed ? FlatStyle.checkedFocusedAndPressedColor : FlatStyle.focusedColor;
+
+ return FlatStyle.styleColor;
+ }
+ }
+
+ // Non-default button.
+ if (control.checkable && control.checked) {
+ if (!control.enabled)
+ return Qt.rgba(0, 0, 0, 0.1);
+
+ if (control.pressed)
+ return control.activeFocus ? FlatStyle.checkedFocusedAndPressedColor : FlatStyle.checkedAndPressedColor;
+
+ return control.activeFocus ? FlatStyle.focusedAndPressedColor : FlatStyle.pressedColorAlt;
+ }
+
+ if (control.pressed)
+ return control.activeFocus ? FlatStyle.focusedAndPressedColor : FlatStyle.pressedColorAlt;
+
+ if (!control.activeFocus && __hovered)
+ return FlatStyle.hoveredColor;
+
+ return "transparent";
+ }
+
+ border.color: {
+ if (!control.isDefault) {
+ if (!control.enabled)
+ return Qt.rgba(0, 0, 0, (control.checkable && control.checked ? 0.3 : 0.2));
+
+ if (control.activeFocus && !control.pressed && !control.checked)
+ return FlatStyle.focusedColor;
+
+ if (!__hovered && !control.checked && !control.pressed)
+ return FlatStyle.styleColor;
+ }
+
+ return "transparent";
+ }
+
+ border.width: control.activeFocus ? FlatStyle.twoPixels : FlatStyle.onePixel
+ }
+
+ label: Item {
+ readonly property bool isDown: control.pressed || (control.checkable && control.checked)
+ readonly property bool hasIcon: icon.status === Image.Ready || icon.status === Image.Loading
+ readonly property bool hasMenu: !!control.menu
+ readonly property bool hasText: !!control.text
+ readonly property int labelSpacing: Math.round(10 * FlatStyle.scaleFactor)
+ implicitWidth: icon.implicitWidth + label.implicitWidth + indicator.implicitHeight
+ + (hasIcon || hasText ? labelSpacing : 0) + (hasIcon && hasText ? labelSpacing : 0)
+ implicitHeight: Math.max(Math.max(icon.implicitHeight, label.implicitHeight), indicator.height)
+ baselineOffset: label.y + label.baselineOffset
+ Image {
+ id: icon
+ visible: hasIcon
+ source: control.iconSource
+ // center align when only icon, otherwise left align
+ anchors.left: parent.left
+ anchors.leftMargin: hasMenu || hasText ? labelSpacing : parent.width / 2 - width / 2
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ Text {
+ id: label
+ visible: hasText
+ text: control.text
+ elide: Text.ElideRight
+ font.family: FlatStyle.fontFamily
+ renderType: FlatStyle.__renderType
+ opacity: !enabled && !control.isDefault ? FlatStyle.disabledOpacity : 1.0
+ color: control.isDefault ? FlatStyle.selectedTextColor :
+ !enabled ? FlatStyle.disabledColor :
+ isDown ? FlatStyle.selectedTextColor :
+ control.activeFocus ? FlatStyle.focusedTextColor :
+ __hovered ? FlatStyle.selectedTextColor : FlatStyle.styleColor
+ horizontalAlignment: hasMenu != hasIcon ? Qt.AlignLeft : Qt.AlignHCenter
+ verticalAlignment: Qt.AlignVCenter
+ anchors.fill: parent
+ anchors.leftMargin: labelSpacing + (hasIcon ? labelSpacing + icon.width : 0)
+ anchors.rightMargin: hasMenu ? indicator.width : labelSpacing
+ }
+ Item {
+ id: indicator
+ visible: hasMenu
+ implicitWidth: Math.round(28 * FlatStyle.scaleFactor)
+ implicitHeight: Math.round(26 * FlatStyle.scaleFactor)
+ // center align when only menu, otherwise right align
+ anchors.right: parent.right
+ anchors.rightMargin: !hasIcon && !hasText ? parent.width / 2 - width / 2 : 0
+ anchors.verticalCenter: parent.verticalCenter
+
+ opacity: control.enabled ? 1.0 : 0.2
+ property color color: !control.enabled ? FlatStyle.disabledColor :
+ control.activeFocus && !control.pressed ? FlatStyle.focusedColor :
+ control.activeFocus || control.pressed || __hovered ? FlatStyle.selectedTextColor : FlatStyle.styleColor
+
+ Rectangle {
+ x: Math.round(7 * FlatStyle.scaleFactor)
+ y: Math.round(7 * FlatStyle.scaleFactor)
+ width: Math.round(14 * FlatStyle.scaleFactor)
+ height: FlatStyle.twoPixels
+ color: indicator.color
+ }
+ Rectangle {
+ x: Math.round(7 * FlatStyle.scaleFactor)
+ y: Math.round(12 * FlatStyle.scaleFactor)
+ width: Math.round(14 * FlatStyle.scaleFactor)
+ height: FlatStyle.twoPixels
+ color: indicator.color
+ }
+ Rectangle {
+ x: Math.round(7 * FlatStyle.scaleFactor)
+ y: Math.round(17 * FlatStyle.scaleFactor)
+ width: Math.round(14 * FlatStyle.scaleFactor)
+ height: FlatStyle.twoPixels
+ color: indicator.color
+ }
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/CalendarStyle.qml b/src/extras/Styles/Flat/CalendarStyle.qml
new file mode 100644
index 00000000..b41e3c8e
--- /dev/null
+++ b/src/extras/Styles/Flat/CalendarStyle.qml
@@ -0,0 +1,205 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.3
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Private 1.0
+import QtQuick.Extras.Private.CppUtils 1.0
+
+Base.CalendarStyle {
+ // This style doesn't support a grid.
+ gridVisible: false
+ // gridColor == frame color
+ gridColor: control.enabled ? FlatStyle.mediumFrameColor : FlatStyle.alphaFrameColor
+ // This ensures the week number separator is hidden.
+ __gridLineWidth: 0
+
+ // Used in conjunction with the control height.
+ // These values are taken from the flat style specs.
+ readonly property real __headerFontRatio: 18 / 264
+ readonly property real __weekNumberFontRatio: 9 / 264
+ readonly property real __dayFontRatio: 13 / 264
+
+ navigationBar: Rectangle {
+ implicitHeight: Math.round(control.height * 0.2121)
+ color: control.enabled ? FlatStyle.styleColor : FlatStyle.mediumFrameColor
+
+ MouseArea {
+ id: previousMonth
+ width: parent.height
+ height: width
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ onClicked: control.showPreviousMonth()
+
+ Rectangle {
+ anchors.fill: parent
+ color: FlatStyle.selectedTextColor
+ opacity: previousMonth.pressed ? 0.25 : 0
+
+ Behavior on opacity {
+ NumberAnimation {
+ duration: 80
+ }
+ }
+ }
+
+ LeftArrowIcon {
+ width: Math.round(parent.width * 0.3)
+ height: Math.round(parent.width * 0.3)
+ anchors.centerIn: parent
+ }
+ }
+ Label {
+ id: dateText
+ text: styleData.title
+ color: FlatStyle.selectedTextColor
+ elide: Text.ElideRight
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ font.pixelSize: control.height * __headerFontRatio
+ font.family: FlatStyle.fontFamily
+ font.weight: Font.Light
+ renderType: FlatStyle.__renderType
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: previousMonth.right
+ anchors.leftMargin: 2
+ anchors.right: nextMonth.left
+ anchors.rightMargin: 2
+ }
+ MouseArea {
+ id: nextMonth
+ width: parent.height
+ height: width
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ onClicked: control.showNextMonth()
+
+ Rectangle {
+ anchors.fill: parent
+ color: FlatStyle.selectedTextColor
+ opacity: nextMonth.pressed ? 0.25 : 0
+
+ Behavior on opacity {
+ NumberAnimation {
+ duration: 100
+ }
+ }
+ }
+
+ LeftArrowIcon {
+ width: Math.round(parent.width * 0.3)
+ height: Math.round(parent.width * 0.3)
+ anchors.centerIn: parent
+ scale: -1
+ }
+ }
+ }
+
+ dayDelegate: Item {
+ Rectangle {
+ id: rect
+ // There should always be at least 1 pixel margin between circles.
+ width: MathUtils.roundEven(Math.min(parent.width, parent.height) - 1)
+ height: width
+ anchors.centerIn: parent
+ radius: width / 2
+ color: (styleData.date !== undefined && styleData.selected
+ ? (control.enabled ? FlatStyle.styleColor : FlatStyle.disabledColor)
+ : "transparent")
+ border.width: styleData.today ? FlatStyle.onePixel : 0
+ border.color: !control.enabled ? FlatStyle.alphaFrameColor : FlatStyle.styleColor
+ opacity: control.enabled ? 1 : 0.15
+ }
+
+ Label {
+ id: dayDelegateText
+ text: styleData.date.getDate()
+ anchors.fill: rect
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ fontSizeMode: Text.Fit
+ font.pixelSize: control.height * __dayFontRatio
+ font.family: FlatStyle.fontFamily
+ font.weight: Font.Light
+ renderType: FlatStyle.__renderType
+ opacity: !control.enabled ? (!styleData.valid || !styleData.visibleMonth ? 0.3 : 0.6) :
+ (!styleData.valid || !styleData.visibleMonth ? 0.3 : 1)
+ color: !control.enabled ? FlatStyle.disabledColor
+ : (styleData.selected ? FlatStyle.selectedTextColor : FlatStyle.textColor)
+ }
+ }
+
+ weekNumberDelegate: Item {
+ implicitWidth: control.width * 0.14
+
+ Label {
+ text: styleData.weekNumber
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: control.height * (__dayFontRatio - __weekNumberFontRatio) / 2
+ fontSizeMode: Text.Fit
+ font.pixelSize: control.height * __weekNumberFontRatio
+ renderType: FlatStyle.__renderType
+ color: !control.enabled ? FlatStyle.disabledColor : FlatStyle.styleColor
+ opacity: !control.enabled ? FlatStyle.disabledOpacity : 1
+ }
+ }
+
+ dayOfWeekDelegate: Item {
+ implicitHeight: control.height * 0.13
+
+ Label {
+ text: localeDayName.length == 0 || localeDayName.length > 1
+ ? control.__locale.dayName(styleData.dayOfWeek, Locale.ShortFormat)[0]
+ : localeDayName
+ color: !control.enabled ? FlatStyle.disabledColor : FlatStyle.styleColor
+ opacity: !control.enabled ? FlatStyle.disabledOpacity : 1
+ font.family: FlatStyle.fontFamily
+ anchors.fill: parent
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ fontSizeMode: Text.Fit
+ font.pixelSize: control.height * __headerFontRatio
+ renderType: FlatStyle.__renderType
+
+ property string localeDayName: control.__locale.dayName(styleData.dayOfWeek, Locale.NarrowFormat)
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/CheckBoxDrawer.qml b/src/extras/Styles/Flat/CheckBoxDrawer.qml
new file mode 100644
index 00000000..5955b6fe
--- /dev/null
+++ b/src/extras/Styles/Flat/CheckBoxDrawer.qml
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.3
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Flat 1.0
+
+// Internal, for use with CheckBoxStyle and GroupBoxStyle
+Item {
+ implicitWidth: Math.round(26 * FlatStyle.scaleFactor)
+ implicitHeight: implicitWidth
+
+ property bool controlEnabled: false
+ property bool controlActiveFocus: false
+ property bool controlPressed: false
+ property bool controlHovered: false
+ property bool controlChecked: false
+ property alias backgroundVisible: background.visible
+
+ onControlActiveFocusChanged: checkCanvas.requestPaint()
+ onControlEnabledChanged: checkCanvas.requestPaint()
+ onControlPressedChanged: checkCanvas.requestPaint()
+
+ Rectangle {
+ id: background
+ anchors.centerIn: parent
+ width: Math.round(20 * FlatStyle.scaleFactor)
+ height: width
+ radius: FlatStyle.radius
+ color: controlEnabled ? (controlPressed ? FlatStyle.lightFrameColor : FlatStyle.backgroundColor) : FlatStyle.disabledFillColor
+ border.color: !controlEnabled ? FlatStyle.disabledFillColor :
+ (controlPressed ? FlatStyle.darkFrameColor :
+ (controlActiveFocus ? FlatStyle.focusedColor :
+ (controlHovered ? FlatStyle.styleColor : FlatStyle.lightFrameColor)))
+ border.width: controlActiveFocus &&
+ !controlPressed ? FlatStyle.twoPixels : FlatStyle.onePixel
+ }
+
+ Canvas {
+ id: checkCanvas
+ anchors.centerIn: parent
+ width: Math.round(20 * FlatStyle.scaleFactor)
+ height: width
+ visible: controlChecked
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ ctx.beginPath();
+ ctx.moveTo(0.417 * width, 0.783 * height);
+ ctx.lineTo(0.152 * width, 0.519 * height);
+ ctx.lineTo(0.248 * width, 0.423 * height);
+ ctx.lineTo(0.417 * width, 0.593 * height);
+ ctx.lineTo(0.75 * width, 0.26 * height);
+ ctx.lineTo(0.846 * width, 0.355 * height);
+ ctx.lineTo();
+ ctx.closePath();
+ ctx.fillStyle = !controlEnabled ? FlatStyle.mediumFrameColor :
+ (controlPressed ? FlatStyle.checkedAndPressedColor :
+ (controlActiveFocus ? FlatStyle.focusedColor : FlatStyle.styleColor));
+ ctx.fill();
+ }
+ }
+
+}
diff --git a/src/extras/Styles/Flat/CheckBoxStyle.qml b/src/extras/Styles/Flat/CheckBoxStyle.qml
new file mode 100644
index 00000000..65377365
--- /dev/null
+++ b/src/extras/Styles/Flat/CheckBoxStyle.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+
+Base.CheckBoxStyle {
+ spacing: Math.round(8 * FlatStyle.scaleFactor)
+
+ indicator: CheckBoxDrawer {
+ controlEnabled: control.enabled
+ controlActiveFocus: control.activeFocus
+ controlPressed: control.pressed
+ controlHovered: !Settings.hasTouchScreen && control.hovered
+ controlChecked: control.checked
+ }
+
+ label: Text {
+ text: control.text
+ font.family: FlatStyle.fontFamily
+ renderType: FlatStyle.__renderType
+ anchors.verticalCenter: parent.verticalCenter
+ opacity: enabled ? 1.0 : FlatStyle.disabledOpacity
+ color: !enabled ? FlatStyle.disabledColor :
+ control.activeFocus ? FlatStyle.focusedTextColor : FlatStyle.defaultTextColor
+ }
+}
diff --git a/src/extras/Styles/Flat/CircularButtonStyle.qml b/src/extras/Styles/Flat/CircularButtonStyle.qml
new file mode 100644
index 00000000..774870e6
--- /dev/null
+++ b/src/extras/Styles/Flat/CircularButtonStyle.qml
@@ -0,0 +1,38 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick.Extras.Styles 1.3 as Base
+
+Base.CircularButtonStyle { }
diff --git a/src/extras/Styles/Flat/CircularGaugeStyle.qml b/src/extras/Styles/Flat/CircularGaugeStyle.qml
new file mode 100644
index 00000000..d18cdea5
--- /dev/null
+++ b/src/extras/Styles/Flat/CircularGaugeStyle.qml
@@ -0,0 +1,168 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Extras.Private 1.0
+import QtQuick.Extras.Private.CppUtils 1.1
+import QtQuick.Extras.Styles 1.3 as Base
+
+Base.CircularGaugeStyle {
+ id: circularGaugeStyle
+
+ tickmarkInset: __thickArcTickmarklessMargin + __thickArcLineWidth / 2 - __tickmarkLength / 2
+ minorTickmarkInset: __thickArcTickmarklessMargin + __thickArcLineWidth / 2 - (__tickmarkLength / 2) / 2
+ labelInset: Math.max(textMetrics.width, textMetrics.height) / 2
+
+ // A stroked arc starts losing its shape when it is very thick, so prevent that from happening.
+ readonly property real __thickArcLineWidth: Math.min(22 * FlatStyle.scaleFactor, Math.round(outerRadius * 0.2))
+ readonly property real __thickArcTickmarklessMargin: labelInset * 2
+ readonly property real __tickmarkLength: __thickArcLineWidth * 0.5
+ readonly property real __tickmarkWidth: FlatStyle.onePixel
+ readonly property real __fontSize: Math.max(6, __protectedScope.toPixels(0.12))
+ // TODO: add this to Utils or something; it's not specific to this control
+ readonly property real __antialiasingAdjustment: FlatStyle.onePixel
+
+ Text {
+ id: textMetrics
+ font.pixelSize: __fontSize
+ text: control.maximumValue.toFixed(0)
+ visible: false
+ }
+
+ background: Item {
+ implicitWidth: Math.round(160 * FlatStyle.scaleFactor)
+ implicitHeight: Math.round(160 * FlatStyle.scaleFactor)
+
+ readonly property real thinArcLineWidth: FlatStyle.onePixel
+ readonly property bool tickmarklessVariant: false
+ readonly property real arcDistance: thinArcLineWidth * 3
+
+ Connections {
+ target: control
+ onValueChanged: thickArc.requestPaint()
+ onMinimumValueChanged: thickArc.requestPaint()
+ onMaximumValueChanged: thickArc.requestPaint()
+ onEnabledChanged: {
+ thickArc.requestPaint();
+ thinArc.requestPaint();
+ }
+ }
+
+ // TODO: test performance of this on the Pi
+ Canvas {
+ id: thickArc
+ anchors.fill: parent
+ anchors.margins: Math.floor(tickmarklessVariant ? arcDistance : __thickArcTickmarklessMargin)
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ ctx.lineWidth = __thickArcLineWidth;
+ var radius = Math.floor(width / 2 - ctx.lineWidth / 2 - __antialiasingAdjustment);
+ if (radius < 0)
+ return;
+
+ ctx.beginPath();
+ ctx.globalAlpha = control.enabled ? 1 : 0.2;
+ ctx.strokeStyle = control.enabled ? FlatStyle.styleColor : FlatStyle.disabledColor;
+ var startAngle = MathUtils.degToRad(minimumValueAngle - 90);
+ var endAngle = MathUtils.degToRad(needleRotation - 90);
+ ctx.arc(Math.floor(width / 2), Math.floor(height / 2), radius, startAngle, endAngle, false);
+ ctx.stroke();
+ }
+ }
+
+ Canvas {
+ id: thinArc
+ anchors.fill: parent
+ anchors.margins: Math.floor(tickmarklessVariant ? 0 : thickArc.anchors.margins + __thickArcLineWidth + arcDistance)
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ ctx.lineWidth = thinArcLineWidth;
+ var radius = width / 2 - ctx.lineWidth / 2 - __antialiasingAdjustment;
+ if (radius < 0)
+ return;
+
+ ctx.beginPath();
+ ctx.globalAlpha = control.enabled ? 1 : 0.2;
+ ctx.strokeStyle = control.enabled ? FlatStyle.styleColor : FlatStyle.disabledColor;
+ var startAngle = MathUtils.degToRad(minimumValueAngle - 90);
+ var endAngle = MathUtils.degToRad(maximumValueAngle - 90);
+ ctx.arc(Math.floor(width / 2), Math.floor(height / 2), radius, startAngle, endAngle, false);
+ ctx.stroke();
+ }
+ }
+ }
+
+ needle: null
+ foreground: null
+
+ tickmark: Rectangle {
+ implicitWidth: __tickmarkWidth
+ implicitHeight: __tickmarkLength
+ antialiasing: true
+ color: control.value < styleData.value || isEdgeTickmark ? (control.enabled ? FlatStyle.styleColor : FlatStyle.disabledColor) : FlatStyle.selectedTextColor
+ opacity: control.value < styleData.value || isEdgeTickmark ? (control.enabled ? 1 : 0.2) : 0.5
+ visible: (!isEdgeTickmark) || (control.value < styleData.value)
+ || (styleData.value === control.minimumValue && control.value === control.minimumValue)
+
+ readonly property bool isEdgeTickmark: styleData.value === control.minimumValue || styleData.value === control.maximumValue
+ }
+
+ minorTickmark: Rectangle {
+ implicitWidth: __tickmarkWidth
+ implicitHeight: __tickmarkLength / 2
+ antialiasing: true
+ color: control.enabled ? FlatStyle.styleColor : FlatStyle.disabledColor
+ visible: control.value < styleData.value
+ opacity: control.enabled ? 1 : 0.2
+ }
+
+ tickmarkLabel: Text {
+ font.pixelSize: __fontSize
+ text: styleData.value
+ color: control.enabled ? FlatStyle.defaultTextColor : FlatStyle.disabledColor
+ opacity: control.enabled ? 1 : FlatStyle.disabledOpacity
+ antialiasing: true
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+}
diff --git a/src/extras/Styles/Flat/CircularTickmarkLabelStyle.qml b/src/extras/Styles/Flat/CircularTickmarkLabelStyle.qml
new file mode 100644
index 00000000..8127608b
--- /dev/null
+++ b/src/extras/Styles/Flat/CircularTickmarkLabelStyle.qml
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick.Extras.Styles 1.3 as Base
+
+Base.CircularTickmarkLabelStyle {}
diff --git a/src/extras/Styles/Flat/ComboBoxStyle.qml b/src/extras/Styles/Flat/ComboBoxStyle.qml
new file mode 100644
index 00000000..b263c9cd
--- /dev/null
+++ b/src/extras/Styles/Flat/ComboBoxStyle.qml
@@ -0,0 +1,163 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Extras.Private 1.0
+
+Base.ComboBoxStyle {
+ id: style
+
+ padding {
+ top: 0
+ left: Math.round(FlatStyle.scaleFactor * (control.editable ? 10 : 6))
+ right: 0
+ bottom: 0
+ }
+
+ font.family: FlatStyle.fontFamily
+ textColor: !control.enabled ? FlatStyle.mediumFrameColor :
+ control.editable ? FlatStyle.defaultTextColor :
+ control.pressed ? FlatStyle.selectedTextColor :
+ control.activeFocus ? FlatStyle.focusedTextColor : FlatStyle.styleColor
+ selectionColor: FlatStyle.highlightColor
+ selectedTextColor: FlatStyle.selectedTextColor
+
+ dropDownButtonWidth: Math.round(28 * FlatStyle.scaleFactor)
+
+ background: Item {
+ id: background
+ anchors.fill: parent
+ implicitWidth: Math.round(100 * FlatStyle.scaleFactor)
+ implicitHeight: Math.round(26 * FlatStyle.scaleFactor)
+
+ Rectangle {
+ anchors.fill: parent
+ radius: FlatStyle.radius
+
+ visible: !control.editable
+ opacity: control.enabled ? 1.0 : control.editable ? 0.1 : 0.2
+
+ color: control.editable && !control.enabled ? FlatStyle.disabledColor :
+ control.activeFocus && control.pressed ? FlatStyle.focusedAndPressedColor :
+ control.pressed ? FlatStyle.pressedColorAlt : "transparent"
+
+ border.width: control.activeFocus ? FlatStyle.twoPixels : FlatStyle.onePixel
+ border.color: !control.enabled ? FlatStyle.disabledColor :
+ control.activeFocus && control.pressed ? FlatStyle.focusedAndPressedColor :
+ control.activeFocus ? FlatStyle.highlightColor :
+ control.pressed ? FlatStyle.pressedColorAlt : FlatStyle.styleColor
+ }
+
+ Item {
+ clip: true
+ visible: control.editable
+ width: style.dropDownButtonWidth
+ anchors.top: parent.top
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+
+ Rectangle {
+ width: background.width
+ anchors.top: parent.top
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ radius: FlatStyle.radius
+ color: !control.enabled ? FlatStyle.lightFrameColor :
+ control.activeFocus && control.pressed ? FlatStyle.focusedAndPressedColor :
+ control.activeFocus ? FlatStyle.focusedColor :
+ control.pressed ? FlatStyle.pressedColor : FlatStyle.styleColor
+ }
+ }
+
+ LeftArrowIcon {
+ width: Math.round(14 * FlatStyle.scaleFactor)
+ height: Math.round(14 * FlatStyle.scaleFactor)
+ anchors.right: parent.right
+ anchors.rightMargin: width / 2
+ anchors.verticalCenter: parent.verticalCenter
+ rotation: control.pressed ? 90 : -90
+ color: control.editable || control.pressed ? FlatStyle.selectedTextColor
+ : control.activeFocus ? FlatStyle.focusedColor
+ : control.enabled ? FlatStyle.styleColor : FlatStyle.disabledColor
+ opacity: control.enabled || control.editable ? 1.0 : 0.2
+ }
+ }
+
+ __editor: Item {
+ clip: true
+ anchors.fill: parent
+ anchors.bottomMargin: anchors.margins + 1 // ### FIXME: compensate the -1 margin in ComboBoxStyle:
+ Rectangle {
+ anchors.fill: parent
+ anchors.rightMargin: -Math.round(3 * FlatStyle.scaleFactor)
+
+ radius: FlatStyle.radius
+ color: !control.enabled ? FlatStyle.disabledColor : FlatStyle.backgroundColor
+ opacity: control.enabled ? 1.0 : 0.1
+
+ border.width: control.activeFocus ? FlatStyle.twoPixels : FlatStyle.onePixel
+ border.color: !control.enabled ? FlatStyle.disabledColor :
+ control.activeFocus ? FlatStyle.highlightColor :
+ control.pressed ? FlatStyle.pressedColorAlt : FlatStyle.styleColor
+ }
+ }
+
+ __dropDownStyle: MenuStyle {
+ font: style.font
+ __maxPopupHeight: 600
+ __menuItemType: "comboboxitem"
+ __scrollerStyle: ScrollViewStyle { }
+
+ itemDelegate.background: Item {
+ Rectangle {
+ anchors.fill: parent
+ color: !!styleData.pressed || styleData.selected ? FlatStyle.disabledColor : "transparent"
+ opacity: !!styleData.pressed || styleData.selected ? 0.15 : 1.0
+ }
+ Rectangle {
+ color: FlatStyle.darkFrameColor
+ width: parent.width
+ height: FlatStyle.onePixel
+ anchors.bottom: parent.bottom
+ visible: styleData.index < control.__menu.items.length - 1 // TODO
+ }
+ }
+ }
+
+ __selectionHandle: SelectionHandleStyle { }
+ __cursorHandle: CursorHandleStyle { }
+}
diff --git a/src/extras/Styles/Flat/CursorHandleStyle.qml b/src/extras/Styles/Flat/CursorHandleStyle.qml
new file mode 100644
index 00000000..4efe5c15
--- /dev/null
+++ b/src/extras/Styles/Flat/CursorHandleStyle.qml
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls.Styles.Flat 1.0
+
+TextHandle {
+ x: -Math.round(FlatStyle.scaleFactor)
+ type: TextHandle.CursorHandle
+ color: FlatStyle.selectionHandleColor
+ scaleFactor: FlatStyle.scaleFactor
+ visible: styleData.hasSelection
+}
diff --git a/src/extras/Styles/Flat/DelayButtonStyle.qml b/src/extras/Styles/Flat/DelayButtonStyle.qml
new file mode 100644
index 00000000..2e438497
--- /dev/null
+++ b/src/extras/Styles/Flat/DelayButtonStyle.qml
@@ -0,0 +1,291 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras.Styles 1.1 as Base
+import QtQuick.Extras.Private 1.0
+import QtQuick.Extras.Private.CppUtils 1.1
+
+Base.DelayButtonStyle {
+ id: delayButtonStyle
+
+ StateGroup {
+ id: privateScope
+
+ property color buttonColor
+ property color borderColor
+ property color textColor
+ property color progressBarColor
+ readonly property real progressBarWidth: Math.round(4 * FlatStyle.scaleFactor)
+ readonly property real progressBarSpacing: Math.round(16 * FlatStyle.scaleFactor)
+ readonly property bool hovered: control.hovered && (!Settings.hasTouchScreen && !Settings.isMobile)
+
+ states: [
+ State {
+ name: "normal"
+ when: control.enabled && !control.activeFocus && !control.pressed && !privateScope.hovered && !control.checked
+
+ PropertyChanges {
+ target: privateScope
+ buttonColor: "white"
+ borderColor: FlatStyle.styleColor
+ textColor: FlatStyle.styleColor
+ progressBarColor: borderColor
+ }
+ },
+ State {
+ name: "disabled"
+ when: !control.enabled
+
+ PropertyChanges {
+ target: privateScope
+ buttonColor: FlatStyle.disabledFillColor
+ borderColor: "transparent"
+ textColor: "white"
+ progressBarColor: buttonColor
+ }
+ },
+ State {
+ name: "hovered"
+ when: !control.activeFocus && !control.pressed && privateScope.hovered
+
+ PropertyChanges {
+ target: privateScope
+ buttonColor: FlatStyle.hoveredColor
+ borderColor: "transparent"
+ textColor: "white"
+ progressBarColor: buttonColor
+ }
+ },
+ State {
+ name: "focused"
+ when: control.activeFocus && !control.pressed && !control.checked
+
+ PropertyChanges {
+ target: privateScope
+ buttonColor: "white"
+ borderColor: FlatStyle.highlightColor
+ textColor: borderColor
+ progressBarColor: borderColor
+ }
+ },
+ State {
+ name: "pressed"
+ when: !control.activeFocus && control.pressed && !control.checked
+
+ PropertyChanges {
+ target: privateScope
+ buttonColor: FlatStyle.pressedColorAlt
+ borderColor: "transparent"
+ textColor: "white"
+ progressBarColor: buttonColor
+ }
+ },
+ State {
+ name: "focusedAndPressed"
+ when: control.activeFocus && control.pressed && !control.checked
+
+ PropertyChanges {
+ target: privateScope
+ buttonColor: FlatStyle.focusedAndPressedColor
+ borderColor: "transparent"
+ textColor: "white"
+ progressBarColor: buttonColor
+ }
+ },
+ State {
+ name: "checked"
+ when: !control.activeFocus && !control.pressed && !privateScope.hovered && control.checked
+
+ PropertyChanges {
+ target: privateScope
+ buttonColor: FlatStyle.pressedColorAlt
+ borderColor: "transparent"
+ textColor: "white"
+ progressBarColor: buttonColor
+ }
+ },
+ State {
+ name: "checkedAndPressed"
+ when: !control.activeFocus && control.pressed && control.checked
+
+ PropertyChanges {
+ target: privateScope
+ buttonColor: FlatStyle.checkedAndPressedColorAlt
+ borderColor: "transparent"
+ textColor: "white"
+ progressBarColor: buttonColor
+ }
+ },
+ State {
+ name: "checkedAndFocused"
+ when: control.activeFocus && !control.pressed && control.checked
+
+ PropertyChanges {
+ target: privateScope
+ buttonColor: FlatStyle.focusedAndPressedColor
+ borderColor: "transparent"
+ textColor: "white"
+ progressBarColor: buttonColor
+ }
+ },
+ State {
+ name: "checkedPressedAndFocused"
+ when: control.activeFocus && control.pressed && control.checked
+
+ PropertyChanges {
+ target: privateScope
+ buttonColor: FlatStyle.checkedFocusedAndPressedColor
+ borderColor: "transparent"
+ textColor: "white"
+ progressBarColor: buttonColor
+ }
+ }
+ ]
+ }
+
+ label: Text {
+ text: control.text
+ anchors.fill: parent
+ anchors.margins: privateScope.progressBarWidth + privateScope.progressBarSpacing
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ wrapMode: Text.Wrap
+ fontSizeMode: Text.Fit
+ font.family: FlatStyle.fontFamily
+ font.weight: Font.Light
+ renderType: FlatStyle.__renderType
+ color: privateScope.textColor
+ font.pixelSize: TextSingleton.font.pixelSize * 1.5
+ }
+
+ background: Item {
+ implicitWidth: Math.round(160 * FlatStyle.scaleFactor)
+ implicitHeight: Math.round(160 * FlatStyle.scaleFactor)
+
+ Item {
+ id: container
+ width: Math.min(parent.width, parent.height)
+ height: width
+ anchors.centerIn: parent
+
+ Rectangle {
+ id: body
+ anchors.fill: parent
+ anchors.margins: privateScope.progressBarWidth + privateScope.progressBarSpacing
+ radius: width / 2
+ color: privateScope.buttonColor
+ border.color: privateScope.borderColor
+ border.width: FlatStyle.onePixel
+ }
+
+ CircularProgressBar {
+ id: progressBar
+ anchors.fill: parent
+ antialiasing: true
+ barWidth: privateScope.progressBarWidth
+ progress: control.progress
+ minimumValueAngle: 0
+ maximumValueAngle: 360
+
+ // TODO: Add gradient property if/when we drop support for building with 5.1.
+ Component.onCompleted: {
+ clearStops()
+ addStop(0, privateScope.progressBarColor)
+ redraw()
+ }
+
+ Connections {
+ target: privateScope
+ onProgressBarColorChanged: {
+ progressBar.clearStops()
+ progressBar.addStop(0, privateScope.progressBarColor)
+ progressBar.redraw()
+ }
+ }
+
+ states: [
+ State {
+ name: "normal"
+ when: control.progress < 1
+
+ PropertyChanges {
+ target: progressBar
+ opacity: 1
+ }
+ },
+ State {
+ name: "flashing"
+ when: control.progress === 1
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "normal"
+ to: "flashing"
+
+ SequentialAnimation {
+ loops: Animation.Infinite
+
+ NumberAnimation {
+ target: progressBar
+ property: "opacity"
+ from: 1
+ to: 0
+ duration: 500
+ easing.type: Easing.InOutSine
+ }
+ NumberAnimation {
+ target: progressBar
+ property: "opacity"
+ from: 0
+ to: 1
+ duration: 500
+ easing.type: Easing.InOutSine
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+
+ foreground: null
+}
diff --git a/src/extras/Styles/Flat/DialStyle.qml b/src/extras/Styles/Flat/DialStyle.qml
new file mode 100644
index 00000000..3e841d9b
--- /dev/null
+++ b/src/extras/Styles/Flat/DialStyle.qml
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Private 1.0
+import QtQuick.Extras.Private.CppUtils 1.1
+import QtQuick.Extras.Styles 1.3 as Base
+
+Base.DialStyle {
+ id: dialStyle
+
+ handleInset: handleSize * 1.5 + Math.min(control.width, control.height) * 0.15
+
+ readonly property int handleSize: Math.max(6, Math.round(Math.min(control.width, control.height) * 0.05))
+
+ background: Item {
+ implicitWidth: Math.round(160 * FlatStyle.scaleFactor)
+ implicitHeight: Math.round(160 * FlatStyle.scaleFactor)
+
+ CircularProgressBar {
+ id: progressBar
+ anchors.fill: parent
+ progress: control.value
+ minimumValueAngle: -150
+ maximumValueAngle: 150
+ barWidth: handleSize / 2
+ backgroundColor: FlatStyle.grooveColor
+
+ function updateColor() {
+ clearStops();
+ addStop(0, control.enabled ? (control.activeFocus ? FlatStyle.focusedColor : FlatStyle.styleColor) : FlatStyle.mediumFrameColor);
+ redraw();
+ }
+
+ Component.onCompleted: updateColor()
+
+ Connections {
+ target: control
+ onEnabledChanged: progressBar.updateColor()
+ onActiveFocusChanged: progressBar.updateColor()
+ }
+ }
+
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: parent.width * 0.15
+ radius: width / 2
+ color: "white"
+ border.width: control.enabled && control.activeFocus ? FlatStyle.twoPixels : FlatStyle.onePixel
+ border.color: control.enabled ? (control.activeFocus ? FlatStyle.focusedColor : FlatStyle.styleColor) : FlatStyle.mediumFrameColor
+ }
+ }
+
+ handle: Rectangle {
+ color: control.enabled ? (control.activeFocus ? FlatStyle.focusedColor : FlatStyle.styleColor) : FlatStyle.mediumFrameColor
+ width: handleSize
+ height: width
+ radius: height / 2
+ }
+
+ tickmark: null
+}
diff --git a/src/extras/Styles/Flat/Flat.pro b/src/extras/Styles/Flat/Flat.pro
new file mode 100644
index 00000000..6f70c7a8
--- /dev/null
+++ b/src/extras/Styles/Flat/Flat.pro
@@ -0,0 +1,67 @@
+TARGET = qtquickextrasflatplugin
+TARGETPATH = QtQuick/Controls/Styles/Flat
+
+QT += qml quick
+
+HEADERS += \
+ flatstyleplugin.h \
+ qquicktexthandle.h
+SOURCES += \
+ flatstyleplugin.cpp \
+ qquicktexthandle.cpp
+
+FLAT_STYLE += \
+ $$PWD/FlatStyle.qml \
+ $$PWD/ApplicationWindowStyle.qml \
+ $$PWD/BusyIndicatorStyle.qml \
+ $$PWD/ButtonStyle.qml \
+ $$PWD/CalendarStyle.qml \
+ $$PWD/CheckBoxStyle.qml \
+ $$PWD/CheckBoxDrawer.qml \
+ $$PWD/CircularButtonStyle.qml \
+ $$PWD/CircularGaugeStyle.qml \
+ $$PWD/CircularTickmarkLabelStyle.qml \
+ $$PWD/ComboBoxStyle.qml \
+ $$PWD/CursorHandleStyle.qml \
+ $$PWD/DelayButtonStyle.qml \
+ $$PWD/DialStyle.qml \
+ $$PWD/FocusFrameStyle.qml \
+ $$PWD/GaugeStyle.qml \
+ $$PWD/GroupBoxStyle.qml \
+ $$PWD/LeftArrowIcon.qml \
+ $$PWD/MenuBarStyle.qml \
+ $$PWD/MenuStyle.qml \
+ $$PWD/PieMenuStyle.qml \
+ $$PWD/ProgressBarStyle.qml \
+ $$PWD/RadioButtonStyle.qml \
+ $$PWD/ScrollViewStyle.qml \
+ $$PWD/SelectionHandleStyle.qml \
+ $$PWD/SliderStyle.qml \
+ $$PWD/SpinBoxStyle.qml \
+ $$PWD/StatusBarStyle.qml \
+ $$PWD/StatusIndicatorStyle.qml \
+ $$PWD/SwitchStyle.qml \
+ $$PWD/TabViewStyle.qml \
+ $$PWD/TableViewStyle.qml \
+ $$PWD/TextAreaStyle.qml \
+ $$PWD/TextFieldStyle.qml \
+ $$PWD/ToggleButtonStyle.qml \
+ $$PWD/ToolBarStyle.qml \
+ $$PWD/ToolButtonStyle.qml \
+ $$PWD/ToolButtonBackground.qml \
+ $$PWD/ToolButtonIndicator.qml \
+ $$PWD/TumblerStyle.qml
+
+FLAT_STYLE += \
+ $$PWD/images/BusyIndicator_Normal-Large.png \
+ $$PWD/images/BusyIndicator_Normal-Medium.png \
+ $$PWD/images/BusyIndicator_Normal-Small.png \
+ $$PWD/fonts/OpenSans-Light.ttf \
+ $$PWD/fonts/OpenSans-Regular.ttf \
+ $$PWD/fonts/OpenSans-Semibold.ttf \
+ $$PWD/fonts/LICENSE.txt \
+
+RESOURCES += flatstyle.qrc
+
+CONFIG += no_cxx_module
+load(qml_plugin)
diff --git a/src/extras/Styles/Flat/FlatStyle.qml b/src/extras/Styles/Flat/FlatStyle.qml
new file mode 100644
index 00000000..60e03d4e
--- /dev/null
+++ b/src/extras/Styles/Flat/FlatStyle.qml
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+pragma Singleton
+
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+
+QtObject {
+ readonly property string fontFamily: __openSansRegularLoader.name
+
+ readonly property color backgroundColor: "#ffffff"
+ readonly property color defaultTextColor: "#333333"
+ readonly property color styleColor: "#5caa15"
+ readonly property color strokeColor: "#328930"
+ readonly property color hoveredColor: "#7dbb44"
+ readonly property color focusedColor: "#4da6d8"
+ readonly property color focusedTextColor: "#1288cb"
+ readonly property color focusedAndPressedColor: "#4595c2"
+ readonly property color focusedStrokeColor: "#2f86bb"
+ readonly property color focusedAndPressedStrokeColor: "#266b96"
+ readonly property color checkedFocusedAndPressedColor: "#3a7ca2"
+ readonly property color checkedAndPressedColor: "#4a8811"
+ readonly property color checkedAndPressedColorAlt: "#3c6f0e"
+ readonly property color pressedColor: "#457f10"
+ readonly property color pressedColorAlt: "#539913"
+ readonly property color pressedStrokeColor: "#286e26"
+ readonly property color invalidColor: "#dd0000"
+ readonly property color disabledColor: "#000000"
+ readonly property color disabledFillColor: "#d9d9d9"
+ readonly property color highlightColor: "#4da6d8"
+ readonly property color selectedTextColor: "#ffffff"
+ readonly property color textSelectionColor: "#ceeaff"
+ readonly property color textColor: "#1a1a1a"
+ readonly property color grooveColor: "#14000000"
+ readonly property color lightFrameColor: "#cccccc"
+ readonly property color mediumFrameColor: "#b3b3b3"
+ readonly property color darkFrameColor: "#999999"
+ readonly property color alphaFrameColor: "#33000000"
+ readonly property color selectionHandleColor: "#0668ec"
+ readonly property color flatFrameColor: "#f2f2f2"
+ readonly property real disabledOpacity: 0.3
+ readonly property real defaultFontSize: 13
+
+ // 16 is the implicitHeight of text on a PC monitor. This should scale well
+ // to other devices. For example, if the implicitHeight is 64 on a touch
+ // device, the scale factor will be x4.
+ readonly property real scaleFactor: Math.max(1, TextSingleton.implicitHeight / 16)
+
+ readonly property real onePixel: Math.max(1, Math.round(scaleFactor * 1))
+ readonly property real twoPixels: Math.max(2, Math.round(scaleFactor * 2))
+ readonly property int radius: Math.round(scaleFactor * 3)
+
+ property FontLoader __openSansDemiBoldLoader: FontLoader {
+ source: "fonts/OpenSans-Semibold.ttf"
+ }
+
+ property FontLoader __openSansRegularLoader: FontLoader {
+ source: "fonts/OpenSans-Regular.ttf"
+ }
+
+ property FontLoader __openSansLightLoader: FontLoader {
+ source: "fonts/OpenSans-Light.ttf"
+ }
+
+ readonly property int __renderType: Text.QtRendering
+}
diff --git a/src/extras/Styles/Flat/FocusFrameStyle.qml b/src/extras/Styles/Flat/FocusFrameStyle.qml
new file mode 100644
index 00000000..eb4fa009
--- /dev/null
+++ b/src/extras/Styles/Flat/FocusFrameStyle.qml
@@ -0,0 +1,38 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick.Controls.Private 1.0 as Private
+
+Private.FocusFrameStyle { }
diff --git a/src/extras/Styles/Flat/GaugeStyle.qml b/src/extras/Styles/Flat/GaugeStyle.qml
new file mode 100644
index 00000000..d5bf986b
--- /dev/null
+++ b/src/extras/Styles/Flat/GaugeStyle.qml
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Extras.Styles 1.3 as Base
+import QtQuick.Extras.Private 1.0
+
+Base.GaugeStyle {
+ id: gaugeStyle
+
+ readonly property int __totalValueBarWidth: Math.round(22 * FlatStyle.scaleFactor + __lineSpacing + __lineWidth)
+ readonly property int __actualValueBarWidth: __totalValueBarWidth - __lineSpacing - __lineWidth
+ readonly property int __lineWidth: FlatStyle.onePixel
+ readonly property int __lineSpacing: Math.round(3 * FlatStyle.scaleFactor)
+
+ background: Item {
+ Rectangle {
+ color: control.enabled ? FlatStyle.styleColor : FlatStyle.disabledColor
+ opacity: control.enabled ? 1 : 0.2
+ width: __lineWidth
+ height: parent.height
+ x: control.tickmarkAlignment === Qt.AlignLeft || control.tickmarkAlignment === Qt.AlignTop ? parent.width - width : 0
+ }
+ }
+
+ valueBar: Item {
+ implicitWidth: __totalValueBarWidth
+
+ Rectangle {
+ color: control.enabled ? FlatStyle.styleColor : FlatStyle.disabledColor
+ opacity: control.enabled ? 1 : 0.2
+ x: control.tickmarkAlignment === Qt.AlignRight || control.tickmarkAlignment === Qt.AlignBottom ? __lineWidth + __lineSpacing : 0
+ implicitWidth: __actualValueBarWidth
+ height: parent.height
+ }
+ }
+
+ foreground: null
+
+ tickmark: Item {
+ id: tickmarkItem
+ implicitWidth: Math.round(12 * FlatStyle.scaleFactor)
+ implicitHeight: FlatStyle.onePixel
+
+ Rectangle {
+ x: control.tickmarkAlignment === Qt.AlignLeft || control.tickmarkAlignment === Qt.AlignTop
+ ? parent.width + __actualValueBarWidth / 2 - width / 2
+ : -__actualValueBarWidth / 2 - width / 2
+ // Length of the tickmark is the same as the spacing between the tickmarks and labels.
+ width: parent.width
+ height: parent.height
+ color: gaugeStyle.valuePosition > styleData.valuePosition + height ? FlatStyle.selectedTextColor : (control.enabled ? FlatStyle.styleColor : FlatStyle.disabledColor)
+ opacity: gaugeStyle.valuePosition > styleData.valuePosition + height ? 0.5 : (control.enabled ? 1 : 0.2)
+ visible: (styleData.index === 0 && gaugeStyle.valuePosition === 0) ||
+ (styleData.index !== 0 && (gaugeStyle.valuePosition <= styleData.valuePosition || gaugeStyle.valuePosition > styleData.valuePosition + height))
+ }
+ }
+
+ minorTickmark: Item {
+ implicitWidth: Math.round(6 * FlatStyle.scaleFactor)
+ implicitHeight: FlatStyle.onePixel
+
+ Rectangle {
+ x: control.tickmarkAlignment === Qt.AlignLeft || control.tickmarkAlignment === Qt.AlignTop
+ ? parent.width + __actualValueBarWidth / 2 - width / 2
+ : -__actualValueBarWidth / 2 - width / 2
+ width: parent.width
+ height: parent.height
+ color: control.enabled ? FlatStyle.styleColor : FlatStyle.disabledColor
+ opacity: control.enabled ? 1 : 0.2
+ visible: gaugeStyle.valuePosition <= styleData.valuePosition
+ }
+ }
+
+ tickmarkLabel: Item {
+ implicitWidth: textLabel.implicitWidth
+ implicitHeight: textLabel.implicitHeight
+
+ Label {
+ id: textLabel
+ text: control.formatValue(styleData.value)
+ font: control.font
+ color: control.enabled ? FlatStyle.defaultTextColor : FlatStyle.disabledColor
+ opacity: control.enabled ? 1 : FlatStyle.disabledOpacity
+ renderType: FlatStyle.__renderType
+ Connections {
+ target: control
+ // Setting an anchor to undefined leaves it in the position it was in last.
+ // We don't want that, as we want the label's y pos to be at zero when it's not anchored.
+ // Using a binding here whose when property is true when control.orientation === Qt.Horizontal
+ // doesn't work.
+ onOrientationChanged: textLabel.y = 0
+ }
+ anchors.baseline: control.orientation === Qt.Vertical ? parent.verticalCenter : undefined
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/GroupBoxStyle.qml b/src/extras/Styles/Flat/GroupBoxStyle.qml
new file mode 100644
index 00000000..65f8cf19
--- /dev/null
+++ b/src/extras/Styles/Flat/GroupBoxStyle.qml
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls.Private 1.0 as Private
+import QtQuick.Controls.Styles.Flat 1.0
+
+Private.GroupBoxStyle {
+ id: root
+
+ readonly property int spacing: Math.round(8 * FlatStyle.scaleFactor)
+
+ padding {
+ left: spacing
+ right: spacing
+ bottom: spacing
+ }
+
+ textColor: !control.enabled ? FlatStyle.disabledColor : check.activeFocus ? FlatStyle.focusedTextColor : FlatStyle.defaultTextColor
+
+ panel: Item {
+ anchors.fill: parent
+
+ Rectangle {
+ id: background
+ radius: FlatStyle.radius
+ border.width: control.flat ? 0 : FlatStyle.onePixel
+ border.color: FlatStyle.lightFrameColor
+ color: control.flat ? FlatStyle.flatFrameColor : "transparent"
+ anchors.fill: parent
+ anchors.topMargin: Math.max(indicator.height, label.height) + root.spacing / 2
+ }
+
+ // TODO:
+ Binding {
+ target: root
+ property: "padding.top"
+ value: background.anchors.topMargin + root.spacing
+ }
+
+ CheckBoxDrawer {
+ id: indicator
+ visible: control.checkable
+ controlEnabled: control.enabled
+ controlActiveFocus: check.activeFocus
+ controlPressed: check.pressed
+ controlChecked: control.checked
+ anchors.left: parent.left
+ // compensate padding around check indicator
+ anchors.leftMargin: Math.round(-3 * FlatStyle.scaleFactor)
+ }
+
+ Text {
+ id: label
+ anchors.left: control.checkable ? indicator.right : parent.left
+ anchors.right: parent.right
+ anchors.verticalCenter: indicator.verticalCenter
+ anchors.leftMargin: control.checkable ? root.spacing / 2 : 0
+ text: control.title
+ color: root.textColor
+ renderType: FlatStyle.__renderType
+ elide: Text.ElideRight
+ font.family: FlatStyle.fontFamily
+ font.pixelSize: 16 * FlatStyle.scaleFactor
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/LeftArrowIcon.qml b/src/extras/Styles/Flat/LeftArrowIcon.qml
new file mode 100644
index 00000000..de64f3c9
--- /dev/null
+++ b/src/extras/Styles/Flat/LeftArrowIcon.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.3
+
+Canvas {
+ implicitWidth: 32
+ implicitHeight: 32
+
+ property color color: "white"
+
+ onColorChanged: requestPaint()
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+
+ ctx.beginPath();
+ ctx.moveTo(0.66321495 * width, 0.06548707 * height);
+ ctx.lineTo(0.2191097 * width, 0.50959232 * height);
+ ctx.lineTo(0.66628301 * width, 0.95676556 * height);
+ ctx.lineTo(0.77673409 * width, 0.84631453 * height);
+ ctx.lineTo(0.44001181 * width, 0.50959232 * height);
+ ctx.lineTo(0.77366599 * width, 0.1759381 * height);
+ ctx.fillStyle = color;
+ ctx.fill();
+ }
+}
diff --git a/src/extras/Styles/Flat/MenuBarStyle.qml b/src/extras/Styles/Flat/MenuBarStyle.qml
new file mode 100644
index 00000000..4be92cbc
--- /dev/null
+++ b/src/extras/Styles/Flat/MenuBarStyle.qml
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick.Controls.Styles 1.2 as Base
+
+Base.MenuBarStyle {
+ __isNative: false
+ background: null
+ itemDelegate: null
+}
diff --git a/src/extras/Styles/Flat/MenuStyle.qml b/src/extras/Styles/Flat/MenuStyle.qml
new file mode 100644
index 00000000..54a7e33f
--- /dev/null
+++ b/src/extras/Styles/Flat/MenuStyle.qml
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+
+Base.MenuStyle {
+ id: style
+ font.family: FlatStyle.fontFamily
+ __leftLabelMargin: Math.round(30 * FlatStyle.scaleFactor)
+
+ frame: Rectangle {
+ border.color: FlatStyle.darkFrameColor
+ border.width: FlatStyle.onePixel
+ }
+
+ itemDelegate.background: Rectangle {
+ color: !!styleData.pressed || styleData.selected ? FlatStyle.disabledColor : "transparent"
+ opacity: !!styleData.pressed || styleData.selected ? 0.15 : 1.0
+ }
+
+ itemDelegate.label: Text {
+ text: formatMnemonic(styleData.text, styleData.underlineMnemonic)
+ renderType: FlatStyle.__renderType
+ color: FlatStyle.defaultTextColor
+ font.family: FlatStyle.fontFamily
+ font.pixelSize: FlatStyle.defaultFontSize
+ verticalAlignment: Text.AlignVCenter
+ height: Math.round(26 * FlatStyle.scaleFactor)
+ }
+
+ itemDelegate.shortcut: Text {
+ text: styleData.shortcut
+ renderType: FlatStyle.__renderType
+ color: FlatStyle.defaultTextColor
+ font.family: FlatStyle.fontFamily
+ font.pixelSize: FlatStyle.defaultFontSize
+ }
+
+ itemDelegate.checkmarkIndicator: CheckBoxDrawer {
+ visible: styleData.checked
+ controlEnabled: styleData.enabled
+ controlChecked: styleData.checked
+ backgroundVisible: false
+ x: -4 // ### FIXME: compensate hardcoded "x: 4" in MenuStyle
+ y: FlatStyle.onePixel
+ }
+
+ itemDelegate.submenuIndicator: LeftArrowIcon {
+ scale: -1
+ color: "#000000"
+ width: Math.round(10 * FlatStyle.scaleFactor)
+ height: Math.round(10 * FlatStyle.scaleFactor)
+ baselineOffset: Math.round(7 * FlatStyle.scaleFactor)
+ }
+
+ separator: Rectangle {
+ color: FlatStyle.lightFrameColor
+ width: parent.width
+ implicitHeight: FlatStyle.onePixel
+ }
+}
diff --git a/src/extras/Styles/Flat/PieMenuStyle.qml b/src/extras/Styles/Flat/PieMenuStyle.qml
new file mode 100644
index 00000000..9b314610
--- /dev/null
+++ b/src/extras/Styles/Flat/PieMenuStyle.qml
@@ -0,0 +1,169 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.3
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Extras.Styles 1.3 as Base
+import QtQuick.Extras.Private 1.0
+
+Base.PieMenuStyle {
+ id: pieMenuStyle
+ shadowRadius: 0
+ shadowSpread: 0
+ shadowColor: "transparent"
+ backgroundColor: FlatStyle.styleColor
+ selectionColor: FlatStyle.styleColor
+ startAngle: -78
+ endAngle: 78
+ cancelRadius: radius * 0.4352
+
+ __implicitWidth: Math.round(85 * 2 * FlatStyle.scaleFactor)
+ __implicitHeight: __implicitWidth
+
+ title: null
+
+ menuItem: Item {
+ readonly property var __styleData: styleData
+
+ Canvas {
+ id: actionCanvas
+ antialiasing: true
+ anchors.fill: parent
+ anchors.margins: -1
+
+ Connections {
+ target: pieMenuStyle
+ onStartAngleChanged: actionCanvas.requestPaint()
+ onEndAngleChanged: actionCanvas.requestPaint()
+ }
+
+ Connections {
+ target: __styleData
+ onPressedChanged: actionCanvas.requestPaint()
+ }
+
+ readonly property bool stroke: !__styleData.hovered
+ readonly property real spacingThickness: Math.max(4 * FlatStyle.scaleFactor, radius * 0.05)
+ // It's actually one, but stroking always goes 50/50 on the inside/outside, so this is
+ // an easy way of making it one pixel without having to mess around with more drawing code.
+ // This will work as long as the fill and stroke colors are both completely opaque.
+ readonly property real lineWidth: FlatStyle.twoPixels
+ // The following properties are all for either side of a radius/circumference, so the total is actually double.
+ readonly property real outerMenuItemSpacing: Math.asin(spacingThickness / (2 * radius))
+ readonly property real innerMenuItemSpacing: Math.asin(spacingThickness / (2 * cancelRadius))
+ // The total angle to subtract from the circumference of the inner radius arc
+ readonly property real innerRadiusStrokeCircumferenceAdjustment: Math.asin(lineWidth / (2 * cancelRadius))
+ readonly property real outerRadiusStrokeCircumferenceAdjustment: Math.asin(lineWidth / (2 * radius))
+
+ onStrokeChanged: actionCanvas.requestPaint()
+
+ function drawRingSection(ctx, x, y, section, r, ringWidth, ringColor) {
+ if (stroke) {
+ ctx.strokeStyle = ringColor;
+ ctx.fillStyle = "white";
+ } else {
+ ctx.fillStyle = ringColor;
+ }
+
+ ctx.beginPath();
+
+ if (stroke)
+ ctx.lineWidth = lineWidth;
+ var start = control.__protectedScope.sectionStartAngle(section);
+ var end = control.__protectedScope.sectionEndAngle(section);
+ // Adjust the radius to account for stroke being 50% inside/50% outside.
+ var radius = !stroke ? r : r - ctx.lineWidth / 2;
+ // Add spacing between the items, while still accounting for reversed menus.
+ if (start > end) {
+ start -= outerMenuItemSpacing;
+ end += outerMenuItemSpacing;
+ if (stroke) {
+ start -= outerRadiusStrokeCircumferenceAdjustment;
+ end += outerRadiusStrokeCircumferenceAdjustment;
+ }
+ } else {
+ start += outerMenuItemSpacing;
+ end -= outerMenuItemSpacing;
+ if (stroke) {
+ start += outerRadiusStrokeCircumferenceAdjustment;
+ end -= outerRadiusStrokeCircumferenceAdjustment;
+ }
+ }
+
+ ctx.arc(x, y, radius, start, end, start > end);
+
+ start = control.__protectedScope.sectionStartAngle(section);
+ end = control.__protectedScope.sectionEndAngle(section);
+ radius = !stroke ? ringWidth : ringWidth + ctx.lineWidth / 2;
+ if (start > end) {
+ start -= innerMenuItemSpacing;
+ end += innerMenuItemSpacing;
+ if (stroke) {
+ start -= innerRadiusStrokeCircumferenceAdjustment;
+ end += innerRadiusStrokeCircumferenceAdjustment;
+ }
+ } else {
+ start += innerMenuItemSpacing;
+ end -= innerMenuItemSpacing;
+ if (stroke) {
+ start += innerRadiusStrokeCircumferenceAdjustment;
+ end -= innerRadiusStrokeCircumferenceAdjustment;
+ }
+ }
+
+ ctx.arc(x, y, radius, end, start, start <= end);
+ ctx.closePath();
+
+ if (stroke)
+ ctx.stroke();
+
+ ctx.fill();
+ }
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.reset();
+ drawRingSection(ctx, width / 2, height / 2, styleData.index, radius, cancelRadius,
+ __styleData.pressed ? FlatStyle.pressedColorAlt : (stroke ? backgroundColor : selectionColor));
+ }
+ }
+
+ PieMenuIcon {
+ control: pieMenuStyle.control
+ styleData: __styleData
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/ProgressBarStyle.qml b/src/extras/Styles/Flat/ProgressBarStyle.qml
new file mode 100644
index 00000000..f0b5bdd4
--- /dev/null
+++ b/src/extras/Styles/Flat/ProgressBarStyle.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Private.CppUtils 1.1
+
+Base.ProgressBarStyle {
+ background: Item {
+ implicitWidth: Math.round(100 * FlatStyle.scaleFactor)
+ implicitHeight: Math.round(16 * FlatStyle.scaleFactor)
+
+ FlatProgressBar {
+ enabled: control.enabled
+ width: Math.round(parent.width)
+ height: Math.round(parent.height)
+ indeterminate: control.indeterminate
+ progress: (control.value - control.minimumValue) / (control.maximumValue - control.minimumValue)
+ }
+ }
+
+ progress: null
+}
diff --git a/src/extras/Styles/Flat/RadioButtonStyle.qml b/src/extras/Styles/Flat/RadioButtonStyle.qml
new file mode 100644
index 00000000..779e8636
--- /dev/null
+++ b/src/extras/Styles/Flat/RadioButtonStyle.qml
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras 1.3
+
+Base.RadioButtonStyle {
+ spacing: Math.round(8 * FlatStyle.scaleFactor)
+
+ indicator: Item {
+ implicitWidth: Math.round(26 * FlatStyle.scaleFactor)
+ implicitHeight: implicitWidth
+
+ Rectangle {
+ id: outer
+ anchors.centerIn: parent
+ width: Math.round(20 * FlatStyle.scaleFactor)
+ height: width
+ radius: width / 2
+ color: control.enabled ? (control.pressed ? FlatStyle.lightFrameColor : FlatStyle.backgroundColor) : FlatStyle.disabledFillColor
+ border.color: !control.enabled ? FlatStyle.disabledFillColor :
+ (control.pressed ? FlatStyle.darkFrameColor :
+ (control.activeFocus ? FlatStyle.focusedColor :
+ (!Settings.hasTouchScreen && control.hovered ? FlatStyle.styleColor : FlatStyle.lightFrameColor)))
+ border.width: control.activeFocus && !control.pressed ? FlatStyle.twoPixels : FlatStyle.onePixel
+ }
+
+ Rectangle {
+ id: inner
+ anchors.centerIn: parent
+ implicitWidth: Math.round(FlatStyle.scaleFactor * 8)
+ width: implicitWidth + (outer.width % 2 + implicitWidth % 2) % 2
+ height: width
+ radius: width / 2
+ visible: control.checked
+ color: !control.enabled ? FlatStyle.mediumFrameColor :
+ (control.activeFocus ? FlatStyle.focusedColor :
+ (control.pressed ? FlatStyle.checkedAndPressedColor : FlatStyle.styleColor))
+ }
+ }
+
+ label: Text {
+ text: control.text
+ font.family: FlatStyle.fontFamily
+ renderType: FlatStyle.__renderType
+ anchors.verticalCenter: parent.verticalCenter
+ opacity: enabled ? 1.0 : FlatStyle.disabledOpacity
+ color: !enabled ? FlatStyle.disabledColor :
+ control.activeFocus ? FlatStyle.focusedTextColor : FlatStyle.defaultTextColor
+ }
+}
diff --git a/src/extras/Styles/Flat/ScrollViewStyle.qml b/src/extras/Styles/Flat/ScrollViewStyle.qml
new file mode 100644
index 00000000..7e94b7db
--- /dev/null
+++ b/src/extras/Styles/Flat/ScrollViewStyle.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+
+Base.ScrollViewStyle {
+ readonly property int barWidth: 2 * Math.round(FlatStyle.scaleFactor)
+ readonly property int frameWidth: control.frameVisible ? Math.max(1, Math.round(FlatStyle.scaleFactor)) : 0
+ padding {
+ top: frameWidth
+ left: frameWidth
+ right: frameWidth
+ bottom: frameWidth
+ }
+ corner: null
+ transientScrollBars: true
+ frame: Rectangle {
+ color: control["backgroundVisible"] ? FlatStyle.backgroundColor : "transparent"
+ border.color: FlatStyle.mediumFrameColor
+ border.width: frameWidth
+ visible: control.frameVisible
+ }
+ scrollBarBackground: Item {
+ implicitWidth: 2 * barWidth
+ implicitHeight: 2 * barWidth
+ }
+ handle: Item {
+ implicitWidth: barWidth
+ implicitHeight: barWidth
+ Rectangle {
+ color: FlatStyle.darkFrameColor
+ radius: barWidth / 2
+ anchors.fill: parent
+ anchors.topMargin: styleData.horizontal ? 0 : barWidth
+ anchors.leftMargin: styleData.horizontal ? barWidth : 0
+ anchors.rightMargin: styleData.horizontal ? barWidth : 0
+ anchors.bottomMargin: styleData.horizontal ? 0 : barWidth
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/SelectionHandleStyle.qml b/src/extras/Styles/Flat/SelectionHandleStyle.qml
new file mode 100644
index 00000000..954e4f8b
--- /dev/null
+++ b/src/extras/Styles/Flat/SelectionHandleStyle.qml
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls.Styles.Flat 1.0
+
+TextHandle {
+ x: -width
+ type: TextHandle.SelectionHandle
+ color: FlatStyle.selectionHandleColor
+ scaleFactor: FlatStyle.scaleFactor
+}
diff --git a/src/extras/Styles/Flat/SliderStyle.qml b/src/extras/Styles/Flat/SliderStyle.qml
new file mode 100644
index 00000000..191612c5
--- /dev/null
+++ b/src/extras/Styles/Flat/SliderStyle.qml
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Private 1.0
+
+Base.SliderStyle {
+ handle: Item {
+ width: Math.round(26 * FlatStyle.scaleFactor)
+ height: width
+
+ readonly property bool focusedOnly: control.activeFocus && !control.pressed
+
+ Rectangle {
+ id: handleBorder
+ width: parent.width
+ height: width
+ radius: width / 2
+ color: focusedOnly ? FlatStyle.focusedColor :
+ control.hovered && !control.pressed ? FlatStyle.styleColor : "#000000"
+ opacity: (control.activeFocus || control.hovered) && !control.pressed ? 1.0 : 0.2
+ }
+
+ Rectangle {
+ id: handleBody
+ readonly property real borderThickness: focusedOnly ? FlatStyle.twoPixels : FlatStyle.onePixel
+ x: borderThickness
+ y: borderThickness
+ width: parent.width - 2 * borderThickness
+ height: width
+ border.color: "white"
+ border.width: (width - parent.width * 10 / 26) / 2
+ radius: width / 2
+ color: !control.enabled ? FlatStyle.disabledFillColor :
+ focusedOnly ? FlatStyle.focusedColor : FlatStyle.styleColor
+ }
+
+ Rectangle {
+ id: pressedDarkness
+ anchors.fill: parent
+ radius: width / 2
+ color: "#000000"
+ opacity: 0.2
+ visible: control.pressed
+ }
+ }
+
+ groove: Item {
+ implicitWidth: Math.round(100 * FlatStyle.scaleFactor)
+ height: Math.round(4 * FlatStyle.scaleFactor)
+ anchors.verticalCenter: parent.verticalCenter
+
+ Rectangle {
+ id: emptyGroove
+ width: parent.width
+ height: parent.height
+ radius: Math.round(2 * FlatStyle.scaleFactor)
+ color: "#000000"
+ opacity: control.enabled ? 0.2 : 0.12
+ }
+
+ Rectangle {
+ id: filledGroove
+ color: control.enabled ? FlatStyle.styleColor : FlatStyle.mediumFrameColor
+ width: styleData.handlePosition
+ height: parent.height
+ radius: emptyGroove.radius
+ }
+ }
+
+ // TODO: tickmarks
+}
diff --git a/src/extras/Styles/Flat/SpinBoxStyle.qml b/src/extras/Styles/Flat/SpinBoxStyle.qml
new file mode 100644
index 00000000..1b182da5
--- /dev/null
+++ b/src/extras/Styles/Flat/SpinBoxStyle.qml
@@ -0,0 +1,153 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+
+Base.SpinBoxStyle {
+ padding { top: 0; left: 0; right: 0; bottom: 0 }
+ renderType: FlatStyle.__renderType
+
+ panel: Item {
+ property int horizontalAlignment: Qt.AlignHCenter
+ property int verticalAlignment: Qt.AlignVCenter
+
+ property color foregroundColor: !control.enabled ? FlatStyle.mediumFrameColor : FlatStyle.defaultTextColor
+ property color selectionColor: FlatStyle.highlightColor
+ property color selectedTextColor: FlatStyle.selectedTextColor
+ property var margins: QtObject {
+ readonly property real top: 2 * FlatStyle.scaleFactor
+ readonly property real left: decrement.width
+ readonly property real right: increment.width
+ readonly property real bottom: 2 * FlatStyle.scaleFactor
+ }
+
+ property rect upRect: Qt.rect(increment.x, increment.y, increment.width, increment.height)
+ property rect downRect: Qt.rect(decrement.x, decrement.y, decrement.width, decrement.height)
+
+ property font font
+ font.family: FlatStyle.fontFamily
+
+ implicitWidth: Math.round(100 * FlatStyle.scaleFactor)
+ implicitHeight: Math.round(26 * FlatStyle.scaleFactor)
+
+ Item {
+ id: decrement
+ clip: true
+ width: Math.round(28 * FlatStyle.scaleFactor)
+ height: parent.height
+
+ Rectangle {
+ width: parent.width + FlatStyle.radius
+ height: parent.height
+ color: !control.enabled ? FlatStyle.lightFrameColor :
+ control.activeFocus && styleData.downPressed ? FlatStyle.checkedFocusedAndPressedColor :
+ control.activeFocus ? FlatStyle.highlightColor :
+ styleData.downPressed ? FlatStyle.checkedAndPressedColor : FlatStyle.styleColor
+ radius: FlatStyle.radius
+ }
+
+ Rectangle {
+ color: FlatStyle.backgroundColor
+ width: Math.round(10 * FlatStyle.scaleFactor)
+ height: Math.round(2 * FlatStyle.scaleFactor)
+ anchors.horizontalCenter: parent.left
+ anchors.horizontalCenterOffset: Math.round(14 * FlatStyle.scaleFactor)
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+
+ Item {
+ id: increment
+ clip: true
+ width: Math.round(28 * FlatStyle.scaleFactor)
+ height: parent.height
+ anchors.right: parent.right
+
+ Rectangle {
+ width: parent.width + FlatStyle.radius
+ height: parent.height
+ anchors.right: parent.right
+ color: !control.enabled ? FlatStyle.lightFrameColor :
+ control.activeFocus && styleData.upPressed ? FlatStyle.checkedFocusedAndPressedColor :
+ control.activeFocus ? FlatStyle.highlightColor :
+ styleData.upPressed ? FlatStyle.checkedAndPressedColor : FlatStyle.styleColor
+ radius: FlatStyle.radius
+ }
+
+ Rectangle {
+ color: FlatStyle.backgroundColor
+ width: Math.round(10 * FlatStyle.scaleFactor)
+ height: Math.round(2 * FlatStyle.scaleFactor)
+ anchors.horizontalCenter: parent.right
+ anchors.horizontalCenterOffset: Math.round(-14 * FlatStyle.scaleFactor)
+ anchors.verticalCenter: parent.verticalCenter
+ }
+
+ Rectangle {
+ color: FlatStyle.backgroundColor
+ width: Math.round(2 * FlatStyle.scaleFactor)
+ height: Math.round(10 * FlatStyle.scaleFactor)
+ anchors.horizontalCenter: parent.right
+ anchors.horizontalCenterOffset: Math.round(-14 * FlatStyle.scaleFactor)
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+
+ Rectangle {
+ id: frame
+ anchors.fill: parent
+ anchors.leftMargin: decrement.width
+ anchors.rightMargin: increment.width
+ color: !control.enabled ? "transparent" :
+ control.activeFocus ? FlatStyle.highlightColor : FlatStyle.mediumFrameColor
+
+ Rectangle {
+ id: field
+ anchors.fill: parent
+ anchors.topMargin: Math.round((!control.enabled ? 0 : control.activeFocus ? 2 : 1) * FlatStyle.scaleFactor)
+ anchors.bottomMargin: Math.round((!control.enabled ? 0 : control.activeFocus ? 2 : 1) * FlatStyle.scaleFactor)
+ color: !control.enabled ? FlatStyle.disabledColor : FlatStyle.backgroundColor
+ opacity: !control.enabled ? 0.1 : 1.0
+ }
+ }
+ }
+
+ __selectionHandle: null
+ __cursorHandle: null
+}
diff --git a/src/extras/Styles/Flat/StatusBarStyle.qml b/src/extras/Styles/Flat/StatusBarStyle.qml
new file mode 100644
index 00000000..e2bc77ff
--- /dev/null
+++ b/src/extras/Styles/Flat/StatusBarStyle.qml
@@ -0,0 +1,38 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick.Controls.Styles 1.2 as Base
+
+Base.StatusBarStyle { }
diff --git a/src/extras/Styles/Flat/StatusIndicatorStyle.qml b/src/extras/Styles/Flat/StatusIndicatorStyle.qml
new file mode 100644
index 00000000..fb527665
--- /dev/null
+++ b/src/extras/Styles/Flat/StatusIndicatorStyle.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.3
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Extras.Styles 1.3 as Base
+import QtQuick.Extras.Private 1.0
+import QtQuick.Extras.Private.CppUtils 1.0
+
+Base.StatusIndicatorStyle {
+ color: FlatStyle.focusedTextColor
+
+ indicator: Item {
+ implicitWidth: Math.max(12, MathUtils.roundEven(12 * FlatStyle.scaleFactor))
+ implicitHeight: MathUtils.roundEven(implicitWidth / 2)
+
+ Rectangle {
+ // Math.max because the control could be manually resized to be too small.
+ width: Math.max(12, MathUtils.roundEven(parent.width))
+ height: MathUtils.roundEven(width / 2)
+ radius: Math.max(2, height * 0.2)
+ anchors.centerIn: parent
+ color: !control.enabled || !control.active ? FlatStyle.disabledColor : control.color
+ opacity: control.enabled ? (control.active ? 1 : 0.3) : (control.active ? FlatStyle.disabledOpacity : 0.15)
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/SwitchStyle.qml b/src/extras/Styles/Flat/SwitchStyle.qml
new file mode 100644
index 00000000..3918c474
--- /dev/null
+++ b/src/extras/Styles/Flat/SwitchStyle.qml
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+
+Base.SwitchStyle {
+ readonly property int __knobHeight: Math.round(26 * FlatStyle.scaleFactor)
+
+ groove: Item {
+ implicitWidth: Math.round(46 * FlatStyle.scaleFactor)
+ implicitHeight: __knobHeight
+ Rectangle {
+ radius: height / 2
+ y: 1 * FlatStyle.scaleFactor
+ implicitWidth: parent.implicitWidth
+ implicitHeight: Math.round(24 * FlatStyle.scaleFactor)
+ border.width: (control.activeFocus ? FlatStyle.twoPixels : FlatStyle.onePixel)
+ border.color: control.activeFocus ? FlatStyle.highlightColor : control.enabled && control.checked ? FlatStyle.styleColor : FlatStyle.mediumFrameColor
+ color: !control.checked ? "transparent" :
+ !control.enabled ? FlatStyle.disabledFillColor :
+ control.activeFocus ? FlatStyle.highlightColor : FlatStyle.styleColor
+ }
+ }
+
+ handle: Item {
+ implicitWidth: __knobHeight
+ implicitHeight: __knobHeight
+ Rectangle {
+ id: knobShadow
+ x: 1 * FlatStyle.scaleFactor
+ y: 1 * FlatStyle.scaleFactor
+ radius: height / 2
+ width: parent.width
+ height: parent.height
+ color: "#000000"
+ opacity: 0.1
+ }
+ Rectangle {
+ id: knob
+ radius: height / 2
+ width: parent.width
+ height: parent.height
+ border.width: (control.activeFocus ? FlatStyle.twoPixels : FlatStyle.onePixel)
+ border.color: !control.enabled ? FlatStyle.mediumFrameColor :
+ control.pressed && control.activeFocus ? FlatStyle.focusedAndPressedStrokeColor :
+ control.activeFocus ? FlatStyle.focusedStrokeColor :
+ control.checked ? FlatStyle.strokeColor : FlatStyle.darkFrameColor
+ color: !control.enabled ? FlatStyle.disabledFillColor : control.pressed ? FlatStyle.lightFrameColor : FlatStyle.backgroundColor
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/TabViewStyle.qml b/src/extras/Styles/Flat/TabViewStyle.qml
new file mode 100644
index 00000000..c680f762
--- /dev/null
+++ b/src/extras/Styles/Flat/TabViewStyle.qml
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+
+Base.TabViewStyle {
+ readonly property int frameWidth: Math.round(FlatStyle.scaleFactor)
+
+ tabOverlap: -frameWidth
+ frameOverlap: frameWidth
+
+ frame: Rectangle {
+ visible: control.frameVisible
+ color: FlatStyle.backgroundColor
+ border.color: FlatStyle.lightFrameColor
+ }
+
+ tab: Item {
+ readonly property int totalWidth: styleData.availableWidth + tabOverlap * (control.count - 1)
+ readonly property int tabWidth: Math.max(1, totalWidth / Math.max(1, control.count))
+ readonly property int remainder: (styleData.index == control.count - 1 && tabWidth > 0) ? totalWidth % tabWidth : 0
+
+ implicitWidth: tabWidth + remainder
+ implicitHeight: Math.round(40 * FlatStyle.scaleFactor)
+
+ Rectangle {
+ anchors.fill: parent
+ visible: styleData.pressed || !styleData.selected || styleData.activeFocus
+ opacity: styleData.enabled ? 1.0 : FlatStyle.disabledOpacity
+ color: styleData.activeFocus ? (styleData.pressed ? FlatStyle.checkedFocusedAndPressedColor : FlatStyle.focusedColor) :
+ styleData.pressed ? FlatStyle.pressedColor :
+ styleData.selected ? FlatStyle.backgroundColor :
+ !styleData.enabled ? FlatStyle.disabledColor : FlatStyle.styleColor
+ }
+
+ Text {
+ text: styleData.title
+ anchors.fill: parent
+ anchors.leftMargin: Math.round(5 * FlatStyle.scaleFactor)
+ anchors.rightMargin: anchors.leftMargin
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ font.family: FlatStyle.fontFamily
+ renderType: FlatStyle.__renderType
+ elide: Text.ElideRight
+ opacity: !styleData.enabled && styleData.selected ? FlatStyle.disabledOpacity : 1.0
+ color: !styleData.enabled && styleData.selected ? FlatStyle.disabledColor :
+ styleData.selected && styleData.enabled && !styleData.activeFocus && !styleData.pressed ? FlatStyle.styleColor : FlatStyle.selectedTextColor
+ }
+ }
+
+ tabBar: Rectangle {
+ color: FlatStyle.backgroundColor
+ border.color: control.frameVisible ? FlatStyle.lightFrameColor : "transparent"
+ anchors.fill: parent
+ Rectangle {
+ height: frameWidth
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.margins: frameWidth
+ y: control.tabPosition == Qt.TopEdge ? parent.height - height : 0
+ color: FlatStyle.backgroundColor
+ visible: control.frameVisible
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/TableViewStyle.qml b/src/extras/Styles/Flat/TableViewStyle.qml
new file mode 100644
index 00000000..c64628e8
--- /dev/null
+++ b/src/extras/Styles/Flat/TableViewStyle.qml
@@ -0,0 +1,163 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 1.3
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Flat 1.0
+
+Base.ScrollViewStyle {
+ readonly property TableView control: __control
+
+ readonly property color backgroundColor: "transparent"
+ readonly property color alternateBackgroundColor: FlatStyle.disabledColor
+
+ readonly property color textColor: FlatStyle.defaultTextColor
+ readonly property color highlightedTextColor: FlatStyle.styleColor
+
+ transientScrollBars: true
+
+ readonly property bool activateItemOnSingleClick: false
+
+ readonly property real __alternateBackgroundOpacity: 0.07
+ readonly property real __selectedBackgroundOpacity: 0.2
+ readonly property real __focusedBackgroundOpacity: 0.4
+ readonly property real __columnMargin: Math.round(20 * FlatStyle.scaleFactor)
+
+ frame: Item {
+ visible: control.frameVisible && control.alternatingRowColors
+ Rectangle {
+ anchors.bottom: parent.bottom
+ width: parent.width
+ height: 1
+ color: FlatStyle.mediumFrameColor
+ }
+ }
+
+ property Component headerDelegate: Rectangle {
+ height: Math.round(56 * FlatStyle.scaleFactor)
+ color: control.enabled ? FlatStyle.styleColor : FlatStyle.mediumFrameColor
+ Text {
+ anchors.fill: parent
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: styleData.textAlignment
+ anchors.leftMargin: __columnMargin
+ text: styleData.value
+ elide: Text.ElideRight
+ color: FlatStyle.selectedTextColor
+ font {
+ family: FlatStyle.fontFamily
+ pixelSize: FlatStyle.defaultFontSize * FlatStyle.scaleFactor
+ }
+
+ renderType: FlatStyle.__renderType
+ }
+
+ Rectangle {
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ height: Math.round(36 * FlatStyle.scaleFactor)
+ width: FlatStyle.onePixel
+ color: "white"
+ opacity: styleData.column !== control.columnCount - 1 ? 0.4 : 0
+ }
+ }
+
+ property Component rowDelegate: Item {
+ height: 46 * FlatStyle.scaleFactor
+ readonly property color selectedColor: styleData.hasActiveFocus ?
+ FlatStyle.focusedColor : FlatStyle.styleColor
+ readonly property bool selected: control.enabled && (styleData.hasActiveFocus || styleData.selected)
+
+ Rectangle {
+ id: bg
+ color: selected ? selectedColor :
+ styleData.alternate ? alternateBackgroundColor : backgroundColor
+ opacity: !control.enabled ? (styleData.alternate ? __alternateBackgroundOpacity : 1.0) :
+ styleData.hasActiveFocus ? __focusedBackgroundOpacity :
+ styleData.selected ? (styleData.alternate ? __selectedBackgroundOpacity : __alternateBackgroundOpacity) :
+ (styleData.alternate ? __alternateBackgroundOpacity : 1.0)
+ anchors.fill: parent
+ }
+
+ Rectangle {
+ // Bottom separator
+ visible: !control.alternatingRowColors
+ color: selected ? selectedColor : FlatStyle.mediumFrameColor
+ height: Math.round(1 * FlatStyle.scaleFactor)
+ width: parent.width
+ anchors.bottom: parent.bottom
+ }
+
+ Rectangle {
+ // Top separator. Only visible if the current row is selected. It hides
+ // the previous row's bottom separator when this row is selected or focused
+ visible: selected && !control.alternatingRowColors
+ color: selectedColor
+ height: Math.round(1 * FlatStyle.scaleFactor)
+ width: parent.width
+ anchors.bottom: parent.top
+ }
+ }
+
+ property Component itemDelegate: Item {
+ height: Math.round(46 * FlatStyle.scaleFactor)
+ implicitWidth: label.implicitWidth + __columnMargin
+
+ Text {
+ id: label
+ text: styleData.value !== undefined ? styleData.value : ""
+ elide: styleData.elideMode
+ color: !control.enabled ? FlatStyle.disabledColor :
+ styleData.hasActiveFocus ? FlatStyle.focusedTextColor :
+ styleData.textColor
+ opacity: !control.enabled ? FlatStyle.disabledOpacity : 1.0
+ font {
+ family: FlatStyle.fontFamily
+ pixelSize: FlatStyle.defaultFontSize * FlatStyle.scaleFactor
+ weight: control.enabled && (styleData.selected || styleData.hasActiveFocus) ?
+ Font.DemiBold : Font.Normal
+ }
+ renderType: FlatStyle.__renderType
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.leftMargin: __columnMargin
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+
+}
diff --git a/src/extras/Styles/Flat/TextAreaStyle.qml b/src/extras/Styles/Flat/TextAreaStyle.qml
new file mode 100644
index 00000000..52275f2f
--- /dev/null
+++ b/src/extras/Styles/Flat/TextAreaStyle.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Flat 1.0
+
+ScrollViewStyle {
+ readonly property TextArea control: __control
+
+ property font font
+ readonly property color textColor: !control.enabled ? FlatStyle.darkFrameColor : FlatStyle.defaultTextColor
+ readonly property color selectionColor: FlatStyle.textSelectionColor
+ readonly property color selectedTextColor: FlatStyle.defaultTextColor
+ readonly property color backgroundColor: "transparent"
+ readonly property int renderType: FlatStyle.__renderType
+ readonly property real textMargin: Math.round(10 * FlatStyle.scaleFactor)
+
+ font.family: FlatStyle.fontFamily
+
+ frame: Rectangle {
+ anchors.fill: parent
+ implicitWidth: Math.round(150 * FlatStyle.scaleFactor)
+ implicitHeight: Math.round(170 * FlatStyle.scaleFactor)
+ radius: control.frameVisible ? FlatStyle.radius : 0
+ border.width: (control.activeFocus ? FlatStyle.twoPixels : enabled ? FlatStyle.onePixel : 0)
+ border.color: !control.frameVisible ? "transparent" : control.activeFocus ? FlatStyle.highlightColor : FlatStyle.darkFrameColor
+ color: !control.backgroundVisible ? "transparent" : enabled ? FlatStyle.backgroundColor : FlatStyle.disabledColor
+ opacity: enabled ? 1.0 : 0.15
+ }
+
+ property Component __selectionHandle: SelectionHandleStyle { }
+ property Component __cursorHandle: CursorHandleStyle { }
+}
diff --git a/src/extras/Styles/Flat/TextFieldStyle.qml b/src/extras/Styles/Flat/TextFieldStyle.qml
new file mode 100644
index 00000000..060e63d1
--- /dev/null
+++ b/src/extras/Styles/Flat/TextFieldStyle.qml
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+
+Base.TextFieldStyle {
+ font.family: FlatStyle.fontFamily
+
+ textColor: !control.enabled ? FlatStyle.mediumFrameColor : FlatStyle.defaultTextColor
+ placeholderTextColor: FlatStyle.mediumFrameColor
+ selectionColor: FlatStyle.textSelectionColor
+ selectedTextColor: FlatStyle.defaultTextColor
+ renderType: FlatStyle.__renderType
+
+ padding {
+ top: 0
+ left: Math.round(FlatStyle.scaleFactor * 10)
+ right: Math.round(FlatStyle.scaleFactor * 10)
+ bottom: 0
+ }
+
+ background: Rectangle {
+ implicitWidth: Math.round(150 * FlatStyle.scaleFactor)
+ implicitHeight: Math.max(Math.round(26 * FlatStyle.scaleFactor), Math.round(control.__contentHeight * 1.2))
+ radius: FlatStyle.radius
+ border.width: (control.activeFocus ? FlatStyle.twoPixels : enabled ? FlatStyle.onePixel : 0)
+ border.color: control.activeFocus ? FlatStyle.highlightColor : FlatStyle.darkFrameColor
+ color: enabled ? FlatStyle.backgroundColor : FlatStyle.disabledColor
+ opacity: enabled ? 1.0 : 0.15
+ }
+
+ __selectionHandle: SelectionHandleStyle { }
+ __cursorHandle: CursorHandleStyle { }
+}
diff --git a/src/extras/Styles/Flat/ToggleButtonStyle.qml b/src/extras/Styles/Flat/ToggleButtonStyle.qml
new file mode 100644
index 00000000..3b120e1d
--- /dev/null
+++ b/src/extras/Styles/Flat/ToggleButtonStyle.qml
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+import QtQuick.Extras 1.3
+import QtQuick.Extras.Private 1.0
+import QtQuick.Extras.Styles 1.3 as Base
+
+Base.ToggleButtonStyle {
+ label: Label {
+ text: control.text
+ color: FlatStyle.mediumFrameColor
+ font.family: FlatStyle.fontFamily
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ renderType: FlatStyle.__renderType
+ }
+
+ background: Item {
+ implicitWidth: Math.round(100 * FlatStyle.scaleFactor)
+ implicitHeight: Math.round(52 * FlatStyle.scaleFactor)
+
+ readonly property real outerLightLineWidth: Math.max(4, Math.round(innerRect.radius * 0.5))
+ readonly property real thinDarkLineWidth: Math.max(1, FlatStyle.onePixel)
+ readonly property color indicatorColor: control.enabled ? (control.checked ? FlatStyle.styleColor : FlatStyle.invalidColor) : FlatStyle.lightFrameColor
+ readonly property bool hovered: control.hovered && (!Settings.hasTouchScreen && !Settings.isMobile)
+
+ Rectangle {
+ id: innerRect
+ color: control.enabled ? (control.pressed ? FlatStyle.lightFrameColor : "white") : Qt.rgba(0, 0, 0, 0.07)
+ border.color: control.enabled ? (hovered ? indicatorColor : FlatStyle.mediumFrameColor) : "#d8d8d8" // TODO: specs don't mention having a border for disabled toggle buttons
+ border.width: !control.activeFocus ? thinDarkLineWidth : 0
+ radius: Math.round(3 * FlatStyle.scaleFactor)
+ anchors.fill: parent
+
+ Item {
+ id: clipItem
+ x: control.checked ? width : 0
+ width: indicatorRect.width / 2
+ height: indicatorRect.height / 2
+ clip: true
+
+ Rectangle {
+ id: indicatorRect
+ x: control.checked ? -parent.width : 0
+ color: indicatorColor
+ radius: innerRect.radius
+ width: innerRect.width
+ height: Math.round(8 * FlatStyle.scaleFactor) * 2
+ }
+ }
+ }
+
+ Rectangle {
+ anchors.fill: innerRect
+ color: "transparent"
+ radius: innerRect.radius
+ border.color: FlatStyle.focusedColor
+ border.width: 2 * FlatStyle.scaleFactor
+ visible: control.activeFocus
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/ToolBarStyle.qml b/src/extras/Styles/Flat/ToolBarStyle.qml
new file mode 100644
index 00000000..0b6aa688
--- /dev/null
+++ b/src/extras/Styles/Flat/ToolBarStyle.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+
+Base.ToolBarStyle {
+ padding {
+ top: 0
+ left: Math.round(FlatStyle.scaleFactor * 10)
+ right: Math.round(FlatStyle.scaleFactor * 10)
+ bottom: 0
+ }
+
+ menuButton: Item {
+ implicitWidth: Math.round(FlatStyle.scaleFactor * 26)
+ implicitHeight: Math.round(FlatStyle.scaleFactor * 26)
+
+ ToolButtonBackground {
+ anchors.fill: parent
+ buttonEnabled: control.enabled
+ buttonHasActiveFocus: control.activeFocus
+ buttonPressed: styleData.pressed
+ buttonChecked: false
+ buttonHovered: !Settings.hasTouchScreen && styleData.hovered
+ }
+
+ ToolButtonIndicator {
+ buttonEnabled: control.enabled
+ buttonHasActiveFocus: styleData.activeFocus
+ buttonPressedOrChecked: styleData.pressed
+ anchors.centerIn: parent
+ }
+ }
+
+ background: Rectangle {
+ implicitHeight: Math.max(1, Math.round(FlatStyle.scaleFactor * 40))
+ color: FlatStyle.flatFrameColor
+ }
+}
diff --git a/src/extras/Styles/Flat/ToolButtonBackground.qml b/src/extras/Styles/Flat/ToolButtonBackground.qml
new file mode 100644
index 00000000..7dcd1ee0
--- /dev/null
+++ b/src/extras/Styles/Flat/ToolButtonBackground.qml
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Flat 1.0
+
+// Internal, for use with ToolButtonStyle and ToolBarStyle
+Rectangle {
+ id: background
+
+ property bool buttonEnabled: false
+ property bool buttonHasActiveFocus: false
+ property bool buttonHovered: false
+ property bool buttonChecked: false
+ property bool buttonPressed: false
+
+ color: {
+ if (buttonChecked) {
+ if (!buttonEnabled)
+ return "transparent";
+ if (buttonHasActiveFocus)
+ return buttonPressed ? FlatStyle.checkedFocusedAndPressedColor : FlatStyle.focusedAndPressedColor;
+ if (buttonPressed)
+ return Qt.rgba(0, 0, 0, 0.1);
+ return "transparent";
+ }
+
+ if (!buttonEnabled)
+ return "transparent";
+ if (buttonHasActiveFocus)
+ return buttonPressed ? FlatStyle.focusedAndPressedColor : "transparent";
+ if (buttonPressed)
+ return Qt.rgba(0, 0, 0, 0.1);
+ return "transparent";
+ }
+ border.color: {
+ if (buttonChecked) {
+ if (!buttonEnabled)
+ return Qt.rgba(0, 0, 0, 0.1);
+ if (buttonHasActiveFocus)
+ return "transparent";
+ if (buttonPressed)
+ return Qt.rgba(0, 0, 0, 0.2);
+ if (buttonHovered)
+ return Qt.rgba(0, 0, 0, 0.3);
+ return Qt.rgba(0, 0, 0, 0.2);
+ }
+
+ if (!buttonEnabled)
+ return "transparent";
+ if (buttonHasActiveFocus && !buttonPressed)
+ return FlatStyle.focusedColor;
+ if (buttonHovered && !buttonPressed)
+ return Qt.rgba(0, 0, 0, 0.2);
+ return "transparent";
+ }
+ border.width: buttonHasActiveFocus ? FlatStyle.twoPixels : FlatStyle.onePixel
+ radius: FlatStyle.radius
+}
diff --git a/src/extras/Styles/Flat/ToolButtonIndicator.qml b/src/extras/Styles/Flat/ToolButtonIndicator.qml
new file mode 100644
index 00000000..1c6ffc74
--- /dev/null
+++ b/src/extras/Styles/Flat/ToolButtonIndicator.qml
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Flat 1.0
+
+// Internal, for use with ToolButtonStyle and ToolBarStyle
+Item {
+ id: toolButtonIndicator
+ implicitWidth: Math.round(26 * FlatStyle.scaleFactor)
+ implicitHeight: Math.round(26 * FlatStyle.scaleFactor)
+
+ property bool buttonEnabled: false
+ property bool buttonHasActiveFocus: false
+ property bool buttonPressedOrChecked: false
+
+ Column {
+ anchors.centerIn: parent
+ spacing: Math.round(2 * FlatStyle.scaleFactor)
+
+ Repeater {
+ model: toolButtonIndicator.visible ? 3 : 0
+
+ Rectangle {
+ width: Math.round(4 * FlatStyle.scaleFactor)
+ height: width
+ radius: width / 2
+ color: !buttonEnabled ? FlatStyle.disabledColor : buttonPressedOrChecked && buttonHasActiveFocus
+ ? FlatStyle.selectedTextColor : buttonHasActiveFocus
+ ? FlatStyle.focusedColor : FlatStyle.defaultTextColor
+ opacity: !buttonEnabled ? FlatStyle.disabledOpacity : 1
+ }
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/ToolButtonStyle.qml b/src/extras/Styles/Flat/ToolButtonStyle.qml
new file mode 100644
index 00000000..60866e91
--- /dev/null
+++ b/src/extras/Styles/Flat/ToolButtonStyle.qml
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2 as Base
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Controls.Private 1.0
+
+Base.ButtonStyle {
+ padding { top: 0; left: 0; right: 0; bottom: 0 }
+
+ panel: Item {
+ id: panelItem
+
+ readonly property bool isDown: control.pressed || (control.checkable && control.checked)
+ readonly property bool hasIcon: icon.status === Image.Ready || icon.status === Image.Loading
+ readonly property bool hasMenu: !!control.menu
+ readonly property bool hasText: !!control.text
+ readonly property real margins: 10 * FlatStyle.scaleFactor
+
+ ToolButtonBackground {
+ id: background
+ anchors.fill: parent
+ buttonEnabled: control.enabled
+ buttonHasActiveFocus: control.activeFocus
+ buttonPressed: control.pressed
+ buttonChecked: control.checkable && control.checked
+ buttonHovered: !Settings.hasTouchScreen && control.hovered
+ }
+
+ implicitWidth: icon.implicitWidth + label.implicitWidth + indicator.implicitHeight
+ + (hasIcon || hasText ? panelItem.margins : 0) + (hasIcon && hasText ? panelItem.margins : 0)
+ implicitHeight: Math.max(background.height, Math.max(icon.implicitHeight, Math.max(label.implicitHeight, indicator.height)))
+ baselineOffset: label.y + label.baselineOffset
+
+ Image {
+ id: icon
+ visible: hasIcon
+ source: control.iconSource
+ anchors.leftMargin: panelItem.margins
+ anchors.verticalCenter: parent.verticalCenter
+ // center align when only icon, otherwise left align
+ anchors.left: hasMenu || hasText ? parent.left : undefined
+ anchors.horizontalCenter: !hasMenu && !hasText ? parent.horizontalCenter : undefined
+ }
+ Text {
+ id: label
+ visible: hasText
+ text: control.text
+ elide: Text.ElideRight
+ font.family: FlatStyle.fontFamily
+ renderType: FlatStyle.__renderType
+ color: !enabled ? FlatStyle.disabledColor : panelItem.isDown && control.activeFocus
+ ? FlatStyle.selectedTextColor : control.activeFocus
+ ? FlatStyle.focusedColor : FlatStyle.defaultTextColor
+ opacity: !enabled ? FlatStyle.disabledOpacity : 1.0
+ horizontalAlignment: hasMenu && !hasIcon ? Qt.AlignLeft : Qt.AlignHCenter
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: icon.right
+ anchors.right: indicator.left
+ anchors.leftMargin: hasIcon ? panelItem.margins : 0
+ anchors.rightMargin: hasMenu ? 0 : panelItem.margins
+ }
+ ToolButtonIndicator {
+ id: indicator
+ visible: panelItem.hasMenu
+ buttonEnabled: control.enabled
+ buttonHasActiveFocus: control.activeFocus
+ buttonPressedOrChecked: panelItem.isDown
+ anchors.verticalCenter: parent.verticalCenter
+ // center align when only menu, otherwise right align
+ anchors.right: hasIcon || hasText ? parent.right : undefined
+ anchors.horizontalCenter: !hasIcon && !hasText ? parent.horizontalCenter : undefined
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/TumblerStyle.qml b/src/extras/Styles/Flat/TumblerStyle.qml
new file mode 100644
index 00000000..cede9fee
--- /dev/null
+++ b/src/extras/Styles/Flat/TumblerStyle.qml
@@ -0,0 +1,167 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles.Flat 1.0
+import QtQuick.Extras.Styles 1.3 as Base
+
+Base.TumblerStyle {
+ id: tumblerStyle
+
+ padding.left: 0
+ padding.right: 0
+ padding.top: __frameHeight
+ padding.bottom: __frameHeight
+
+ visibleItemCount: 5
+
+ readonly property real __frameHeight: FlatStyle.onePixel
+
+ background: null
+
+ foreground: null
+
+ columnForeground: Item {
+ Item {
+ anchors.centerIn: parent
+ width: parent.width
+ height: tumblerStyle.__delegateHeight
+
+ Rectangle {
+ width: parent.width * 0.8
+ anchors.horizontalCenter: parent.horizontalCenter
+ height: __frameHeight
+ color: control.enabled ? FlatStyle.styleColor : FlatStyle.disabledColor
+ opacity: control.enabled ? 1 : 0.2
+ anchors.top: parent.top
+ visible: !styleData.activeFocus
+ }
+
+ Rectangle {
+ width: parent.width * 0.8
+ anchors.horizontalCenter: parent.horizontalCenter
+ height: __frameHeight
+ color: control.enabled ? FlatStyle.styleColor : FlatStyle.disabledColor
+ opacity: control.enabled ? 1 : 0.2
+ anchors.top: parent.bottom
+ visible: !styleData.activeFocus
+ }
+ }
+ }
+
+ highlight: Item {
+ id: highlightItem
+ implicitHeight: (control.height - padding.top - padding.bottom) / tumblerStyle.visibleItemCount
+
+ Rectangle {
+ color: styleData.activeFocus ? FlatStyle.highlightColor : "white"
+ width: parent.width
+ height: parent.height
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+
+ separator: null
+
+ frame: Item {
+ Rectangle {
+ height: __frameHeight
+ width: parent.width
+ color: FlatStyle.disabledColor
+ opacity: control.enabled ? 0.2 : 0.1
+ }
+
+ Rectangle {
+ height: __frameHeight
+ width: parent.width
+ anchors.bottom: parent.bottom
+ color: FlatStyle.disabledColor
+ opacity: control.enabled ? 0.2 : 0.1
+ }
+ }
+
+ delegate: Item {
+ id: delegateItem
+ implicitHeight: (control.height - padding.top - padding.bottom) / tumblerStyle.visibleItemCount
+
+ Text {
+ id: label
+ text: styleData.value
+ color: control.enabled ? (styleData.activeFocus ? FlatStyle.focusedTextColor : FlatStyle.defaultTextColor) : FlatStyle.disabledColor
+ opacity: control.enabled ? enabledOpacity : FlatStyle.disabledOpacity
+ font.pixelSize: Math.round(TextSingleton.font.pixelSize * 1.3)
+ font.family: FlatStyle.fontFamily
+ renderType: FlatStyle.__renderType
+ anchors.centerIn: parent
+
+ readonly property real enabledOpacity: 1.1 - Math.abs(styleData.displacement * 2) / tumblerStyle.visibleItemCount * (230 / 255)
+ }
+
+ Loader {
+ id: block
+ y: styleData.displacement < 0 ? 0 : (1 - offset) * parent.height
+ width: parent.width
+ height: parent.height * offset
+ clip: true
+ active: Math.abs(styleData.displacement) <= 1
+
+ property real offset: Math.max(0, 1 - Math.abs(styleData.displacement))
+
+ sourceComponent: Rectangle {
+ // Use a Rectangle that is the same color as the highlight in order to avoid rendering text on top of text.
+ color: styleData.activeFocus ? FlatStyle.highlightColor : "white"
+ anchors.fill: parent
+
+ Text {
+ id: focusText
+ y: styleData.displacement < 0 ? 0 : parent.height - height
+ width: parent.width
+ height: delegateItem.height
+ color: control.enabled ? (styleData.activeFocus ? "white" : FlatStyle.defaultTextColor) : FlatStyle.disabledColor
+ opacity: control.enabled ? 1 : FlatStyle.disabledOpacity
+ text: styleData.value
+ font.pixelSize: Math.round(TextSingleton.font.pixelSize * 1.5)
+ font.family: FlatStyle.fontFamily
+ renderType: FlatStyle.__renderType
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+ }
+ }
+ }
+}
diff --git a/src/extras/Styles/Flat/flatstyle.qrc b/src/extras/Styles/Flat/flatstyle.qrc
new file mode 100644
index 00000000..3084d51e
--- /dev/null
+++ b/src/extras/Styles/Flat/flatstyle.qrc
@@ -0,0 +1,51 @@
+<RCC>
+ <qresource prefix="/ExtrasImports/QtQuick/Controls/Styles/Flat">
+ <file>ApplicationWindowStyle.qml</file>
+ <file>BusyIndicatorStyle.qml</file>
+ <file>ButtonStyle.qml</file>
+ <file>CalendarStyle.qml</file>
+ <file>CheckBoxDrawer.qml</file>
+ <file>CheckBoxStyle.qml</file>
+ <file>CircularButtonStyle.qml</file>
+ <file>CircularGaugeStyle.qml</file>
+ <file>CircularTickmarkLabelStyle.qml</file>
+ <file>ComboBoxStyle.qml</file>
+ <file>CursorHandleStyle.qml</file>
+ <file>DelayButtonStyle.qml</file>
+ <file>DialStyle.qml</file>
+ <file>FlatStyle.qml</file>
+ <file>FocusFrameStyle.qml</file>
+ <file>GaugeStyle.qml</file>
+ <file>GroupBoxStyle.qml</file>
+ <file>LeftArrowIcon.qml</file>
+ <file>MenuBarStyle.qml</file>
+ <file>MenuStyle.qml</file>
+ <file>PieMenuStyle.qml</file>
+ <file>ProgressBarStyle.qml</file>
+ <file>RadioButtonStyle.qml</file>
+ <file>ScrollViewStyle.qml</file>
+ <file>SelectionHandleStyle.qml</file>
+ <file>SliderStyle.qml</file>
+ <file>SpinBoxStyle.qml</file>
+ <file>StatusBarStyle.qml</file>
+ <file>StatusIndicatorStyle.qml</file>
+ <file>SwitchStyle.qml</file>
+ <file>TabViewStyle.qml</file>
+ <file>TableViewStyle.qml</file>
+ <file>TextAreaStyle.qml</file>
+ <file>TextFieldStyle.qml</file>
+ <file>ToggleButtonStyle.qml</file>
+ <file>ToolBarStyle.qml</file>
+ <file>ToolButtonBackground.qml</file>
+ <file>ToolButtonIndicator.qml</file>
+ <file>ToolButtonStyle.qml</file>
+ <file>TumblerStyle.qml</file>
+ <file>images/BusyIndicator_Normal-Large.png</file>
+ <file>images/BusyIndicator_Normal-Medium.png</file>
+ <file>images/BusyIndicator_Normal-Small.png</file>
+ <file>fonts/LICENSE.txt</file>
+ <file>fonts/OpenSans-Light.ttf</file>
+ <file>fonts/OpenSans-Regular.ttf</file>
+ <file>fonts/OpenSans-Semibold.ttf</file>
+ </qresource>
+</RCC>
diff --git a/src/extras/Styles/Flat/flatstyleplugin.cpp b/src/extras/Styles/Flat/flatstyleplugin.cpp
new file mode 100644
index 00000000..e3bffd5c
--- /dev/null
+++ b/src/extras/Styles/Flat/flatstyleplugin.cpp
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "flatstyleplugin.h"
+
+#include <QtCore/qglobal.h>
+#include <QtCore/qfile.h>
+#include <QtCore/qdebug.h>
+
+#include "qquicktexthandle.h"
+
+static void initResources()
+{
+ Q_INIT_RESOURCE(flatstyle);
+}
+
+extern "C" {
+ Q_DECL_EXPORT bool qt_quick_controls_style_init()
+ {
+ initResources();
+ return true;
+ }
+
+ Q_DECL_EXPORT const char* qt_quick_controls_style_path()
+ {
+ return "qrc:/ExtrasImports/QtQuick/Controls/Styles/";
+ }
+}
+
+QT_BEGIN_NAMESPACE
+
+QtQuickExtrasStylesPlugin::QtQuickExtrasStylesPlugin(QObject *parent) :
+ QQmlExtensionPlugin(parent)
+{
+}
+
+void QtQuickExtrasStylesPlugin::registerTypes(const char *uri)
+{
+ Q_INIT_RESOURCE(flatstyle);
+
+ const QString prefix = "qrc:/ExtrasImports/QtQuick/Controls/Styles/Flat/";
+ // register version 1.0
+ qmlRegisterSingletonType(QUrl(prefix + "FlatStyle.qml"), uri, 1, 0, "FlatStyle");
+ qmlRegisterType(QUrl(prefix + "ApplicationWindowStyle.qml"), uri, 1, 0, "ApplicationWindowStyle");
+ qmlRegisterType(QUrl(prefix + "BusyIndicatorStyle.qml"), uri, 1, 0, "BusyIndicatorStyle");
+ qmlRegisterType(QUrl(prefix + "ButtonStyle.qml"), uri, 1, 0, "ButtonStyle");
+ qmlRegisterType(QUrl(prefix + "CalendarStyle.qml"), uri, 1, 0, "CalendarStyle");
+ qmlRegisterType(QUrl(prefix + "CheckBoxStyle.qml"), uri, 1, 0, "CheckBoxStyle");
+ qmlRegisterType(QUrl(prefix + "CheckBoxDrawer.qml"), uri, 1, 0, "CheckBoxDrawer");
+ qmlRegisterType(QUrl(prefix + "CircularButtonStyle.qml"), uri, 1, 0, "CircularButtonStyle");
+ qmlRegisterType(QUrl(prefix + "CircularGaugeStyle.qml"), uri, 1, 0, "CircularGaugeStyle");
+ qmlRegisterType(QUrl(prefix + "CircularTickmarkLabelStyle.qml"), uri, 1, 0, "CircularTickmarkLabelStyle");
+ qmlRegisterType(QUrl(prefix + "ComboBoxStyle.qml"), uri, 1, 0, "ComboBoxStyle");
+ qmlRegisterType(QUrl(prefix + "CursorHandleStyle.qml"), uri, 1, 0, "CursorHandleStyle");
+ qmlRegisterType(QUrl(prefix + "DelayButtonStyle.qml"), uri, 1, 0, "DelayButtonStyle");
+ qmlRegisterType(QUrl(prefix + "FocusFrameStyle.qml"), uri, 1, 0, "FocusFrameStyle");
+ qmlRegisterType(QUrl(prefix + "GaugeStyle.qml"), uri, 1, 0, "GaugeStyle");
+ qmlRegisterType(QUrl(prefix + "GroupBoxStyle.qml"), uri, 1, 0, "GroupBoxStyle");
+ qmlRegisterType(QUrl(prefix + "LeftArrowIcon.qml"), uri, 1, 0, "LeftArrowIcon");
+ qmlRegisterType(QUrl(prefix + "MenuBarStyle.qml"), uri, 1, 0, "MenuBarStyle");
+ qmlRegisterType(QUrl(prefix + "PieMenuStyle.qml"), uri, 1, 0, "PieMenuStyle");
+ qmlRegisterType(QUrl(prefix + "ProgressBarStyle.qml"), uri, 1, 0, "ProgressBarStyle");
+ qmlRegisterType(QUrl(prefix + "RadioButtonStyle.qml"), uri, 1, 0, "RadioButtonStyle");
+ qmlRegisterType(QUrl(prefix + "ScrollViewStyle.qml"), uri, 1, 0, "ScrollViewStyle");
+ qmlRegisterType(QUrl(prefix + "SelectionHandleStyle.qml"), uri, 1, 0, "SelectionHandleStyle");
+ qmlRegisterType(QUrl(prefix + "SliderStyle.qml"), uri, 1, 0, "SliderStyle");
+ qmlRegisterType(QUrl(prefix + "SpinBoxStyle.qml"), uri, 1, 0, "SpinBoxStyle");
+ qmlRegisterType(QUrl(prefix + "StatusBarStyle.qml"), uri, 1, 0, "StatusBarStyle");
+ qmlRegisterType(QUrl(prefix + "StatusIndicatorStyle.qml"), uri, 1, 0, "StatusIndicatorStyle");
+ qmlRegisterType(QUrl(prefix + "SwitchStyle.qml"), uri, 1, 0, "SwitchStyle");
+ qmlRegisterType(QUrl(prefix + "TabViewStyle.qml"), uri, 1, 0, "TabViewStyle");
+ qmlRegisterType(QUrl(prefix + "TableViewStyle.qml"), uri, 1, 0, "TableViewStyle");
+ qmlRegisterType(QUrl(prefix + "TextAreaStyle.qml"), uri, 1, 0, "TextAreaStyle");
+ qmlRegisterType(QUrl(prefix + "TextFieldStyle.qml"), uri, 1, 0, "TextFieldStyle");
+ qmlRegisterType(QUrl(prefix + "ToggleButtonStyle.qml"), uri, 1, 0, "ToggleButtonStyle");
+ qmlRegisterType(QUrl(prefix + "ToolBarStyle.qml"), uri, 1, 0, "ToolBarStyle");
+ qmlRegisterType(QUrl(prefix + "ToolButtonStyle.qml"), uri, 1, 0, "ToolButtonStyle");
+ qmlRegisterType(QUrl(prefix + "ToolButtonBackground.qml"), uri, 1, 0, "ToolButtonBackground");
+ qmlRegisterType(QUrl(prefix + "ToolButtonIndicator.qml"), uri, 1, 0, "ToolButtonIndicator");
+ qmlRegisterType(QUrl(prefix + "TumblerStyle.qml"), uri, 1, 0, "TumblerStyle");
+ qmlRegisterType<QQuickTextHandle>("QtQuick.Controls.Styles.Flat", 1, 0, "TextHandle");
+}
+
+QT_END_NAMESPACE
diff --git a/src/extras/Styles/Flat/flatstyleplugin.h b/src/extras/Styles/Flat/flatstyleplugin.h
new file mode 100644
index 00000000..4f1fb6d1
--- /dev/null
+++ b/src/extras/Styles/Flat/flatstyleplugin.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef STYLES_PLUGIN_H
+#define STYLES_PLUGIN_H
+
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include <QtQml/qqmlengine.h>
+
+QT_BEGIN_NAMESPACE
+
+class QtQuickExtrasStylesPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
+public:
+ explicit QtQuickExtrasStylesPlugin(QObject *parent = 0);
+
+ void registerTypes(const char *uri);
+};
+
+QT_END_NAMESPACE
+
+#endif // STYLES_PLUGIN_H
diff --git a/src/extras/Styles/Flat/fonts/LICENSE.txt b/src/extras/Styles/Flat/fonts/LICENSE.txt
new file mode 100644
index 00000000..d6456956
--- /dev/null
+++ b/src/extras/Styles/Flat/fonts/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/src/extras/Styles/Flat/fonts/OpenSans-Light.ttf b/src/extras/Styles/Flat/fonts/OpenSans-Light.ttf
new file mode 100644
index 00000000..0d381897
--- /dev/null
+++ b/src/extras/Styles/Flat/fonts/OpenSans-Light.ttf
Binary files differ
diff --git a/src/extras/Styles/Flat/fonts/OpenSans-Regular.ttf b/src/extras/Styles/Flat/fonts/OpenSans-Regular.ttf
new file mode 100644
index 00000000..db433349
--- /dev/null
+++ b/src/extras/Styles/Flat/fonts/OpenSans-Regular.ttf
Binary files differ
diff --git a/src/extras/Styles/Flat/fonts/OpenSans-Semibold.ttf b/src/extras/Styles/Flat/fonts/OpenSans-Semibold.ttf
new file mode 100644
index 00000000..1a7679e3
--- /dev/null
+++ b/src/extras/Styles/Flat/fonts/OpenSans-Semibold.ttf
Binary files differ
diff --git a/src/extras/Styles/Flat/images/BusyIndicator_Normal-Large.png b/src/extras/Styles/Flat/images/BusyIndicator_Normal-Large.png
new file mode 100644
index 00000000..6f9e6e25
--- /dev/null
+++ b/src/extras/Styles/Flat/images/BusyIndicator_Normal-Large.png
Binary files differ
diff --git a/src/extras/Styles/Flat/images/BusyIndicator_Normal-Medium.png b/src/extras/Styles/Flat/images/BusyIndicator_Normal-Medium.png
new file mode 100644
index 00000000..2922e2a3
--- /dev/null
+++ b/src/extras/Styles/Flat/images/BusyIndicator_Normal-Medium.png
Binary files differ
diff --git a/src/extras/Styles/Flat/images/BusyIndicator_Normal-Small.png b/src/extras/Styles/Flat/images/BusyIndicator_Normal-Small.png
new file mode 100644
index 00000000..c1e1b1f1
--- /dev/null
+++ b/src/extras/Styles/Flat/images/BusyIndicator_Normal-Small.png
Binary files differ
diff --git a/src/extras/Styles/Flat/qmldir b/src/extras/Styles/Flat/qmldir
new file mode 100644
index 00000000..2b6390a4
--- /dev/null
+++ b/src/extras/Styles/Flat/qmldir
@@ -0,0 +1,3 @@
+module QtQuick.Controls.Styles.Flat
+plugin qtquickextrasflatplugin
+classname QtQuickExtrasFlatPlugin
diff --git a/src/extras/Styles/Flat/qquicktexthandle.cpp b/src/extras/Styles/Flat/qquicktexthandle.cpp
new file mode 100644
index 00000000..57029b8f
--- /dev/null
+++ b/src/extras/Styles/Flat/qquicktexthandle.cpp
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquicktexthandle.h"
+
+QQuickTextHandle::QQuickTextHandle(QQuickItem *parent) :
+ QQuickPaintedItem(parent)
+{
+ setAntialiasing(true);
+}
+
+QQuickTextHandle::~QQuickTextHandle()
+{
+}
+
+void QQuickTextHandle::paint(QPainter *painter)
+{
+ painter->save();
+ paintBulb(painter, QColor(0, 0, 0, 38), true);
+ painter->restore();
+
+ paintBulb(painter, mColor, false);
+ painter->fillRect((mType == SelectionHandle ? 10 : 1), 0, 2, 23, mColor);
+}
+
+QQuickTextHandle::TextHandleType QQuickTextHandle::type() const
+{
+ return mType;
+}
+
+void QQuickTextHandle::setType(QQuickTextHandle::TextHandleType type)
+{
+ if (mType != type) {
+ mType = type;
+ update();
+ emit typeChanged();
+ }
+}
+
+QColor QQuickTextHandle::color() const
+{
+ return mColor;
+}
+
+void QQuickTextHandle::setColor(const QColor &color)
+{
+ if (mColor != color) {
+ mColor = color;
+ update();
+ emit colorChanged();
+ }
+}
+
+qreal QQuickTextHandle::scaleFactor() const
+{
+ return mScaleFactor;
+}
+
+void QQuickTextHandle::setScaleFactor(qreal scaleFactor)
+{
+ if (mScaleFactor != scaleFactor) {
+ mScaleFactor = scaleFactor;
+ setImplicitWidth(qRound(28 * mScaleFactor));
+ // + 2 for shadows
+ setImplicitHeight(qRound((32 + 2) * mScaleFactor));
+ update();
+ emit scaleFactorChanged();
+ }
+}
+
+void QQuickTextHandle::paintBulb(QPainter *painter, const QColor &color, bool isShadow)
+{
+ painter->scale(mScaleFactor, mScaleFactor);
+ QPainterPath path;
+
+ if (mType == SelectionHandle) {
+ painter->translate(16, isShadow ? 2 : 0);
+ path.moveTo(10.242, 28.457);
+ path.cubicTo(7.8980000000000015, 30.799, 4.099000000000001, 30.799,1.7560000000000002, 28.457);
+ path.cubicTo(-0.5859999999999999, 26.115000000000002, -0.5859999999999999,22.314, 1.7560000000000002, 19.973);
+ path.cubicTo(4.748, 16.980999999999998, 11.869, 18.343999999999998, 11.869, 18.343999999999998);
+ path.cubicTo(11.869, 18.343999999999998, 13.244, 25.455, 10.242, 28.457);
+
+ } else {
+ if (isShadow)
+ painter->translate(0, 2);
+ path.moveTo(2.757,28.457);
+ path.cubicTo(5.101,30.799,8.899000000000001,30.799,11.243,28.457);
+ path.cubicTo(13.585,26.115000000000002,13.585,22.314,11.243,19.973);
+ path.cubicTo(8.251,16.98,1.13,18.344,1.13,18.344);
+ path.cubicTo(1.13,18.344,-0.245,25.455,2.757,28.457);
+ }
+
+ painter->fillPath(path, QBrush(color));
+}
+
diff --git a/src/extras/Styles/Flat/qquicktexthandle.h b/src/extras/Styles/Flat/qquicktexthandle.h
new file mode 100644
index 00000000..4df6d42d
--- /dev/null
+++ b/src/extras/Styles/Flat/qquicktexthandle.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKTEXTHANDLE_H
+#define QQUICKTEXTHANDLE_H
+
+#include <QPainter>
+#include <QQuickPaintedItem>
+
+class QQuickTextHandle : public QQuickPaintedItem
+{
+ Q_OBJECT
+ Q_PROPERTY(TextHandleType type READ type WRITE setType NOTIFY typeChanged)
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+ Q_PROPERTY(qreal scaleFactor READ scaleFactor WRITE setScaleFactor NOTIFY scaleFactorChanged)
+ Q_ENUMS(TextHandleType)
+public:
+ enum TextHandleType {
+ CursorHandle = 0,
+ SelectionHandle = 1
+ };
+
+ QQuickTextHandle(QQuickItem *parent = 0);
+ ~QQuickTextHandle();
+
+ void paint(QPainter *painter) Q_DECL_OVERRIDE;
+
+ TextHandleType type() const;
+ void setType(TextHandleType type);
+
+ QColor color() const;
+ void setColor(const QColor &color);
+
+ qreal scaleFactor() const;
+ void setScaleFactor(qreal scaleFactor);
+
+Q_SIGNALS:
+ void typeChanged();
+ void colorChanged();
+ void scaleFactorChanged();
+
+private:
+ void paintBulb(QPainter *painter, const QColor &color, bool isShadow);
+
+ TextHandleType mType;
+ QColor mColor;
+ qreal mScaleFactor;
+};
+
+#endif // QQUICKTEXTHANDLE_H