diff options
Diffstat (limited to 'src/imports/controls')
305 files changed, 5151 insertions, 2561 deletions
diff --git a/src/imports/controls/AbstractButton.qml b/src/imports/controls/AbstractButton.qml index 487b452b..a45c6816 100644 --- a/src/imports/controls/AbstractButton.qml +++ b/src/imports/controls/AbstractButton.qml @@ -34,8 +34,8 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T T.AbstractButton { id: control diff --git a/src/imports/controls/ApplicationWindow.qml b/src/imports/controls/ApplicationWindow.qml index 98de8946..e82430e5 100644 --- a/src/imports/controls/ApplicationWindow.qml +++ b/src/imports/controls/ApplicationWindow.qml @@ -34,20 +34,22 @@ ** ****************************************************************************/ -import QtQuick 2.6 +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Window 2.2 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates 2.1 as T T.ApplicationWindow { id: window - color: "#ffffff" + color: Default.backgroundColor overlay.modal: Rectangle { - color: "#7f28282a" + color: Default.overlayModalColor } overlay.modeless: Rectangle { - color: "#1f28282a" + color: Default.overlayDimColor } } diff --git a/src/imports/controls/BusyIndicator.qml b/src/imports/controls/BusyIndicator.qml index 9be1f046..171e5869 100644 --- a/src/imports/controls/BusyIndicator.qml +++ b/src/imports/controls/BusyIndicator.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Controls 2.0 -import QtQuick.Controls.impl 2.0 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.BusyIndicator { id: control diff --git a/src/imports/controls/Button.qml b/src/imports/controls/Button.qml index 1a974eed..85d52b12 100644 --- a/src/imports/controls/Button.qml +++ b/src/imports/controls/Button.qml @@ -34,8 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.Button { id: control @@ -54,7 +56,9 @@ T.Button { text: control.text font: control.font opacity: enabled || control.highlighted || control.checked ? 1 : 0.3 - color: control.checked || control.highlighted ? "#ffffff" : (control.visualFocus ? "#0066ff" : (control.down ? "#26282a" : "#353637")) + color: control.checked || control.highlighted ? + Default.textLightColor : + (control.visualFocus ? Default.focusColor : (control.down ? Default.textDarkColor : Default.textColor)) horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter elide: Text.ElideRight @@ -65,9 +69,9 @@ T.Button { implicitHeight: 40 visible: !control.flat || control.down || control.checked || control.highlighted color: control.checked || control.highlighted ? - (control.visualFocus ? (control.down ? "#599bff" : "#0066ff") : (control.down ? "#585a5c" : "#353637")) : - (control.visualFocus ? (control.down ? "#cce0ff" : "#f0f6ff") : (control.down ? "#d0d0d0" : "#e0e0e0")) - border.color: "#0066ff" + (control.visualFocus ? (control.down ? Default.buttonCheckedFocusColor : Default.focusColor) : (control.down ? Default.buttonCheckedPressedColor : Default.textColor)) : + (control.visualFocus ? (control.down ? Default.focusPressedColor : Default.focusLightColor) : (control.down ? Default.buttonPressedColor : Default.buttonColor)) + border.color: Default.focusColor border.width: control.visualFocus ? 2 : 0 } } diff --git a/src/imports/controls/CheckBox.qml b/src/imports/controls/CheckBox.qml index 632097b1..98fb31e1 100644 --- a/src/imports/controls/CheckBox.qml +++ b/src/imports/controls/CheckBox.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls 2.0 -import QtQuick.Controls.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 T.CheckBox { id: control @@ -64,7 +64,7 @@ T.CheckBox { text: control.text font: control.font - color: control.down ? "#26282a" : "#353637" + color: control.down ? Default.textDarkColor : Default.textColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft diff --git a/src/imports/controls/CheckDelegate.qml b/src/imports/controls/CheckDelegate.qml index 96cb48e0..929dc4b5 100644 --- a/src/imports/controls/CheckDelegate.qml +++ b/src/imports/controls/CheckDelegate.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls 2.0 -import QtQuick.Controls.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 T.CheckDelegate { id: control @@ -58,7 +58,7 @@ T.CheckDelegate { text: control.text font: control.font - color: control.enabled ? "#26282a" : "#bdbebf" + color: control.enabled ? Default.textDarkColor : Default.textDisabledColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft @@ -76,6 +76,6 @@ T.CheckDelegate { implicitWidth: 100 implicitHeight: 40 visible: control.down || control.highlighted - color: control.down ? "#bdbebf" : "#eeeeee" + color: control.down ? Default.delegatePressedColor : Default.delegateColor } } diff --git a/src/imports/controls/CheckIndicator.qml b/src/imports/controls/CheckIndicator.qml index 5aad92ef..9078e0c6 100644 --- a/src/imports/controls/CheckIndicator.qml +++ b/src/imports/controls/CheckIndicator.qml @@ -34,7 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 Rectangle { id: indicator @@ -44,15 +46,19 @@ Rectangle { implicitWidth: 28 implicitHeight: 28 - color: control.enabled ? (control.down ? (control.visualFocus ? "#cce0ff" : "#f6f6f6") : "#ffffff") : "#353637" + color: control.enabled ? (control.down + ? (control.visualFocus ? Default.focusPressedColor : Default.indicatorPressedColor) + : Default.backgroundColor) : Default.disabledDarkColor border.width: control.visualFocus ? 2 : 1 - border.color: control.enabled ? (control.visualFocus ? "#0066ff" : (control.down ? "#808080" : "#909090")) : "transparent" + border.color: control.enabled ? (control.visualFocus + ? Default.focusColor + : (control.down ? Default.indicatorFramePressedColor : Default.indicatorFrameColor)) : "transparent" opacity: enabled ? 1 : 0.3 Image { x: (parent.width - width) / 2 y: (parent.height - height) / 2 - source: "image://default/check/" + (control.visualFocus ? "#0066ff" : "#353637") + source: "image://default/check/" + (control.visualFocus ? Default.focusColor : Default.textColor) sourceSize.width: width sourceSize.height: height visible: control.checkState === Qt.Checked @@ -63,7 +69,7 @@ Rectangle { y: (parent.height - height) / 2 width: 16 height: 3 - color: control.visualFocus ? "#0066ff" : "#353637" + color: control.visualFocus ? Default.focusColor : Default.frameDarkColor visible: control.checkState === Qt.PartiallyChecked } } diff --git a/src/imports/controls/ComboBox.qml b/src/imports/controls/ComboBox.qml index 31f2e5d9..e174a70d 100644 --- a/src/imports/controls/ComboBox.qml +++ b/src/imports/controls/ComboBox.qml @@ -34,10 +34,11 @@ ** ****************************************************************************/ -import QtQuick 2.6 +import QtQuick 2.8 import QtQuick.Window 2.2 -import QtQuick.Controls 2.0 -import QtQuick.Templates 2.0 as T +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.ComboBox { id: control @@ -59,12 +60,13 @@ T.ComboBox { text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal highlighted: control.highlightedIndex == index + hoverEnabled: control.hoverEnabled } indicator: Image { x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding y: control.topPadding + (control.availableHeight - height) / 2 - source: "image://default/double-arrow/" + (control.visualFocus ? "#0066ff" : "#353637") + source: "image://default/double-arrow/" + (control.visualFocus ? Default.focusColor : Default.textColor) sourceSize.width: width sourceSize.height: height opacity: enabled ? 1 : 0.3 @@ -76,7 +78,7 @@ T.ComboBox { text: control.displayText font: control.font - color: control.visualFocus ? "#0066ff" : "#353637" + color: control.visualFocus ? Default.focusColor : Default.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter elide: Text.ElideRight @@ -87,10 +89,11 @@ T.ComboBox { implicitWidth: 120 implicitHeight: 40 - color: control.visualFocus ? (control.pressed ? "#cce0ff" : "#f0f6ff") : - (control.pressed || popup.visible ? "#d0d0d0" : "#e0e0e0") - border.color: "#0066ff" + color: control.visualFocus ? (control.pressed ? Default.focusPressedColor : Default.focusLightColor) : + (control.pressed || popup.visible ? Default.buttonPressedColor : Default.buttonColor) + border.color: Default.focusColor border.width: control.visualFocus ? 2 : 0 + visible: !control.flat || control.pressed } popup: T.Popup { @@ -115,7 +118,7 @@ T.ComboBox { width: listview.width height: listview.height color: "transparent" - border.color: "#bdbebf" + border.color: Default.frameLightColor } T.ScrollIndicator.vertical: ScrollIndicator { } diff --git a/src/imports/controls/Container.qml b/src/imports/controls/Container.qml index 9e9215f8..d3aa89bc 100644 --- a/src/imports/controls/Container.qml +++ b/src/imports/controls/Container.qml @@ -34,8 +34,8 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T T.Container { id: control diff --git a/src/imports/controls/Control.qml b/src/imports/controls/Control.qml index a4bb95fe..92b1cfd2 100644 --- a/src/imports/controls/Control.qml +++ b/src/imports/controls/Control.qml @@ -34,8 +34,8 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T T.Control { id: control diff --git a/src/imports/controls/Dial.qml b/src/imports/controls/Dial.qml index cd4d6ba2..67c3b0fb 100644 --- a/src/imports/controls/Dial.qml +++ b/src/imports/controls/Dial.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Controls 2.0 -import QtQuick.Controls.impl 2.0 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.Dial { id: control @@ -48,7 +48,7 @@ T.Dial { background: DialRing { width: control.availableWidth height: control.availableHeight - color: control.visualFocus ? "#0066ff" : "#353637" + color: control.visualFocus ? Default.focusColor : Default.frameDarkColor progress: control.position opacity: control.enabled ? 1 : 0.3 } @@ -59,7 +59,7 @@ T.Dial { y: background.y + background.height / 2 - handle.height / 2 width: 14 height: 10 - source: "image://default/dial-indicator/" + (control.visualFocus ? "#0066ff" : "#353637") + source: "image://default/dial-indicator/" + (control.visualFocus ? Default.focusColor : Default.textColor) sourceSize.width: width sourceSize.height: height antialiasing: true diff --git a/src/imports/controls/Dialog.qml b/src/imports/controls/Dialog.qml new file mode 100644 index 00000000..1cf64164 --- /dev/null +++ b/src/imports/controls/Dialog.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 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.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 + +T.Dialog { + id: control + + implicitWidth: Math.max(background ? background.implicitWidth : 0, + header && header.visible ? header.implicitWidth : 0, + footer && footer.visible ? footer.implicitWidth : 0, + contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0) + implicitHeight: Math.max(background ? background.implicitHeight : 0, + (header && header.visible ? header.implicitHeight + spacing : 0) + + (footer && footer.visible ? footer.implicitHeight + spacing : 0) + + (contentHeight > 0 ? contentHeight + topPadding + bottomPadding : 0)) + + contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) + contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) + + padding: 12 + + background: Rectangle { + border.color: Default.frameDarkColor + } + + header: Label { + text: control.title + visible: control.title + elide: Label.ElideRight + font.bold: true + padding: 12 + background: Rectangle { + x: 1; y: 1 + width: parent.width - 2 + height: parent.height - 1 + } + } + + footer: DialogButtonBox { + visible: count > 0 + } +} diff --git a/src/imports/controls/DialogButtonBox.qml b/src/imports/controls/DialogButtonBox.qml new file mode 100644 index 00000000..9f4ebce5 --- /dev/null +++ b/src/imports/controls/DialogButtonBox.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 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.8 +import QtQuick.Templates 2.1 as T + +T.DialogButtonBox { + id: control + + implicitWidth: Math.max(background ? background.implicitWidth : 0, + contentItem.implicitWidth + leftPadding + rightPadding) + implicitHeight: Math.max(background ? background.implicitHeight : 0, + contentItem.implicitHeight + topPadding + bottomPadding) + + spacing: 1 + padding: 12 + alignment: count === 1 ? Qt.AlignRight : undefined + + delegate: Button { + width: control.count === 1 ? control.availableWidth / 2 : undefined + } + + contentItem: ListView { + implicitWidth: contentWidth + implicitHeight: 40 + + model: control.contentModel + spacing: control.spacing + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + snapMode: ListView.SnapToItem + } + + background: Rectangle { + implicitHeight: 40 + x: 1; y: 1 + width: parent.width - 2 + height: parent.height - 2 + } +} diff --git a/src/imports/controls/Drawer.qml b/src/imports/controls/Drawer.qml index 6e9ab71f..a90893d9 100644 --- a/src/imports/controls/Drawer.qml +++ b/src/imports/controls/Drawer.qml @@ -34,8 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.Drawer { id: control @@ -56,14 +58,12 @@ T.Drawer { enter: Transition { SmoothedAnimation { velocity: 5 } } exit: Transition { SmoothedAnimation { velocity: 5 } } - contentItem: Item { } - background: Rectangle { Rectangle { readonly property bool horizontal: control.edge === Qt.LeftEdge || control.edge === Qt.RightEdge width: horizontal ? 1 : parent.width height: horizontal ? parent.height : 1 - color: "#353637" + color: Default.frameDarkColor x: control.edge === Qt.LeftEdge ? parent.width - 1 : 0 y: control.edge === Qt.TopEdge ? parent.height - 1 : 0 } diff --git a/src/imports/controls/Frame.qml b/src/imports/controls/Frame.qml index b7968cb4..6086d92b 100644 --- a/src/imports/controls/Frame.qml +++ b/src/imports/controls/Frame.qml @@ -34,8 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.Frame { id: control @@ -48,10 +50,8 @@ T.Frame { padding: 12 - contentItem: Item { } - background: Rectangle { color: "transparent" - border.color: "#bdbebf" + border.color: Default.frameLightColor } } diff --git a/src/imports/controls/GroupBox.qml b/src/imports/controls/GroupBox.qml index 31f4963f..4f083b15 100644 --- a/src/imports/controls/GroupBox.qml +++ b/src/imports/controls/GroupBox.qml @@ -34,8 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.GroupBox { id: control @@ -52,15 +54,13 @@ T.GroupBox { padding: 12 topPadding: padding + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0) - contentItem: Item { } - label: Text { x: control.leftPadding width: control.availableWidth text: control.title font: control.font - color: control.enabled ? "#353637" : "#bdbebf" + color: control.enabled ? Default.textColor : Default.textDisabledColor elide: Text.ElideRight horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter @@ -72,6 +72,6 @@ T.GroupBox { height: parent.height - control.topPadding + control.padding color: "transparent" - border.color: "#bdbebf" + border.color: Default.frameLightColor } } diff --git a/src/imports/controls/ItemDelegate.qml b/src/imports/controls/ItemDelegate.qml index 519ef3bf..23d72080 100644 --- a/src/imports/controls/ItemDelegate.qml +++ b/src/imports/controls/ItemDelegate.qml @@ -34,8 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.ItemDelegate { id: control @@ -56,7 +58,7 @@ T.ItemDelegate { text: control.text font: control.font - color: control.enabled ? "#26282a" : "#bdbebf" + color: control.enabled ? Default.textDarkColor : Default.textDisabledColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft @@ -67,6 +69,8 @@ T.ItemDelegate { implicitWidth: 100 implicitHeight: 40 visible: control.down || control.highlighted || control.visualFocus - color: control.visualFocus ? (control.pressed ? "#cce0ff" : "#e5efff") : (control.down ? "#bdbebf" : "#eeeeee") + color: control.visualFocus + ? (control.pressed ? Default.focusPressedColor : Default.delegateFocusColor) + : (control.down ? Default.delegatePressedColor : Default.delegateColor) } } diff --git a/src/imports/controls/Label.qml b/src/imports/controls/Label.qml index d0f01613..c492cd7a 100644 --- a/src/imports/controls/Label.qml +++ b/src/imports/controls/Label.qml @@ -34,12 +34,14 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.Label { id: control - color: "#26282a" - linkColor: "#45a7d7" // TODO + color: Default.textDarkColor + linkColor: Default.textLinkColor } diff --git a/src/imports/controls/Menu.qml b/src/imports/controls/Menu.qml index d9a97cee..e449f6d1 100644 --- a/src/imports/controls/Menu.qml +++ b/src/imports/controls/Menu.qml @@ -34,9 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Controls 2.0 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.Menu { id: control @@ -63,7 +64,7 @@ T.Menu { background: Rectangle { implicitWidth: 200 implicitHeight: 40 - color: "#ffffff" - border.color: "#353637" + color: Default.backgroundColor + border.color: Default.frameDarkColor } } diff --git a/src/imports/controls/MenuItem.qml b/src/imports/controls/MenuItem.qml index 69f00900..cd224393 100644 --- a/src/imports/controls/MenuItem.qml +++ b/src/imports/controls/MenuItem.qml @@ -34,8 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.MenuItem { id: control @@ -55,7 +57,7 @@ T.MenuItem { text: control.text font: control.font - color: control.enabled ? "#26282a" : "#bdbebf" + color: control.enabled ? Default.textDarkColor : Default.textDisabledColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft @@ -79,7 +81,7 @@ T.MenuItem { y: 1 width: parent.width - 2 height: parent.height - 2 - color: control.visualFocus || control.down ? "#eeeeee" : "transparent" + color: control.visualFocus || control.down ? Default.delegateColor : "transparent" } } } diff --git a/src/imports/controls/MenuSeparator.qml b/src/imports/controls/MenuSeparator.qml new file mode 100644 index 00000000..ef075ef9 --- /dev/null +++ b/src/imports/controls/MenuSeparator.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 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.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T + +T.MenuSeparator { + id: control + + implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding) + implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding) + + padding: 2 + topPadding: padding + 4 + bottomPadding: padding + 4 + + //! [contentItem] + contentItem: Rectangle { + implicitWidth: 188 + implicitHeight: 1 + color: Default.separatorColor + } + //! [contentItem] +} diff --git a/src/imports/controls/Page.qml b/src/imports/controls/Page.qml index 4ed7efb1..02f81e07 100644 --- a/src/imports/controls/Page.qml +++ b/src/imports/controls/Page.qml @@ -34,15 +34,27 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.Page { id: control - contentItem: Item { } + implicitWidth: Math.max(background ? background.implicitWidth : 0, + Math.max(contentWidth, + header && header.visible ? header.implicitWidth : 0, + footer && footer.visible ? footer.implicitWidth : 0) + leftPadding + rightPadding) + implicitHeight: Math.max(background ? background.implicitHeight : 0, + contentHeight + topPadding + bottomPadding + + (header && header.visible ? header.implicitHeight + spacing : 0) + + (footer && footer.visible ? footer.implicitHeight + spacing : 0)) + + contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) + contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) background: Rectangle { - color: "#ffffff" + color: Default.backgroundColor } } diff --git a/src/imports/controls/PageIndicator.qml b/src/imports/controls/PageIndicator.qml index 933bc839..0273af98 100644 --- a/src/imports/controls/PageIndicator.qml +++ b/src/imports/controls/PageIndicator.qml @@ -34,8 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.PageIndicator { id: control @@ -53,7 +55,7 @@ T.PageIndicator { implicitHeight: 8 radius: width / 2 - color: "#28282a" // TODO + color: Default.pageIndicatorColor opacity: index === currentIndex ? 0.95 : pressed ? 0.7 : 0.45 Behavior on opacity { OpacityAnimator { duration: 100 } } diff --git a/src/imports/controls/Pane.qml b/src/imports/controls/Pane.qml index feb8eb58..2aeeee5d 100644 --- a/src/imports/controls/Pane.qml +++ b/src/imports/controls/Pane.qml @@ -34,8 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.Pane { id: control @@ -48,9 +50,7 @@ T.Pane { padding: 12 - contentItem: Item { } - background: Rectangle { - color: "#ffffff" + color: Default.backgroundColor } } diff --git a/src/imports/controls/Popup.qml b/src/imports/controls/Popup.qml index 72428f23..476a1882 100644 --- a/src/imports/controls/Popup.qml +++ b/src/imports/controls/Popup.qml @@ -34,8 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.Popup { id: control @@ -50,9 +52,7 @@ T.Popup { padding: 12 - contentItem: Item { } - background: Rectangle { - border.color: "#353637" + border.color: Default.frameDarkColor } } diff --git a/src/imports/controls/ProgressBar.qml b/src/imports/controls/ProgressBar.qml index 45e990ee..a050383b 100644 --- a/src/imports/controls/ProgressBar.qml +++ b/src/imports/controls/ProgressBar.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls 2.0 -import QtQuick.Controls.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 T.ProgressBar { id: control @@ -69,6 +69,6 @@ T.ProgressBar { width: control.availableWidth height: 6 - color: "#e4e4e4" + color: Default.progressBarColor } } diff --git a/src/imports/controls/RadioButton.qml b/src/imports/controls/RadioButton.qml index 1100273a..35395d85 100644 --- a/src/imports/controls/RadioButton.qml +++ b/src/imports/controls/RadioButton.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Controls 2.0 -import QtQuick.Controls.impl 2.0 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.RadioButton { id: control @@ -64,7 +64,7 @@ T.RadioButton { text: control.text font: control.font - color: control.down ? "#26282a" : "#353637" + color: control.down ? Default.textDarkColor : Default.textColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft diff --git a/src/imports/controls/RadioDelegate.qml b/src/imports/controls/RadioDelegate.qml index 620417a8..5df649d9 100644 --- a/src/imports/controls/RadioDelegate.qml +++ b/src/imports/controls/RadioDelegate.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Controls 2.0 -import QtQuick.Controls.impl 2.0 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.RadioDelegate { id: control @@ -58,7 +58,7 @@ T.RadioDelegate { text: control.text font: control.font - color: control.enabled ? "#26282a" : "#bdbebf" + color: control.enabled ? Default.textDarkColor : Default.textDisabledColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft @@ -76,6 +76,6 @@ T.RadioDelegate { implicitWidth: 100 implicitHeight: 40 visible: control.down || control.highlighted - color: control.down ? "#bdbebf" : "#eeeeee" + color: control.down ? Default.delegatePressedColor : Default.delegateColor } } diff --git a/src/imports/controls/RadioIndicator.qml b/src/imports/controls/RadioIndicator.qml index 05ff6673..15e6f9cf 100644 --- a/src/imports/controls/RadioIndicator.qml +++ b/src/imports/controls/RadioIndicator.qml @@ -34,16 +34,20 @@ ** ****************************************************************************/ -import QtQuick 2.6 +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 Rectangle { implicitWidth: 28 implicitHeight: 28 radius: width / 2 - color: control.down ? (control.visualFocus ? "#cce0ff" : "#f6f6f6") : (control.visualFocus ? "#f0f6ff" : "#ffffff") + color: control.down + ? (control.visualFocus ? Default.focusPressedColor : Default.indicatorPressedColor) + : (control.visualFocus ? Default.focusLightColor : Default.backgroundColor) border.width: control.visualFocus ? 2 : 1 - border.color: control.visualFocus ? "#0066ff" : (control.down ? "#808080" : "#909090") + border.color: control.visualFocus ? Default.focusColor : (control.down ? Default.indicatorFramePressedColor : Default.indicatorFrameColor) opacity: enabled ? 1 : 0.3 property Item control @@ -54,7 +58,7 @@ Rectangle { width: 20 height: 20 radius: width / 2 - color: control.down ? "#26282a" : "#353637" + color: control.down ? Default.textDarkColor : Default.buttonCheckedColor visible: control.checked } } diff --git a/src/imports/controls/RangeSlider.qml b/src/imports/controls/RangeSlider.qml index 181550a4..52e28ba4 100644 --- a/src/imports/controls/RangeSlider.qml +++ b/src/imports/controls/RangeSlider.qml @@ -34,8 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.RangeSlider { id: control @@ -56,8 +58,12 @@ T.RangeSlider { implicitHeight: 28 radius: width / 2 border.width: activeFocus ? 2 : 1 - border.color: control.enabled ? (activeFocus ? "#0066ff" : (control.first.pressed ? "#808080" : "#909090")) : "#d6d6d6" - color: control.enabled ? (first.pressed ? (activeFocus ? "#cce0ff" : "#f6f6f6") : (activeFocus ? "#f0f6ff" : "#ffffff")) : "#fdfdfd" + border.color: control.enabled ? (activeFocus + ? Default.focusColor + : (control.first.pressed ? Default.indicatorFramePressedColor : Default.indicatorFrameColor)) : Default.indicatorFrameDisabledColor + color: control.enabled ? (first.pressed + ? (activeFocus ? Default.focusPressedColor : Default.indicatorPressedColor) + : (activeFocus ? Default.focusLightColor : Default.backgroundColor)) : Default.indicatorDisabledColor readonly property bool horizontal: control.orientation === Qt.Horizontal } @@ -69,8 +75,12 @@ T.RangeSlider { implicitHeight: 28 radius: width / 2 border.width: activeFocus ? 2 : 1 - border.color: control.enabled ? (activeFocus ? "#0066ff" : (control.first.pressed ? "#808080" : "#909090")) : "#d6d6d6" - color: control.enabled ? (second.pressed ? (activeFocus ? "#cce0ff" : "#f6f6f6") : (activeFocus ? "#f0f6ff" : "#ffffff")) : "#fdfdfd" + border.color: control.enabled ? (activeFocus + ? Default.focusColor + : (control.first.pressed ? Default.indicatorFramePressedColor : Default.indicatorFrameColor)) : Default.indicatorFrameDisabledColor + color: control.enabled ? (second.pressed + ? (activeFocus ? Default.focusPressedColor : Default.indicatorPressedColor) + : (activeFocus ? Default.focusLightColor : Default.backgroundColor)) : Default.indicatorDisabledColor readonly property bool horizontal: control.orientation === Qt.Horizontal } @@ -83,7 +93,7 @@ T.RangeSlider { width: horizontal ? control.availableWidth : implicitWidth height: horizontal ? implicitHeight : control.availableHeight radius: 3 - color: "#e0e0e0" + color: Default.buttonColor scale: horizontal && control.mirrored ? -1 : 1 readonly property bool horizontal: control.orientation === Qt.Horizontal diff --git a/src/imports/controls/RoundButton.qml b/src/imports/controls/RoundButton.qml new file mode 100644 index 00000000..15c01b48 --- /dev/null +++ b/src/imports/controls/RoundButton.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 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.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T + +T.RoundButton { + id: control + + implicitWidth: Math.max(background ? background.implicitWidth : 0, + contentItem.implicitWidth + leftPadding + rightPadding) + implicitHeight: Math.max(background ? background.implicitHeight : 0, + contentItem.implicitHeight + topPadding + bottomPadding) + baselineOffset: contentItem.y + contentItem.baselineOffset + + padding: 6 + + //! [contentItem] + contentItem: Text { + text: control.text + font: control.font + opacity: enabled || control.highlighted || control.checked ? 1 : 0.3 + color: control.checked || control.highlighted ? Default.textLightColor : (control.visualFocus ? Default.focusColor : (control.down ? Default.textDarkColor : Default.textColor)) + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + } + //! [contentItem] + + //! [background] + background: Rectangle { + implicitWidth: 40 + implicitHeight: 40 + radius: control.radius + opacity: enabled ? 1 : 0.3 + visible: !control.flat || control.down || control.checked || control.highlighted + color: control.checked || control.highlighted ? + (control.visualFocus ? (control.down ? Default.buttonCheckedFocusColor : Default.focusColor) : (control.down ? Default.buttonCheckedPressedColor : Default.buttonCheckedColor)) : + (control.visualFocus ? (control.down ? Default.focusPressedColor : Default.focusLightColor) : (control.down ? Default.buttonPressedColor : Default.buttonColor)) + border.color: Default.focusColor + border.width: control.visualFocus ? 2 : 0 + } + //! [background] +} diff --git a/src/imports/controls/ScrollBar.qml b/src/imports/controls/ScrollBar.qml index c77463aa..52ec1995 100644 --- a/src/imports/controls/ScrollBar.qml +++ b/src/imports/controls/ScrollBar.qml @@ -34,8 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.ScrollBar { id: control @@ -54,7 +56,7 @@ T.ScrollBar { implicitHeight: 6 radius: width / 2 - color: control.pressed ? "#28282a" : "#bdbebf" + color: control.pressed ? Default.scrollBarPressedColor : Default.scrollBarColor visible: control.size < 1.0 opacity: 0.0 diff --git a/src/imports/controls/ScrollIndicator.qml b/src/imports/controls/ScrollIndicator.qml index c129e5b8..8ef60ed6 100644 --- a/src/imports/controls/ScrollIndicator.qml +++ b/src/imports/controls/ScrollIndicator.qml @@ -34,8 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.ScrollIndicator { id: control @@ -53,7 +55,7 @@ T.ScrollIndicator { implicitWidth: 2 implicitHeight: 2 - color: "#bdbebf" + color: Default.scrollBarColor visible: control.size < 1.0 opacity: 0.0 diff --git a/src/imports/controls/Slider.qml b/src/imports/controls/Slider.qml index 5e4dc699..2a14d31c 100644 --- a/src/imports/controls/Slider.qml +++ b/src/imports/controls/Slider.qml @@ -34,8 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.Slider { id: control @@ -53,9 +55,13 @@ T.Slider { implicitWidth: 28 implicitHeight: 28 radius: width / 2 - color: control.enabled ? (control.pressed ? (control.visualFocus ? "#cce0ff" : "#f6f6f6") : (control.visualFocus ? "#f0f6ff" : "#ffffff")) : "#fdfdfd" + color: control.enabled ? (control.pressed + ? (control.visualFocus ? Default.focusPressedColor : Default.indicatorPressedColor) + : (control.visualFocus ? Default.focusLightColor : Default.backgroundColor)) : Default.indicatorDisabledColor border.width: control.visualFocus ? 2 : 1 - border.color: control.enabled ? (control.visualFocus ? "#0066ff" : (control.pressed ? "#808080" : "#909090")) : "#d6d6d6" + border.color: control.enabled ? (control.visualFocus + ? Default.focusColor + : (control.pressed ? Default.indicatorFramePressedColor : Default.indicatorFrameColor)) : Default.indicatorFrameDisabledColor readonly property bool horizontal: control.orientation === Qt.Horizontal } @@ -68,7 +74,7 @@ T.Slider { width: horizontal ? control.availableWidth : implicitWidth height: horizontal ? implicitHeight : control.availableHeight radius: 3 - color: "#e0e0e0" + color: Default.buttonColor scale: horizontal && control.mirrored ? -1 : 1 readonly property bool horizontal: control.orientation === Qt.Horizontal diff --git a/src/imports/controls/SpinBox.qml b/src/imports/controls/SpinBox.qml index dee368e2..fd81337d 100644 --- a/src/imports/controls/SpinBox.qml +++ b/src/imports/controls/SpinBox.qml @@ -34,8 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.SpinBox { id: control @@ -66,15 +68,15 @@ T.SpinBox { opacity: control.enabled ? 1 : 0.3 font: control.font - color: "#353637" - selectionColor: "#0066ff" - selectedTextColor: "#ffffff" + color: Default.textColor + selectionColor: Default.focusColor + selectedTextColor: Default.textLightColor horizontalAlignment: Qt.AlignHCenter verticalAlignment: Qt.AlignVCenter readOnly: !control.editable validator: control.validator - inputMethodHints: Qt.ImhFormattedNumbersOnly + inputMethodHints: Qt.ImhDigitsOnly Rectangle { x: -6 - (down.indicator ? 1 : 0) @@ -83,7 +85,7 @@ T.SpinBox { height: control.height visible: control.activeFocus color: "transparent" - border.color: "#0066ff" + border.color: Default.focusColor border.width: 2 } } @@ -93,21 +95,21 @@ T.SpinBox { height: parent.height implicitWidth: 40 implicitHeight: 40 - color: up.pressed ? "#d0d0d0" : "#e0e0e0" + color: up.pressed ? Default.buttonPressedColor : Default.buttonColor Rectangle { x: (parent.width - width) / 2 y: (parent.height - height) / 2 width: parent.width / 3 height: 2 - color: enabled ? "#353637" : "#bdbebf" + color: enabled ? Default.textColor : Default.textDisabledColor } Rectangle { x: (parent.width - width) / 2 y: (parent.height - height) / 2 width: 2 height: parent.width / 3 - color: enabled ? "#353637" : "#bdbebf" + color: enabled ? Default.textColor : Default.textDisabledColor } } @@ -116,19 +118,19 @@ T.SpinBox { height: parent.height implicitWidth: 40 implicitHeight: 40 - color: down.pressed ? "#d0d0d0" : "#e0e0e0" + color: down.pressed ? Default.buttonPressedColor : Default.buttonColor Rectangle { x: (parent.width - width) / 2 y: (parent.height - height) / 2 width: parent.width / 3 height: 2 - color: enabled ? "#353637" : "#bdbebf" + color: enabled ? Default.textColor : Default.textDisabledColor } } background: Rectangle { implicitWidth: 140 - border.color: "#e0e0e0" + border.color: Default.buttonColor } } diff --git a/src/imports/controls/StackView.qml b/src/imports/controls/StackView.qml index f70ecf97..96120d2b 100644 --- a/src/imports/controls/StackView.qml +++ b/src/imports/controls/StackView.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.4 -import QtQuick.Controls 2.0 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Templates 2.1 as T T.StackView { id: control diff --git a/src/imports/controls/SwipeDelegate.qml b/src/imports/controls/SwipeDelegate.qml index 6c84dae0..b140eb95 100644 --- a/src/imports/controls/SwipeDelegate.qml +++ b/src/imports/controls/SwipeDelegate.qml @@ -34,8 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.SwipeDelegate { id: control @@ -56,7 +58,7 @@ T.SwipeDelegate { text: control.text font: control.font - color: control.enabled ? "#26282a" : "#bdbebf" + color: control.enabled ? Default.textDarkColor : Default.textDisabledColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft @@ -72,7 +74,9 @@ T.SwipeDelegate { } background: Rectangle { - color: control.visualFocus ? (control.down ? "#cce0ff" : "#e5efff") : (control.down ? "#bdbebf" : "#ffffff") + color: control.visualFocus + ? (control.down ? Default.focusPressedColor : Default.delegateFocusColor) + : (control.down ? Default.delegatePressedColor : Default.backgroundColor) Behavior on x { enabled: !control.down diff --git a/src/imports/controls/SwipeView.qml b/src/imports/controls/SwipeView.qml index c4e5a570..555775ee 100644 --- a/src/imports/controls/SwipeView.qml +++ b/src/imports/controls/SwipeView.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Controls 2.0 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Templates 2.1 as T T.SwipeView { id: control @@ -48,6 +48,7 @@ T.SwipeView { contentItem: ListView { model: control.contentModel + interactive: control.interactive currentIndex: control.currentIndex spacing: control.spacing diff --git a/src/imports/controls/Switch.qml b/src/imports/controls/Switch.qml index b4717d05..1918189a 100644 --- a/src/imports/controls/Switch.qml +++ b/src/imports/controls/Switch.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls 2.0 -import QtQuick.Controls.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 T.Switch { id: control @@ -64,7 +64,7 @@ T.Switch { text: control.text font: control.font - color: control.enabled ? "#26282a" : "#bdbebf" + color: control.enabled ? Default.textDarkColor : Default.textDisabledColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft diff --git a/src/imports/controls/SwitchDelegate.qml b/src/imports/controls/SwitchDelegate.qml index f5383628..a030ec07 100644 --- a/src/imports/controls/SwitchDelegate.qml +++ b/src/imports/controls/SwitchDelegate.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls 2.0 -import QtQuick.Controls.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 T.SwitchDelegate { id: control @@ -64,7 +64,7 @@ T.SwitchDelegate { text: control.text font: control.font - color: control.enabled ? "#26282a" : "#bdbebf" + color: control.enabled ? Default.textDarkColor : Default.textDisabledColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft @@ -75,6 +75,6 @@ T.SwitchDelegate { implicitWidth: 100 implicitHeight: 40 visible: control.down || control.highlighted - color: control.down ? "#bdbebf" : "#eeeeee" + color: control.down ? Default.delegatePressedColor : Default.delegateColor } } diff --git a/src/imports/controls/SwitchIndicator.qml b/src/imports/controls/SwitchIndicator.qml index 261d9999..362ebfef 100644 --- a/src/imports/controls/SwitchIndicator.qml +++ b/src/imports/controls/SwitchIndicator.qml @@ -34,7 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 Item { implicitWidth: 56 @@ -47,9 +49,9 @@ Item { width: 56 height: 16 radius: 8 - color: control.checked ? (control.visualFocus ? "#0066ff" : "#353637") : "#e0e0e0" + color: control.checked ? (control.visualFocus ? Default.focusColor : Default.buttonCheckedColor) : Default.buttonColor border.width: control.visualFocus ? 2 : 0 - border.color: "#0066ff" + border.color: Default.focusColor } Rectangle { @@ -58,9 +60,13 @@ Item { width: 28 height: 28 radius: 16 - color: control.enabled ? (control.down ? (control.visualFocus ? "#cce0ff" : "#f6f6f6") : (control.visualFocus ? "#f0f6ff" : "#ffffff")) : "#fdfdfd" + color: control.enabled ? (control.down + ? (control.visualFocus ? Default.focusPressedColor : Default.indicatorPressedColor) + : (control.visualFocus ? Default.focusLightColor : Default.backgroundColor)) : Default.indicatorDisabledColor border.width: control.visualFocus ? 2 : 1 - border.color: control.enabled ? (control.visualFocus ? "#0066ff" : (control.down ? "#808080" : "#909090")) : "#d6d6d6" + border.color: control.enabled ? (control.visualFocus + ? Default.focusColor + : (control.down ? Default.indicatorFramePressedColor : Default.indicatorFrameColor)) : Default.indicatorFrameDisabledColor Behavior on x { enabled: !control.down diff --git a/src/imports/controls/TabBar.qml b/src/imports/controls/TabBar.qml index 22b5329e..21358c39 100644 --- a/src/imports/controls/TabBar.qml +++ b/src/imports/controls/TabBar.qml @@ -34,8 +34,8 @@ ** ****************************************************************************/ -import QtQuick 2.7 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T T.TabBar { id: control diff --git a/src/imports/controls/TabButton.qml b/src/imports/controls/TabButton.qml index 2c5b2708..f0d922a1 100644 --- a/src/imports/controls/TabButton.qml +++ b/src/imports/controls/TabButton.qml @@ -34,8 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.TabButton { id: control @@ -53,13 +55,15 @@ T.TabButton { font: control.font elide: Text.ElideRight opacity: enabled ? 1 : 0.3 - color: !control.checked ? "#ffffff" : control.down ? "#26282a" : "#353637" + color: !control.checked ? Default.textLightColor : control.down ? Default.textDarkColor : Default.textColor horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } background: Rectangle { implicitHeight: 40 - color: control.down ? (control.checked ? "#e4e4e4" : "#585a5c") : (control.checked ? "transparent" : "#353637") + color: control.down + ? (control.checked ? Default.tabButtonCheckedPressedColor : Default.tabButtonPressedColor) + : (control.checked ? "transparent" : Default.tabButtonColor) } } diff --git a/src/imports/controls/TextArea.qml b/src/imports/controls/TextArea.qml index f1ec6dfa..734cc9d0 100644 --- a/src/imports/controls/TextArea.qml +++ b/src/imports/controls/TextArea.qml @@ -34,8 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.TextArea { id: control @@ -51,8 +53,8 @@ T.TextArea { leftPadding: padding + 4 opacity: enabled ? 1 : 0.2 - color: "#353637" - selectionColor: "#fddd5c" + color: Default.textColor + selectionColor: Default.textSelectionColor selectedTextColor: color Text { @@ -64,7 +66,7 @@ T.TextArea { text: control.placeholderText font: control.font - color: "#c2c2c2" + color: Default.textDisabledLightColor horizontalAlignment: control.horizontalAlignment verticalAlignment: control.verticalAlignment visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter) diff --git a/src/imports/controls/TextField.qml b/src/imports/controls/TextField.qml index fc07e7bb..5e6e91b6 100644 --- a/src/imports/controls/TextField.qml +++ b/src/imports/controls/TextField.qml @@ -34,8 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.TextField { id: control @@ -51,8 +53,8 @@ T.TextField { leftPadding: padding + 4 opacity: enabled ? 1 : 0.2 - color: "#353637" - selectionColor: "#fddd5c" + color: Default.textColor + selectionColor: Default.textSelectionColor selectedTextColor: color verticalAlignment: TextInput.AlignVCenter @@ -65,7 +67,7 @@ T.TextField { text: control.placeholderText font: control.font - color: "#bdbebf" + color: Default.textDisabledColor horizontalAlignment: control.horizontalAlignment verticalAlignment: control.verticalAlignment visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter) @@ -76,7 +78,7 @@ T.TextField { implicitWidth: 200 implicitHeight: 40 border.width: control.activeFocus ? 2 : 1 - color: control.enabled ? "#ffffff" : "#353637" - border.color: control.activeFocus ? "#0066ff" : (control.enabled ? "#bdbebf" : "transparent") + color: control.enabled ? Default.backgroundColor : Default.disabledDarkColor + border.color: control.activeFocus ? Default.focusColor : (control.enabled ? Default.disabledLightColor : "transparent") } } diff --git a/src/imports/controls/ToolBar.qml b/src/imports/controls/ToolBar.qml index 02b6c6f3..d7c29be7 100644 --- a/src/imports/controls/ToolBar.qml +++ b/src/imports/controls/ToolBar.qml @@ -34,8 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.ToolBar { id: control @@ -46,10 +48,8 @@ T.ToolBar { contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) - contentItem: Item { } - background: Rectangle { implicitHeight: 40 - color: "#eeeeee" + color: Default.delegateColor } } diff --git a/src/imports/controls/ToolButton.qml b/src/imports/controls/ToolButton.qml index 1fda5ba3..8d91da10 100644 --- a/src/imports/controls/ToolButton.qml +++ b/src/imports/controls/ToolButton.qml @@ -34,8 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.ToolButton { id: control @@ -51,7 +53,7 @@ T.ToolButton { contentItem: Text { text: control.text font: control.font - color: control.enabled ? (control.visualFocus ? "#0066ff" : "#26282a") : "#c2c2c2" + color: control.enabled ? (control.visualFocus ? Default.focusColor : Default.textDarkColor) : Default.textDisabledLightColor elide: Text.ElideRight horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter @@ -61,7 +63,7 @@ T.ToolButton { implicitWidth: 40 implicitHeight: 40 - color: Qt.darker("#33333333", control.enabled && (control.checked || control.highlighted) ? 1.5 : 1.0) + color: Qt.darker(Default.toolButtonColor, control.enabled && (control.checked || control.highlighted) ? 1.5 : 1.0) opacity: control.down ? 1.0 : control.enabled && (control.checked || control.highlighted) ? 0.5 : 0 visible: control.down || (control.enabled && (control.checked || control.highlighted)) } diff --git a/src/imports/controls/ToolSeparator.qml b/src/imports/controls/ToolSeparator.qml new file mode 100644 index 00000000..dca746d7 --- /dev/null +++ b/src/imports/controls/ToolSeparator.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 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.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T + +T.ToolSeparator { + id: control + + implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding) + implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding) + + padding: vertical ? 6 : 2 + topPadding: vertical ? 2 : 6 + bottomPadding: vertical ? 2 : 6 + + //! [contentItem] + contentItem: Rectangle { + implicitWidth: vertical ? 1 : 30 + implicitHeight: vertical ? 30 : 1 + color: Default.separatorColor + } + //! [contentItem] +} diff --git a/src/imports/controls/ToolTip.qml b/src/imports/controls/ToolTip.qml index 322757c7..bf574c28 100644 --- a/src/imports/controls/ToolTip.qml +++ b/src/imports/controls/ToolTip.qml @@ -34,9 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Controls 2.0 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.ToolTip { id: control @@ -61,6 +62,6 @@ T.ToolTip { } background: Rectangle { - border.color: "#353637" + border.color: Default.frameDarkColor } } diff --git a/src/imports/controls/Tumbler.qml b/src/imports/controls/Tumbler.qml index 571d8089..6c89b86d 100644 --- a/src/imports/controls/Tumbler.qml +++ b/src/imports/controls/Tumbler.qml @@ -34,9 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Controls 2.0 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T T.Tumbler { id: control @@ -46,29 +47,23 @@ T.Tumbler { delegate: Text { id: label text: modelData - color: control.visualFocus ? "#0066ff" : "#26282a" + color: control.visualFocus ? Default.focusColor : Default.textDarkColor font: control.font opacity: (1.0 - Math.abs(Tumbler.displacement) / (visibleItemCount / 2)) * (control.enabled ? 1 : 0.6) horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } - contentItem: PathView { - id: pathView + contentItem: TumblerView { + id: tumblerView model: control.model delegate: control.delegate - clip: true - pathItemCount: control.visibleItemCount + 1 - preferredHighlightBegin: 0.5 - preferredHighlightEnd: 0.5 - dragMargin: width / 2 - path: Path { - startX: pathView.width / 2 - startY: -pathView.delegateHeight / 2 + startX: tumblerView.width / 2 + startY: -tumblerView.delegateHeight / 2 PathLine { - x: pathView.width / 2 - y: pathView.pathItemCount * pathView.delegateHeight - pathView.delegateHeight / 2 + x: tumblerView.width / 2 + y: (control.visibleItemCount + 1) * tumblerView.delegateHeight - tumblerView.delegateHeight / 2 } } diff --git a/src/imports/controls/controls.pri b/src/imports/controls/controls.pri index dcbcf8e1..79e03db5 100644 --- a/src/imports/controls/controls.pri +++ b/src/imports/controls/controls.pri @@ -1,12 +1,14 @@ HEADERS += \ $$PWD/qquickbusyindicatorring_p.h \ $$PWD/qquickprogressstrip_p.h \ - $$PWD/qquickdialring_p.h + $$PWD/qquickdialring_p.h \ + $$PWD/qquickdefaultstyle_p.h SOURCES += \ $$PWD/qquickbusyindicatorring.cpp \ $$PWD/qquickprogressstrip.cpp \ - $$PWD/qquickdialring.cpp + $$PWD/qquickdialring.cpp \ + $$PWD/qquickdefaultstyle.cpp QML_CONTROLS = \ AbstractButton.qml \ @@ -20,6 +22,8 @@ QML_CONTROLS = \ Container.qml \ Control.qml \ Dial.qml \ + Dialog.qml \ + DialogButtonBox.qml \ Drawer.qml \ Frame.qml \ GroupBox.qml \ @@ -27,6 +31,7 @@ QML_CONTROLS = \ Label.qml \ Menu.qml \ MenuItem.qml \ + MenuSeparator.qml \ Page.qml \ PageIndicator.qml \ Pane.qml \ @@ -36,6 +41,7 @@ QML_CONTROLS = \ RadioDelegate.qml \ RadioIndicator.qml \ RangeSlider.qml \ + RoundButton.qml \ ScrollBar.qml \ ScrollIndicator.qml \ Slider.qml \ @@ -52,6 +58,7 @@ QML_CONTROLS = \ TextField.qml \ ToolBar.qml \ ToolButton.qml \ + ToolSeparator.qml \ ToolTip.qml \ Tumbler.qml diff --git a/src/imports/controls/controls.pro b/src/imports/controls/controls.pro index 15c07cf0..9e8a3c27 100644 --- a/src/imports/controls/controls.pro +++ b/src/imports/controls/controls.pro @@ -1,6 +1,6 @@ TARGET = qtquickcontrols2plugin TARGETPATH = QtQuick/Controls.2 -IMPORT_VERSION = 2.0 +IMPORT_VERSION = 2.1 QT += qml quick QT_PRIVATE += core-private gui-private qml-private quick-private quicktemplates2-private quickcontrols2-private diff --git a/src/imports/controls/dependencies.json b/src/imports/controls/dependencies.json new file mode 100644 index 00000000..4481dd1c --- /dev/null +++ b/src/imports/controls/dependencies.json @@ -0,0 +1,17 @@ +[ + { + "name": "QtQuick", + "type": "module", + "version": "2.8" + }, + { + "name": "QtQuick.Window", + "type": "module", + "version": "2.2" + }, + { + "name": "QtQuick.Templates", + "type": "module", + "version": "2.1" + } +] diff --git a/src/imports/controls/designer/ToolSeparatorSpecifics.qml b/src/imports/controls/designer/ToolSeparatorSpecifics.qml new file mode 100644 index 00000000..2e967a6e --- /dev/null +++ b/src/imports/controls/designer/ToolSeparatorSpecifics.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 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.8 +import HelperWidgets 2.0 +import QtQuick.Layouts 1.3 + +Column { + width: parent.width + + Section { + width: parent.width + caption: qsTr("ToolSeparator") + + SectionLayout { + Label { + text: qsTr("Orientation") + tooltip: qsTr("The orientation of the separator.") + } + SecondColumnLayout { + ComboBox { + backendValue: backendValues.orientation + model: [ "Horizontal", "Vertical" ] + scope: "Qt" + Layout.fillWidth: true + } + } + } + } + + ControlSection { + width: parent.width + } + + PaddingSection { + width: parent.width + } +} diff --git a/src/imports/controls/designer/images/toolseparator-icon.png b/src/imports/controls/designer/images/toolseparator-icon.png Binary files differnew file mode 100644 index 00000000..3d2e152f --- /dev/null +++ b/src/imports/controls/designer/images/toolseparator-icon.png diff --git a/src/imports/controls/designer/images/toolseparator-icon16.png b/src/imports/controls/designer/images/toolseparator-icon16.png Binary files differnew file mode 100644 index 00000000..97672506 --- /dev/null +++ b/src/imports/controls/designer/images/toolseparator-icon16.png diff --git a/src/imports/controls/designer/images/toolseparator-icon16@2x.png b/src/imports/controls/designer/images/toolseparator-icon16@2x.png Binary files differnew file mode 100644 index 00000000..979b6426 --- /dev/null +++ b/src/imports/controls/designer/images/toolseparator-icon16@2x.png diff --git a/src/imports/controls/designer/images/toolseparator-icon@2x.png b/src/imports/controls/designer/images/toolseparator-icon@2x.png Binary files differnew file mode 100644 index 00000000..19287154 --- /dev/null +++ b/src/imports/controls/designer/images/toolseparator-icon@2x.png diff --git a/src/imports/controls/designer/qtquickcontrols2.metainfo b/src/imports/controls/designer/qtquickcontrols2.metainfo index 81a6d914..c697b3c2 100644 --- a/src/imports/controls/designer/qtquickcontrols2.metainfo +++ b/src/imports/controls/designer/qtquickcontrols2.metainfo @@ -388,6 +388,19 @@ MetaInfo { } Type { + name: "QtQuick.Controls.ToolSeparator" + icon: "images/toolseparator-icon16.png" + + ItemLibraryEntry { + name: "ToolSeparator" + category: "Qt Quick - Controls 2" + libraryIcon: "images/toolseparator-icon.png" + version: "2.1" + requiredImport: "QtQuick.Controls" + } + } + + Type { name: "QtQuick.Controls.Tumbler" icon: "images/tumbler-icon16.png" @@ -399,4 +412,32 @@ MetaInfo { requiredImport: "QtQuick.Controls" } } + + Type { + name: "QtQuick.Controls.TabBar" + icon: "images/toolbar-icon16.png" + + ItemLibraryEntry { + name: "Tab Bar" + category: "Qt Quick - Controls 2" + libraryIcon: "images/toolbar-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + Property { name: "width"; type: "int"; value: 240 } + } + } + + Type { + name: "QtQuick.Controls.TabButton" + icon: "images/toolbutton-icon16.png" + + ItemLibraryEntry { + name: "Tab Button" + category: "Qt Quick - Controls 2" + libraryIcon: "images/toolbutton-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + Property { name: "text"; type: "binding"; value: "qsTr(\"Tab Button\")" } + } + } } diff --git a/src/imports/controls/doc/images/qtlabscalendar-calendarmodel.png b/src/imports/controls/doc/images/qtlabscalendar-calendarmodel.png Binary files differdeleted file mode 100644 index 7a140d27..00000000 --- a/src/imports/controls/doc/images/qtlabscalendar-calendarmodel.png +++ /dev/null diff --git a/src/imports/controls/doc/images/qtlabscalendar-dayofweekrow-layout.png b/src/imports/controls/doc/images/qtlabscalendar-dayofweekrow-layout.png Binary files differdeleted file mode 100644 index 130e3757..00000000 --- a/src/imports/controls/doc/images/qtlabscalendar-dayofweekrow-layout.png +++ /dev/null diff --git a/src/imports/controls/doc/images/qtlabscalendar-dayofweekrow.png b/src/imports/controls/doc/images/qtlabscalendar-dayofweekrow.png Binary files differdeleted file mode 100644 index 6c8424ab..00000000 --- a/src/imports/controls/doc/images/qtlabscalendar-dayofweekrow.png +++ /dev/null diff --git a/src/imports/controls/doc/images/qtlabscalendar-monthgrid-layout.png b/src/imports/controls/doc/images/qtlabscalendar-monthgrid-layout.png Binary files differdeleted file mode 100644 index dd903650..00000000 --- a/src/imports/controls/doc/images/qtlabscalendar-monthgrid-layout.png +++ /dev/null diff --git a/src/imports/controls/doc/images/qtlabscalendar-monthgrid.png b/src/imports/controls/doc/images/qtlabscalendar-monthgrid.png Binary files differdeleted file mode 100644 index 0c3b3c41..00000000 --- a/src/imports/controls/doc/images/qtlabscalendar-monthgrid.png +++ /dev/null diff --git a/src/imports/controls/doc/images/qtlabscalendar-weeknumbercolumn-layout.png b/src/imports/controls/doc/images/qtlabscalendar-weeknumbercolumn-layout.png Binary files differdeleted file mode 100644 index b015a3e6..00000000 --- a/src/imports/controls/doc/images/qtlabscalendar-weeknumbercolumn-layout.png +++ /dev/null diff --git a/src/imports/controls/doc/images/qtlabscalendar-weeknumbercolumn.png b/src/imports/controls/doc/images/qtlabscalendar-weeknumbercolumn.png Binary files differdeleted file mode 100644 index 65e25b29..00000000 --- a/src/imports/controls/doc/images/qtlabscalendar-weeknumbercolumn.png +++ /dev/null diff --git a/src/imports/controls/doc/images/qtquickcontrols2-dialogbuttonbox-attached.png b/src/imports/controls/doc/images/qtquickcontrols2-dialogbuttonbox-attached.png Binary files differnew file mode 100644 index 00000000..53ecf83d --- /dev/null +++ b/src/imports/controls/doc/images/qtquickcontrols2-dialogbuttonbox-attached.png diff --git a/src/imports/controls/doc/images/qtquickcontrols2-dialogbuttonbox.png b/src/imports/controls/doc/images/qtquickcontrols2-dialogbuttonbox.png Binary files differnew file mode 100644 index 00000000..87cece98 --- /dev/null +++ b/src/imports/controls/doc/images/qtquickcontrols2-dialogbuttonbox.png diff --git a/src/imports/controls/doc/images/qtquickcontrols2-menuseparator-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-menuseparator-custom.png Binary files differnew file mode 100644 index 00000000..48785b73 --- /dev/null +++ b/src/imports/controls/doc/images/qtquickcontrols2-menuseparator-custom.png diff --git a/src/imports/controls/doc/images/qtquickcontrols2-menuseparator.png b/src/imports/controls/doc/images/qtquickcontrols2-menuseparator.png Binary files differnew file mode 100644 index 00000000..beb1cfeb --- /dev/null +++ b/src/imports/controls/doc/images/qtquickcontrols2-menuseparator.png diff --git a/src/imports/controls/doc/images/qtquickcontrols2-roundbutton.png b/src/imports/controls/doc/images/qtquickcontrols2-roundbutton.png Binary files differnew file mode 100644 index 00000000..9f1d44fc --- /dev/null +++ b/src/imports/controls/doc/images/qtquickcontrols2-roundbutton.png diff --git a/src/imports/controls/doc/images/qtquickcontrols2-toolseparator-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-toolseparator-custom.png Binary files differnew file mode 100644 index 00000000..4f423154 --- /dev/null +++ b/src/imports/controls/doc/images/qtquickcontrols2-toolseparator-custom.png diff --git a/src/imports/controls/doc/images/qtquickcontrols2-toolseparator.png b/src/imports/controls/doc/images/qtquickcontrols2-toolseparator.png Binary files differnew file mode 100644 index 00000000..253c429b --- /dev/null +++ b/src/imports/controls/doc/images/qtquickcontrols2-toolseparator.png diff --git a/src/imports/controls/doc/images/qtquickcontrols2-tumbler-wrap.gif b/src/imports/controls/doc/images/qtquickcontrols2-tumbler-wrap.gif Binary files differindex 4821a4e8..8f59eedc 100644 --- a/src/imports/controls/doc/images/qtquickcontrols2-tumbler-wrap.gif +++ b/src/imports/controls/doc/images/qtquickcontrols2-tumbler-wrap.gif diff --git a/src/imports/controls/doc/qtquickcontrols2.qdocconf b/src/imports/controls/doc/qtquickcontrols2.qdocconf index a9a48343..42ff16f8 100644 --- a/src/imports/controls/doc/qtquickcontrols2.qdocconf +++ b/src/imports/controls/doc/qtquickcontrols2.qdocconf @@ -29,27 +29,24 @@ qhp.QtQuickControls2.subprojects.examples.title = Examples qhp.QtQuickControls2.subprojects.examples.indexTitle = Qt Quick Controls 2 Examples qhp.QtQuickControls2.subprojects.examples.selectors = fake:example -depends = qtcore qtgui qtdoc qtqml qtquick qtquickdialogs qtquickcontrols qtquickextras qmake qtsql qtwidgets +depends = qtcore qtgui qtdoc qtqml qtquick qtquickdialogs qtquickcontrols qtquickextras qmake qtsql qtwidgets qtlabscalendar qtlabsplatform # Specify the install path under QT_INSTALL_EXAMPLES # Note: paths passed to \example command must contain the parent directory, e.g. # \example controls/tabs exampledirs += ../../../../examples/quickcontrols2 \ ../../../quicktemplates2 \ - ../../calendar \ - ../../../../tests/auto/controls/data \ snippets \ snippets/screenshots examplesinstallpath = quickcontrols2 headerdirs += ../../../quicktemplates2 \ - ../../calendar \ ../../../quickcontrols2 sourcedirs += ../../../quicktemplates2 \ - ../../calendar \ ../../../quickcontrols2 \ + ../../templates/doc/src \ src imagedirs += images @@ -91,7 +88,6 @@ macro.endstylemethod2 = "\\br" macro.stylecolor.HTML = "<div style=\"padding:10px;color:#fff;background:\1;\">\1 \2</div>" macro.nbsp.HTML = " " -macro.labs = "\\note \\e{Types in Qt.labs modules are not guaranteed to remain compatible in future versions.}" #Add output suffix to the html filenames outputsuffixes = QML diff --git a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-dialog-modal.qml index 5ea3714c..c151ceed 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-dialog-modal.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -26,10 +26,16 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.calendar 1.0 +import QtQuick.Controls 2.1 +Item { + width: dialog.implicitWidth + height: dialog.implicitHeight //! [1] -DayOfWeekRow { - locale: Qt.locale("en_US") +Dialog { + id: dialog + modal: true + standardButtons: Dialog.Ok } //! [1] +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-dialog-modeless.qml index e58e5c7b..45e1c2c0 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-dialog-modeless.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -26,12 +26,16 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.calendar 1.0 +import QtQuick.Controls 2.1 +Item { + width: dialog.implicitWidth + height: dialog.implicitHeight //! [1] -WeekNumberColumn { - month: Calendar.December - year: 2015 - locale: Qt.locale("en_US") +Dialog { + id: dialog + modal: false + standardButtons: Dialog.Ok } //! [1] +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow-layout.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-dialog.qml index ce41d224..69e84914 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow-layout.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-dialog.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -26,22 +26,19 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Layouts 1.0 -import Qt.labs.calendar 1.0 +import QtQuick.Controls 2.1 +Item { + width: dialog.implicitWidth + height: dialog.implicitHeight //! [1] -ColumnLayout { - DayOfWeekRow { - locale: grid.locale - Layout.fillWidth: true - } +Dialog { + id: dialog + title: "Title" + standardButtons: Dialog.Ok | Dialog.Cancel - MonthGrid { - id: grid - month: Calendar.December - year: 2015 - locale: Qt.locale("en_US") - Layout.fillWidth: true - } + onAccepted: console.log("Ok clicked") + onRejected: console.log("Cancel clicked") } //! [1] +} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-dialogbuttonbox-attached.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-dialogbuttonbox-attached.qml new file mode 100644 index 00000000..a93cda30 --- /dev/null +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-dialogbuttonbox-attached.qml @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.1 + +//! [1] +DialogButtonBox { + Button { + text: qsTr("Save") + DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole + } + Button { + text: qsTr("Close") + DialogButtonBox.buttonRole: DialogButtonBox.DestructiveRole + } +} +//! [1] diff --git a/src/imports/controls/doc/snippets/basic-example.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-dialogbuttonbox.qml index 62ab2466..41e6cf23 100644 --- a/src/imports/controls/doc/snippets/basic-example.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-dialogbuttonbox.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -25,19 +25,14 @@ ** ****************************************************************************/ -//! [0] -import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick 2.0 +import QtQuick.Controls 2.1 -ApplicationWindow { - title: "My Application" - width: 640 - height: 480 - visible: true +//! [1] +DialogButtonBox { + standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel - Button { - text: "Push Me" - anchors.centerIn: parent - } + onAccepted: console.log("Ok clicked") + onRejected: console.log("Cancel clicked") } -//! [0] +//! [1] diff --git a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-calendarmodel.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-menuseparator-custom.qml index dfbf4fbc..b5d8b18b 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-calendarmodel.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-menuseparator-custom.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -25,33 +25,45 @@ ** ****************************************************************************/ -import QtQuick 2.0 -import Qt.labs.calendar 1.0 -import QtQuick.Controls 2.0 +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.1 -//! [1] -ListView { - id: listview +Item { + id: window + width: menu.contentItem.width + height: menu.contentItem.height + visible: true - width: 200; height: 200 - snapMode: ListView.SnapOneItem - orientation: ListView.Horizontal - highlightRangeMode: ListView.StrictlyEnforceRange +// Indent it like this so that the indenting in the generated doc is normal. +Menu { + id: menu + contentItem.parent: window - model: CalendarModel { - from: new Date(2015, 0, 1) - to: new Date(2015, 11, 31) + MenuItem { + text: qsTr("New...") + } + MenuItem { + text: qsTr("Open...") + } + MenuItem { + text: qsTr("Save") } - delegate: MonthGrid { - width: listview.width - height: listview.height - - month: model.month - year: model.year - locale: Qt.locale("en_US") + MenuSeparator { + padding: 0 + topPadding: 12 + bottomPadding: 12 + contentItem: Rectangle { + implicitWidth: 200 + implicitHeight: 1 + color: "#1E000000" + } } - ScrollIndicator.horizontal: ScrollIndicator { } + MenuItem { + text: qsTr("Exit") + } +} } -//! [1] +//! [file] diff --git a/src/imports/controls/doc/src/calendar/qtlabscalendar-index.qdoc b/src/imports/controls/doc/snippets/qtquickcontrols2-menuseparator.qml index d99b3880..d41d3cf9 100644 --- a/src/imports/controls/doc/src/calendar/qtlabscalendar-index.qdoc +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-menuseparator.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -25,27 +25,36 @@ ** ****************************************************************************/ -/*! - \page qtlabscalendar-index.html - \title Qt Labs Calendar - - \brief The Qt Labs Calendar module provides a set of UI controls for Qt - Quick. - - The Qt Labs Calendar module provides a set of types that can be used - to build calendars in Qt Quick. - - \section1 QML Types - - \generatelist {qmltypesbymodule Qt.labs.calendar} - - \labs - - \section1 Related Information - - \list - \li \l{Qt Quick} - \li \l{Qt Quick Layouts} - \li \l{Qt Quick Controls 2} - \endlist -*/ +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.1 + +Item { + id: window + width: menu.contentItem.width + height: menu.contentItem.height + visible: true + +// Indent it like this so that the indenting in the generated doc is normal. +Menu { + id: menu + contentItem.parent: window + + MenuItem { + text: qsTr("New...") + } + MenuItem { + text: qsTr("Open...") + } + MenuItem { + text: qsTr("Save") + } + + MenuSeparator {} + + MenuItem { + text: qsTr("Exit") + } +} +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-roundbutton.qml index 16f872b8..fa926302 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-roundbutton.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -26,12 +26,11 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.calendar 1.0 +import QtQuick.Controls 2.1 //! [1] -MonthGrid { - month: Calendar.December - year: 2015 - locale: Qt.locale("en_US") +RoundButton { + text: "\u2713" // Unicode Character 'CHECK MARK' + onClicked: textArea.readOnly = true } //! [1] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-stackview-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-stackview-custom.qml index 3e40ea2d..898ff6af 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-stackview-custom.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-stackview-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 StackView { id: control diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate.qml index db077057..46b2809f 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate.qml @@ -25,39 +25,56 @@ ** ****************************************************************************/ -import QtQuick 2.7 -import QtQuick.Controls 2.0 +import QtQuick 2.8 +import QtQuick.Controls 2.1 //! [1] ListView { - width: 200 - height: 300 - clip: true + id: listView + anchors.fill: parent model: ListModel { - id: listModel - ListElement { title: "Electricity bill" } - ListElement { title: "Happy Birthday!" } - ListElement { title: "FW: Cat pictures" } - ListElement { title: "Hotel visit receipt" } - ListElement { title: "Customer service" } + ListElement { sender: "Bob Bobbleton"; title: "How are you going?" } + ListElement { sender: "Rug Emporium"; title: "SALE! All rugs MUST go!" } + ListElement { sender: "Electric Co."; title: "Electricity bill 15/07/2016 overdue" } + ListElement { sender: "Tips"; title: "Five ways this tip will save your life" } } delegate: SwipeDelegate { id: swipeDelegate - text: title + text: model.sender + " - " + model.title width: parent.width - onClicked: if (swipe.complete) listModel.remove(index) + ListView.onRemove: SequentialAnimation { + PropertyAction { + target: swipeDelegate + property: "ListView.delayRemove" + value: true + } + NumberAnimation { + target: swipeDelegate + property: "height" + to: 0 + easing.type: Easing.InOutQuad + } + PropertyAction { + target: swipeDelegate; + property: "ListView.delayRemove"; + value: false + } + } - swipe.right: Rectangle { - color: swipeDelegate.swipe.complete && swipeDelegate.pressed ? "#333" : "#444" - width: parent.width + swipe.right: Label { + id: deleteLabel + text: qsTr("Delete") + color: "white" + verticalAlignment: Label.AlignVCenter + padding: 12 height: parent.height + anchors.right: parent.right + + SwipeDelegate.onClicked: listView.model.remove(index) - Label { - font.pixelSize: swipeDelegate.font.pixelSize - text: qsTr("Remove") - color: "white" - anchors.centerIn: parent + background: Rectangle { + color: deleteLabel.SwipeDelegate.pressed ? Qt.darker("tomato", 1.1) : "tomato" } } } diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-swipeview-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-swipeview-custom.qml index 04b12512..0f862276 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-swipeview-custom.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-swipeview-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 SwipeView { id: control diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-toolseparator-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-toolseparator-custom.qml new file mode 100644 index 00000000..7495a993 --- /dev/null +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-toolseparator-custom.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.8 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.1 + +//! [file] +ToolBar { + RowLayout { + anchors.fill: parent + + ToolButton { + text: qsTr("Action 1") + } + ToolButton { + text: qsTr("Action 2") + } + + ToolSeparator { + padding: vertical ? 10 : 2 + topPadding: vertical ? 2 : 10 + bottomPadding: vertical ? 2 : 10 + + contentItem: Rectangle { + implicitWidth: parent.vertical ? 1 : 24 + implicitHeight: parent.vertical ? 24 : 1 + color: "#c3c3c3" + } + } + + ToolButton { + text: qsTr("Action 3") + } + ToolButton { + text: qsTr("Action 4") + } + + Item { + Layout.fillWidth: true + } + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid-layout.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-toolseparator.qml index 346e6099..7770d14c 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid-layout.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-toolseparator.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -25,37 +25,44 @@ ** ****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Layouts 1.0 -import Qt.labs.calendar 1.0 +import QtQuick 2.8 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.1 //! [1] -GridLayout { - columns: 2 +ToolBar { + RowLayout { + anchors.fill: parent - DayOfWeekRow { - locale: grid.locale + ToolButton { + text: qsTr("Action 1") + } + ToolButton { + text: qsTr("Action 2") + } - Layout.column: 1 - Layout.fillWidth: true - } + ToolSeparator {} - WeekNumberColumn { - month: grid.month - year: grid.year - locale: grid.locale + ToolButton { + text: qsTr("Action 3") + } + ToolButton { + text: qsTr("Action 4") + } - Layout.fillHeight: true - } + ToolSeparator {} - MonthGrid { - id: grid - month: Calendar.December - year: 2015 - locale: Qt.locale("en_US") + ToolButton { + text: qsTr("Action 5") + } + ToolButton { + text: qsTr("Action 6") + } - Layout.fillWidth: true - Layout.fillHeight: true + Item { + Layout.fillWidth: true + } } } //! [1] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-custom.qml index 94d9c12e..6bb8a45e 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-custom.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Item { ToolTip { diff --git a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn-layout.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-listView.qml index d105553f..ff3ecd81 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn-layout.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-listView.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -25,25 +25,22 @@ ** ****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Layouts 1.0 -import Qt.labs.calendar 1.0 +import QtQuick 2.8 +import QtQuick.Controls 2.1 -//! [1] -RowLayout { - WeekNumberColumn { - month: grid.month - year: grid.year - locale: grid.locale - Layout.fillHeight: true - } +//! [contentItem] +Tumbler { + id: tumbler + + contentItem: ListView { + model: tumbler.model + delegate: tumbler.delegate - MonthGrid { - id: grid - month: Calendar.December - year: 2015 - locale: Qt.locale("en_US") - Layout.fillHeight: true + snapMode: ListView.SnapToItem + highlightRangeMode: ListView.StrictlyEnforceRange + preferredHighlightBegin: height / 2 - (height / tumbler.visibleItemCount / 2) + preferredHighlightEnd: height / 2 + (height / tumbler.visibleItemCount / 2) + clip: true } } -//! [1] +//! [contentItem] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-pathView.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-pathView.qml new file mode 100644 index 00000000..957112e0 --- /dev/null +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-pathView.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.8 +import QtQuick.Controls 2.1 + +//! [contentItem] +Tumbler { + id: tumbler + + contentItem: PathView { + id: pathView + model: tumbler.model + delegate: tumbler.delegate + clip: true + pathItemCount: tumbler.visibleItemCount + 1 + preferredHighlightBegin: 0.5 + preferredHighlightEnd: 0.5 + dragMargin: width / 2 + + path: Path { + startX: pathView.width / 2 + startY: -pathView.delegateHeight / 2 + PathLine { + x: pathView.width / 2 + y: pathView.pathItemCount * pathView.delegateHeight - pathView.delegateHeight / 2 + } + } + + property real delegateHeight: tumbler.availableHeight / tumbler.visibleItemCount + } +} +//! [contentItem] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-timePicker.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-timePicker.qml new file mode 100644 index 00000000..86276266 --- /dev/null +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-timePicker.qml @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [tumbler] +import QtQuick 2.8 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.1 + +Rectangle { + width: frame.implicitWidth + 10 + height: frame.implicitHeight + 10 + + function formatText(count, modelData) { + var data = count === 12 ? modelData + 1 : modelData; + return data.toString().length < 2 ? "0" + data : data; + } + + FontMetrics { + id: fontMetrics + } + + Component { + id: delegateComponent + + Label { + text: formatText(Tumbler.tumbler.count, modelData) + opacity: 1.0 - Math.abs(Tumbler.displacement) / (Tumbler.tumbler.visibleItemCount / 2) + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + font.pixelSize: fontMetrics.font.pixelSize * 1.25 + } + } + + Frame { + id: frame + padding: 0 + anchors.centerIn: parent + + Row { + id: row + + Tumbler { + id: hoursTumbler + model: 12 + delegate: delegateComponent + } + + Tumbler { + id: minutesTumbler + model: 60 + delegate: delegateComponent + } + + Tumbler { + id: amPmTumbler + model: ["AM", "PM"] + delegate: delegateComponent + } + } + } +} +//! [tumbler] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-busyindicator-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-busyindicator-custom.qml index 82ed9cdc..847ad736 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-busyindicator-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-busyindicator-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 BusyIndicator { id: control diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-custom.qml index eac6b831..dbe53f4d 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Button { id: control diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-disabled.qml index f4555c90..c7399b9a 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-disabled.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-disabled.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Button { width: 80 diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-focused.qml index a99346a6..ea220fde 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-focused.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-focused.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Button { width: 80 diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-normal.qml index f206bcec..385d4abb 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-normal.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-normal.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Button { width: 80 diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-pressed.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-pressed.qml index 8a941561..edf0b324 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-pressed.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-pressed.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Button { width: 80 diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-checked.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-checked.qml index 075e6342..e5c466da 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-checked.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-checked.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 CheckBox { text: "Checked" diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-custom.qml index 0465ec80..9645a4b6 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 CheckBox { id: control diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-disabled.qml index 4878cf31..3bfbb730 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-disabled.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-disabled.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 CheckBox { text: "Disabled" diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-focused.qml index 93f1c214..fd7c7fea 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-focused.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-focused.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 CheckBox { text: "Focused" diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-normal.qml index a840116e..dba9e7e9 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-normal.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-normal.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 CheckBox { text: "Normal" diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkdelegate-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkdelegate-custom.qml index 483f9838..83f0ef86 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkdelegate-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkdelegate-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 CheckDelegate { id: control diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-custom.qml index bd261e52..12d56a56 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 ComboBox { id: control diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-delegate.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-delegate.qml index d8b5d1fa..2817d956 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-delegate.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-delegate.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Item { id: root diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-popup.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-popup.qml index 36569e15..1ac43234 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-popup.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-popup.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Item { id: root diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-custom.qml index efe061d3..1bf9baf4 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Dial { id: control diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-handle.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-handle.qml index 19d943a6..d9a61682 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-handle.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-handle.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Dial { id: dial diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame-custom.qml index d11c431e..f2b5d254 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Frame { background: Rectangle { diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame.qml index 1ede733d..98f177ef 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame.qml @@ -27,7 +27,7 @@ import QtQuick 2.0 import QtQuick.Layouts 1.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 //! [1] Frame { diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-checkable.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-checkable.qml index a2999925..db58593f 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-checkable.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-checkable.qml @@ -27,7 +27,7 @@ import QtQuick 2.0 import QtQuick.Layouts 1.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 //! [1] GroupBox { diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-custom.qml index cb9ed049..bf21e022 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 GroupBox { id: control diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-label.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-label.qml index 74d0ea52..bef99d0b 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-label.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-label.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 GroupBox { width: 100 diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox.qml index f79f3aef..7d4f328c 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox.qml @@ -27,7 +27,7 @@ import QtQuick 2.0 import QtQuick.Layouts 1.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 //! [1] GroupBox { diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate-custom.qml index 002aae69..0935d8f6 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 ItemDelegate { id: control diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate.qml index 143b3323..733434e8 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 //! [1] ListView { diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label-custom.qml index 98dbdc5e..2eedb29f 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Label { text: qsTr("Label") diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label.qml index 4346c0eb..cf59c49a 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 //! [1] Label { diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-menu-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-menu-custom.qml index a6971232..f4507714 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-menu-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-menu-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Item { id: window diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-custom.qml index 65112ef4..225ba423 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 PageIndicator { id: control diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-delegate.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-delegate.qml index 4b3ccf23..c7ae046f 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-delegate.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-delegate.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 PageIndicator { count: 5 diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator.qml index 237bc6e7..cf91d6f2 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator.qml @@ -25,7 +25,7 @@ ** ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 //! [1] PageIndicator { diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane-custom.qml index 80519939..42c30795 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Pane { background: Rectangle { diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane.qml index 3d86499f..b7b8fa5d 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane.qml @@ -27,7 +27,7 @@ import QtQuick 2.0 import QtQuick.Layouts 1.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 //! [1] Pane { diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-custom.qml index 88faed20..9e6779d6 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 ProgressBar { id: control diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-custom.qml index dba262be..1d9661a5 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 RadioButton { id: control diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiodelegate-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiodelegate-custom.qml index 6efb7803..91125921 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiodelegate-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiodelegate-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 RadioDelegate { id: control diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-custom.qml index 7e488d14..86fae061 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 RangeSlider { id: control diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-active.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-active.qml index 086541c8..1570aff4 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-active.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-active.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Item { width: 100 diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-custom.qml index 0bf13b3c..05b3f3aa 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 ScrollBar { id: control diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-active.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-active.qml index c118c7aa..954b449c 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-active.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-active.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Item { width: 100 diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-custom.qml index 5720f4f7..97930e1e 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 ScrollIndicator { id: control diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-custom.qml index ebc11f46..6201cbf8 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Slider { id: control diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-handle.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-handle.qml index 20b569f3..fa23972c 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-handle.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-handle.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Slider { value: 0.5 diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-custom.qml index 6433fd80..cfbd8400 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 SpinBox { id: control diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-double.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-double.qml index 15af31ae..ad22b856 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-double.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-double.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 //! [1] SpinBox { diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-down.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-down.qml index 419dae5c..ecd2a659 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-down.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-down.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 SpinBox { value: 50 diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-textual.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-textual.qml index 814b8b28..e6b7c735 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-textual.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-textual.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 //! [1] SpinBox { diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-up.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-up.qml index b4b0fab3..0b2c3fea 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-up.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-up.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 SpinBox { value: 50 diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox.qml index 6616ed60..d8c54714 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 //! [1] SpinBox { diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipedelegate-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipedelegate-custom.qml index ae63efed..087e17fe 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipedelegate-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipedelegate-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 SwipeDelegate { id: control @@ -37,7 +37,7 @@ SwipeDelegate { id: component Rectangle { - color: control.swipe.complete && control.down ? "#333" : "#444" + color: SwipeDelegate.pressed ? "#333" : "#444" width: parent.width height: parent.height clip: true diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipeview-indicator.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipeview-indicator.qml index 2ba8df9c..3afcc3e2 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipeview-indicator.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipeview-indicator.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Item { width: 200 diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-checked.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-checked.qml index f9a18b1c..3a6dfc7c 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-checked.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-checked.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Switch { text: "Checked" diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-custom.qml index 698c1a05..5152040d 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Switch { id: control diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-disabled.qml index a40586b5..6eb53084 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-disabled.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-disabled.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Switch { text: "Disabled" diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-focused.qml index f98f2c90..6ca19062 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-focused.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-focused.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Switch { text: "Focused" diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-normal.qml index a55c2854..339874d7 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-normal.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-normal.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Switch { text: "Normal" diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switchdelegate-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switchdelegate-custom.qml index 8d0daa0a..e06af484 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switchdelegate-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switchdelegate-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 SwitchDelegate { id: control diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-custom.qml index 1873fba9..305101c0 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 TabBar { id: control diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar.qml index b445ee67..e3a67c30 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar.qml @@ -27,7 +27,7 @@ import QtQuick 2.0 import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Column { width: 300 diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbutton.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbutton.qml index 67e5e1e0..9fef1e59 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbutton.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbutton.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 //! [1] TabBar { diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-custom.qml index f70c7135..dd6035c0 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 TextArea { id: control diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-flickable.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-flickable.qml index e11750cb..500e09c3 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-flickable.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-flickable.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Item { width: 100 diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-custom.qml index 0deb0e5c..8e5d897c 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 TextField { id: control diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-disabled.qml index ac798f53..21c351c4 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-disabled.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-disabled.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 TextField { width: 80 diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-focused.qml index a4e1b3b1..ddea7c51 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-focused.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-focused.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 TextField { width: 80 diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-normal.qml index 12c7ead9..29f7fb9c 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-normal.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-normal.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 TextField { width: 80 diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar-custom.qml index 3e98808c..e8d268c5 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar-custom.qml @@ -27,7 +27,7 @@ import QtQuick 2.6 import QtQuick.Layouts 1.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 //! [file] ToolBar { diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml index 246f3ae5..2ec10c57 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml @@ -27,7 +27,7 @@ import QtQuick 2.0 import QtQuick.Layouts 1.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Item { width: children[0].implicitWidth * 2 diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbutton-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbutton-custom.qml index 10491cb5..449266c1 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbutton-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbutton-custom.qml @@ -27,7 +27,7 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 ToolButton { id: control diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-hover.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-hover.qml index 330ab83c..27b03a63 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-hover.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-hover.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 //! [1] Button { diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-pressandhold.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-pressandhold.qml index eddb09e6..7d285528 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-pressandhold.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-pressandhold.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 //! [1] Button { diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml index e6a386c1..ca08ce72 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml @@ -27,7 +27,7 @@ import QtQuick 2.0 import QtQuick.Window 2.2 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Item { id: root @@ -46,7 +46,7 @@ Item { ToolTip { parent: slider.handle visible: slider.pressed - text: slider.position.toFixed(1) + text: slider.valueAt(slider.position).toFixed(1) } } //! [1] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip.qml index 146fe477..3aa26908 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip.qml @@ -27,7 +27,7 @@ import QtQuick 2.0 import QtQuick.Window 2.2 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Item { id: root diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-custom.qml index d2b4f960..f1c2b806 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-custom.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-custom.qml @@ -27,12 +27,11 @@ //! [file] import QtQuick 2.6 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Tumbler { id: control model: 15 - visibleItemCount: 5 background: Item { Rectangle { diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-delegate.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-delegate.qml index 4d389ab7..4d2c7349 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-delegate.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-delegate.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 Tumbler { id: tumbler diff --git a/src/imports/controls/doc/src/calendar/qtlabscalendar.qdoc b/src/imports/controls/doc/src/calendar/qtlabscalendar.qdoc deleted file mode 100644 index a94e5ec6..00000000 --- a/src/imports/controls/doc/src/calendar/qtlabscalendar.qdoc +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \qmlmodule Qt.labs.calendar 1.0 - \title Qt Labs Calendar QML Types - \ingroup qmlmodules - \brief Provides QML types for calendars (Qt Labs Calendar). - - The \l{Qt Labs Calendar} module provides QML types for creating - calendars. These QML types work in conjunction with \l{Qt Quick} and - \l{Qt Quick Controls 2}. - - The QML types can be imported into your application using the - following import statement in your .qml file: - - \badcode - import Qt.labs.calendar 1.0 - \endcode - - \section1 QML Types - - \generatelist {qmltypesbymodule Qt.labs.calendar} - - \labs - - \section1 Related Information - - \list - \li \l {Qt Quick Controls 2 QML Types} - \endlist - - \noautolist -*/ diff --git a/src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc index 5e2c9370..d79dd198 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc @@ -128,6 +128,24 @@ \b {See also} \l RadioButton + \section1 RoundButton Control + + \l RoundButton is a clickable control that starts an action, or opens or + closes a popup. A round button with a square image icon or one-letter font + icon is circular. A circular RoundButton takes less space than a normal + \l Button, and can also be used as a floating action button. + + \image qtquickcontrols2-roundbutton.png + + Recommendations: + + \list + \li Keep labels short and concise. + \li If the text is localized, consider the influence of a longer text on the layout. + \endlist + + \b {See also} \l RoundButton + \section1 Switch Control \image qtquickcontrols2-switch.png diff --git a/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc index 29bfc99c..d03f2325 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc @@ -36,14 +36,15 @@ attributes. The following example specifies that the preferred style is the \l {Material style}. Furthermore, when the application is run with the Material style, its theme is light and the accent and primary colors are teal and blue grey, respectively. However, if the application - is run with the \l {Universal style} instead, the theme is dark and the accent color is red. + is run with the \l {Universal style} instead, the accent color is red and the appropriate theme + is chosen based on the system theme colors. \code [Controls] Style=Material [Universal] - Theme=Dark + Theme=System Accent=Red [Material] diff --git a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc index 71ffe350..06201404 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc @@ -49,7 +49,7 @@ \qml import QtQuick 2.6 - import QtQuick.Controls 2.0 + import QtQuick.Controls 2.1 ApplicationWindow { width: 400 @@ -92,7 +92,7 @@ your application, refer to it by its filename: \qml - import QtQuick.Controls 2.0 + import QtQuick.Controls 2.1 ApplicationWindow { MyButton { @@ -108,7 +108,7 @@ control, first import the folder into a namespace: \qml - import QtQuick.Controls 2.0 + import QtQuick.Controls 2.1 import "controls" as MyControls ApplicationWindow { @@ -136,8 +136,6 @@ \list \li At least one QML file whose name matches a control (for example, \c Button.qml) must exist. - - The Default style will be used for any controls that aren't implemented. \li The files must be in a directory in the filesystem or in the \l {The Qt Resource System}{resource system}. @@ -155,6 +153,10 @@ for example. \endlist + By default, the styling system uses the Default style as a fallback for + controls that aren't implemented. To customize or extend any other built-in + style, it is possible to specify a different fallback style using \l QQuickStyle. + What this means is that you can implement as many controls as you like for your custom style, and place them almost anywhere. It also allows users to create their own styles for your application. @@ -299,7 +301,7 @@ \qml import QtQuick 2.6 - import QtQuick.Controls 2.0 + import QtQuick.Controls 2.1 import MyStyle 1.0 @@ -488,7 +490,7 @@ \quotefromfile qtquickcontrols2-menu-custom.qml \skipto import QtQuick 2.6 - \printuntil import QtQuick.Controls 2.0 + \printuntil import QtQuick.Controls 2.1 \skipto Menu \printto contentItem.parent: window \skipline contentItem.parent: window @@ -503,6 +505,23 @@ \l {Customizing Button}{Button}. + \section2 Customizing MenuSeparator + + MenuSeparator consists of two visual items: \l {Control::background}{background} + and \l {Control::contentItem}{content item}. + + \image qtquickcontrols2-menuseparator-custom.png + + \quotefromfile qtquickcontrols2-menuseparator-custom.qml + \skipto import QtQuick 2.6 + \printuntil import QtQuick.Controls 2.1 + \skipto Menu + \printto contentItem.parent: window + \skipline contentItem.parent: window + \printuntil text: qsTr("Exit") + \printuntil } + \printuntil } + \section2 Customizing PageIndicator PageIndicator consists of a \l {Control::background}{background}, \l {Control::contentItem}{content item}, and \l {PageIndicator::delegate}{delegate}. @@ -581,6 +600,12 @@ \snippet qtquickcontrols2-rangeslider-custom.qml file + \section2 Customizing RoundButton + + RoundButton can be customized in the same manner as + \l {Customizing Button}{Button}. + + \section2 Customizing ScrollBar ScrollBar consists of two visual items: \l {Control::background}{background} @@ -723,6 +748,16 @@ \snippet qtquickcontrols2-toolbutton-custom.qml file + \section2 Customizing ToolSeparator + + ToolSeparator consists of two visual items: \l {Control::background}{background} + and \l {Control::contentItem}{content item}. + + \image qtquickcontrols2-toolseparator-custom.png + + \snippet qtquickcontrols2-toolseparator-custom.qml file + + \section2 Customizing ToolTip ToolTip consists of two visual items: \l {Popup::background}{background} @@ -730,7 +765,7 @@ \quotefromfile qtquickcontrols2-tooltip-custom.qml \skipto import QtQuick 2.6 - \printuntil import QtQuick.Controls 2.0 + \printuntil import QtQuick.Controls 2.1 \skipto ToolTip \printuntil } \printuntil } @@ -747,4 +782,13 @@ \image qtquickcontrols2-tumbler-custom.png \snippet qtquickcontrols2-tumbler-custom.qml file + + If you want to define your own contentItem, use either a \l ListView or + \l PathView as the root item. For a wrapping Tumbler, use PathView: + + \snippet qtquickcontrols2-tumbler-pathView.qml contentItem + + For a non-wrapping Tumbler, use ListView: + + \snippet qtquickcontrols2-tumbler-listView.qml contentItem */ diff --git a/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc index a85890f5..01429b94 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc @@ -115,14 +115,14 @@ \row \li Can be used on Desktop \li Yes - \li Yes \sup 3 + \li Yes \row \li Can be used on Mobile - \li Yes \sup 4 + \li Yes \sup 3 \li Yes \row \li Can be used on Embedded - \li Yes \sup 4 + \li Yes \sup 3 \li Yes \row \li Internal event handling @@ -133,7 +133,6 @@ \list 1 \li Not officially supported, but technically possible via private APIs \li Only themes for specific styles can be changed at runtime, styles are fixed - \li No hover effects \li Performance may not be optimal \endlist @@ -186,185 +185,487 @@ This works with both modules, and will reduce the amount of work needed when the migration begins. - \section3 Type Comparison Table + \section2 Type Comparison Table + + The first column lists all types available in \l {Qt Quick Controls} + {Qt Quick Controls 1}, \l {Qt Quick Dialogs}, and \l {Qt Quick Extras}. + The second column documents the respective type in Qt Quick Controls 2. + When a direct alternative is not available, the third column contains + an alternative that provides related functionality. The last column + contains some remarks about the differences between the types in the + different modules. \table \header - \li Qt Quick Controls 1, Qt Quick Extras - \li Qt Quick Controls 2, Qt Labs Calendar - \row - \li \mdash - \li \l [QML QtQuickControls2] {AbstractButton} + \li Qt Quick Controls 1 + \li Qt Quick Controls 2 + \li Alternatives + \li Remarks \row \li \l [QML QtQuickControls] {Action} - \li \span {} {\mdash \nbsp \sub {(see \l [QML QtQuick] {Shortcut} instead)}} + \li \mdash + \li \l [QML QtQuick] {Shortcut} \br\sup {(Qt Quick)} + \li \list + \li \b {Qt Quick Controls 1}: \c Action is an abstract user interface + action that is bound to buttons and menu items, and can provide + shortcuts. + \li \b {Qt Quick}: \c Shortcut provides the shortcut functionality that + was previously only provided by \c Action. + \endlist \row \li \l [QML QtQuickControls] {ApplicationWindow} \li \l [QML QtQuickControls2] {ApplicationWindow} + \li + \li \row \li \l [QML QtQuickControls] {BusyIndicator} \li \l [QML QtQuickControls2] {BusyIndicator} + \li + \li \row \li \l [QML QtQuickControls] {Button} \li \l [QML QtQuickControls2] {Button} + \li + \li \row - \li \l [QML QtQuickExtras] {CircularGauge} + \li \l [QML QtQuickControls] {Calendar} \li \mdash + \li \l [QML QtLabsCalendar] {MonthGrid},\br + \l [QML QtLabsCalendar] {DayOfWeekRow},\br + \l [QML QtLabsCalendar] {WeekNumberColumn} \br\sup {(Qt Labs Calendar)} + \li \list + \li \b {Qt Labs Calendar}: \c MonthGrid, \c DayOfWeek, and \c WeekNumberColumn + are \e experimental unstyled building blocks for calendar views. + \endlist \row + \li \l [QML QtQuickControls] {CheckBox} + \li \l [QML QtQuickControls2] {CheckBox} + \li + \li + \row + \li \l [QML QtQuickControls] {ComboBox} + \li \l [QML QtQuickControls2] {ComboBox} + \li + \li \list + \li \b {Qt Quick Controls 2}: \c ComboBox is not editable. + \endlist + \row + \li \l [QML QtQuickControls] {ExclusiveGroup} \li \mdash - \li \l [QML QtQuickControls2] {Control} + \li \l [QML QtQuickControls2] {ButtonGroup} \br\sup {(Qt Quick Controls 2)} + \li \list + \li \b {Qt Quick Controls 2}: \c ButtonGroup offers similar functionality. + \endlist + \row + \li \l [QML QtQuickControls] {GroupBox} + \li \l [QML QtQuickControls2] {GroupBox} + \li + \li \row + \li \l [QML QtQuickControls] {Label} + \li \l [QML QtQuickControls2] {Label} + \li + \li + \row + \li \l [QML QtQuickControls] {Menu} + \li \l [QML QtQuickControls2] {Menu} + \li \l [QML QtLabsPlatform] {Menu} \br\sup {(Qt Labs Platform)} + \li \list + \li \b {Qt Quick Controls 1}: \c Menu is native on platforms where an + implementation is available in the Qt Platform Abstraction Layer. + Other platforms use a QML-based top-level menu popup window. \c Menu + supports traditional desktop style cascading submenus, but does not + work on Embedded Linux because \l EGLFS does not support multiple + top-level windows. + \li \b {Qt Quick Controls 2}: \c Menu is a non-native \c Item-based popup + that is stacked above the application content. Due to this, menu popups + are restricted within window boundaries. \c Menu is fully customizable + using QML and Qt Quick, and allows adding any \c Items. Traditional + desktop oriented features, such as cascading submenus and visualizing + keyboard shortcuts are missing. + \li \b {Qt Labs Platform}: \c Menu is an \e experimental native menu that + uses Qt Widgets as a fallback on platforms where a native implementation + is not available in the Qt Platform Abstraction Layer. + \endlist + \row + \li \l [QML QtQuickControls] {MenuBar} \li \mdash - \li \l [QML QtQuickControls2] {Container} + \li \l [QML QtLabsPlatform] {MenuBar} \br\sup {(Qt Labs Platform)} + \li \list + \li \b {Qt Quick Controls 1}: \c MenuBar is native on platforms where an + implementation is available in the Qt Platform Abstraction Layer. Other + platforms use a QML-based menubar item stacked at the top of the window. + \li \b {Qt Labs Platform}: \c MenuBar is an \e experimental native menubar. + It is only available on platforms where a native implementation is available + in the Qt Platform Abstraction Layer. + \endlist + \row + \li \l [QML QtQuickControls] {MenuItem},\br + \l [QML QtQuickControls] {MenuSeparator} + \li \l [QML QtQuickControls2] {MenuItem},\br + \l [QML QtQuickControls2] {MenuSeparator} + \li \l [QML QtLabsPlatform] {MenuItem},\br + \l [QML QtLabsPlatform] {MenuSeparator} \br\sup {(Qt Labs Platform)} + \li \list + \li \b {Qt Quick Controls 1}: \c MenuItem and \c MenuSeparator are native + on platforms where an implementation is available in the Qt Platform + Abstraction Layer. Other platforms use QML-based menu items and separators. + \li \b {Qt Quick Controls 2}: \c MenuItem and \c MenuSeparator are a non-native + QML-based menu items and separators that can be fully customized using QML + and Qt Quick. + \li \b {Qt Labs Platform}: \c MenuItem and \c MenuSeparator are \e experimental + native menu items and separators. + \endlist \row - \li \l [QML QtQuickControls] {Calendar} - \li \l [QML QtLabsCalendar] {MonthGrid}, - \l [QML QtLabsCalendar] {DayOfWeekRow}, - \l [QML QtLabsCalendar] {WeekNumberColumn} + \li \l [QML QtQuickControls] {ProgressBar} + \li \l [QML QtQuickControls2] {ProgressBar} + \li + \li \row - \li \l [QML QtQuickControls] {CheckBox} - \li \l [QML QtQuickControls2] {CheckBox} + \li \l [QML QtQuickControls] {RadioButton} + \li \l [QML QtQuickControls2] {RadioButton} + \li + \li \row + \li \l [QML QtQuickControls] {ScrollView} \li \mdash - \li \l [QML QtQuickControls2] {CheckDelegate} + \li \l [QML QtQuickControls2] {ScrollBar},\br + \l [QML QtQuickControls2] {ScrollIndicator} \br\sup {(Qt Quick Controls 2)} + \li \list + \li \b {Qt Quick Controls 2}: \c ScrollBar and \c ScrollIndicator offer + similar functionality. They can be attached to any \c Flickable to + build scrollable views. + \endlist \row - \li \l [QML QtQuickControls] {ComboBox} - \li \l [QML QtQuickControls2] {ComboBox} + \li \l [QML QtQuickControls] {Slider} + \li \l [QML QtQuickControls2] {Slider} + \li + \li \row - \li \l [QML QtQuickExtras] {DelayButton} + \li \l [QML QtQuickControls] {SpinBox} + \li \l [QML QtQuickControls2] {SpinBox} + \li + \li + \row + \li \l [QML QtQuickControls] {SplitView} \li \mdash + \li + \li \row - \li \l [QML QtQuickExtras] {Dial} - \li \l [QML QtQuickControls2] {Dial} + \li \l [QML QtQuickControls] {StackView},\br + \l [QML QtQuickControls] {StackViewDelegate},\br + \l [QML QtQuickControls] {Stack} + \li \l [QML QtQuickControls2] {StackView} + \li + \li \list + \li \b {Qt Quick Controls 2}: \c StackView provides customizable transitions + and attached properties via a single \c StackView type. + \endlist \row + \li \l [QML QtQuickControls] {StatusBar} \li \mdash - \li \l [QML QtQuickControls2] {Drawer} + \li \l [QML QtQuickControls2] {ToolBar} \br\sup {(Qt Quick Controls 2)} + \li \list + \li \b {Qt Quick Controls 2}: \c ApplicationWindow allows assigning any + item or control, such as \c ToolBar, as a header or footer. + \endlist \row - \li \l [QML QtQuickControls] {ExclusiveGroup} - \li \l [QML QtQuickControls2] {ButtonGroup} + \li \l [QML QtQuickControls] {Switch} + \li \l [QML QtQuickControls2] {Switch} + \li + \li \row + \li \l [QML QtQuickControls] {TabView},\br + \l [QML QtQuickControls] {Tab} \li \mdash - \li \l [QML QtQuickControls2] {Frame} + \li \l [QML QtQuickControls2] {TabBar},\br + \l [QML QtQuickControls2] {TabButton} \br\sup {(Qt Quick Controls 2)} + \li \list + \li \b {Qt Quick Controls 2}: \c TabBar and \c TabButton offer similar + functionality, and can be used to build tabbed views. + \endlist \row - \li \l [QML QtQuickExtras] {Gauge} + \li \l [QML QtQuickControls] {TableView} \li \mdash + \li + \li \row - \li \l [QML QtQuickControls] {GroupBox} - \li \l [QML QtQuickControls2] {GroupBox} + \li \l [QML QtQuickControls] {TextArea} + \li \l [QML QtQuickControls2] {TextArea} + \li + \li \list + \li \b {Qt Quick Controls 1}: \c TextArea inherits \c ScrollView and is therefore + always a scrollable editor. + \li \b {Qt Quick Controls 2}: \c TextArea is a simpler multi-line editor that can + be optionally attached to a \c Flickable to provide scrolling functionality. + This allows using \c TextArea in a scrollable page without having two nested + scrollable areas, which can be problematic and cause usability issues. + \endlist \row - \li \mdash - \li \l [QML QtQuickControls2] {ItemDelegate} + \li \l [QML QtQuickControls] {TextField} + \li \l [QML QtQuickControls2] {TextField} + \li + \li \row - \li \l [QML QtQuickControls] {Label} - \li \l [QML QtQuickControls2] {Label} + \li \l [QML QtQuickControls] {ToolBar} + \li \l [QML QtQuickControls2] {ToolBar} + \li + \li \row - \li \l [QML QtQuickControls] {Menu} - \li \l [QML QtQuickControls2] {Menu} + \li \l [QML QtQuickControls] {ToolButton} + \li \l [QML QtQuickControls2] {ToolButton} + \li + \li \row - \li \l [QML QtQuickControls] {MenuBar} + \li \l [QML QtQuickControls] {TreeView} \li \mdash + \li + \li + + \header + \li Qt Quick Dialogs + \li Qt Quick Controls 2 + \li Alternatives + \li Remarks \row - \li \l [QML QtQuickControls] {MenuItem} - \li \l [QML QtQuickControls2] {MenuItem} + \li \l [QML QtQuickDialogs] {Dialog} + \li \mdash + \li \l [QML QtQuickControls2] {Dialog} + \li \list + \li \b {Qt Quick Dialogs}: \c Dialog is either a top-level window or an \c Item-based popup + depending on whether the underlying platform supports multiple top-level windows. + \li \b {Qt Quick Controls 2}: \c Dialog is not a top-level window, but an \c Item-based + popup that is stacked above the application content. Due to this, dialogs are restricted + within window boundaries. + \endlist + \row + \li \l [QML QtQuickDialogs] {ColorDialog},\br + \l [QML QtQuickDialogs] {FileDialog},\br + \l [QML QtQuickDialogs] {FontDialog},\br + \l [QML QtQuickDialogs] {MessageDialog} + \li \mdash + \li \l [QML QtLabsPlatform] {ColorDialog},\br + \l [QML QtLabsPlatform] {FileDialog},\br + \l [QML QtLabsPlatform] {FolderDialog},\br + \l [QML QtLabsPlatform] {FontDialog},\br + \l [QML QtLabsPlatform] {MessageDialog} \br\sup {(Qt Labs Platform)} + \li \list + \li \b {Qt Quick Dialogs}: Dialogs are native on platforms where an implementation + is available in the Qt Platform Abstraction Layer. Other platforms use either + Qt Widgets or QML-based dialogs depending on whether the underlying platform + supports multiple top-level windows. + \li \b {Qt Labs Platform}: \e Experimental native dialogs that use Qt Widgets as + a fallback on platforms where a native implementation is not available in the + Qt Platform Abstraction Layer. + \endlist + + \header + \li Qt Quick Extras + \li Qt Quick Controls 2 + \li Alternatives + \li Remarks \row + \li \l [QML QtQuickExtras] {CircularGauge} \li \mdash - \li \l [QML QtQuickControls2] {Page} + \li + \li \row + \li \l [QML QtQuickExtras] {DelayButton} \li \mdash - \li \l [QML QtQuickControls2] {PageIndicator} + \li + \li \row + \li \l [QML QtQuickExtras] {Dial} + \li \l [QML QtQuickControls2] {Dial} + \li + \li + \row + \li \l [QML QtQuickExtras] {Gauge} \li \mdash - \li \l [QML QtQuickControls2] {Pane} + \li + \li \row \li \l [QML QtQuickExtras] {Picture} \li \mdash + \li + \li \row \li \l [QML QtQuickExtras] {PieMenu} \li \mdash + \li + \li \row + \li \l [QML QtQuickExtras] {StatusIndicator} \li \mdash - \li \l [QML QtQuickControls2] {Popup} + \li + \li \row - \li \l [QML QtQuickControls] {ProgressBar} - \li \l [QML QtQuickControls2] {ProgressBar} + \li \l [QML QtQuickExtras] {ToggleButton} + \li \mdash + \li + \li \row - \li \l [QML QtQuickControls] {RadioButton} - \li \l [QML QtQuickControls2] {RadioButton} + \li \l [QML QtQuickExtras] {Tumbler},\br + \l [QML QtQuickExtras] {TumblerColumn} + \li \l [QML QtQuickControls2] {Tumbler} + \li + \li \list + \li \b {Qt Quick Extras}: \c Tumbler can consist of multiple columns. + \li \b {Qt Quick Controls 2}: \c Tumbler presents a single spinnable wheel. + Multiple columns can be created by placing multiple \c Tumblers next + to each other. + \endlist + + \header + \li No Predecessor + \li Qt Quick Controls 2 + \li Alternatives + \li Remarks \row \li \mdash - \li \l [QML QtQuickControls2] {RadioDelegate} + \li \l [QML QtQuickControls2] {AbstractButton} + \li + \li \row \li \mdash - \li \l [QML QtQuickControls2] {RangeSlider} + \li \l [QML QtQuickControls2] {ButtonGroup} + \li \l [QML QtQuickControls] {ExclusiveGroup} \br\sup {(Qt Quick Controls 1)} + \li \list + \li \b {Qt Quick Controls 1}: \c ExclusiveGroup offers similar functionality. + \endlist \row - \li \l [QML QtQuickControls] {ScrollView} - \li \l [QML QtQuickControls2] {ScrollBar}, - \l [QML QtQuickControls2] {ScrollIndicator} + \li \mdash + \li \l [QML QtQuickControls2] {CheckDelegate} + \li + \li \row - \li \l [QML QtQuickControls] {Slider} - \li \l [QML QtQuickControls2] {Slider} + \li \mdash + \li \l [QML QtQuickControls2] {Container} + \li + \li \row - \li \l [QML QtQuickControls] {SplitView} \li \mdash + \li \l [QML QtQuickControls2] {Control} + \li + \li \row - \li \l [QML QtQuickControls] {SpinBox} - \li \l [QML QtQuickControls2] {SpinBox} + \li \mdash + \li \l [QML QtQuickControls2] {Drawer} + \li + \li \row - \li \l [QML QtQuickControls] {StackView}, - \l [QML QtQuickControls] {StackViewDelegate}, - \l [QML QtQuickControls] {Stack} - \li \l [QML QtQuickControls2] {StackView} + \li \mdash + \li \l [QML QtQuickControls2] {Frame} + \li + \li \row - \li \l [QML QtQuickControls] {StatusBar} \li \mdash + \li \l [QML QtQuickControls2] {ItemDelegate} + \li + \li \row - \li \l [QML QtQuickExtras] {StatusIndicator} \li \mdash + \li \l [QML QtQuickControls2] {Page} + \li + \li \row \li \mdash - \li \l [QML QtQuickControls2] {SwipeDelegate} + \li \l [QML QtQuickControls2] {PageIndicator} + \li + \li \row \li \mdash - \li \l [QML QtQuickControls2] {SwipeView} + \li \l [QML QtQuickControls2] {Pane} + \li + \li \row - \li \l [QML QtQuickControls] {Switch} - \li \l [QML QtQuickControls2] {Switch} + \li \mdash + \li \l [QML QtQuickControls2] {Popup} + \li + \li \row \li \mdash - \li \l [QML QtQuickControls2] {SwitchDelegate} + \li \l [QML QtQuickControls2] {RadioDelegate} + \li + \li \row - \li \l [QML QtQuickControls] {TabView}, - \l [QML QtQuickControls] {Tab} - \li \l [QML QtQuickControls2] {TabBar}, - \l [QML QtQuickControls2] {TabButton} + \li \mdash + \li \l [QML QtQuickControls2] {RangeSlider} + \li + \li \row - \li \l [QML QtQuickControls] {TableView} \li \mdash + \li \l [QML QtQuickControls2] {RoundButton} + \li + \li \row - \li \l [QML QtQuickControls] {TextArea} - \li \l [QML QtQuickControls2] {TextArea} + \li \mdash + \li \l [QML QtQuickControls2] {ScrollBar},\br + \l [QML QtQuickControls2] {ScrollIndicator} + \li \l [QML QtQuickControls] {ScrollView} \br\sup {(Qt Quick Controls 1)} + \li \list + \li \b {Qt Quick Controls 1}: \c ScrollView offers similar functionality. + It combines horizontal and vertical scrollbars, and the background and + frame around the scrollable view. + \endlist \row - \li \l [QML QtQuickControls] {TextField} - \li \l [QML QtQuickControls2] {TextField} + \li \mdash + \li \mdash + \li \l [QML QtLabsPlatform] {StandardPaths} \br\sup {(Qt Labs Platform)} + \li \list + \li \b {Qt Quick Dialogs}: \c FileDialog offers a shortcut property that can be used + to access the most common standard paths. + \li \b {Qt Labs Platform}: \c StandardPaths offers a separate type to give full access + to the standard paths. + \endlist \row - \li \l [QML QtQuickExtras] {ToggleButton} \li \mdash + \li \l [QML QtQuickControls2] {SwipeDelegate} + \li + \li \row - \li \l [QML QtQuickControls] {ToolBar} - \li \l [QML QtQuickControls2] {ToolBar} + \li \mdash + \li \l [QML QtQuickControls2] {SwipeView} + \li + \li \row - \li \l [QML QtQuickControls] {ToolButton} - \li \l [QML QtQuickControls2] {ToolButton} + \li \mdash + \li \l [QML QtQuickControls2] {SwitchDelegate} + \li + \li \row \li \mdash - \li \l [QML QtQuickControls2] {ToolTip} + \li \mdash + \li \l [QML QtLabsPlatform] {SystemTrayIcon} \br\sup {(Qt Labs Platform)} + \li \list + \li \b {Qt Labs Platform}: \c SystemTrayIcon is an \e experimental native + system tray icon that uses Qt Widgets as a fallback on platforms where + a native implementation is not available in the Qt Platform Abstraction + Layer. + \endlist \row - \li \l [QML QtQuickControls] {TreeView} \li \mdash + \li \l [QML QtQuickControls2] {TabBar},\br + \l [QML QtQuickControls2] {TabButton} + \li \l [QML QtQuickControls] {TabView} \br\sup {(Qt Quick Controls 1)} + \li \list + \li \b {Qt Quick Controls 1}: \c TabView offers similar functionality. + It combines the tab bar, background and frame around the tabs. + \endlist \row - \li \l [QML QtQuickExtras] {Tumbler}, - \l [QML QtQuickExtras] {TumblerColumn} - \li \l [QML QtQuickControls2] {Tumbler} + \li \mdash + \li \l [QML QtQuickControls2] {ToolSeparator} + \li + \li + \row + \li \mdash + \li \l [QML QtQuickControls2] {ToolTip} + \li + \li \list + \li \b {Qt Quick Controls 1}: \c Button and \c Action have built-in + Qt Widgets-based tooltips. + \li \b {Qt Quick Controls 2}: \c ToolTip can be attached to any \c Item. + \endlist \endtable \section1 Related Information @@ -374,5 +675,7 @@ \li \l{Qt Quick Controls 2 QML Types} \li \l{Qt Quick Controls QML Types} \li \l{Qt Quick Extras QML Types} + \li \l{Qt Labs Calendar QML Types} + \li \l{Qt Labs Platform QML Types} \endlist */ diff --git a/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc index 7c1b1c16..c83adf4b 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc @@ -43,10 +43,18 @@ The value can be either one of the built-in styles, for example \c "Material", or the path to a custom style such as \c ":/mystyle". \row + \li \c QT_QUICK_CONTROLS_FALLBACK_STYLE + \li Specifies a fallback style for \l {Creating a Custom Style}{custom styles}. + The value can be one of the built-in styles, for example \c "Material", + \row \li \c QT_QUICK_CONTROLS_CONF \li Specifies the location of the \l {Qt Quick Controls 2 configuration file}. By default, the configuration file is loaded from the application's resources in \c ":/qtquickcontrols2.conf". + \row + \li \c QT_QUICK_CONTROLS_HOVER_ENABLED + \li Specifies whether Qt Quick Controls 2 use \l {Control::hoverEnabled}{hover effects}. + The value can be set to \c 0 or \c 1 to disable or enable hover effects, respectively. \endtable \l {Material style} specific environment variables: diff --git a/src/imports/controls/doc/src/qtquickcontrols2-fileselectors.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-fileselectors.qdoc index 86df60c7..a132c6f0 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-fileselectors.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-fileselectors.qdoc @@ -62,7 +62,7 @@ \code // main.qml import QtQuick 2.6 - import QtQuick.Controls 2.0 + import QtQuick.Controls 2.1 ApplicationWindow { id: window @@ -81,7 +81,7 @@ \code // CustomButton.qml import QtQuick 2.6 - import QtQuick.Controls 2.0 + import QtQuick.Controls 2.1 Button { id: control @@ -103,8 +103,8 @@ // +material/CustomButton.qml import QtQuick 2.6 import QtGraphicalEffects 1.0 - import QtQuick.Controls 2.0 - import QtQuick.Controls.Material 2.0 + import QtQuick.Controls 2.1 + import QtQuick.Controls.Material 2.1 Button { id: control diff --git a/src/imports/controls/doc/src/qtquickcontrols2-gettingstarted.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-gettingstarted.qdoc index 4661e8c9..7eb9eaf4 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-gettingstarted.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-gettingstarted.qdoc @@ -31,7 +31,22 @@ A basic example of a QML file that makes use of controls is shown here: - \snippet basic-example.qml 0 + \qml + import QtQuick 2.6 + import QtQuick.Controls 2.1 + + ApplicationWindow { + title: "My Application" + width: 640 + height: 480 + visible: true + + Button { + text: "Push Me" + anchors.centerIn: parent + } + } + \endqml \section1 Setting Up Controls from C++ diff --git a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc index cdb20a27..d3f3ec52 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc @@ -32,7 +32,8 @@ \brief Provides a set of UI controls for Qt Quick. Qt Quick Controls 2 provides a set of controls that can be used - to build complete interfaces in Qt Quick. + to build complete interfaces in Qt Quick. The module was introduced + in Qt 5.7. \section1 Prerequisites @@ -40,7 +41,7 @@ application using the following import statement in your \c {.qml} file: \code - import QtQuick.Controls 2.0 + import QtQuick.Controls 2.1 \endcode The \l{Qt Quick Controls 2 C++ Classes}{C++ classes} can be included into @@ -85,6 +86,7 @@ \list \li \l{Qt Quick Controls 2 - Gallery}{Gallery} \li \l{Qt Quick Controls 2 - Chat Tutorial}{Chat Tutorial} + \li \l{Qt Quick Controls 2 - Text Editor}{Text Editor} \li \l{Qt Quick Controls 2 Examples}{All Examples} \endlist @@ -95,5 +97,6 @@ \li \l{Qt Quick Layouts} \li \l{Qt Quick Templates 2} \li \l{Qt Labs Calendar} + \li \l{Qt Labs Platform} \endlist */ diff --git a/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc index 9842fee6..d841c46d 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc @@ -32,7 +32,7 @@ The Material Style is based on the Google Material Design Guidelines. \l{detailed-desc-material}{More...} - \styleimport {QtQuick.Controls.Material 2.0} {Qt 5.7} + \styleimport {QtQuick.Controls.Material 2.1} {Qt 5.7} \section1 Attached Properties @@ -89,8 +89,8 @@ \li \qml import QtQuick 2.0 - import QtQuick.Controls 2.0 - import QtQuick.Controls.Material 2.0 + import QtQuick.Controls 2.1 + import QtQuick.Controls.Material 2.1 ApplicationWindow { visible: true @@ -328,6 +328,11 @@ Available themes: \value Material.Light Light theme (default) \value Material.Dark Dark theme + \value Material.System System theme + + Setting the theme to \c System chooses either the light or dark theme based + on the system theme colors. However, when reading the value of the theme + property, the value is never \c System, but the actual theme. In the following example, the theme for both the pane and the button is set to \c Material.Dark: diff --git a/src/imports/controls/doc/src/qtquickcontrols2-qmltypes.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-qmltypes.qdoc index 52da41a7..2add71b2 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-qmltypes.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-qmltypes.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \qmlmodule QtQuick.Controls 2.0 + \qmlmodule QtQuick.Controls 2.1 \title Qt Quick Controls 2 QML Types \ingroup qmlmodules \brief Provides QML types for user interfaces (Qt Quick Controls 2). @@ -39,7 +39,7 @@ using the following import statement in your .qml file: \badcode - import QtQuick.Controls 2.0 + import QtQuick.Controls 2.1 \endcode \section1 QML Types diff --git a/src/imports/controls/doc/src/templates/qtquicktemplates2.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-separators.qdoc index 1ddfe763..c4ef1c76 100644 --- a/src/imports/controls/doc/src/templates/qtquicktemplates2.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-separators.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -26,38 +26,38 @@ ****************************************************************************/ /*! - \qmlmodule QtQuick.Templates 2.0 - \title Qt Quick Templates 2 QML Types - \ingroup qmlmodules - \brief Provides QML types for templates (Qt Quick Templates). + \page qtquickcontrols2-separators.html + \title Separator Controls + \ingroup qtquickcontrols2-guidelines + \brief Guidelines for separator controls - The \l {Qt Quick Templates 2} module provides a set of non-visual templates - that can be used to build user interface controls in QML using \l {Qt Quick}. + Qt Quick Controls 2 offers a selection of separators. - The QML types can be imported using the following import statement in your - \c .qml file: + \annotatedlist qtquickcontrols2-separators - \badcode - import QtQuick.Templates 2.0 as T - \endcode + Each type of separator has its own specific use case. The following + sections offer guidelines for choosing the appropriate type of separator, + depending on the use case. - For the sake of clarity, there is a one-to-one mapping between the types - provided by the \c QtQuick.Templates and \c QtQuick.Controls imports. For - every type available in the \c QtQuick.Controls import, a non-visual template - type by the same name exists in the \c QtQuick.Templates import. + \section1 MenuSeparator Control - \note It is recommended to use a namespace for the templates import to avoid - overlap with the types provided by the \c QtQuick.Controls import. + \image qtquickcontrols2-menuseparator.png - \section1 QML Types + \l MenuSeparator should be used to separate items (typically MenuItem + controls) in a Menu. Grouping related menu items together makes it easier + for the user to interact with the menu. For example, a typical desktop + user interface might have \c Undo and \c Redo items in one group, and + \c Cut, \c Copy and \c Paste in another. - \generatelist {qmltypesbymodule QtQuick.Controls} + \section1 ToolSeparator Control - \section1 Related Information + \image qtquickcontrols2-toolseparator.png + + \l ToolSeparator should be used to separate items (typically ToolButton + controls) in a ToolBar. It can be used in horizontal or vertical toolbars. + \section1 Related Information \list - \li \l {Qt Quick Controls 2 QML Types} + \li \l {Qt Quick Controls 2 Guidelines} \endlist - - \noautolist */ diff --git a/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc index c0e2daee..104c682f 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc @@ -32,7 +32,7 @@ The Universal Style is based on the Microsoft Universal Design Guidelines. \l {detailed-desc-universal}{More...} - \styleimport {QtQuick.Controls.Universal 2.0} {Qt 5.7} + \styleimport {QtQuick.Controls.Universal 2.1} {Qt 5.7} \section1 Attached Properties @@ -88,8 +88,8 @@ \li \qml import QtQuick 2.0 - import QtQuick.Controls 2.0 - import QtQuick.Controls.Universal 2.0 + import QtQuick.Controls 2.1 + import QtQuick.Controls.Universal 2.1 ApplicationWindow { visible: true @@ -241,6 +241,11 @@ Available themes: \value Universal.Light Light theme (default) \value Universal.Dark Dark theme + \value Universal.System System theme + + Setting the theme to \c System chooses either the light or dark theme based + on the system theme colors. However, when reading the value of the theme + property, the value is never \c System, but the actual theme. In the following example, the theme for both the pane and the button is set to \c Universal.Dark: diff --git a/src/imports/controls/doc/src/templates/qtquicktemplates2-index.qdoc b/src/imports/controls/doc/src/templates/qtquicktemplates2-index.qdoc deleted file mode 100644 index 2e22196b..00000000 --- a/src/imports/controls/doc/src/templates/qtquicktemplates2-index.qdoc +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page qtquicktemplates2-index.html - \title Qt Quick Templates 2 - \brief A set of templates to create user interface controls in Qt Quick - - Qt Quick Templates are the foundations of \l {Qt Quick Controls 2}. Templates - are non-visual implementations of controls' logic and behavior. They offer - an interface to visualize the controls in QML using \l {Qt Quick}. - - Even though the templates aim to be as style-agnostic as possible, in some - cases they have to make certain assumptions about the visual structure of - a control. For example, a spinbox has buttons that increment and decrement - the value of the spinbox. In order to implement the behavior of a spinbox, - the spinbox template needs to know if the user is interacting with the up - or down button. A visual implementation of the spinbox template merely needs - to position the up and down buttons and visualize them in normal, pressed, - and disabled states. Any input event handling and state processing is taken - care of by the underlying template. - - \section1 Related Information - - \list - \li \l{Qt Quick} - \li \l{Qt Quick Controls 2} - \li \l{Qt Quick Templates 2 QML Types} - \endlist -*/ diff --git a/src/imports/controls/material/ApplicationWindow.qml b/src/imports/controls/material/ApplicationWindow.qml index db27f25b..0a6b71a3 100644 --- a/src/imports/controls/material/ApplicationWindow.qml +++ b/src/imports/controls/material/ApplicationWindow.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 +import QtQuick 2.8 import QtQuick.Window 2.2 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 T.ApplicationWindow { id: window diff --git a/src/imports/controls/material/BoxShadow.qml b/src/imports/controls/material/BoxShadow.qml index b70fcee5..4809838e 100644 --- a/src/imports/controls/material/BoxShadow.qml +++ b/src/imports/controls/material/BoxShadow.qml @@ -34,10 +34,11 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtGraphicalEffects 1.0 +import QtQuick 2.8 +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 -/*! +/* A implementation of CSS's box-shadow, used by ElevationEffect for a Material Design elevation shadow effect. */ diff --git a/src/imports/controls/material/BusyIndicator.qml b/src/imports/controls/material/BusyIndicator.qml index 387ffb71..3077ceb7 100644 --- a/src/imports/controls/material/BusyIndicator.qml +++ b/src/imports/controls/material/BusyIndicator.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.BusyIndicator { id: control diff --git a/src/imports/controls/material/Button.qml b/src/imports/controls/material/Button.qml index f2fad313..9b3ced25 100644 --- a/src/imports/controls/material/Button.qml +++ b/src/imports/controls/material/Button.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.Button { id: control @@ -62,7 +62,7 @@ T.Button { font: control.font color: !control.enabled ? control.Material.hintTextColor : control.flat && control.highlighted ? control.Material.accentColor : - control.highlighted ? control.Material.primaryHighlightedTextColor : control.Material.primaryTextColor + control.highlighted ? control.Material.primaryHighlightedTextColor : control.Material.foreground horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter elide: Text.ElideRight @@ -78,16 +78,19 @@ T.Button { width: parent.width height: parent.height - 12 radius: 2 - color: !control.enabled - ? control.Material.buttonDisabledColor - : control.down - ? control.highlighted ? control.Material.highlightedButtonPressColor - : control.Material.buttonPressColor - : control.visualFocus || control.checked - ? control.highlighted ? control.Material.highlightedButtonHoverColor - : control.Material.buttonHoverColor - : control.highlighted ? control.Material.highlightedButtonColor - : control.Material.buttonColor + color: !control.enabled ? control.Material.buttonDisabledColor : + control.highlighted ? control.Material.highlightedButtonColor : control.Material.buttonColor + + PaddedRectangle { + y: parent.height - 4 + width: parent.width + height: 4 + radius: 2 + topPadding: -2 + clip: true + visible: control.checkable && (!control.highlighted || control.flat) + color: control.checked && control.enabled ? control.Material.accentColor : control.Material.secondaryTextColor + } Behavior on color { ColorAnimation { @@ -102,5 +105,15 @@ T.Button { layer.effect: ElevationEffect { elevation: control.Material.elevation } + + Ripple { + clipRadius: 2 + width: parent.width + height: parent.height + pressed: control.pressed + anchor: control + active: control.down || control.visualFocus || control.hovered + color: control.Material.rippleColor + } } } diff --git a/src/imports/controls/material/CheckBox.qml b/src/imports/controls/material/CheckBox.qml index 1c6848d8..979654f7 100644 --- a/src/imports/controls/material/CheckBox.qml +++ b/src/imports/controls/material/CheckBox.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.CheckBox { id: control @@ -58,6 +58,18 @@ T.CheckBox { x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2 y: control.topPadding + (control.availableHeight - height) / 2 control: control + + Ripple { + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + width: 28; height: 28 + + z: -1 + anchor: control + pressed: control.pressed + active: control.down || control.visualFocus || control.hovered + color: control.checked ? control.Material.highlightedRippleColor : control.Material.rippleColor + } } contentItem: Text { @@ -66,7 +78,7 @@ T.CheckBox { text: control.text font: control.font - color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor + color: control.enabled ? control.Material.foreground : control.Material.hintTextColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft diff --git a/src/imports/controls/material/CheckDelegate.qml b/src/imports/controls/material/CheckDelegate.qml index d5785467..aec48bf1 100644 --- a/src/imports/controls/material/CheckDelegate.qml +++ b/src/imports/controls/material/CheckDelegate.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.CheckDelegate { id: control @@ -66,7 +66,7 @@ T.CheckDelegate { text: control.text font: control.font - color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor + color: control.enabled ? control.Material.foreground : control.Material.hintTextColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft @@ -76,7 +76,17 @@ T.CheckDelegate { background: Rectangle { implicitHeight: 48 - visible: control.down || control.highlighted - color: control.down ? control.Material.buttonPressColor : control.Material.listHighlightColor + color: control.highlighted ? control.Material.listHighlightColor : "transparent" + + Ripple { + width: parent.width + height: parent.height + + clip: visible + pressed: control.pressed + anchor: control + active: control.down || control.visualFocus || control.hovered + color: control.Material.rippleColor + } } } diff --git a/src/imports/controls/material/CheckIndicator.qml b/src/imports/controls/material/CheckIndicator.qml index f64ca168..afc19bc2 100644 --- a/src/imports/controls/material/CheckIndicator.qml +++ b/src/imports/controls/material/CheckIndicator.qml @@ -34,8 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Controls.Material 2.0 +import QtQuick 2.8 +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 Rectangle { id: indicatorItem @@ -46,7 +47,7 @@ Rectangle { border.width: control.checked ? width / 2 : 2 radius: 2 - property alias control: ripple.control + property Item control Behavior on border.width { NumberAnimation { @@ -62,15 +63,6 @@ Rectangle { } } - Ripple { - id: ripple - width: parent.width - height: width - control: control - colored: control.checked - opacity: control.down || control.visualFocus ? 1 : 0 - } - // TODO: This needs to be transparent Image { id: checkImage diff --git a/src/imports/controls/material/ComboBox.qml b/src/imports/controls/material/ComboBox.qml index 183bcef9..15987ebc 100644 --- a/src/imports/controls/material/ComboBox.qml +++ b/src/imports/controls/material/ComboBox.qml @@ -34,18 +34,16 @@ ** ****************************************************************************/ -import QtQuick 2.6 +import QtQuick 2.8 import QtQuick.Window 2.2 -import QtQuick.Controls 2.0 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +import QtQuick.Controls 2.1 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.ComboBox { id: control - Material.elevation: control.pressed ? 8 : 2 - implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, @@ -59,21 +57,23 @@ T.ComboBox { leftPadding: padding - 4 rightPadding: padding - 4 - // Don't use toolTextColor, as that is often white when we have a white background. - Material.foreground: Material.foreground === Material.toolTextColor ? undefined : Material.foreground + Material.elevation: flat ? control.pressed || control.hovered ? 2 : 0 + : control.pressed ? 8 : 2 + Material.background: flat ? "transparent" : undefined + Material.foreground: flat ? undefined : Material.primaryTextColor delegate: MenuItem { width: control.popup.width text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData - Material.foreground: control.currentIndex === index ? control.Material.accent : control.Material.foreground + Material.foreground: control.currentIndex === index ? control.popup.Material.accent : control.popup.Material.foreground highlighted: control.highlightedIndex === index + hoverEnabled: control.hoverEnabled } indicator: Image { x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding y: control.topPadding + (control.availableHeight - height) / 2 - opacity: !control.enabled ? 0.5 : 1.0 - source: "qrc:/qt-project.org/imports/QtQuick/Controls.2/Material/images/drop-indicator.png" + source: "image://material/drop-indicator/" + (control.enabled ? control.Material.foreground : control.Material.hintTextColor) } contentItem: Text { @@ -82,7 +82,7 @@ T.ComboBox { text: control.displayText font: control.font - color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor + color: control.enabled ? control.Material.foreground : control.Material.hintTextColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter elide: Text.ElideRight @@ -95,7 +95,7 @@ T.ComboBox { // external vertical padding is 6 (to increase touch area) y: 6 height: parent.height - 12 - radius: 2 + radius: control.flat ? 0 : 2 color: control.Material.dialogColor Behavior on color { @@ -104,17 +104,20 @@ T.ComboBox { } } - layer.enabled: control.enabled && control.Material.elevation > 0 + layer.enabled: control.enabled && control.Material.background.a > 0 layer.effect: ElevationEffect { elevation: control.Material.elevation } - Rectangle { + Ripple { + clip: control.flat + clipRadius: control.flat ? 0 : 2 width: parent.width height: parent.height - radius: parent.radius - visible: control.visualFocus - color: control.Material.checkBoxUncheckedRippleColor + pressed: control.pressed + anchor: control + active: control.pressed || control.visualFocus || control.hovered + color: control.Material.rippleColor } } @@ -154,7 +157,7 @@ T.ComboBox { background: Rectangle { radius: 2 - color: control.Material.dialogColor + color: control.popup.Material.dialogColor layer.enabled: control.enabled layer.effect: ElevationEffect { diff --git a/src/imports/controls/material/Dial.qml b/src/imports/controls/material/Dial.qml index c07cd423..ce76c2a7 100644 --- a/src/imports/controls/material/Dial.qml +++ b/src/imports/controls/material/Dial.qml @@ -34,9 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.Dial { id: control @@ -55,7 +56,7 @@ T.Dial { border.color: control.enabled ? control.Material.accentColor : control.Material.hintTextColor } - handle: Rectangle { + handle: SliderHandle { id: handleItem x: background.x + background.width / 2 - handle.width / 2 @@ -72,7 +73,10 @@ T.Dial { ] implicitWidth: 14 implicitHeight: 14 - radius: width / 2 - color: control.enabled ? control.Material.accentColor : control.Material.hintTextColor + + value: control.value + handleHasFocus: control.visualFocus + handlePressed: control.pressed + handleHovered: control.hovered } } diff --git a/src/imports/controls/material/Dialog.qml b/src/imports/controls/material/Dialog.qml new file mode 100644 index 00000000..90cda45a --- /dev/null +++ b/src/imports/controls/material/Dialog.qml @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 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.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls 2.1 +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 + +T.Dialog { + id: control + + implicitWidth: Math.max(background ? background.implicitWidth : 0, + header && header.visible ? header.implicitWidth : 0, + footer && footer.visible ? footer.implicitWidth : 0, + contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0) + implicitHeight: Math.max(background ? background.implicitHeight : 0, + (header && header.visible ? header.implicitHeight + spacing : 0) + + (footer && footer.visible ? footer.implicitHeight + spacing : 0) + + (contentHeight > 0 ? contentHeight + topPadding + bottomPadding : 0)) + + contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) + contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) + + padding: 24 + topPadding: 20 + + Material.elevation: 24 + + enter: Transition { + // grow_fade_in + NumberAnimation { property: "scale"; from: 0.9; to: 1.0; easing.type: Easing.OutQuint; duration: 220 } + NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; easing.type: Easing.OutCubic; duration: 150 } + } + + exit: Transition { + // shrink_fade_out + NumberAnimation { property: "scale"; from: 1.0; to: 0.9; easing.type: Easing.OutQuint; duration: 220 } + NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; easing.type: Easing.OutCubic; duration: 150 } + } + + background: Rectangle { + radius: 2 + color: control.Material.dialogColor + + layer.enabled: control.Material.elevation > 0 + layer.effect: ElevationEffect { + elevation: control.Material.elevation + } + } + + header: Label { + text: control.title + visible: control.title + elide: Label.ElideRight + padding: 24 + bottomPadding: 0 + // TODO: QPlatformTheme::TitleBarFont + font.bold: true + font.pixelSize: 16 + background: PaddedRectangle { + radius: 2 + color: control.Material.dialogColor + bottomPadding: -2 + clip: true + } + } + + footer: DialogButtonBox { + visible: count > 0 + } +} diff --git a/src/imports/controls/material/DialogButtonBox.qml b/src/imports/controls/material/DialogButtonBox.qml new file mode 100644 index 00000000..312aa4eb --- /dev/null +++ b/src/imports/controls/material/DialogButtonBox.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 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.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 + +T.DialogButtonBox { + id: control + + implicitWidth: Math.max(background ? background.implicitWidth : 0, + contentItem.implicitWidth + leftPadding + rightPadding) + implicitHeight: Math.max(background ? background.implicitHeight : 0, + contentItem.implicitHeight + topPadding + bottomPadding) + + spacing: 8 + padding: 8 + topPadding: padding - 4 + bottomPadding: padding - 4 + alignment: Qt.AlignRight + + Material.foreground: Material.accent + + delegate: Button { flat: true } + + contentItem: ListView { + implicitWidth: contentWidth + implicitHeight: 48 + + model: control.contentModel + spacing: control.spacing + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + snapMode: ListView.SnapToItem + } + + background: PaddedRectangle { + implicitHeight: 52 + radius: 2 + color: control.Material.dialogColor + topPadding: control.position === T.DialogButtonBox.Footer ? -2 : 0 + bottomPadding: control.position === T.DialogButtonBox.Header ? -2 : 0 + clip: true + } +} diff --git a/src/imports/controls/material/Drawer.qml b/src/imports/controls/material/Drawer.qml index 1c15e689..7b401b5b 100644 --- a/src/imports/controls/material/Drawer.qml +++ b/src/imports/controls/material/Drawer.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.Drawer { id: control @@ -50,17 +50,32 @@ T.Drawer { contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) + topPadding: !dim && edge === Qt.BottomEdge && Material.elevation === 0 + leftPadding: !dim && edge === Qt.RightEdge && Material.elevation === 0 + rightPadding: !dim && edge === Qt.LeftEdge && Material.elevation === 0 + bottomPadding: !dim && edge === Qt.TopEdge && Material.elevation === 0 + enter: Transition { SmoothedAnimation { velocity: 5 } } exit: Transition { SmoothedAnimation { velocity: 5 } } - contentItem: Item { } + Material.elevation: 16 background: Rectangle { color: control.Material.dialogColor + Rectangle { + readonly property bool horizontal: control.edge === Qt.LeftEdge || control.edge === Qt.RightEdge + width: horizontal ? 1 : parent.width + height: horizontal ? parent.height : 1 + color: control.Material.dividerColor + x: control.edge === Qt.LeftEdge ? parent.width - 1 : 0 + y: control.edge === Qt.TopEdge ? parent.height - 1 : 0 + visible: !control.dim && control.Material.elevation === 0 + } + layer.enabled: control.position > 0 layer.effect: ElevationEffect { - elevation: 16 + elevation: control.Material.elevation fullHeight: true } } diff --git a/src/imports/controls/material/ElevationEffect.qml b/src/imports/controls/material/ElevationEffect.qml index 4ee4369c..3cf6623c 100644 --- a/src/imports/controls/material/ElevationEffect.qml +++ b/src/imports/controls/material/ElevationEffect.qml @@ -34,27 +34,27 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +import QtQuick 2.8 +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 -/*! +/* An effect for standard Material Design elevation shadows. Useful for using as \c layer.effect. */ Item { id: effect - /*! + /* The source the effect is applied to. */ property var source - /*! + /* The elevation of the \l source Item. */ property int elevation: 0 - /*! + /* Set to \c true if the \l source Item is the same width as its parent and the shadow should be full width instead of rounding around the corner of the Item. @@ -62,7 +62,7 @@ Item { */ property bool fullWidth: false - /*! + /* Set to \c true if the \l source Item is the same height as its parent and the shadow should be full height instead of rounding around the corner of the Item. @@ -70,7 +70,7 @@ Item { */ property bool fullHeight: false - /*! + /* \internal The actual source Item the effect is applied to. @@ -102,7 +102,7 @@ Item { * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ - /*! + /* \internal The shadows to use for each possible elevation. There are three shadows that when combined @@ -210,7 +210,7 @@ Item { {offset: 9, blur: 46, spread: 8}] ] - /*! + /* \internal The current shadow based on the elevation. diff --git a/src/imports/controls/material/Frame.qml b/src/imports/controls/material/Frame.qml index c2f623ae..08c01353 100644 --- a/src/imports/controls/material/Frame.qml +++ b/src/imports/controls/material/Frame.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.Frame { id: control @@ -50,8 +50,6 @@ T.Frame { padding: 12 - contentItem: Item { } - background: Rectangle { radius: 2 color: control.Material.elevation > 0 ? control.Material.backgroundColor : "transparent" diff --git a/src/imports/controls/material/GroupBox.qml b/src/imports/controls/material/GroupBox.qml index 6d84197c..64b589af 100644 --- a/src/imports/controls/material/GroupBox.qml +++ b/src/imports/controls/material/GroupBox.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.GroupBox { id: control @@ -54,15 +54,13 @@ T.GroupBox { padding: 12 topPadding: padding + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0) - contentItem: Item {} - label: Text { x: control.leftPadding width: control.availableWidth text: control.title font: control.font - color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor + color: control.enabled ? control.Material.foreground : control.Material.hintTextColor elide: Text.ElideRight horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter diff --git a/src/imports/controls/material/ItemDelegate.qml b/src/imports/controls/material/ItemDelegate.qml index e43fc981..ec74fbee 100644 --- a/src/imports/controls/material/ItemDelegate.qml +++ b/src/imports/controls/material/ItemDelegate.qml @@ -34,9 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.ItemDelegate { id: control @@ -57,7 +58,7 @@ T.ItemDelegate { text: control.text font: control.font - color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor + color: control.enabled ? control.Material.foreground : control.Material.hintTextColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft @@ -67,7 +68,17 @@ T.ItemDelegate { background: Rectangle { implicitHeight: 48 - visible: control.down || control.highlighted - color: control.down ? control.Material.buttonPressColor : control.Material.listHighlightColor + color: control.highlighted ? control.Material.listHighlightColor : "transparent" + + Ripple { + width: parent.width + height: parent.height + + clip: visible + pressed: control.pressed + anchor: control + active: control.down || control.visualFocus || control.hovered + color: control.Material.rippleColor + } } } diff --git a/src/imports/controls/material/Label.qml b/src/imports/controls/material/Label.qml index 8bda5cc2..3a728dc8 100644 --- a/src/imports/controls/material/Label.qml +++ b/src/imports/controls/material/Label.qml @@ -34,13 +34,13 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 T.Label { id: control - color: enabled ? Material.primaryTextColor : Material.hintTextColor + color: enabled ? Material.foreground : Material.hintTextColor linkColor: Material.accentColor } diff --git a/src/imports/controls/material/Menu.qml b/src/imports/controls/material/Menu.qml index b11c00b6..7fe6af0e 100644 --- a/src/imports/controls/material/Menu.qml +++ b/src/imports/controls/material/Menu.qml @@ -34,11 +34,11 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Controls 2.0 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.Menu { id: control diff --git a/src/imports/controls/material/MenuItem.qml b/src/imports/controls/material/MenuItem.qml index 27c2922c..a6dbba2c 100644 --- a/src/imports/controls/material/MenuItem.qml +++ b/src/imports/controls/material/MenuItem.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.MenuItem { id: control @@ -67,7 +67,7 @@ T.MenuItem { text: control.text font: control.font - color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor + color: control.enabled ? control.Material.foreground : control.Material.hintTextColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft @@ -77,7 +77,17 @@ T.MenuItem { background: Rectangle { implicitWidth: 200 implicitHeight: 48 - visible: control.down || control.highlighted - color: control.down ? control.Material.buttonPressColor : control.Material.listHighlightColor + color: control.highlighted ? control.Material.listHighlightColor : "transparent" + + Ripple { + width: parent.width + height: parent.height + + clip: visible + pressed: control.pressed + anchor: control + active: control.down || control.visualFocus || control.hovered + color: control.Material.rippleColor + } } } diff --git a/src/imports/controls/material/Ripple.qml b/src/imports/controls/material/MenuSeparator.qml index 15650384..76cac31b 100644 --- a/src/imports/controls/material/Ripple.qml +++ b/src/imports/controls/material/MenuSeparator.qml @@ -34,18 +34,22 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Controls.Material 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 -Rectangle { - property Item control - property bool colored: false +T.MenuSeparator { + id: control - radius: width / 2 - scale: 2.5 - color: colored ? control.Material.checkBoxCheckedRippleColor : control.Material.checkBoxUncheckedRippleColor + implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding) + implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding) - Behavior on opacity { - NumberAnimation {} + topPadding: 8 + bottomPadding: 8 + + contentItem: Rectangle { + implicitWidth: 200 + implicitHeight: 1 + color: control.Material.dividerColor } } diff --git a/src/imports/controls/material/Page.qml b/src/imports/controls/material/Page.qml index 92c85b58..c91b16c1 100644 --- a/src/imports/controls/material/Page.qml +++ b/src/imports/controls/material/Page.qml @@ -34,14 +34,24 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 T.Page { id: control - contentItem: Item { } + implicitWidth: Math.max(background ? background.implicitWidth : 0, + Math.max(contentWidth, + header && header.visible ? header.implicitWidth : 0, + footer && footer.visible ? footer.implicitWidth : 0) + leftPadding + rightPadding) + implicitHeight: Math.max(background ? background.implicitHeight : 0, + contentHeight + topPadding + bottomPadding + + (header && header.visible ? header.implicitHeight + spacing : 0) + + (footer && footer.visible ? footer.implicitHeight + spacing : 0)) + + contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) + contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) background: Rectangle { color: control.Material.backgroundColor diff --git a/src/imports/controls/material/PageIndicator.qml b/src/imports/controls/material/PageIndicator.qml index 78372afe..5a68df6b 100644 --- a/src/imports/controls/material/PageIndicator.qml +++ b/src/imports/controls/material/PageIndicator.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 T.PageIndicator { id: control @@ -54,7 +54,7 @@ T.PageIndicator { implicitHeight: 8 radius: width / 2 - color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor + color: control.enabled ? control.Material.foreground : control.Material.hintTextColor opacity: index === currentIndex ? 0.95 : pressed ? 0.7 : 0.45 Behavior on opacity { OpacityAnimator { duration: 100 } } diff --git a/src/imports/controls/material/Pane.qml b/src/imports/controls/material/Pane.qml index 251492ea..4aedbd40 100644 --- a/src/imports/controls/material/Pane.qml +++ b/src/imports/controls/material/Pane.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.Pane { id: control @@ -50,8 +50,6 @@ T.Pane { padding: 12 - contentItem: Item { } - background: Rectangle { color: control.Material.backgroundColor radius: control.Material.elevation > 0 ? 2 : 0 diff --git a/src/imports/controls/material/Popup.qml b/src/imports/controls/material/Popup.qml index 19fd6b79..01b3951a 100644 --- a/src/imports/controls/material/Popup.qml +++ b/src/imports/controls/material/Popup.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.Popup { id: control @@ -66,8 +66,6 @@ T.Popup { NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; easing.type: Easing.OutCubic; duration: 150 } } - contentItem: Item { } - background: Rectangle { radius: 2 color: control.Material.dialogColor diff --git a/src/imports/controls/material/ProgressBar.qml b/src/imports/controls/material/ProgressBar.qml index eb8bf3ce..2b78be49 100644 --- a/src/imports/controls/material/ProgressBar.qml +++ b/src/imports/controls/material/ProgressBar.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.ProgressBar { id: control diff --git a/src/imports/controls/material/RadioButton.qml b/src/imports/controls/material/RadioButton.qml index 3ea2cf4d..32bf1cbd 100644 --- a/src/imports/controls/material/RadioButton.qml +++ b/src/imports/controls/material/RadioButton.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.RadioButton { id: control @@ -58,6 +58,18 @@ T.RadioButton { x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2 y: control.topPadding + (control.availableHeight - height) / 2 control: control + + Ripple { + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + width: 28; height: 28 + + z: -1 + anchor: control + pressed: control.pressed + active: control.down || control.visualFocus || control.hovered + color: control.checked ? control.Material.highlightedRippleColor : control.Material.rippleColor + } } contentItem: Text { @@ -66,7 +78,7 @@ T.RadioButton { text: control.text font: control.font - color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor + color: control.enabled ? control.Material.foreground : control.Material.hintTextColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft diff --git a/src/imports/controls/material/RadioDelegate.qml b/src/imports/controls/material/RadioDelegate.qml index 95bfb19b..349352b4 100644 --- a/src/imports/controls/material/RadioDelegate.qml +++ b/src/imports/controls/material/RadioDelegate.qml @@ -34,9 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.RadioDelegate { id: control @@ -65,7 +66,7 @@ T.RadioDelegate { text: control.text font: control.font - color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor + color: control.enabled ? control.Material.foreground : control.Material.hintTextColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft @@ -75,7 +76,17 @@ T.RadioDelegate { background: Rectangle { implicitHeight: 48 - visible: control.down || control.highlighted - color: control.down ? control.Material.buttonPressColor : control.Material.listHighlightColor + color: control.highlighted ? control.Material.listHighlightColor : "transparent" + + Ripple { + width: parent.width + height: parent.height + + clip: visible + pressed: control.pressed + anchor: control + active: control.down || control.visualFocus || control.hovered + color: control.Material.rippleColor + } } } diff --git a/src/imports/controls/material/RadioIndicator.qml b/src/imports/controls/material/RadioIndicator.qml index 4090c732..b1e19656 100644 --- a/src/imports/controls/material/RadioIndicator.qml +++ b/src/imports/controls/material/RadioIndicator.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +import QtQuick 2.8 +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 Rectangle { implicitWidth: 20 @@ -46,16 +46,7 @@ Rectangle { border.color: control.checked || control.down ? control.Material.accentColor : control.Material.secondaryTextColor color: "transparent" - property alias control: ripple.control - - Ripple { - id: ripple - width: parent.width - height: width - control: control - colored: control.checked - opacity: control.down || control.visualFocus ? 1 : 0 - } + property Item control Rectangle { x: (parent.width - width) / 2 diff --git a/src/imports/controls/material/RangeSlider.qml b/src/imports/controls/material/RangeSlider.qml index dc2c25fa..0233f137 100644 --- a/src/imports/controls/material/RangeSlider.qml +++ b/src/imports/controls/material/RangeSlider.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.RangeSlider { id: control @@ -57,6 +57,7 @@ T.RangeSlider { value: first.value handleHasFocus: activeFocus handlePressed: first.pressed + handleHovered: first.hovered } second.handle: SliderHandle { @@ -65,6 +66,7 @@ T.RangeSlider { value: second.value handleHasFocus: activeFocus handlePressed: second.pressed + handleHovered: second.hovered } background: Rectangle { @@ -74,7 +76,7 @@ T.RangeSlider { implicitHeight: horizontal ? 48 : 200 width: horizontal ? control.availableWidth : 1 height: horizontal ? 1 : control.availableHeight - color: control.Material.primaryTextColor + color: control.Material.foreground scale: horizontal && control.mirrored ? -1 : 1 readonly property bool horizontal: control.orientation === Qt.Horizontal diff --git a/src/imports/controls/material/RectangularGlow.qml b/src/imports/controls/material/RectangularGlow.qml new file mode 100644 index 00000000..32c10500 --- /dev/null +++ b/src/imports/controls/material/RectangularGlow.qml @@ -0,0 +1,240 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +/* + A cross-graphics API implementation of QtGraphicalEffects' RectangularGlow. + */ +Item { + id: rootItem + + /* + This property defines how many pixels outside the item area are reached + by the glow. + + The value ranges from 0.0 (no glow) to inf (infinite glow). By default, + the property is set to \c 0.0. + + \table + \header + \li Output examples with different glowRadius values + \li + \li + \row + \li \image RectangularGlow_glowRadius1.png + \li \image RectangularGlow_glowRadius2.png + \li \image RectangularGlow_glowRadius3.png + \row + \li \b { glowRadius: 10 } + \li \b { glowRadius: 20 } + \li \b { glowRadius: 40 } + \row + \li \l spread: 0 + \li \l spread: 0 + \li \l spread: 0 + \row + \li \l color: #ffffff + \li \l color: #ffffff + \li \l color: #ffffff + \row + \li \l cornerRadius: 25 + \li \l cornerRadius: 25 + \li \l cornerRadius: 25 + \endtable + + */ + property real glowRadius: 0.0 + + /* + This property defines how large part of the glow color is strenghtened + near the source edges. + + The value ranges from 0.0 (no strenght increase) to 1.0 (maximum + strenght increase). By default, the property is set to \c 0.0. + + \table + \header + \li Output examples with different spread values + \li + \li + \row + \li \image RectangularGlow_spread1.png + \li \image RectangularGlow_spread2.png + \li \image RectangularGlow_spread3.png + \row + \li \b { spread: 0.0 } + \li \b { spread: 0.5 } + \li \b { spread: 1.0 } + \row + \li \l glowRadius: 20 + \li \l glowRadius: 20 + \li \l glowRadius: 20 + \row + \li \l color: #ffffff + \li \l color: #ffffff + \li \l color: #ffffff + \row + \li \l cornerRadius: 25 + \li \l cornerRadius: 25 + \li \l cornerRadius: 25 + \endtable + */ + property real spread: 0.0 + + /* + This property defines the RGBA color value which is used for the glow. + + By default, the property is set to \c "white". + + \table + \header + \li Output examples with different color values + \li + \li + \row + \li \image RectangularGlow_color1.png + \li \image RectangularGlow_color2.png + \li \image RectangularGlow_color3.png + \row + \li \b { color: #ffffff } + \li \b { color: #55ff55 } + \li \b { color: #5555ff } + \row + \li \l glowRadius: 20 + \li \l glowRadius: 20 + \li \l glowRadius: 20 + \row + \li \l spread: 0 + \li \l spread: 0 + \li \l spread: 0 + \row + \li \l cornerRadius: 25 + \li \l cornerRadius: 25 + \li \l cornerRadius: 25 + \endtable + */ + property color color: "white" + + /* + This property defines the corner radius that is used to draw a glow with + rounded corners. + + The value ranges from 0.0 to half of the effective width or height of + the glow, whichever is smaller. This can be calculated with: \c{ + min(width, height) / 2.0 + glowRadius} + + By default, the property is bound to glowRadius property. The glow + behaves as if the rectangle was blurred when adjusting the glowRadius + property. + + \table + \header + \li Output examples with different cornerRadius values + \li + \li + \row + \li \image RectangularGlow_cornerRadius1.png + \li \image RectangularGlow_cornerRadius2.png + \li \image RectangularGlow_cornerRadius3.png + \row + \li \b { cornerRadius: 0 } + \li \b { cornerRadius: 25 } + \li \b { cornerRadius: 50 } + \row + \li \l glowRadius: 20 + \li \l glowRadius: 20 + \li \l glowRadius: 20 + \row + \li \l spread: 0 + \li \l spread: 0 + \li \l spread: 0 + \row + \li \l color: #ffffff + \li \l color: #ffffff + \li \l color: #ffffff + \endtable + */ + property real cornerRadius: glowRadius + + /* + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + */ + property bool cached: false + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + + x: (parent.width - width) / 2.0 + y: (parent.height - height) / 2.0 + width: parent.width + rootItem.glowRadius * 2 + cornerRadius * 2 + height: parent.height + rootItem.glowRadius * 2 + cornerRadius * 2 + + function clampedCornerRadius() { + var maxCornerRadius = Math.min(rootItem.width, rootItem.height) / 2 + glowRadius; + return Math.max(0, Math.min(rootItem.cornerRadius, maxCornerRadius)) + } + + property color color: rootItem.color + property real inverseSpread: 1.0 - rootItem.spread + property real relativeSizeX: ((inverseSpread * inverseSpread) * rootItem.glowRadius + cornerRadius * 2.0) / width + property real relativeSizeY: relativeSizeX * (width / height) + property real spread: rootItem.spread / 2.0 + property real cornerRadius: clampedCornerRadius() + + fragmentShader: "qrc:/qt-project.org/imports/QtQuick/Controls.2/Material/shaders/RectangularGlow.frag" + } +} diff --git a/src/imports/controls/material/RoundButton.qml b/src/imports/controls/material/RoundButton.qml new file mode 100644 index 00000000..f6899dea --- /dev/null +++ b/src/imports/controls/material/RoundButton.qml @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 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.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 + +T.RoundButton { + id: control + + implicitWidth: Math.max(background ? background.implicitWidth : 0, + contentItem.implicitWidth + leftPadding + rightPadding) + implicitHeight: Math.max(background ? background.implicitHeight : 0, + contentItem.implicitHeight + topPadding + bottomPadding) + baselineOffset: contentItem.y + contentItem.baselineOffset + + // external vertical padding is 6 (to increase touch area) + padding: 12 + + Material.elevation: flat ? control.down || control.hovered ? 2 : 0 + : control.down ? 8 : 2 + Material.background: flat ? "transparent" : undefined + + contentItem: Text { + text: control.text + font: control.font + color: !control.enabled ? control.Material.hintTextColor : + control.flat && control.highlighted ? control.Material.accentColor : + control.highlighted ? control.Material.primaryHighlightedTextColor : control.Material.foreground + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + } + + // TODO: Add a proper ripple/ink effect for mouse/touch input and focus state + background: Rectangle { + implicitWidth: 48 + implicitHeight: 48 + + // external vertical padding is 6 (to increase touch area) + x: 6 + y: 6 + width: parent.width - 12 + height: parent.height - 12 + radius: control.radius + color: !control.enabled ? control.Material.buttonDisabledColor + : control.checked || control.highlighted ? control.Material.highlightedButtonColor : control.Material.buttonColor + + Rectangle { + width: parent.width + height: parent.height + radius: control.radius + visible: control.hovered || control.visualFocus + color: control.Material.rippleColor + } + + Rectangle { + width: parent.width + height: parent.height + radius: control.radius + visible: control.down + color: control.Material.rippleColor + } + + Behavior on color { + ColorAnimation { + duration: 400 + } + } + + // The layer is disabled when the button color is transparent so that you can do + // Material.background: "transparent" and get a proper flat button without needing + // to set Material.elevation as well + layer.enabled: control.enabled && control.Material.buttonColor.a > 0 + layer.effect: ElevationEffect { + elevation: control.Material.elevation + } + } +} diff --git a/src/imports/controls/material/ScrollBar.qml b/src/imports/controls/material/ScrollBar.qml index 84f2d33a..2874f125 100644 --- a/src/imports/controls/material/ScrollBar.qml +++ b/src/imports/controls/material/ScrollBar.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 T.ScrollBar { id: control @@ -46,33 +46,43 @@ T.ScrollBar { implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding) - padding: 2 - topPadding: padding + (control.orientation === Qt.Horizontal ? 12 : 0) - leftPadding: padding + (control.orientation === Qt.Vertical && !control.mirrored ? 12 : 0) - rightPadding: padding + (control.orientation === Qt.Vertical && control.mirrored ? 12 : 0) + padding: 1 contentItem: Rectangle { id: handle - implicitWidth: 4 - implicitHeight: 4 + implicitWidth: 13 + implicitHeight: 13 - color: control.pressed ? control.Material.scrollBarPressedColor : control.Material.scrollBarColor + color: control.pressed ? control.Material.scrollBarPressedColor : + control.hovered ? control.Material.scrollBarHoveredColor : control.Material.scrollBarColor visible: control.size < 1.0 opacity: 0.0 + } - states: State { - name: "active" - when: control.active - PropertyChanges { target: handle; opacity: 0.75 } - } + background: Rectangle { + implicitWidth: 16 + implicitHeight: 16 + color: "#0e000000" + opacity: 0.0 + } - transitions: Transition { + states: State { + name: "active" + when: control.active + } + + transitions: [ + Transition { + to: "active" + NumberAnimation { targets: [contentItem, background]; property: "opacity"; to: 1.0 } + }, + Transition { from: "active" SequentialAnimation { - PauseAnimation { duration: 450 } - NumberAnimation { target: handle; duration: 200; property: "opacity"; to: 0.0 } + PauseAnimation { duration: 2450 } + NumberAnimation { targets: [contentItem, background]; property: "opacity"; to: 0.0 } } } - } + ] } diff --git a/src/imports/controls/material/ScrollIndicator.qml b/src/imports/controls/material/ScrollIndicator.qml index b5f25d33..3b1dd2c3 100644 --- a/src/imports/controls/material/ScrollIndicator.qml +++ b/src/imports/controls/material/ScrollIndicator.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 T.ScrollIndicator { id: control diff --git a/src/imports/controls/material/Slider.qml b/src/imports/controls/material/Slider.qml index 15c8edb2..d13797c5 100644 --- a/src/imports/controls/material/Slider.qml +++ b/src/imports/controls/material/Slider.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.Slider { id: control @@ -55,6 +55,7 @@ T.Slider { value: control.value handleHasFocus: control.visualFocus handlePressed: control.pressed + handleHovered: control.hovered } background: Rectangle { @@ -64,7 +65,7 @@ T.Slider { implicitHeight: horizontal ? 48 : 200 width: horizontal ? control.availableWidth : 1 height: horizontal ? 1 : control.availableHeight - color: control.Material.primaryTextColor + color: control.Material.foreground scale: horizontal && control.mirrored ? -1 : 1 readonly property bool horizontal: control.orientation === Qt.Horizontal diff --git a/src/imports/controls/material/SliderHandle.qml b/src/imports/controls/material/SliderHandle.qml index 49f833d0..ba6260e9 100644 --- a/src/imports/controls/material/SliderHandle.qml +++ b/src/imports/controls/material/SliderHandle.qml @@ -34,8 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Controls.Material 2.0 +import QtQuick 2.8 +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 Item { id: root @@ -45,6 +46,7 @@ Item { property real value: 0 property bool handleHasFocus: false property bool handlePressed: false + property bool handleHovered: false readonly property int initialSize: 13 readonly property bool horizontal: control.orientation === Qt.Horizontal readonly property var control: parent @@ -65,10 +67,11 @@ Item { } Ripple { - width: parent.width - height: width - control: root.control - colored: true - opacity: root.handleHasFocus && !root.handlePressed ? 1 : 0 + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + width: 22; height: 22 + pressed: root.handlePressed + active: root.handlePressed || root.handleHasFocus || root.handleHovered + color: control.Material.rippleColor } } diff --git a/src/imports/controls/material/SpinBox.qml b/src/imports/controls/material/SpinBox.qml index e28815e8..110032be 100644 --- a/src/imports/controls/material/SpinBox.qml +++ b/src/imports/controls/material/SpinBox.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.SpinBox { id: control @@ -68,9 +68,9 @@ T.SpinBox { text: control.textFromValue(control.value, control.locale) font: control.font - color: enabled ? control.Material.primaryTextColor : control.Material.hintTextColor + color: enabled ? control.Material.foreground : control.Material.hintTextColor selectionColor: control.Material.textSelectionColor - selectedTextColor: control.Material.primaryTextColor + selectedTextColor: control.Material.foreground horizontalAlignment: Qt.AlignHCenter verticalAlignment: Qt.AlignVCenter cursorDelegate: Rectangle { @@ -101,55 +101,67 @@ T.SpinBox { readOnly: !control.editable validator: control.validator - inputMethodHints: Qt.ImhFormattedNumbersOnly + inputMethodHints: Qt.ImhDigitsOnly } - up.indicator: PaddedRectangle { + up.indicator: Item { x: control.mirrored ? 0 : parent.width - width implicitWidth: 48 implicitHeight: 48 height: parent.height width: height - padding: control.spacing - radius: 2 - color: Qt.tint(Qt.tint(control.Material.buttonColor, - control.activeFocus ? control.Material.buttonHoverColor : "transparent"), - control.up.pressed ? control.Material.buttonPressColor: "transparent") + + Ripple { + clipRadius: 2 + x: control.spacing + y: control.spacing + width: parent.width - 2 * control.spacing + height: parent.height - 2 * control.spacing + pressed: control.up.pressed + active: control.up.pressed || control.up.hovered || control.visualFocus + color: control.Material.rippleColor + } Rectangle { x: (parent.width - width) / 2 y: (parent.height - height) / 2 width: Math.min(parent.width / 3, parent.width / 3) height: 2 - color: enabled ? control.Material.primaryTextColor : control.Material.spinBoxDisabledIconColor + color: enabled ? control.Material.foreground : control.Material.spinBoxDisabledIconColor } Rectangle { x: (parent.width - width) / 2 y: (parent.height - height) / 2 width: 2 height: Math.min(parent.width / 3, parent.width / 3) - color: enabled ? control.Material.primaryTextColor : control.Material.spinBoxDisabledIconColor + color: enabled ? control.Material.foreground : control.Material.spinBoxDisabledIconColor } } - down.indicator: PaddedRectangle { + down.indicator: Item { x: control.mirrored ? parent.width - width : 0 implicitWidth: 48 implicitHeight: 48 height: parent.height width: height - padding: control.spacing - radius: 2 - color: Qt.tint(Qt.tint(control.Material.buttonColor, - control.activeFocus ? control.Material.buttonHoverColor : "transparent"), - control.down.pressed ? control.Material.buttonPressColor : "transparent") + + Ripple { + clipRadius: 2 + x: control.spacing + y: control.spacing + width: parent.width - 2 * control.spacing + height: parent.height - 2 * control.spacing + pressed: control.down.pressed + active: control.down.pressed || control.down.hovered || control.visualFocus + color: control.Material.rippleColor + } Rectangle { x: (parent.width - width) / 2 y: (parent.height - height) / 2 width: parent.width / 3 height: 2 - color: enabled ? control.Material.primaryTextColor : control.Material.spinBoxDisabledIconColor + color: enabled ? control.Material.foreground : control.Material.spinBoxDisabledIconColor } } diff --git a/src/imports/controls/material/StackView.qml b/src/imports/controls/material/StackView.qml index 982a37cb..916e910f 100644 --- a/src/imports/controls/material/StackView.qml +++ b/src/imports/controls/material/StackView.qml @@ -34,8 +34,8 @@ ** ****************************************************************************/ -import QtQuick 2.4 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T T.StackView { id: control diff --git a/src/imports/controls/material/SwipeDelegate.qml b/src/imports/controls/material/SwipeDelegate.qml index dec2d12f..da54b0c3 100644 --- a/src/imports/controls/material/SwipeDelegate.qml +++ b/src/imports/controls/material/SwipeDelegate.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.SwipeDelegate { id: control @@ -60,7 +60,7 @@ T.SwipeDelegate { text: control.text font: control.font - color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor + color: control.enabled ? control.Material.foreground : control.Material.hintTextColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft @@ -83,10 +83,20 @@ T.SwipeDelegate { Rectangle { width: parent.width height: parent.height - visible: control.down || control.highlighted || control.visualFocus - color: control.down ? control.Material.buttonPressColor : - control.visualFocus || control.hovered ? control.Material.swipeDelegateHoverColor : - control.Material.listHighlightColor + visible: control.highlighted + color: control.Material.listHighlightColor + } + + Ripple { + width: parent.width + height: parent.height + + clip: visible + pressed: control.pressed + anchor: control + active: control.down || control.visualFocus || control.hovered + color: control.Material.rippleColor + enabled: control.swipe.position === 0 } Behavior on x { diff --git a/src/imports/controls/material/SwipeView.qml b/src/imports/controls/material/SwipeView.qml index 38c12b6b..3ac373d5 100644 --- a/src/imports/controls/material/SwipeView.qml +++ b/src/imports/controls/material/SwipeView.qml @@ -34,8 +34,8 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T T.SwipeView { id: control @@ -47,6 +47,7 @@ T.SwipeView { contentItem: ListView { model: control.contentModel + interactive: control.interactive currentIndex: control.currentIndex spacing: control.spacing diff --git a/src/imports/controls/material/Switch.qml b/src/imports/controls/material/Switch.qml index ca739e62..645dc55a 100644 --- a/src/imports/controls/material/Switch.qml +++ b/src/imports/controls/material/Switch.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 -import QtQuick.Templates 2.0 as T +import QtQuick 2.8 +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 +import QtQuick.Templates 2.1 as T T.Switch { id: control @@ -56,6 +56,15 @@ T.Switch { x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2 y: control.topPadding + (control.availableHeight - height) / 2 control: control + + Ripple { + x: parent.handle.x + parent.handle.width / 2 - width / 2 + y: parent.handle.y + parent.handle.height / 2 - height / 2 + width: 28; height: 28 + pressed: control.pressed + active: control.down || control.visualFocus || control.hovered + color: control.checked ? control.Material.highlightedRippleColor : control.Material.rippleColor + } } contentItem: Text { @@ -64,7 +73,7 @@ T.Switch { text: control.text font: control.font - color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor + color: control.enabled ? control.Material.foreground : control.Material.hintTextColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft diff --git a/src/imports/controls/material/SwitchDelegate.qml b/src/imports/controls/material/SwitchDelegate.qml index 097f0acd..9fb18271 100644 --- a/src/imports/controls/material/SwitchDelegate.qml +++ b/src/imports/controls/material/SwitchDelegate.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.SwitchDelegate { id: control @@ -66,7 +66,7 @@ T.SwitchDelegate { text: control.text font: control.font - color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor + color: control.enabled ? control.Material.foreground : control.Material.hintTextColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft @@ -76,7 +76,17 @@ T.SwitchDelegate { background: Rectangle { implicitHeight: 48 - visible: control.down || control.highlighted - color: control.down ? control.Material.buttonPressColor : control.Material.listHighlightColor + color: control.highlighted ? control.Material.listHighlightColor : "transparent" + + Ripple { + width: parent.width + height: parent.height + + clip: visible + pressed: control.pressed + anchor: control + active: control.down || control.visualFocus || control.hovered + color: control.Material.rippleColor + } } } diff --git a/src/imports/controls/material/SwitchIndicator.qml b/src/imports/controls/material/SwitchIndicator.qml index 0d2163b2..c59e6ac2 100644 --- a/src/imports/controls/material/SwitchIndicator.qml +++ b/src/imports/controls/material/SwitchIndicator.qml @@ -34,29 +34,20 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +import QtQuick 2.8 +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 Item { id: indicator implicitWidth: 38 implicitHeight: 32 - property alias control: ripple.control + property Item control + property alias handle: handle Material.elevation: 1 - Ripple { - id: ripple - x: handle.x + handle.width / 2 - width / 2 - y: handle.y + handle.height / 2 - height / 2 - width: handle.width - height: width - colored: control.checked - opacity: control.pressed || control.visualFocus ? 1 : 0 - } - Rectangle { width: parent.width height: 14 diff --git a/src/imports/controls/material/TabBar.qml b/src/imports/controls/material/TabBar.qml index 901e3328..1c3b5c0c 100644 --- a/src/imports/controls/material/TabBar.qml +++ b/src/imports/controls/material/TabBar.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.7 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.TabBar { id: control diff --git a/src/imports/controls/material/TabButton.qml b/src/imports/controls/material/TabButton.qml index 535dfc02..a76df820 100644 --- a/src/imports/controls/material/TabButton.qml +++ b/src/imports/controls/material/TabButton.qml @@ -34,9 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.TabButton { id: control @@ -53,12 +54,18 @@ T.TabButton { text: control.text font: control.font elide: Text.ElideRight - color: !control.enabled ? control.Material.hintTextColor : control.down || control.checked ? control.Material.accentColor : control.Material.primaryTextColor + color: !control.enabled ? control.Material.hintTextColor : control.down || control.checked ? control.Material.accentColor : control.Material.foreground horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } - background: Item { + background: Ripple { implicitHeight: 48 + + clip: true + pressed: control.pressed + anchor: control + active: control.down || control.visualFocus || control.hovered + color: control.Material.rippleColor } } diff --git a/src/imports/controls/material/TextArea.qml b/src/imports/controls/material/TextArea.qml index 38502ed6..d454796a 100644 --- a/src/imports/controls/material/TextArea.qml +++ b/src/imports/controls/material/TextArea.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 T.TextArea { id: control @@ -51,7 +51,7 @@ T.TextArea { topPadding: 8 bottomPadding: 16 - color: enabled ? Material.primaryTextColor : Material.hintTextColor + color: enabled ? Material.foreground : Material.hintTextColor selectionColor: Material.accentColor selectedTextColor: Material.primaryHighlightedTextColor cursorDelegate: Rectangle { diff --git a/src/imports/controls/material/TextField.qml b/src/imports/controls/material/TextField.qml index ab6f6187..8954dd26 100644 --- a/src/imports/controls/material/TextField.qml +++ b/src/imports/controls/material/TextField.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 T.TextField { id: control @@ -51,7 +51,7 @@ T.TextField { topPadding: 8 bottomPadding: 16 - color: enabled ? Material.primaryTextColor : Material.hintTextColor + color: enabled ? Material.foreground : Material.hintTextColor selectionColor: Material.accentColor selectedTextColor: Material.primaryHighlightedTextColor verticalAlignment: TextInput.AlignVCenter diff --git a/src/imports/controls/material/ToolBar.qml b/src/imports/controls/material/ToolBar.qml index f0b50f73..38acf43e 100644 --- a/src/imports/controls/material/ToolBar.qml +++ b/src/imports/controls/material/ToolBar.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.ToolBar { id: control @@ -52,8 +52,6 @@ T.ToolBar { Material.foreground: Material.toolTextColor - contentItem: Item { } - background: Rectangle { implicitHeight: 48 color: control.Material.toolBarColor diff --git a/src/imports/controls/material/ToolButton.qml b/src/imports/controls/material/ToolButton.qml index d8c945a7..78b15ac2 100644 --- a/src/imports/controls/material/ToolButton.qml +++ b/src/imports/controls/material/ToolButton.qml @@ -34,9 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.ToolButton { id: control @@ -52,17 +53,27 @@ T.ToolButton { contentItem: Text { text: control.text font: control.font - color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor + color: !control.enabled ? control.Material.hintTextColor : + control.checked || control.highlighted ? control.Material.accent : control.Material.foreground elide: Text.ElideRight horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } - background: Rectangle { + background: Ripple { implicitWidth: 48 implicitHeight: 48 - color: control.down ? control.Material.buttonPressColor : control.Material.buttonHoverColor - visible: control.enabled && (control.down || control.visualFocus || control.checked || control.highlighted) + readonly property bool square: control.contentItem.implicitWidth <= control.contentItem.implicitHeight + + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + clip: !square + width: square ? parent.height / 2 : parent.width + height: square ? parent.height / 2 : parent.height + pressed: control.pressed + anchor: control + active: control.enabled && (control.down || control.visualFocus || control.hovered) + color: control.Material.rippleColor } } diff --git a/src/imports/controls/material/ToolSeparator.qml b/src/imports/controls/material/ToolSeparator.qml new file mode 100644 index 00000000..c241750a --- /dev/null +++ b/src/imports/controls/material/ToolSeparator.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 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.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 + +T.ToolSeparator { + id: control + + implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding) + implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding) + + leftPadding: vertical ? 12 : 5 + rightPadding: vertical ? 12 : 5 + topPadding: vertical ? 5 : 12 + bottomPadding: vertical ? 5 : 12 + + //! [contentItem] + contentItem: Rectangle { + implicitWidth: vertical ? 1 : 38 + implicitHeight: vertical ? 38 : 1 + color: control.Material.hintTextColor + } + //! [contentItem] +} diff --git a/src/imports/controls/material/ToolTip.qml b/src/imports/controls/material/ToolTip.qml index ab3b05d8..559b85da 100644 --- a/src/imports/controls/material/ToolTip.qml +++ b/src/imports/controls/material/ToolTip.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 T.ToolTip { id: control @@ -72,7 +72,7 @@ T.ToolTip { text: control.text font: control.font // TODO: wrapMode: Label.Wrap - color: control.Material.primaryTextColor + color: control.Material.foreground } background: Rectangle { diff --git a/src/imports/controls/material/Tumbler.qml b/src/imports/controls/material/Tumbler.qml index 7e914319..a3be17b7 100644 --- a/src/imports/controls/material/Tumbler.qml +++ b/src/imports/controls/material/Tumbler.qml @@ -34,10 +34,11 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Controls 2.0 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Material 2.0 +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 T.Tumbler { id: control @@ -47,29 +48,23 @@ T.Tumbler { delegate: Text { id: label text: modelData - color: control.Material.primaryTextColor + color: control.Material.foreground font: control.font opacity: (1.0 - Math.abs(Tumbler.displacement) / (visibleItemCount / 2)) * (control.enabled ? 1 : 0.6) horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } - contentItem: PathView { - id: pathView + contentItem: TumblerView { + id: tumblerView model: control.model delegate: control.delegate - clip: true - pathItemCount: control.visibleItemCount + 1 - preferredHighlightBegin: 0.5 - preferredHighlightEnd: 0.5 - dragMargin: width / 2 - path: Path { - startX: pathView.width / 2 - startY: -pathView.delegateHeight / 2 + startX: tumblerView.width / 2 + startY: -tumblerView.delegateHeight / 2 PathLine { - x: pathView.width / 2 - y: pathView.pathItemCount * pathView.delegateHeight - pathView.delegateHeight / 2 + x: tumblerView.width / 2 + y: (control.visibleItemCount + 1) * tumblerView.delegateHeight - tumblerView.delegateHeight / 2 } } diff --git a/src/imports/controls/material/material.pri b/src/imports/controls/material/material.pri index d6247895..3170a695 100644 --- a/src/imports/controls/material/material.pri +++ b/src/imports/controls/material/material.pri @@ -1,10 +1,12 @@ HEADERS += \ + $$PWD/qquickmaterialripple_p.h \ $$PWD/qquickmaterialstyle_p.h \ $$PWD/qquickmaterialtheme_p.h \ $$PWD/qquickmaterialprogressring_p.h \ $$PWD/qquickmaterialprogressstrip_p.h SOURCES += \ + $$PWD/qquickmaterialripple.cpp \ $$PWD/qquickmaterialstyle.cpp \ $$PWD/qquickmaterialtheme.cpp \ $$PWD/qquickmaterialprogressring.cpp \ @@ -20,6 +22,8 @@ QML_FILES += \ $$PWD/CheckIndicator.qml \ $$PWD/ComboBox.qml \ $$PWD/Dial.qml \ + $$PWD/Dialog.qml \ + $$PWD/DialogButtonBox.qml \ $$PWD/Drawer.qml \ $$PWD/ElevationEffect.qml \ $$PWD/Frame.qml \ @@ -28,6 +32,7 @@ QML_FILES += \ $$PWD/Label.qml \ $$PWD/Menu.qml \ $$PWD/MenuItem.qml \ + $$PWD/MenuSeparator.qml \ $$PWD/Page.qml \ $$PWD/PageIndicator.qml \ $$PWD/Pane.qml \ @@ -37,7 +42,8 @@ QML_FILES += \ $$PWD/RadioDelegate.qml \ $$PWD/RadioIndicator.qml \ $$PWD/RangeSlider.qml \ - $$PWD/Ripple.qml \ + $$PWD/RoundButton.qml \ + $$PWD/RectangularGlow.qml \ $$PWD/ScrollBar.qml \ $$PWD/ScrollIndicator.qml \ $$PWD/Slider.qml \ @@ -55,5 +61,6 @@ QML_FILES += \ $$PWD/TextField.qml \ $$PWD/ToolBar.qml \ $$PWD/ToolButton.qml \ + $$PWD/ToolSeparator.qml \ $$PWD/ToolTip.qml \ $$PWD/Tumbler.qml diff --git a/src/imports/controls/material/material.pro b/src/imports/controls/material/material.pro index 06499467..363e4861 100644 --- a/src/imports/controls/material/material.pro +++ b/src/imports/controls/material/material.pro @@ -1,6 +1,6 @@ TARGET = qtquickcontrols2materialstyleplugin TARGETPATH = QtQuick/Controls.2/Material -IMPORT_VERSION = 2.0 +IMPORT_VERSION = 2.1 QT += qml quick QT_PRIVATE += core-private gui-private qml-private quick-private quicktemplates2-private quickcontrols2-private diff --git a/src/imports/controls/material/qmldir b/src/imports/controls/material/qmldir index 51dafa08..6125e67d 100644 --- a/src/imports/controls/material/qmldir +++ b/src/imports/controls/material/qmldir @@ -2,4 +2,3 @@ module QtQuick.Controls.Material plugin qtquickcontrols2materialstyleplugin classname QtQuickControls2MaterialStylePlugin depends QtQuick.Controls 2.0 -depends QtGraphicalEffects 1.0 diff --git a/src/imports/controls/material/qquickmaterialprogressring.cpp b/src/imports/controls/material/qquickmaterialprogressring.cpp index 8407c7c2..a3564c17 100644 --- a/src/imports/controls/material/qquickmaterialprogressring.cpp +++ b/src/imports/controls/material/qquickmaterialprogressring.cpp @@ -41,8 +41,8 @@ #include <QtCore/qset.h> #include <QtGui/qpainter.h> #include <QtQuick/private/qquickitem_p.h> -#include <QtQuick/qsgsimplerectnode.h> -#include <QtQuick/qsgsimpletexturenode.h> +#include <QtQuick/qsgrectanglenode.h> +#include <QtQuick/qsgimagenode.h> #include <QtQuick/qquickwindow.h> QT_BEGIN_NAMESPACE @@ -79,18 +79,6 @@ private: qreal m_devicePixelRatio; QSGNode *m_containerNode; QQuickWindow *m_window; -}; - -class QQuickMaterialRingTexture : public QSGSimpleTextureNode -{ -public: - QQuickMaterialRingTexture(); - ~QQuickMaterialRingTexture(); - - QColor color() const; - void setColor(QColor color); - -private: QColor m_color; }; @@ -106,14 +94,15 @@ QQuickMaterialProgressRing::~QQuickMaterialProgressRing() QSGNode *QQuickMaterialProgressRing::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *) { - if (!oldNode) - oldNode = new QSGSimpleRectNode(boundingRect(), Qt::transparent); - - static_cast<QSGSimpleRectNode *>(oldNode)->setRect(boundingRect()); + if (!oldNode) { + oldNode = window()->createRectangleNode(); + static_cast<QSGRectangleNode *>(oldNode)->setColor(Qt::transparent); + } + static_cast<QSGRectangleNode *>(oldNode)->setRect(boundingRect()); - QQuickMaterialRingTexture *textureNode = static_cast<QQuickMaterialRingTexture*>(oldNode->firstChild()); + QSGImageNode *textureNode = static_cast<QSGImageNode *>(oldNode->firstChild()); if (!textureNode) { - textureNode = new QQuickMaterialRingTexture; + textureNode = window()->createImageNode(); textureNode->setOwnsTexture(true); oldNode->appendChildNode(textureNode); } @@ -122,7 +111,6 @@ QSGNode *QQuickMaterialProgressRing::updatePaintNode(QSGNode *oldNode, QQuickIte // so just use a blank image. QImage blankImage(width(), height(), QImage::Format_ARGB32_Premultiplied); blankImage.fill(Qt::transparent); - textureNode->setColor(m_color); textureNode->setRect(boundingRect()); textureNode->setTexture(window()->createTextureFromImage(blankImage)); @@ -194,7 +182,7 @@ void QQuickMaterialRingAnimatorJob::updateCurrentTime(int time) if (!m_containerNode) return; - QSGSimpleRectNode *rectNode = static_cast<QSGSimpleRectNode*>(m_containerNode->firstChild()); + QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(m_containerNode->firstChild()); if (!rectNode) return; @@ -209,8 +197,8 @@ void QQuickMaterialRingAnimatorJob::updateCurrentTime(int time) painter.setRenderHint(QPainter::Antialiasing); QPen pen; - QQuickMaterialRingTexture *textureNode = static_cast<QQuickMaterialRingTexture*>(rectNode->firstChild()); - pen.setColor(textureNode->color()); + QSGImageNode *textureNode = static_cast<QSGImageNode *>(rectNode->firstChild()); + pen.setColor(m_color); pen.setWidth(4 * m_devicePixelRatio); painter.setPen(pen); @@ -266,24 +254,7 @@ void QQuickMaterialRingAnimatorJob::nodeWasDestroyed() void QQuickMaterialRingAnimatorJob::afterNodeSync() { m_containerNode = QQuickItemPrivate::get(m_target)->childContainerNode(); -} - -QQuickMaterialRingTexture::QQuickMaterialRingTexture() -{ -} - -QQuickMaterialRingTexture::~QQuickMaterialRingTexture() -{ -} - -QColor QQuickMaterialRingTexture::color() const -{ - return m_color; -} - -void QQuickMaterialRingTexture::setColor(QColor color) -{ - m_color = color; + m_color = static_cast<QQuickMaterialProgressRing *>(m_target.data())->color(); } QT_END_NAMESPACE diff --git a/src/imports/controls/material/qquickmaterialprogressstrip.cpp b/src/imports/controls/material/qquickmaterialprogressstrip.cpp index ce4d676e..542d312f 100644 --- a/src/imports/controls/material/qquickmaterialprogressstrip.cpp +++ b/src/imports/controls/material/qquickmaterialprogressstrip.cpp @@ -38,10 +38,11 @@ #include <QtCore/qmath.h> #include <QtCore/qeasingcurve.h> -#include <QtQuick/qsgsimplerectnode.h> #include <QtQuick/private/qquickitem_p.h> #include <QtQuick/private/qquickanimatorjob_p.h> #include <QtQuick/private/qsgadaptationlayer_p.h> +#include <QtQuick/qsgrectanglenode.h> +#include <QtQuick/qsgimagenode.h> QT_BEGIN_NAMESPACE @@ -81,7 +82,7 @@ void QQuickMaterialProgressStripAnimatorJob::updateCurrentTime(int time) if (!m_node) return; - QSGSimpleRectNode *geometryNode = static_cast<QSGSimpleRectNode *>(m_node->firstChild()); + QSGRectangleNode *geometryNode = static_cast<QSGRectangleNode *>(m_node->firstChild()); Q_ASSERT(!geometryNode || geometryNode->type() == QSGNode::GeometryNodeType); if (!geometryNode) return; @@ -128,7 +129,7 @@ void QQuickMaterialProgressStripAnimatorJob::moveNode(QSGTransformNode *transfor matrix.translate(x, 0); transformNode->setMatrix(matrix); - QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(transformNode->firstChild()); + QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode *>(transformNode->firstChild()); Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType); QRectF r = geometry; @@ -211,9 +212,11 @@ QSGNode *QQuickMaterialProgressStrip::updatePaintNode(QSGNode *oldNode, UpdatePa bounds.setHeight(implicitHeight()); bounds.moveTop((height() - bounds.height()) / 2.0); - if (!oldNode) - oldNode = new QSGSimpleRectNode(bounds, Qt::transparent); - static_cast<QSGSimpleRectNode *>(oldNode)->setRect(bounds); + if (!oldNode) { + oldNode = window()->createRectangleNode(); + static_cast<QSGRectangleNode *>(oldNode)->setColor(Qt::transparent); + } + static_cast<QSGRectangleNode *>(oldNode)->setRect(bounds); const int count = m_indeterminate ? 2 : 1; const qreal w = m_indeterminate ? 0 : m_progress * width(); @@ -225,14 +228,14 @@ QSGNode *QQuickMaterialProgressStrip::updatePaintNode(QSGNode *oldNode, UpdatePa transformNode = new QSGTransformNode; oldNode->appendChildNode(transformNode); - QSGRectangleNode *rectNode = d->sceneGraphContext()->createRectangleNode(); + QSGInternalRectangleNode *rectNode = d->sceneGraphContext()->createInternalRectangleNode(); rectNode->setAntialiasing(true); transformNode->appendChildNode(rectNode); } Q_ASSERT(transformNode->type() == QSGNode::TransformNodeType); static_cast<QSGTransformNode *>(transformNode)->setMatrix(QMatrix4x4()); - QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(transformNode->firstChild()); + QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode *>(transformNode->firstChild()); Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType); rectNode->setRect(rect); diff --git a/src/imports/controls/material/qquickmaterialripple.cpp b/src/imports/controls/material/qquickmaterialripple.cpp new file mode 100644 index 00000000..645b0289 --- /dev/null +++ b/src/imports/controls/material/qquickmaterialripple.cpp @@ -0,0 +1,451 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 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 "qquickmaterialripple_p.h" + +#include <QtCore/qmath.h> +#include <QtQuick/private/qquickitem_p.h> +#include <QtQuick/private/qquickanimator_p.h> +#include <QtQuick/private/qquickrectangle_p.h> +#include <QtQuick/private/qquickanimatorjob_p.h> +#include <QtQuick/private/qsgadaptationlayer_p.h> +#include <QtQuickTemplates2/private/qquickabstractbutton_p.h> +#include <QtQuickTemplates2/private/qquickabstractbutton_p_p.h> + +QT_BEGIN_NAMESPACE + +namespace { + enum WavePhase { WaveEnter, WaveExit }; +} + +static const int RIPPLE_ENTER_DELAY = 80; +static const int OPACITY_ENTER_DURATION_FAST = 120; +static const int WAVE_OPACITY_DECAY_DURATION = 333; +static const qreal WAVE_TOUCH_UP_ACCELERATION = 3400.0; +static const qreal WAVE_TOUCH_DOWN_ACCELERATION = 1024.0; + +class QQuickMaterialRippleAnimatorJob : public QQuickAnimatorJob +{ +public: + QQuickMaterialRippleAnimatorJob(WavePhase phase, const QPointF &anchor, const QRectF &bounds); + + void initialize(QQuickAnimatorController *controller) override; + void updateCurrentTime(int time) override; + void writeBack() override; + void nodeWasDestroyed() override; + void afterNodeSync() override; + +private: + qreal m_diameter; + WavePhase m_phase; + QRectF m_bounds; + QPointF m_anchor; + QSGTransformNode *m_itemNode; + QSGOpacityNode *m_opacityNode; + QSGInternalRectangleNode *m_rectNode; +}; + +QQuickMaterialRippleAnimatorJob::QQuickMaterialRippleAnimatorJob(WavePhase phase, const QPointF &anchor, const QRectF &bounds) + : m_diameter(qSqrt(bounds.width() * bounds.width() + bounds.height() * bounds.height())), + m_phase(phase), + m_bounds(bounds), + m_anchor(anchor), + m_itemNode(nullptr), + m_opacityNode(nullptr), + m_rectNode(nullptr) +{ +} + +void QQuickMaterialRippleAnimatorJob::initialize(QQuickAnimatorController *controller) +{ + QQuickAnimatorJob::initialize(controller); + afterNodeSync(); +} + +void QQuickMaterialRippleAnimatorJob::updateCurrentTime(int time) +{ + if (!m_itemNode || !m_rectNode) + return; + + qreal duration = 0; + if (m_phase == WaveEnter) + duration = QQuickAnimatorJob::duration(); + else + duration = 1000.0 * qSqrt((m_diameter - m_from) / 2.0 / (WAVE_TOUCH_UP_ACCELERATION + WAVE_TOUCH_DOWN_ACCELERATION)); + + qreal p = 1.0; + if (!qFuzzyIsNull(duration) && time < duration) + p = time / duration; + + m_value = m_from + (m_to - m_from) * p; + p = m_value / m_diameter; + + const qreal dx = (1.0 - p) * (m_anchor.x() - m_bounds.width() / 2); + const qreal dy = (1.0 - p) * (m_anchor.y() - m_bounds.height() / 2); + + m_rectNode->setRect(QRectF(0, 0, m_value, m_value)); + m_rectNode->setRadius(m_value / 2); + m_rectNode->update(); + + QMatrix4x4 m; + m.translate((m_bounds.width() - m_value) / 2 + dx, + (m_bounds.height() - m_value) / 2 + dy); + m_itemNode->setMatrix(m); + + if (m_opacityNode) { + qreal opacity = 1.0; + if (m_phase == WaveExit) + opacity -= static_cast<qreal>(time) / WAVE_OPACITY_DECAY_DURATION; + m_opacityNode->setOpacity(opacity); + } +} + +void QQuickMaterialRippleAnimatorJob::writeBack() +{ + if (m_target) + m_target->setSize(QSizeF(m_value, m_value)); + if (m_phase == WaveExit) + m_target->deleteLater(); +} + +void QQuickMaterialRippleAnimatorJob::nodeWasDestroyed() +{ + m_itemNode = nullptr; + m_opacityNode = nullptr; + m_rectNode = nullptr; +} + +void QQuickMaterialRippleAnimatorJob::afterNodeSync() +{ + m_itemNode = QQuickItemPrivate::get(m_target)->itemNode(); + m_opacityNode = QQuickItemPrivate::get(m_target)->opacityNode(); + m_rectNode = static_cast<QSGInternalRectangleNode *>(QQuickItemPrivate::get(m_target)->childContainerNode()->firstChild()); +} + +class QQuickMaterialRippleAnimator : public QQuickAnimator +{ +public: + QQuickMaterialRippleAnimator(const QPointF &anchor, const QRectF &bounds, QObject *parent = nullptr); + + WavePhase phase() const; + void setPhase(WavePhase phase); + +protected: + QString propertyName() const override; + QQuickAnimatorJob *createJob() const override; + +private: + QPointF m_anchor; + QRectF m_bounds; + WavePhase m_phase; +}; + +QQuickMaterialRippleAnimator::QQuickMaterialRippleAnimator(const QPointF &anchor, const QRectF &bounds, QObject *parent) + : QQuickAnimator(parent), m_anchor(anchor), m_bounds(bounds), m_phase(WaveEnter) +{ +} + +WavePhase QQuickMaterialRippleAnimator::phase() const +{ + return m_phase; +} + +void QQuickMaterialRippleAnimator::setPhase(WavePhase phase) +{ + if (m_phase == phase) + return; + + m_phase = phase; +} + +QString QQuickMaterialRippleAnimator::propertyName() const +{ + return QString(); +} + +QQuickAnimatorJob *QQuickMaterialRippleAnimator::createJob() const +{ + return new QQuickMaterialRippleAnimatorJob(m_phase, m_anchor, m_bounds); +} + +QQuickMaterialRipple::QQuickMaterialRipple(QQuickItem *parent) + : QQuickItem(parent), m_active(false), m_pressed(false), m_enterDelay(0), m_trigger(Press), m_clipRadius(0.0), m_anchor(nullptr), m_opacityAnimator(nullptr) +{ + setOpacity(0.0); + setFlag(ItemHasContents); +} + +bool QQuickMaterialRipple::isActive() const +{ + return m_active; +} + +void QQuickMaterialRipple::setActive(bool active) +{ + if (active == m_active) + return; + + m_active = active; + + if (!m_opacityAnimator) { + m_opacityAnimator = new QQuickOpacityAnimator(this); + m_opacityAnimator->setTargetItem(this); + } + m_opacityAnimator->setDuration(active ? OPACITY_ENTER_DURATION_FAST : WAVE_OPACITY_DECAY_DURATION); + + const int time = m_opacityAnimator->currentTime(); + m_opacityAnimator->stop(); + m_opacityAnimator->setFrom(opacity()); + m_opacityAnimator->setTo(active ? 1.0 : 0.0); + m_opacityAnimator->setCurrentTime(time); + m_opacityAnimator->start(); +} + +QColor QQuickMaterialRipple::color() const +{ + return m_color; +} + +void QQuickMaterialRipple::setColor(const QColor &color) +{ + if (m_color == color) + return; + + m_color = color; + update(); +} + +qreal QQuickMaterialRipple::clipRadius() const +{ + return m_clipRadius; +} + +void QQuickMaterialRipple::setClipRadius(qreal radius) +{ + if (qFuzzyCompare(m_clipRadius, radius)) + return; + + m_clipRadius = radius; + setClip(!qFuzzyIsNull(radius)); + update(); +} + +bool QQuickMaterialRipple::isPressed() const +{ + return m_pressed; +} + +void QQuickMaterialRipple::setPressed(bool pressed) +{ + if (pressed == m_pressed) + return; + + m_pressed = pressed; + + if (!isEnabled()) + return; + + if (pressed) { + if (m_trigger == Press) + prepareWave(); + else + exitWave(); + } else { + if (m_trigger == Release) + enterWave(); + else + exitWave(); + } +} + +QQuickMaterialRipple::Trigger QQuickMaterialRipple::trigger() const +{ + return m_trigger; +} + +void QQuickMaterialRipple::setTrigger(Trigger trigger) +{ + m_trigger = trigger; +} + +QPointF QQuickMaterialRipple::anchorPoint() const +{ + const QRectF bounds = boundingRect(); + const QPointF center = bounds.center(); + if (!m_anchor) + return center; + + QPointF anchorPoint = bounds.center(); + if (QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton *>(m_anchor)) + anchorPoint = QQuickAbstractButtonPrivate::get(button)->pressPoint; + anchorPoint = mapFromItem(m_anchor, anchorPoint); + + // calculate whether the anchor point is within the ripple circle bounds, + // that is, whether waves should start expanding from the anchor point + const qreal r = qSqrt(bounds.width() * bounds.width() + bounds.height() * bounds.height()) / 2; + if (QLineF(center, anchorPoint).length() < r) + return anchorPoint; + + // if the anchor point is outside the ripple circle bounds, start expanding + // from the intersection point of the ripple circle and a line from its center + // to the the anchor point + const qreal p = qAtan2(anchorPoint.y() - center.y(), anchorPoint.x() - center.x()); + return QPointF(center.x() + r * qCos(p), center.y() + r * qSin(p)); +} + +QQuickItem *QQuickMaterialRipple::anchor() const +{ + return m_anchor; +} + +void QQuickMaterialRipple::setAnchor(QQuickItem *item) +{ + m_anchor = item; +} + +void QQuickMaterialRipple::itemChange(ItemChange change, const ItemChangeData &data) +{ + QQuickItem::itemChange(change, data); + + if (change == ItemChildRemovedChange) { + QQuickMaterialRippleAnimator *animator = data.item->findChild<QQuickMaterialRippleAnimator *>(); + if (animator) + m_rippleAnimators.removeOne(animator); + } +} + +QSGNode *QQuickMaterialRipple::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) +{ + QQuickItemPrivate *d = QQuickItemPrivate::get(this); + QQuickDefaultClipNode *clipNode = d->clipNode(); + if (clipNode) { + // TODO: QTBUG-51894 + // clipNode->setRadius(m_clipRadius); + clipNode->setRect(boundingRect()); + clipNode->update(); + } + + const qreal w = width(); + const qreal h = height(); + const qreal sz = qSqrt(w * w + h * h); + + QSGTransformNode *transformNode = static_cast<QSGTransformNode *>(oldNode); + if (!transformNode) + transformNode = new QSGTransformNode; + + QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode *>(transformNode->firstChild()); + if (!rectNode) { + rectNode = d->sceneGraphContext()->createInternalRectangleNode(); + rectNode->setAntialiasing(true); + transformNode->appendChildNode(rectNode); + } + + QMatrix4x4 matrix; + if (qFuzzyIsNull(m_clipRadius)) { + matrix.translate((w - sz) / 2, (h - sz) / 2); + rectNode->setRect(QRectF(0, 0, sz, sz)); + rectNode->setRadius(sz / 2); + } else { + rectNode->setRect(QRectF(0, 0, w, h)); + rectNode->setRadius(m_clipRadius); + } + transformNode->setMatrix(matrix); + rectNode->setColor(m_color); + rectNode->update(); + + return transformNode; +} + +void QQuickMaterialRipple::timerEvent(QTimerEvent *event) +{ + QQuickItem::timerEvent(event); + + if (event->timerId() == m_enterDelay) + enterWave(); +} + +void QQuickMaterialRipple::prepareWave() +{ + if (m_enterDelay <= 0) + m_enterDelay = startTimer(RIPPLE_ENTER_DELAY); +} + +void QQuickMaterialRipple::enterWave() +{ + if (m_enterDelay > 0) { + killTimer(m_enterDelay); + m_enterDelay = 0; + } + + const qreal w = width(); + const qreal h = height(); + const qreal sz = qSqrt(w * w + h * h); + + QQuickRectangle *wave = new QQuickRectangle(this); + wave->setPosition(QPointF((w - sz) / 2, (h - sz) / 2)); + wave->setSize(QSizeF(sz, sz)); + wave->setRadius(sz / 2); + wave->setColor(color()); + wave->setOpacity(0.0); + + QQuickMaterialRippleAnimator *animator = new QQuickMaterialRippleAnimator(anchorPoint(), boundingRect(), wave); + animator->setDuration(qRound(1000.0 * qSqrt(sz / 2.0 / WAVE_TOUCH_DOWN_ACCELERATION))); + animator->setTargetItem(wave); + animator->setTo(sz); + animator->start(); + m_rippleAnimators += animator; +} + +void QQuickMaterialRipple::exitWave() +{ + if (m_enterDelay > 0) { + killTimer(m_enterDelay); + m_enterDelay = 0; + } + + for (QQuickMaterialRippleAnimator *animator : m_rippleAnimators) { + if (animator->phase() == WaveEnter) { + animator->stop(); // -> writeBack() -> setSize() + if (QQuickItem *wave = animator->targetItem()) + animator->setFrom(wave->width()); + animator->setDuration(WAVE_OPACITY_DECAY_DURATION); + animator->setPhase(WaveExit); + animator->restart(); + } + } +} + +QT_END_NAMESPACE diff --git a/src/imports/controls/material/qquickmaterialripple_p.h b/src/imports/controls/material/qquickmaterialripple_p.h new file mode 100644 index 00000000..0209ba41 --- /dev/null +++ b/src/imports/controls/material/qquickmaterialripple_p.h @@ -0,0 +1,120 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 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 QQUICKMATERIALRIPPLE_P_H +#define QQUICKMATERIALRIPPLE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtQuick/qquickitem.h> +#include <QtGui/qcolor.h> + +QT_BEGIN_NAMESPACE + +class QQuickOpacityAnimator; +class QQuickMaterialRippleAnimator; + +class QQuickMaterialRipple : public QQuickItem +{ + Q_OBJECT + Q_PROPERTY(QColor color READ color WRITE setColor FINAL) + Q_PROPERTY(qreal clipRadius READ clipRadius WRITE setClipRadius FINAL) + Q_PROPERTY(bool pressed READ isPressed WRITE setPressed FINAL) + Q_PROPERTY(bool active READ isActive WRITE setActive FINAL) + Q_PROPERTY(QQuickItem *anchor READ anchor WRITE setAnchor FINAL) + Q_PROPERTY(Trigger trigger READ trigger WRITE setTrigger FINAL) + +public: + QQuickMaterialRipple(QQuickItem *parent = nullptr); + + QColor color() const; + void setColor(const QColor &color); + + qreal clipRadius() const; + void setClipRadius(qreal radius); + + bool isActive() const; + void setActive(bool active); + + bool isPressed() const; + void setPressed(bool pressed); + + enum Trigger { Press, Release }; + Q_ENUM (Trigger) + + Trigger trigger() const; + void setTrigger(Trigger trigger); + + QPointF anchorPoint() const; + + QQuickItem *anchor() const; + void setAnchor(QQuickItem *anchor); + +protected: + void itemChange(ItemChange change, const ItemChangeData &data) override; + QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override; + void timerEvent(QTimerEvent *event) override; + + void prepareWave(); + void enterWave(); + void exitWave(); + +private: + bool m_active; + bool m_pressed; + int m_enterDelay; + Trigger m_trigger; + qreal m_clipRadius; + QColor m_color; + QQuickItem *m_anchor; + QQuickOpacityAnimator *m_opacityAnimator; + QVector<QQuickMaterialRippleAnimator *> m_rippleAnimators; +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QQuickMaterialRipple) + +#endif // QQUICKMATERIALRIPPLE_P_H diff --git a/src/imports/controls/material/qquickmaterialstyle.cpp b/src/imports/controls/material/qquickmaterialstyle.cpp index 1c19bbd3..08203482 100644 --- a/src/imports/controls/material/qquickmaterialstyle.cpp +++ b/src/imports/controls/material/qquickmaterialstyle.cpp @@ -408,37 +408,24 @@ static const QRgb raisedButtonColorLight = 0xFFD6D7D7; static const QRgb raisedButtonColorDark = 0x3FCCCCCC; static const QRgb raisedButtonDisabledColorLight = dividerColorLight; static const QRgb raisedButtonDisabledColorDark = dividerColorDark; -static const QRgb flatButtonPressColorLight = 0x66999999; -static const QRgb flatButtonPressColorDark = 0x3FCCCCCC; -static const QRgb flatButtonFocusColorLight = 0x33CCCCCC; -static const QRgb flatButtonFocusColorDark = 0x26CCCCCC; -static const QRgb swipeDelegateColorLight = 0xFFD6D7D7; -static const QRgb swipeDelegateColorDark = 0xFF525252; -static const QRgb swipeDelegateHoverColorLight = 0xFFDFDFDF; -static const QRgb swipeDelegateHoverColorDark = 0xFF5D5D5D; -static const QRgb swipeDelegatePressColorLight = 0xFFCFCFCF; -static const QRgb swipeDelegatePressColorDark = 0xFF484848; -static const QRgb swipeDelegateDisabledColorLight = 0xFFEFEFEF; -static const QRgb swipeDelegateDisabledColorDark = 0xFF7C7C7C; static const QRgb frameColorLight = hintTextColorLight; static const QRgb frameColorDark = hintTextColorDark; static const QRgb switchUncheckedTrackColorLight = 0x42000000; static const QRgb switchUncheckedTrackColorDark = 0x4CFFFFFF; static const QRgb switchDisabledTrackColorLight = 0x1E000000; static const QRgb switchDisabledTrackColorDark = 0x19FFFFFF; -static const QRgb checkBoxUncheckedRippleColorLight = 0x10000000; -static const QRgb checkBoxUncheckedRippleColorDark = 0x20FFFFFF; +static const QRgb rippleColorLight = 0x10000000; +static const QRgb rippleColorDark = 0x20FFFFFF; static const QRgb spinBoxDisabledIconColorLight = 0xFFCCCCCC; static const QRgb spinBoxDisabledIconColorDark = 0xFF666666; -static QColor alphaBlend(const QColor &bg, const QColor &fg) +extern bool qt_is_dark_system_theme(); + +static QQuickMaterialStyle::Theme effectiveTheme(QQuickMaterialStyle::Theme theme) { - QColor result; - result.setRedF(fg.redF() * fg.alphaF() + bg.redF() * (1.0 - fg.alphaF())); - result.setGreenF(fg.greenF() * fg.alphaF() + bg.greenF() * (1.0 - fg.alphaF())); - result.setBlueF(fg.blueF() * fg.alphaF() + bg.blueF() * (1.0 - fg.alphaF())); - result.setAlphaF(bg.alphaF() + fg.alphaF() * (1.0 - bg.alphaF())); - return result; + if (theme == QQuickMaterialStyle::System) + theme = qt_is_dark_system_theme() ? QQuickMaterialStyle::Dark : QQuickMaterialStyle::Light; + return theme; } QQuickMaterialStyle::QQuickMaterialStyle(QObject *parent) : QQuickStyleAttached(parent), @@ -475,6 +462,9 @@ QQuickMaterialStyle::Theme QQuickMaterialStyle::theme() const void QQuickMaterialStyle::setTheme(Theme theme) { + if (theme == System) + theme = qt_is_dark_system_theme() ? Dark : Light; + m_explicitTheme = true; if (m_theme == theme) return; @@ -648,7 +638,13 @@ void QQuickMaterialStyle::resetAccent() QVariant QQuickMaterialStyle::foreground() const { - return primaryTextColor(); + if (!m_hasForeground) + return QColor::fromRgba(m_theme == Light ? primaryTextColorLight : primaryTextColorDark); + if (m_customForeground) + return QColor::fromRgba(m_foreground); + if (m_foreground > BlueGrey) + return QColor(); + return QColor::fromRgba(colors[m_foreground][Shade500]); } void QQuickMaterialStyle::setForeground(const QVariant &var) @@ -824,13 +820,7 @@ QColor QQuickMaterialStyle::backgroundColor() const QColor QQuickMaterialStyle::primaryTextColor() const { - if (!m_hasForeground) - return QColor::fromRgba(m_theme == Light ? primaryTextColorLight : primaryTextColorDark); - if (m_customForeground) - return QColor::fromRgba(m_foreground); - if (m_foreground > BlueGrey) - return QColor(); - return colors[m_foreground][Shade500]; + return QColor::fromRgba(m_theme == Light ? primaryTextColorLight : primaryTextColorDark); } QColor QQuickMaterialStyle::primaryHighlightedTextColor() const @@ -877,10 +867,9 @@ QColor QQuickMaterialStyle::iconDisabledColor() const return QColor::fromRgba(m_theme == Light ? iconDisabledColorLight : iconDisabledColorDark); } -QColor QQuickMaterialStyle::buttonColor(bool highlighted, bool pressed, bool hover) const +QColor QQuickMaterialStyle::buttonColor(bool highlighted) const { - Shade shade = pressed ? (m_theme == Light ? Shade700 : Shade100) - : themeShade(); + Shade shade = themeShade(); QColor color = Qt::transparent; @@ -891,45 +880,14 @@ QColor QQuickMaterialStyle::buttonColor(bool highlighted, bool pressed, bool hov } else if (elevation() > 0) { color = QColor::fromRgba(m_theme == Light ? raisedButtonColorLight : raisedButtonColorDark); - - if (pressed) { - color = this->shade(color, shade); - } } - if (color == Qt::transparent) { - if (pressed) { - return QColor::fromRgba(m_theme == Light ? flatButtonPressColorLight - : flatButtonPressColorDark); - } else if (hover) { - return QColor::fromRgba(m_theme == Light ? flatButtonFocusColorLight - : flatButtonFocusColorDark); - } else { - return color; - } - } - - if (pressed || hover) { - // Add overlaying black shadow 12% opacity - return alphaBlend(color, QColor::fromRgba(0x1F000000)); - } else { - return color; - } + return color; } QColor QQuickMaterialStyle::buttonColor() const { - return buttonColor(false, false, false); -} - -QColor QQuickMaterialStyle::buttonHoverColor() const -{ - return buttonColor(false, false, true); -} - -QColor QQuickMaterialStyle::buttonPressColor() const -{ - return buttonColor(false, true, false); + return buttonColor(false); } QColor QQuickMaterialStyle::buttonDisabledColor() const @@ -944,37 +902,7 @@ QColor QQuickMaterialStyle::buttonDisabledColor() const QColor QQuickMaterialStyle::highlightedButtonColor() const { - return buttonColor(true, false, false); -} - -QColor QQuickMaterialStyle::highlightedButtonHoverColor() const -{ - return buttonColor(true, false, true); -} - -QColor QQuickMaterialStyle::highlightedButtonPressColor() const -{ - return buttonColor(true, true, false); -} - -QColor QQuickMaterialStyle::swipeDelegateColor() const -{ - return QColor::fromRgba(m_theme == Light ? swipeDelegateColorLight : swipeDelegateColorDark); -} - -QColor QQuickMaterialStyle::swipeDelegateHoverColor() const -{ - return QColor::fromRgba(m_theme == Light ? swipeDelegateHoverColorLight : swipeDelegateHoverColorDark); -} - -QColor QQuickMaterialStyle::swipeDelegatePressColor() const -{ - return QColor::fromRgba(m_theme == Light ? swipeDelegatePressColorLight : swipeDelegatePressColorDark); -} - -QColor QQuickMaterialStyle::swipeDelegateDisabledColor() const -{ - return QColor::fromRgba(m_theme == Light ? swipeDelegateDisabledColorLight : swipeDelegateDisabledColorDark); + return buttonColor(true); } QColor QQuickMaterialStyle::frameColor() const @@ -982,12 +910,12 @@ QColor QQuickMaterialStyle::frameColor() const return QColor::fromRgba(m_theme == Light ? frameColorLight : frameColorDark); } -QColor QQuickMaterialStyle::checkBoxUncheckedRippleColor() const +QColor QQuickMaterialStyle::rippleColor() const { - return QColor::fromRgba(m_theme == Light ? checkBoxUncheckedRippleColorLight : checkBoxUncheckedRippleColorDark); + return QColor::fromRgba(m_theme == Light ? rippleColorLight : rippleColorDark); } -QColor QQuickMaterialStyle::checkBoxCheckedRippleColor() const +QColor QQuickMaterialStyle::highlightedRippleColor() const { QColor pressColor = accentColor(); pressColor.setAlpha(m_theme == Light ? 30 : 50); @@ -1031,6 +959,11 @@ QColor QQuickMaterialStyle::scrollBarColor() const return QColor::fromRgba(m_theme == Light ? 0x40000000 : 0x40FFFFFF); } +QColor QQuickMaterialStyle::scrollBarHoveredColor() const +{ + return QColor::fromRgba(m_theme == Light ? 0x60000000 : 0x60FFFFFF); +} + QColor QQuickMaterialStyle::scrollBarPressedColor() const { return QColor::fromRgba(m_theme == Light ? 0x80000000 : 0x80FFFFFF); @@ -1242,7 +1175,7 @@ void QQuickMaterialStyle::init() QByteArray themeValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_THEME", settings, QStringLiteral("Theme")); Theme themeEnum = toEnumValue<Theme>(themeValue, &ok); if (ok) - globalTheme = m_theme = themeEnum; + globalTheme = m_theme = effectiveTheme(themeEnum); else if (!themeValue.isEmpty()) qWarning().nospace().noquote() << "Material: unknown theme value: " << themeValue; diff --git a/src/imports/controls/material/qquickmaterialstyle_p.h b/src/imports/controls/material/qquickmaterialstyle_p.h index af5638f1..78fef272 100644 --- a/src/imports/controls/material/qquickmaterialstyle_p.h +++ b/src/imports/controls/material/qquickmaterialstyle_p.h @@ -67,7 +67,7 @@ class QQuickMaterialStyle : public QQuickStyleAttached Q_PROPERTY(QColor primaryColor READ primaryColor NOTIFY primaryChanged FINAL) // TODO: remove? Q_PROPERTY(QColor accentColor READ accentColor NOTIFY accentChanged FINAL) // TODO: remove? Q_PROPERTY(QColor backgroundColor READ backgroundColor NOTIFY backgroundChanged FINAL) - Q_PROPERTY(QColor primaryTextColor READ primaryTextColor NOTIFY foregroundChanged FINAL) // TODO: rename to foregroundColor()? + Q_PROPERTY(QColor primaryTextColor READ primaryTextColor NOTIFY paletteChanged FINAL) Q_PROPERTY(QColor primaryHighlightedTextColor READ primaryHighlightedTextColor NOTIFY paletteChanged FINAL) Q_PROPERTY(QColor secondaryTextColor READ secondaryTextColor NOTIFY paletteChanged FINAL) Q_PROPERTY(QColor hintTextColor READ hintTextColor NOTIFY paletteChanged FINAL) @@ -77,19 +77,11 @@ class QQuickMaterialStyle : public QQuickStyleAttached Q_PROPERTY(QColor iconColor READ iconColor NOTIFY paletteChanged FINAL) Q_PROPERTY(QColor iconDisabledColor READ iconDisabledColor NOTIFY paletteChanged FINAL) Q_PROPERTY(QColor buttonColor READ buttonColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor buttonHoverColor READ buttonHoverColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor buttonPressColor READ buttonPressColor NOTIFY paletteChanged FINAL) Q_PROPERTY(QColor buttonDisabledColor READ buttonDisabledColor NOTIFY paletteChanged FINAL) Q_PROPERTY(QColor highlightedButtonColor READ highlightedButtonColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor highlightedButtonHoverColor READ highlightedButtonHoverColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor highlightedButtonPressColor READ highlightedButtonPressColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor swipeDelegateColor READ swipeDelegateColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor swipeDelegateHoverColor READ swipeDelegateHoverColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor swipeDelegatePressColor READ swipeDelegatePressColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor swipeDelegateDisabledColor READ swipeDelegateDisabledColor NOTIFY paletteChanged FINAL) Q_PROPERTY(QColor frameColor READ frameColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor checkBoxUncheckedRippleColor READ checkBoxUncheckedRippleColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor checkBoxCheckedRippleColor READ checkBoxCheckedRippleColor NOTIFY paletteChanged FINAL) + Q_PROPERTY(QColor rippleColor READ rippleColor NOTIFY paletteChanged FINAL) + Q_PROPERTY(QColor highlightedRippleColor READ highlightedRippleColor NOTIFY paletteChanged FINAL) Q_PROPERTY(QColor switchUncheckedTrackColor READ switchUncheckedTrackColor NOTIFY paletteChanged FINAL) Q_PROPERTY(QColor switchCheckedTrackColor READ switchCheckedTrackColor NOTIFY paletteChanged FINAL) Q_PROPERTY(QColor switchUncheckedHandleColor READ switchUncheckedHandleColor NOTIFY paletteChanged FINAL) @@ -97,6 +89,7 @@ class QQuickMaterialStyle : public QQuickStyleAttached Q_PROPERTY(QColor switchDisabledTrackColor READ switchDisabledTrackColor NOTIFY paletteChanged FINAL) Q_PROPERTY(QColor switchDisabledHandleColor READ switchDisabledHandleColor NOTIFY paletteChanged FINAL) Q_PROPERTY(QColor scrollBarColor READ scrollBarColor NOTIFY paletteChanged FINAL) + Q_PROPERTY(QColor scrollBarHoveredColor READ scrollBarHoveredColor NOTIFY paletteChanged FINAL) Q_PROPERTY(QColor scrollBarPressedColor READ scrollBarPressedColor NOTIFY paletteChanged FINAL) Q_PROPERTY(QColor dialogColor READ dialogColor NOTIFY paletteChanged FINAL) Q_PROPERTY(QColor backgroundDimColor READ backgroundDimColor NOTIFY paletteChanged FINAL) @@ -109,7 +102,8 @@ class QQuickMaterialStyle : public QQuickStyleAttached public: enum Theme { Light, - Dark + Dark, + System }; enum Color { @@ -206,20 +200,12 @@ public: QColor iconColor() const; QColor iconDisabledColor() const; QColor buttonColor() const; - QColor buttonHoverColor() const; - QColor buttonPressColor() const; QColor buttonDisabledColor() const; QColor highlightedButtonColor() const; - QColor highlightedButtonHoverColor() const; - QColor highlightedButtonPressColor() const; QColor highlightedButtonDisabledColor() const; - QColor swipeDelegateColor() const; - QColor swipeDelegateHoverColor() const; - QColor swipeDelegatePressColor() const; - QColor swipeDelegateDisabledColor() const; QColor frameColor() const; - QColor checkBoxUncheckedRippleColor() const; - QColor checkBoxCheckedRippleColor() const; + QColor rippleColor() const; + QColor highlightedRippleColor() const; QColor switchUncheckedTrackColor() const; QColor switchCheckedTrackColor() const; QColor switchUncheckedHandleColor() const; @@ -227,6 +213,7 @@ public: QColor switchDisabledTrackColor() const; QColor switchDisabledHandleColor() const; QColor scrollBarColor() const; + QColor scrollBarHoveredColor() const; QColor scrollBarPressedColor() const; QColor dialogColor() const; QColor backgroundDimColor() const; @@ -258,7 +245,7 @@ private: QColor backgroundColor(Shade shade) const; QColor accentColor(Shade shade) const; - QColor buttonColor(bool highlighted, bool pressed, bool hover) const; + QColor buttonColor(bool highlighted) const; Shade themeShade() const; // These reflect whether a color value was explicitly set on the specific diff --git a/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp b/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp index ac11e95b..27d2c5a6 100644 --- a/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp +++ b/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp @@ -40,9 +40,11 @@ #include "qquickmaterialtheme_p.h" #include "qquickmaterialprogressring_p.h" #include "qquickmaterialprogressstrip_p.h" +#include "qquickmaterialripple_p.h" #include <QtQuickControls2/private/qquickstyleselector_p.h> #include <QtQuickControls2/private/qquickpaddedrectangle_p.h> +#include <QtQuickControls2/private/qquickcolorimageprovider_p.h> static inline void initResources() { @@ -77,22 +79,27 @@ QtQuickControls2MaterialStylePlugin::QtQuickControls2MaterialStylePlugin(QObject void QtQuickControls2MaterialStylePlugin::registerTypes(const char *uri) { qmlRegisterUncreatableType<QQuickMaterialStyle>(uri, 2, 0, "Material", tr("Material is an attached property")); + qmlRegisterRevision<QQuickMaterialStyle, 1>(uri, 2, 1); } void QtQuickControls2MaterialStylePlugin::initializeEngine(QQmlEngine *engine, const char *uri) { QQuickStylePlugin::initializeEngine(engine, uri); + engine->addImageProvider(name(), new QQuickColorImageProvider(QStringLiteral(":/qt-project.org/imports/QtQuick/Controls.2/Material/images"))); + QByteArray import = QByteArray(uri) + ".impl"; qmlRegisterType<QQuickPaddedRectangle>(import, 2, 0, "PaddedRectangle"); + qmlRegisterRevision<QQuickPaddedRectangle, 1>(import, 2, 1); qmlRegisterType<QQuickMaterialProgressRing>(import, 2, 0, "ProgressRing"); qmlRegisterType<QQuickMaterialProgressStrip>(import, 2, 0, "ProgressStrip"); qmlRegisterType<QQuickMaterialRingAnimator>(import, 2, 0, "RingAnimator"); + qmlRegisterType<QQuickMaterialRipple>(import, 2, 0, "Ripple"); qmlRegisterType<QQuickMaterialStripAnimator>(import, 2, 0, "StripAnimator"); qmlRegisterType(typeUrl(QStringLiteral("BoxShadow.qml")), import, 2, 0, "BoxShadow"); qmlRegisterType(typeUrl(QStringLiteral("CheckIndicator.qml")), import, 2, 0, "CheckIndicator"); qmlRegisterType(typeUrl(QStringLiteral("ElevationEffect.qml")), import, 2, 0, "ElevationEffect"); - qmlRegisterType(typeUrl(QStringLiteral("Ripple.qml")), import, 2, 0, "Ripple"); + qmlRegisterType(typeUrl(QStringLiteral("RectangularGlow.qml")), import, 2, 0, "RectangularGlow"); qmlRegisterType(typeUrl(QStringLiteral("SliderHandle.qml")), import, 2, 0, "SliderHandle"); qmlRegisterType(typeUrl(QStringLiteral("SwitchIndicator.qml")), import, 2, 0, "SwitchIndicator"); } diff --git a/src/imports/controls/material/qtquickcontrols2materialstyleplugin.qrc b/src/imports/controls/material/qtquickcontrols2materialstyleplugin.qrc index 47257ce4..e2cc90fa 100644 --- a/src/imports/controls/material/qtquickcontrols2materialstyleplugin.qrc +++ b/src/imports/controls/material/qtquickcontrols2materialstyleplugin.qrc @@ -8,5 +8,8 @@ <file>images/drop-indicator@2x.png</file> <file>images/drop-indicator@3x.png</file> <file>images/drop-indicator@4x.png</file> + <file>shaders/RectangularGlow.frag</file> + <file>shaders/+glslcore/RectangularGlow.frag</file> + <file>shaders/+hlsl/RectangularGlow.frag</file> </qresource> </RCC> diff --git a/src/imports/controls/material/shaders/+glslcore/RectangularGlow.frag b/src/imports/controls/material/shaders/+glslcore/RectangularGlow.frag new file mode 100644 index 00000000..432d86b5 --- /dev/null +++ b/src/imports/controls/material/shaders/+glslcore/RectangularGlow.frag @@ -0,0 +1,25 @@ +#version 150 + +uniform float qt_Opacity; +uniform float relativeSizeX; +uniform float relativeSizeY; +uniform float spread; +uniform vec4 color; + +in vec2 qt_TexCoord0; +out vec4 fragColor; + +float linearstep(float e0, float e1, float x) +{ + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); +} + +void main() +{ + float alpha = + smoothstep(0.0, relativeSizeX, 0.5 - abs(0.5 - qt_TexCoord0.x)) * + smoothstep(0.0, relativeSizeY, 0.5 - abs(0.5 - qt_TexCoord0.y)); + + float spreadMultiplier = linearstep(spread, 1.0 - spread, alpha); + fragColor = color * qt_Opacity * spreadMultiplier * spreadMultiplier; +} diff --git a/src/imports/controls/material/shaders/+hlsl/RectangularGlow.frag b/src/imports/controls/material/shaders/+hlsl/RectangularGlow.frag new file mode 100644 index 00000000..69d9f852 --- /dev/null +++ b/src/imports/controls/material/shaders/+hlsl/RectangularGlow.frag @@ -0,0 +1,21 @@ +cbuffer ConstantBuffer : register(b0) +{ + float4x4 qt_Matrix; + float qt_Opacity; + float relativeSizeX; + float relativeSizeY; + float spread; + float4 color; +} + +float linearstep(float e0, float e1, float x) { return clamp((x - e0) / (e1 - e0), 0.0, 1.0); } + +float4 main(float4 position : SV_POSITION, float2 coord : TEXCOORD0) : SV_TARGET +{ + float alpha = + smoothstep(0.0, relativeSizeX, 0.5 - abs(0.5 - coord.x)) * + smoothstep(0.0, relativeSizeY, 0.5 - abs(0.5 - coord.y)); + + float spreadMultiplier = linearstep(spread, 1.0 - spread, alpha); + return color * qt_Opacity * spreadMultiplier * spreadMultiplier; +} diff --git a/src/imports/controls/material/shaders/RectangularGlow.frag b/src/imports/controls/material/shaders/RectangularGlow.frag new file mode 100644 index 00000000..40bab580 --- /dev/null +++ b/src/imports/controls/material/shaders/RectangularGlow.frag @@ -0,0 +1,19 @@ +uniform highp float qt_Opacity; +uniform mediump float relativeSizeX; +uniform mediump float relativeSizeY; +uniform mediump float spread; +uniform lowp vec4 color; +varying highp vec2 qt_TexCoord0; + +highp float linearstep(highp float e0, highp float e1, highp float x) { + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); +} + +void main() { + lowp float alpha = + smoothstep(0.0, relativeSizeX, 0.5 - abs(0.5 - qt_TexCoord0.x)) * + smoothstep(0.0, relativeSizeY, 0.5 - abs(0.5 - qt_TexCoord0.y)); + + highp float spreadMultiplier = linearstep(spread, 1.0 - spread, alpha); + gl_FragColor = color * qt_Opacity * spreadMultiplier * spreadMultiplier; +} diff --git a/src/imports/controls/plugins.qmltypes b/src/imports/controls/plugins.qmltypes index e661056c..de4e26f8 100644 --- a/src/imports/controls/plugins.qmltypes +++ b/src/imports/controls/plugins.qmltypes @@ -4,82 +4,14 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable QtQuick.Controls 2.0 -merge ..\templates\plugins.qmltypes -dependencies dep.json' +// 'qmlplugindump -nonrelocatable QtQuick.Controls 2.1 -merge ../templates/plugins.qmltypes -dependencies dependencies.json' Module { - dependencies: ["QtQuick.Templates 2.0", "QtQuick.Window 2.2", "QtQuick 2.7"] - Component { - name: "QQuickAbstractAnimation" - prototype: "QObject" - Enum { - name: "Loops" - values: { - "Infinite": -2 - } - } - Property { name: "running"; type: "bool" } - Property { name: "paused"; type: "bool" } - Property { name: "alwaysRunToEnd"; type: "bool" } - Property { name: "loops"; type: "int" } - Signal { name: "started" } - Signal { name: "stopped" } - Signal { - name: "runningChanged" - Parameter { type: "bool" } - } - Signal { - name: "pausedChanged" - Parameter { type: "bool" } - } - Signal { - name: "alwaysRunToEndChanged" - Parameter { type: "bool" } - } - Signal { - name: "loopCountChanged" - Parameter { type: "int" } - } - Method { name: "restart" } - Method { name: "start" } - Method { name: "pause" } - Method { name: "resume" } - Method { name: "stop" } - Method { name: "complete" } - } - Component { - name: "QQuickAnimator" - prototype: "QQuickAbstractAnimation" - exports: [ - "QtQuick.Controls.impl/BusyRingAnimator 2.0", - "QtQuick.Controls.impl/ProgressStripAnimator 2.0" - ] - exportMetaObjectRevisions: [0, 0] - Property { name: "target"; type: "QQuickItem"; isPointer: true } - Property { name: "easing"; type: "QEasingCurve" } - Property { name: "duration"; type: "int" } - Property { name: "to"; type: "double" } - Property { name: "from"; type: "double" } - Signal { - name: "targetItemChanged" - Parameter { type: "QQuickItem"; isPointer: true } - } - Signal { - name: "durationChanged" - Parameter { name: "duration"; type: "int" } - } - Signal { - name: "easingChanged" - Parameter { name: "curve"; type: "QEasingCurve" } - } - Signal { - name: "toChanged" - Parameter { name: "to"; type: "double" } - } - Signal { - name: "fromChanged" - Parameter { name: "from"; type: "double" } - } - } + dependencies: [ + "QtQuick 2.8", + "QtQuick.Templates 2.1", + "QtQuick.Window 2.2" + ] Component { name: "QQuickBusyIndicatorRing" defaultProperty: "data" @@ -88,26 +20,51 @@ Module { exportMetaObjectRevisions: [0] } Component { - name: "QQuickButtonGroup" + name: "QQuickDefaultStyle" prototype: "QObject" - exports: ["QtQuick.Controls/ButtonGroup 2.0"] - exportMetaObjectRevisions: [0] - attachedType: "QQuickButtonGroupAttached" - Property { name: "checkedButton"; type: "QQuickAbstractButton"; isPointer: true } - Property { name: "buttons"; type: "QQuickAbstractButton"; isList: true; isReadonly: true } - Method { - name: "addButton" - Parameter { name: "button"; type: "QQuickAbstractButton"; isPointer: true } - } - Method { - name: "removeButton" - Parameter { name: "button"; type: "QQuickAbstractButton"; isPointer: true } - } - } - Component { - name: "QQuickButtonGroupAttached" - prototype: "QObject" - Property { name: "group"; type: "QQuickButtonGroup"; isPointer: true } + exports: ["QtQuick.Controls.impl/Default 2.1"] + isCreatable: false + isSingleton: true + exportMetaObjectRevisions: [0] + Property { name: "backgroundColor"; type: "QColor"; isReadonly: true } + Property { name: "overlayModalColor"; type: "QColor"; isReadonly: true } + Property { name: "overlayDimColor"; type: "QColor"; isReadonly: true } + Property { name: "textColor"; type: "QColor"; isReadonly: true } + Property { name: "textDarkColor"; type: "QColor"; isReadonly: true } + Property { name: "textLightColor"; type: "QColor"; isReadonly: true } + Property { name: "textLinkColor"; type: "QColor"; isReadonly: true } + Property { name: "textSelectionColor"; type: "QColor"; isReadonly: true } + Property { name: "textDisabledColor"; type: "QColor"; isReadonly: true } + Property { name: "textDisabledLightColor"; type: "QColor"; isReadonly: true } + Property { name: "focusColor"; type: "QColor"; isReadonly: true } + Property { name: "focusLightColor"; type: "QColor"; isReadonly: true } + Property { name: "focusPressedColor"; type: "QColor"; isReadonly: true } + Property { name: "buttonColor"; type: "QColor"; isReadonly: true } + Property { name: "buttonPressedColor"; type: "QColor"; isReadonly: true } + Property { name: "buttonCheckedColor"; type: "QColor"; isReadonly: true } + Property { name: "buttonCheckedPressedColor"; type: "QColor"; isReadonly: true } + Property { name: "buttonCheckedFocusColor"; type: "QColor"; isReadonly: true } + Property { name: "toolButtonColor"; type: "QColor"; isReadonly: true } + Property { name: "tabButtonColor"; type: "QColor"; isReadonly: true } + Property { name: "tabButtonPressedColor"; type: "QColor"; isReadonly: true } + Property { name: "tabButtonCheckedPressedColor"; type: "QColor"; isReadonly: true } + Property { name: "delegateColor"; type: "QColor"; isReadonly: true } + Property { name: "delegatePressedColor"; type: "QColor"; isReadonly: true } + Property { name: "delegateFocusColor"; type: "QColor"; isReadonly: true } + Property { name: "indicatorPressedColor"; type: "QColor"; isReadonly: true } + Property { name: "indicatorDisabledColor"; type: "QColor"; isReadonly: true } + Property { name: "indicatorFrameColor"; type: "QColor"; isReadonly: true } + Property { name: "indicatorFramePressedColor"; type: "QColor"; isReadonly: true } + Property { name: "indicatorFrameDisabledColor"; type: "QColor"; isReadonly: true } + Property { name: "frameDarkColor"; type: "QColor"; isReadonly: true } + Property { name: "frameLightColor"; type: "QColor"; isReadonly: true } + Property { name: "scrollBarColor"; type: "QColor"; isReadonly: true } + Property { name: "scrollBarPressedColor"; type: "QColor"; isReadonly: true } + Property { name: "progressBarColor"; type: "QColor"; isReadonly: true } + Property { name: "pageIndicatorColor"; type: "QColor"; isReadonly: true } + Property { name: "separatorColor"; type: "QColor"; isReadonly: true } + Property { name: "disabledDarkColor"; type: "QColor"; isReadonly: true } + Property { name: "disabledLightColor"; type: "QColor"; isReadonly: true } } Component { name: "QQuickDialRing" @@ -119,24 +76,6 @@ Module { Property { name: "color"; type: "QColor" } } Component { - name: "QQuickPaintedItem" - defaultProperty: "data" - prototype: "QQuickItem" - Enum { - name: "RenderTarget" - values: { - "Image": 0, - "FramebufferObject": 1, - "InvertedYFramebufferObject": 2 - } - } - Property { name: "contentsSize"; type: "QSize" } - Property { name: "fillColor"; type: "QColor" } - Property { name: "contentsScale"; type: "double" } - Property { name: "renderTarget"; type: "RenderTarget" } - Property { name: "textureSize"; type: "QSize" } - } - Component { name: "QQuickProgressStrip" defaultProperty: "data" prototype: "QQuickItem" @@ -146,6 +85,24 @@ Module { Property { name: "progress"; type: "double" } } Component { + name: "QQuickTumblerView" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick.Controls.impl/TumblerView 2.1"] + exportMetaObjectRevisions: [0] + Property { name: "model"; type: "QVariant" } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "path"; type: "QQuickPath"; isPointer: true } + } + Component { + prototype: "QQuickAbstractButton" + name: "QtQuick.Controls/AbstractButton 2.0" + exports: ["QtQuick.Controls/AbstractButton 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { prototype: "QQuickApplicationWindow" name: "QtQuick.Controls/ApplicationWindow 2.0" exports: ["QtQuick.Controls/ApplicationWindow 2.0"] @@ -186,17 +143,13 @@ Module { defaultProperty: "data" } Component { - prototype: "QQuickItem" + prototype: "QQuickRectangle" name: "QtQuick.Controls.impl/CheckIndicator 2.0" exports: ["QtQuick.Controls.impl/CheckIndicator 2.0"] exportMetaObjectRevisions: [0] isComposite: true defaultProperty: "data" Property { name: "control"; type: "QQuickItem"; isPointer: true } - Property { name: "color"; type: "QColor" } - Property { name: "gradient"; type: "QQuickGradient"; isPointer: true } - Property { name: "border"; type: "QQuickPen"; isReadonly: true; isPointer: true } - Property { name: "radius"; type: "double" } } Component { prototype: "QQuickComboBox" @@ -207,6 +160,22 @@ Module { defaultProperty: "data" } Component { + prototype: "QQuickContainer" + name: "QtQuick.Controls/Container 2.0" + exports: ["QtQuick.Controls/Container 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "contentData" + } + Component { + prototype: "QQuickControl" + name: "QtQuick.Controls/Control 2.0" + exports: ["QtQuick.Controls/Control 2.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + } + Component { prototype: "QQuickDial" name: "QtQuick.Controls/Dial 2.0" exports: ["QtQuick.Controls/Dial 2.0"] @@ -215,6 +184,22 @@ Module { defaultProperty: "data" } Component { + prototype: "QQuickDialog" + name: "QtQuick.Controls/Dialog 2.1" + exports: ["QtQuick.Controls/Dialog 2.1"] + exportMetaObjectRevisions: [1] + isComposite: true + defaultProperty: "contentData" + } + Component { + prototype: "QQuickDialogButtonBox" + name: "QtQuick.Controls/DialogButtonBox 2.1" + exports: ["QtQuick.Controls/DialogButtonBox 2.1"] + exportMetaObjectRevisions: [1] + isComposite: true + defaultProperty: "contentData" + } + Component { prototype: "QQuickDrawer" name: "QtQuick.Controls/Drawer 2.0" exports: ["QtQuick.Controls/Drawer 2.0"] @@ -271,6 +256,14 @@ Module { defaultProperty: "data" } Component { + prototype: "QQuickMenuSeparator" + name: "QtQuick.Controls/MenuSeparator 2.1" + exports: ["QtQuick.Controls/MenuSeparator 2.1"] + exportMetaObjectRevisions: [1] + isComposite: true + defaultProperty: "data" + } + Component { prototype: "QQuickPage" name: "QtQuick.Controls/Page 2.0" exports: ["QtQuick.Controls/Page 2.0"] @@ -327,17 +320,13 @@ Module { defaultProperty: "data" } Component { - prototype: "QQuickItem" + prototype: "QQuickRectangle" name: "QtQuick.Controls.impl/RadioIndicator 2.0" exports: ["QtQuick.Controls.impl/RadioIndicator 2.0"] exportMetaObjectRevisions: [0] isComposite: true defaultProperty: "data" Property { name: "control"; type: "QQuickItem"; isPointer: true } - Property { name: "color"; type: "QColor" } - Property { name: "gradient"; type: "QQuickGradient"; isPointer: true } - Property { name: "border"; type: "QQuickPen"; isReadonly: true; isPointer: true } - Property { name: "radius"; type: "double" } } Component { prototype: "QQuickRangeSlider" @@ -348,6 +337,14 @@ Module { defaultProperty: "data" } Component { + prototype: "QQuickRoundButton" + name: "QtQuick.Controls/RoundButton 2.1" + exports: ["QtQuick.Controls/RoundButton 2.1"] + exportMetaObjectRevisions: [1] + isComposite: true + defaultProperty: "data" + } + Component { prototype: "QQuickScrollBar" name: "QtQuick.Controls/ScrollBar 2.0" exports: ["QtQuick.Controls/ScrollBar 2.0"] @@ -477,6 +474,14 @@ Module { defaultProperty: "data" } Component { + prototype: "QQuickToolSeparator" + name: "QtQuick.Controls/ToolSeparator 2.1" + exports: ["QtQuick.Controls/ToolSeparator 2.1"] + exportMetaObjectRevisions: [1] + isComposite: true + defaultProperty: "data" + } + Component { prototype: "QQuickToolTip" name: "QtQuick.Controls/ToolTip 2.0" exports: ["QtQuick.Controls/ToolTip 2.0"] @@ -492,6 +497,7 @@ Module { isComposite: true defaultProperty: "data" } + Component { name: "QQuickAbstractButton" defaultProperty: "data" @@ -502,6 +508,7 @@ Module { Property { name: "down"; type: "bool" } Property { name: "pressed"; type: "bool"; isReadonly: true } Property { name: "checked"; type: "bool" } + Property { name: "checkable"; type: "bool" } Property { name: "autoExclusive"; type: "bool" } Property { name: "indicator"; type: "QQuickItem"; isPointer: true } Signal { name: "pressed" } @@ -553,12 +560,41 @@ Module { prototype: "QQuickAbstractButton" exports: ["QtQuick.Templates/Button 2.0"] exportMetaObjectRevisions: [0] - Property { name: "checkable"; type: "bool" } Property { name: "autoRepeat"; type: "bool" } Property { name: "highlighted"; type: "bool" } Property { name: "flat"; type: "bool" } } Component { + name: "QQuickButtonGroup" + prototype: "QObject" + exports: [ + "QtQuick.Templates/ButtonGroup 2.0", + "QtQuick.Templates/ButtonGroup 2.1" + ] + exportMetaObjectRevisions: [0, 1] + attachedType: "QQuickButtonGroupAttached" + Property { name: "checkedButton"; type: "QQuickAbstractButton"; isPointer: true } + Property { name: "buttons"; type: "QQuickAbstractButton"; isList: true; isReadonly: true } + Signal { + name: "clicked" + revision: 1 + Parameter { name: "button"; type: "QQuickAbstractButton"; isPointer: true } + } + Method { + name: "addButton" + Parameter { name: "button"; type: "QQuickAbstractButton"; isPointer: true } + } + Method { + name: "removeButton" + Parameter { name: "button"; type: "QQuickAbstractButton"; isPointer: true } + } + } + Component { + name: "QQuickButtonGroupAttached" + prototype: "QObject" + Property { name: "group"; type: "QQuickButtonGroup"; isPointer: true } + } + Component { name: "QQuickCheckBox" defaultProperty: "data" prototype: "QQuickAbstractButton" @@ -580,11 +616,15 @@ Module { name: "QQuickComboBox" defaultProperty: "data" prototype: "QQuickControl" - exports: ["QtQuick.Templates/ComboBox 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Templates/ComboBox 2.0", + "QtQuick.Templates/ComboBox 2.1" + ] + exportMetaObjectRevisions: [0, 1] Property { name: "count"; type: "int"; isReadonly: true } Property { name: "model"; type: "QVariant" } Property { name: "delegateModel"; type: "QQmlInstanceModel"; isReadonly: true; isPointer: true } + Property { name: "flat"; revision: 1; type: "bool" } Property { name: "pressed"; type: "bool" } Property { name: "highlightedIndex"; type: "int"; isReadonly: true } Property { name: "currentIndex"; type: "int" } @@ -594,6 +634,7 @@ Module { Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } Property { name: "indicator"; type: "QQuickItem"; isPointer: true } Property { name: "popup"; type: "QQuickPopup"; isPointer: true } + Signal { name: "flatChanged"; revision: 1 } Signal { name: "activated" Parameter { name: "index"; type: "int" } @@ -625,8 +666,11 @@ Module { name: "QQuickContainer" defaultProperty: "contentData" prototype: "QQuickControl" - exports: ["QtQuick.Templates/Container 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Templates/Container 2.0", + "QtQuick.Templates/Container 2.1" + ] + exportMetaObjectRevisions: [0, 1] Property { name: "count"; type: "int"; isReadonly: true } Property { name: "contentModel"; type: "QVariant"; isReadonly: true } Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true } @@ -637,6 +681,8 @@ Module { name: "setCurrentIndex" Parameter { name: "index"; type: "int" } } + Method { name: "incrementCurrentIndex"; revision: 1 } + Method { name: "decrementCurrentIndex"; revision: 1 } Method { name: "itemAt" type: "QQuickItem*" @@ -715,6 +761,58 @@ Module { Method { name: "decrease" } } Component { + name: "QQuickDialog" + defaultProperty: "contentData" + prototype: "QQuickPopup" + exports: ["QtQuick.Templates/Dialog 2.1"] + exportMetaObjectRevisions: [0] + Property { name: "title"; type: "string" } + Property { name: "header"; type: "QQuickItem"; isPointer: true } + Property { name: "footer"; type: "QQuickItem"; isPointer: true } + Property { name: "standardButtons"; type: "QPlatformDialogHelper::StandardButtons" } + Signal { name: "accepted" } + Signal { name: "rejected" } + Method { name: "accept" } + Method { name: "reject" } + } + Component { + name: "QQuickDialogButtonBox" + defaultProperty: "contentData" + prototype: "QQuickContainer" + exports: ["QtQuick.Templates/DialogButtonBox 2.1"] + exportMetaObjectRevisions: [0] + attachedType: "QQuickDialogButtonBoxAttached" + Enum { + name: "Position" + values: { + "Header": 0, + "Footer": 1 + } + } + Property { name: "position"; type: "Position" } + Property { name: "alignment"; type: "Qt::Alignment" } + Property { name: "standardButtons"; type: "QPlatformDialogHelper::StandardButtons" } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + Signal { name: "accepted" } + Signal { name: "rejected" } + Signal { name: "helpRequested" } + Signal { + name: "clicked" + Parameter { name: "button"; type: "QQuickAbstractButton"; isPointer: true } + } + Method { + name: "standardButton" + type: "QQuickAbstractButton*" + Parameter { name: "button"; type: "QPlatformDialogHelper::StandardButton" } + } + } + Component { + name: "QQuickDialogButtonBoxAttached" + prototype: "QObject" + Property { name: "buttonBox"; type: "QQuickDialogButtonBox"; isReadonly: true; isPointer: true } + Property { name: "buttonRole"; type: "QPlatformDialogHelper::ButtonRole" } + } + Component { name: "QQuickDrawer" defaultProperty: "contentData" prototype: "QQuickPopup" @@ -741,15 +839,6 @@ Module { Property { name: "label"; type: "QQuickItem"; isPointer: true } } Component { - name: "QQuickImplicitSizeItem" - defaultProperty: "data" - prototype: "QQuickItem" - Property { name: "implicitWidth"; type: "double"; isReadonly: true } - Property { name: "implicitHeight"; type: "double"; isReadonly: true } - Signal { name: "implicitWidthChanged2"; revision: 1 } - Signal { name: "implicitHeightChanged2"; revision: 1 } - } - Component { name: "QQuickItemDelegate" defaultProperty: "data" prototype: "QQuickAbstractButton" @@ -805,16 +894,22 @@ Module { prototype: "QQuickAbstractButton" exports: ["QtQuick.Templates/MenuItem 2.0"] exportMetaObjectRevisions: [0] - Property { name: "checkable"; type: "bool" } Property { name: "highlighted"; type: "bool" } Signal { name: "triggered" } } Component { + name: "QQuickMenuSeparator" + defaultProperty: "data" + prototype: "QQuickControl" + exports: ["QtQuick.Templates/MenuSeparator 2.1"] + exportMetaObjectRevisions: [0] + } + Component { name: "QQuickOverlay" defaultProperty: "data" prototype: "QQuickItem" - Property { name: "modal"; type: "QQuickItem"; isPointer: true } - Property { name: "modeless"; type: "QQuickItem"; isPointer: true } + Property { name: "modal"; type: "QQmlComponent"; isPointer: true } + Property { name: "modeless"; type: "QQmlComponent"; isPointer: true } Signal { name: "pressed" } Signal { name: "released" } } @@ -822,13 +917,17 @@ Module { name: "QQuickPage" defaultProperty: "contentData" prototype: "QQuickControl" - exports: ["QtQuick.Templates/Page 2.0"] - exportMetaObjectRevisions: [0] + exports: ["QtQuick.Templates/Page 2.0", "QtQuick.Templates/Page 2.1"] + exportMetaObjectRevisions: [0, 1] Property { name: "title"; type: "string" } Property { name: "header"; type: "QQuickItem"; isPointer: true } Property { name: "footer"; type: "QQuickItem"; isPointer: true } + Property { name: "contentWidth"; revision: 1; type: "double" } + Property { name: "contentHeight"; revision: 1; type: "double" } Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true } Property { name: "contentChildren"; type: "QQuickItem"; isList: true; isReadonly: true } + Signal { name: "contentWidthChanged"; revision: 1 } + Signal { name: "contentHeightChanged"; revision: 1 } } Component { name: "QQuickPageIndicator" @@ -856,8 +955,11 @@ Module { name: "QQuickPopup" defaultProperty: "contentData" prototype: "QObject" - exports: ["QtQuick.Templates/Popup 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Templates/Popup 2.0", + "QtQuick.Templates/Popup 2.1" + ] + exportMetaObjectRevisions: [0, 1] Enum { name: "ClosePolicy" values: { @@ -894,6 +996,7 @@ Module { Property { name: "contentHeight"; type: "double" } Property { name: "availableWidth"; type: "double"; isReadonly: true } Property { name: "availableHeight"; type: "double"; isReadonly: true } + Property { name: "spacing"; revision: 1; type: "double" } Property { name: "margins"; type: "double" } Property { name: "topMargin"; type: "double" } Property { name: "leftMargin"; type: "double" } @@ -923,6 +1026,7 @@ Module { Property { name: "transformOrigin"; type: "TransformOrigin" } Property { name: "enter"; type: "QQuickTransition"; isPointer: true } Property { name: "exit"; type: "QQuickTransition"; isPointer: true } + Signal { name: "spacingChanged"; revision: 1 } Signal { name: "windowChanged" Parameter { name: "window"; type: "QQuickWindow"; isPointer: true } @@ -933,6 +1037,11 @@ Module { Signal { name: "closed" } Method { name: "open" } Method { name: "close" } + Method { + name: "forceActiveFocus" + Parameter { name: "reason"; type: "Qt::FocusReason" } + } + Method { name: "forceActiveFocus" } } Component { name: "QQuickProgressBar" @@ -965,8 +1074,11 @@ Module { name: "QQuickRangeSlider" defaultProperty: "data" prototype: "QQuickControl" - exports: ["QtQuick.Templates/RangeSlider 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Templates/RangeSlider 2.0", + "QtQuick.Templates/RangeSlider 2.1" + ] + exportMetaObjectRevisions: [0, 1] Enum { name: "SnapMode" values: { @@ -996,21 +1108,18 @@ Module { Property { name: "visualPosition"; type: "double"; isReadonly: true } Property { name: "handle"; type: "QQuickItem"; isPointer: true } Property { name: "pressed"; type: "bool" } + Property { name: "hovered"; revision: 1; type: "bool" } + Signal { name: "hoveredChanged"; revision: 1 } Method { name: "increase" } Method { name: "decrease" } } Component { - name: "QQuickRootItem" + name: "QQuickRoundButton" defaultProperty: "data" - prototype: "QQuickItem" - Method { - name: "setWidth" - Parameter { name: "w"; type: "int" } - } - Method { - name: "setHeight" - Parameter { name: "h"; type: "int" } - } + prototype: "QQuickButton" + exports: ["QtQuick.Templates/RoundButton 2.1"] + exportMetaObjectRevisions: [1] + Property { name: "radius"; type: "double" } } Component { name: "QQuickScrollBar" @@ -1072,8 +1181,11 @@ Module { name: "QQuickSlider" defaultProperty: "data" prototype: "QQuickControl" - exports: ["QtQuick.Templates/Slider 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Templates/Slider 2.0", + "QtQuick.Templates/Slider 2.1" + ] + exportMetaObjectRevisions: [0, 1] Enum { name: "SnapMode" values: { @@ -1094,13 +1206,22 @@ Module { Property { name: "handle"; type: "QQuickItem"; isPointer: true } Method { name: "increase" } Method { name: "decrease" } + Method { + name: "valueAt" + revision: 1 + type: "double" + Parameter { name: "position"; type: "double" } + } } Component { name: "QQuickSpinBox" defaultProperty: "data" prototype: "QQuickControl" - exports: ["QtQuick.Templates/SpinBox 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Templates/SpinBox 2.0", + "QtQuick.Templates/SpinBox 2.1" + ] + exportMetaObjectRevisions: [0, 1] Property { name: "from"; type: "int" } Property { name: "to"; type: "int" } Property { name: "value"; type: "int" } @@ -1118,7 +1239,9 @@ Module { name: "QQuickSpinButton" prototype: "QObject" Property { name: "pressed"; type: "bool" } + Property { name: "hovered"; revision: 1; type: "bool" } Property { name: "indicator"; type: "QQuickItem"; isPointer: true } + Signal { name: "hoveredChanged"; revision: 1 } } Component { name: "QQuickStackAttached" @@ -1126,13 +1249,21 @@ Module { Property { name: "index"; type: "int"; isReadonly: true } Property { name: "view"; type: "QQuickStackView"; isReadonly: true; isPointer: true } Property { name: "status"; type: "QQuickStackView::Status"; isReadonly: true } + Signal { name: "activated" } + Signal { name: "activating" } + Signal { name: "deactivated" } + Signal { name: "deactivating" } + Signal { name: "removed" } } Component { name: "QQuickStackView" defaultProperty: "data" prototype: "QQuickControl" - exports: ["QtQuick.Templates/StackView 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Templates/StackView 2.0", + "QtQuick.Templates/StackView 2.1" + ] + exportMetaObjectRevisions: [0, 1] attachedType: "QQuickStackAttached" Enum { name: "Status" @@ -1153,8 +1284,11 @@ Module { Enum { name: "Operation" values: { - "Transition": 0, - "Immediate": 1 + "Transition": -1, + "Immediate": 0, + "PushTransition": 1, + "ReplaceTransition": 2, + "PopTransition": 3 } } Property { name: "busy"; type: "bool"; isReadonly: true } @@ -1214,28 +1348,47 @@ Module { Property { name: "leftItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } Property { name: "behindItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } Property { name: "rightItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Signal { name: "completed"; revision: 1 } + Method { name: "close"; revision: 1 } } Component { name: "QQuickSwipeDelegate" defaultProperty: "data" prototype: "QQuickItemDelegate" - exports: ["QtQuick.Templates/SwipeDelegate 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Templates/SwipeDelegate 2.0", + "QtQuick.Templates/SwipeDelegate 2.1" + ] + exportMetaObjectRevisions: [0, 1] + attachedType: "QQuickSwipeDelegateAttached" Property { name: "swipe"; type: "QQuickSwipe"; isReadonly: true; isPointer: true } } Component { + name: "QQuickSwipeDelegateAttached" + prototype: "QObject" + Property { name: "pressed"; type: "bool"; isReadonly: true } + Signal { name: "clicked" } + } + Component { name: "QQuickSwipeView" defaultProperty: "contentData" prototype: "QQuickContainer" - exports: ["QtQuick.Templates/SwipeView 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Templates/SwipeView 2.0", + "QtQuick.Templates/SwipeView 2.1" + ] + exportMetaObjectRevisions: [0, 1] attachedType: "QQuickSwipeViewAttached" + Property { name: "interactive"; revision: 1; type: "bool" } + Signal { name: "interactiveChanged"; revision: 1 } } Component { name: "QQuickSwipeViewAttached" prototype: "QObject" Property { name: "index"; type: "int"; isReadonly: true } Property { name: "isCurrentItem"; type: "bool"; isReadonly: true } + Property { name: "isNextItem"; revision: 1; type: "bool"; isReadonly: true } + Property { name: "isPreviousItem"; revision: 1; type: "bool"; isReadonly: true } Property { name: "view"; type: "QQuickSwipeView"; isReadonly: true; isPointer: true } } Component { @@ -1279,188 +1432,14 @@ Module { exportMetaObjectRevisions: [0] } Component { - name: "QQuickText" - defaultProperty: "data" - prototype: "QQuickImplicitSizeItem" - Enum { - name: "HAlignment" - values: { - "AlignLeft": 1, - "AlignRight": 2, - "AlignHCenter": 4, - "AlignJustify": 8 - } - } - Enum { - name: "VAlignment" - values: { - "AlignTop": 32, - "AlignBottom": 64, - "AlignVCenter": 128 - } - } - Enum { - name: "TextStyle" - values: { - "Normal": 0, - "Outline": 1, - "Raised": 2, - "Sunken": 3 - } - } - Enum { - name: "TextFormat" - values: { - "PlainText": 0, - "RichText": 1, - "AutoText": 2, - "StyledText": 4 - } - } - Enum { - name: "TextElideMode" - values: { - "ElideLeft": 0, - "ElideRight": 1, - "ElideMiddle": 2, - "ElideNone": 3 - } - } - Enum { - name: "WrapMode" - values: { - "NoWrap": 0, - "WordWrap": 1, - "WrapAnywhere": 3, - "WrapAtWordBoundaryOrAnywhere": 4, - "Wrap": 4 - } - } - Enum { - name: "RenderType" - values: { - "QtRendering": 0, - "NativeRendering": 1 - } - } - Enum { - name: "LineHeightMode" - values: { - "ProportionalHeight": 0, - "FixedHeight": 1 - } - } - Enum { - name: "FontSizeMode" - values: { - "FixedSize": 0, - "HorizontalFit": 1, - "VerticalFit": 2, - "Fit": 3 - } - } - Property { name: "text"; type: "string" } - Property { name: "font"; type: "QFont" } - Property { name: "color"; type: "QColor" } - Property { name: "linkColor"; type: "QColor" } - Property { name: "style"; type: "TextStyle" } - Property { name: "styleColor"; type: "QColor" } - Property { name: "horizontalAlignment"; type: "HAlignment" } - Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true } - Property { name: "verticalAlignment"; type: "VAlignment" } - Property { name: "wrapMode"; type: "WrapMode" } - Property { name: "lineCount"; type: "int"; isReadonly: true } - Property { name: "truncated"; type: "bool"; isReadonly: true } - Property { name: "maximumLineCount"; type: "int" } - Property { name: "textFormat"; type: "TextFormat" } - Property { name: "elide"; type: "TextElideMode" } - Property { name: "contentWidth"; type: "double"; isReadonly: true } - Property { name: "contentHeight"; type: "double"; isReadonly: true } - Property { name: "paintedWidth"; type: "double"; isReadonly: true } - Property { name: "paintedHeight"; type: "double"; isReadonly: true } - Property { name: "lineHeight"; type: "double" } - Property { name: "lineHeightMode"; type: "LineHeightMode" } - Property { name: "baseUrl"; type: "QUrl" } - Property { name: "minimumPixelSize"; type: "int" } - Property { name: "minimumPointSize"; type: "int" } - Property { name: "fontSizeMode"; type: "FontSizeMode" } - Property { name: "renderType"; type: "RenderType" } - Property { name: "hoveredLink"; revision: 2; type: "string"; isReadonly: true } - Property { name: "padding"; revision: 6; type: "double" } - Property { name: "topPadding"; revision: 6; type: "double" } - Property { name: "leftPadding"; revision: 6; type: "double" } - Property { name: "rightPadding"; revision: 6; type: "double" } - Property { name: "bottomPadding"; revision: 6; type: "double" } - Signal { - name: "textChanged" - Parameter { name: "text"; type: "string" } - } - Signal { - name: "linkActivated" - Parameter { name: "link"; type: "string" } - } - Signal { - name: "linkHovered" - revision: 2 - Parameter { name: "link"; type: "string" } - } - Signal { - name: "fontChanged" - Parameter { name: "font"; type: "QFont" } - } - Signal { - name: "styleChanged" - Parameter { name: "style"; type: "QQuickText::TextStyle" } - } - Signal { - name: "horizontalAlignmentChanged" - Parameter { name: "alignment"; type: "QQuickText::HAlignment" } - } - Signal { - name: "verticalAlignmentChanged" - Parameter { name: "alignment"; type: "QQuickText::VAlignment" } - } - Signal { - name: "textFormatChanged" - Parameter { name: "textFormat"; type: "QQuickText::TextFormat" } - } - Signal { - name: "elideModeChanged" - Parameter { name: "mode"; type: "QQuickText::TextElideMode" } - } - Signal { name: "contentSizeChanged" } - Signal { - name: "lineHeightChanged" - Parameter { name: "lineHeight"; type: "double" } - } - Signal { - name: "lineHeightModeChanged" - Parameter { name: "mode"; type: "LineHeightMode" } - } - Signal { - name: "lineLaidOut" - Parameter { name: "line"; type: "QQuickTextLine"; isPointer: true } - } - Signal { name: "paddingChanged"; revision: 6 } - Signal { name: "topPaddingChanged"; revision: 6 } - Signal { name: "leftPaddingChanged"; revision: 6 } - Signal { name: "rightPaddingChanged"; revision: 6 } - Signal { name: "bottomPaddingChanged"; revision: 6 } - Method { name: "doLayout" } - Method { - name: "linkAt" - revision: 3 - type: "string" - Parameter { name: "x"; type: "double" } - Parameter { name: "y"; type: "double" } - } - } - Component { name: "QQuickTextArea" defaultProperty: "data" prototype: "QQuickTextEdit" - exports: ["QtQuick.Templates/TextArea 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Templates/TextArea 2.0", + "QtQuick.Templates/TextArea 2.1" + ] + exportMetaObjectRevisions: [0, 1] attachedType: "QQuickTextAreaAttached" Property { name: "font"; type: "QFont" } Property { name: "implicitWidth"; type: "double" } @@ -1468,539 +1447,72 @@ Module { Property { name: "background"; type: "QQuickItem"; isPointer: true } Property { name: "placeholderText"; type: "string" } Property { name: "focusReason"; type: "Qt::FocusReason" } + Property { name: "hovered"; revision: 1; type: "bool"; isReadonly: true } + Property { name: "hoverEnabled"; revision: 1; type: "bool" } Signal { name: "implicitWidthChanged3" } Signal { name: "implicitHeightChanged3" } + Signal { name: "hoveredChanged"; revision: 1 } + Signal { name: "hoverEnabledChanged"; revision: 1 } Signal { name: "pressAndHold" Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true } } - } - Component { - name: "QQuickTextAreaAttached" - prototype: "QObject" - Property { name: "flickable"; type: "QQuickTextArea"; isPointer: true } - } - Component { - name: "QQuickTextEdit" - defaultProperty: "data" - prototype: "QQuickImplicitSizeItem" - Enum { - name: "HAlignment" - values: { - "AlignLeft": 1, - "AlignRight": 2, - "AlignHCenter": 4, - "AlignJustify": 8 - } - } - Enum { - name: "VAlignment" - values: { - "AlignTop": 32, - "AlignBottom": 64, - "AlignVCenter": 128 - } - } - Enum { - name: "TextFormat" - values: { - "PlainText": 0, - "RichText": 1, - "AutoText": 2 - } - } - Enum { - name: "WrapMode" - values: { - "NoWrap": 0, - "WordWrap": 1, - "WrapAnywhere": 3, - "WrapAtWordBoundaryOrAnywhere": 4, - "Wrap": 4 - } - } - Enum { - name: "SelectionMode" - values: { - "SelectCharacters": 0, - "SelectWords": 1 - } - } - Enum { - name: "RenderType" - values: { - "QtRendering": 0, - "NativeRendering": 1 - } - } - Property { name: "text"; type: "string" } - Property { name: "color"; type: "QColor" } - Property { name: "selectionColor"; type: "QColor" } - Property { name: "selectedTextColor"; type: "QColor" } - Property { name: "font"; type: "QFont" } - Property { name: "horizontalAlignment"; type: "HAlignment" } - Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true } - Property { name: "verticalAlignment"; type: "VAlignment" } - Property { name: "wrapMode"; type: "WrapMode" } - Property { name: "lineCount"; type: "int"; isReadonly: true } - Property { name: "length"; type: "int"; isReadonly: true } - Property { name: "contentWidth"; type: "double"; isReadonly: true } - Property { name: "contentHeight"; type: "double"; isReadonly: true } - Property { name: "paintedWidth"; type: "double"; isReadonly: true } - Property { name: "paintedHeight"; type: "double"; isReadonly: true } - Property { name: "textFormat"; type: "TextFormat" } - Property { name: "readOnly"; type: "bool" } - Property { name: "cursorVisible"; type: "bool" } - Property { name: "cursorPosition"; type: "int" } - Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true } - Property { name: "cursorDelegate"; type: "QQmlComponent"; isPointer: true } - Property { name: "selectionStart"; type: "int"; isReadonly: true } - Property { name: "selectionEnd"; type: "int"; isReadonly: true } - Property { name: "selectedText"; type: "string"; isReadonly: true } - Property { name: "activeFocusOnPress"; type: "bool" } - Property { name: "persistentSelection"; type: "bool" } - Property { name: "textMargin"; type: "double" } - Property { name: "inputMethodHints"; type: "Qt::InputMethodHints" } - Property { name: "selectByKeyboard"; revision: 1; type: "bool" } - Property { name: "selectByMouse"; type: "bool" } - Property { name: "mouseSelectionMode"; type: "SelectionMode" } - Property { name: "canPaste"; type: "bool"; isReadonly: true } - Property { name: "canUndo"; type: "bool"; isReadonly: true } - Property { name: "canRedo"; type: "bool"; isReadonly: true } - Property { name: "inputMethodComposing"; type: "bool"; isReadonly: true } - Property { name: "baseUrl"; type: "QUrl" } - Property { name: "renderType"; type: "RenderType" } - Property { - name: "textDocument" - revision: 1 - type: "QQuickTextDocument" - isReadonly: true - isPointer: true - } - Property { name: "hoveredLink"; revision: 2; type: "string"; isReadonly: true } - Property { name: "padding"; revision: 6; type: "double" } - Property { name: "topPadding"; revision: 6; type: "double" } - Property { name: "leftPadding"; revision: 6; type: "double" } - Property { name: "rightPadding"; revision: 6; type: "double" } - Property { name: "bottomPadding"; revision: 6; type: "double" } - Property { name: "preeditText"; revision: 7; type: "string"; isReadonly: true } - Signal { name: "preeditTextChanged"; revision: 7 } - Signal { name: "contentSizeChanged" } - Signal { - name: "colorChanged" - Parameter { name: "color"; type: "QColor" } - } - Signal { - name: "selectionColorChanged" - Parameter { name: "color"; type: "QColor" } - } - Signal { - name: "selectedTextColorChanged" - Parameter { name: "color"; type: "QColor" } - } Signal { - name: "fontChanged" - Parameter { name: "font"; type: "QFont" } - } - Signal { - name: "horizontalAlignmentChanged" - Parameter { name: "alignment"; type: "QQuickTextEdit::HAlignment" } - } - Signal { - name: "verticalAlignmentChanged" - Parameter { name: "alignment"; type: "QQuickTextEdit::VAlignment" } - } - Signal { - name: "textFormatChanged" - Parameter { name: "textFormat"; type: "QQuickTextEdit::TextFormat" } - } - Signal { - name: "readOnlyChanged" - Parameter { name: "isReadOnly"; type: "bool" } - } - Signal { - name: "cursorVisibleChanged" - Parameter { name: "isCursorVisible"; type: "bool" } - } - Signal { - name: "activeFocusOnPressChanged" - Parameter { name: "activeFocusOnPressed"; type: "bool" } - } - Signal { - name: "persistentSelectionChanged" - Parameter { name: "isPersistentSelection"; type: "bool" } - } - Signal { - name: "textMarginChanged" - Parameter { name: "textMargin"; type: "double" } - } - Signal { - name: "selectByKeyboardChanged" + name: "pressed" revision: 1 - Parameter { name: "selectByKeyboard"; type: "bool" } - } - Signal { - name: "selectByMouseChanged" - Parameter { name: "selectByMouse"; type: "bool" } - } - Signal { - name: "mouseSelectionModeChanged" - Parameter { name: "mode"; type: "QQuickTextEdit::SelectionMode" } - } - Signal { - name: "linkActivated" - Parameter { name: "link"; type: "string" } + Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true } } Signal { - name: "linkHovered" - revision: 2 - Parameter { name: "link"; type: "string" } - } - Signal { name: "editingFinished"; revision: 6 } - Signal { name: "paddingChanged"; revision: 6 } - Signal { name: "topPaddingChanged"; revision: 6 } - Signal { name: "leftPaddingChanged"; revision: 6 } - Signal { name: "rightPaddingChanged"; revision: 6 } - Signal { name: "bottomPaddingChanged"; revision: 6 } - Method { name: "selectAll" } - Method { name: "selectWord" } - Method { - name: "select" - Parameter { name: "start"; type: "int" } - Parameter { name: "end"; type: "int" } - } - Method { name: "deselect" } - Method { - name: "isRightToLeft" - type: "bool" - Parameter { name: "start"; type: "int" } - Parameter { name: "end"; type: "int" } - } - Method { name: "cut" } - Method { name: "copy" } - Method { name: "paste" } - Method { name: "undo" } - Method { name: "redo" } - Method { - name: "insert" - Parameter { name: "position"; type: "int" } - Parameter { name: "text"; type: "string" } - } - Method { - name: "remove" - Parameter { name: "start"; type: "int" } - Parameter { name: "end"; type: "int" } - } - Method { - name: "append" - revision: 2 - Parameter { name: "text"; type: "string" } - } - Method { name: "clear"; revision: 7 } - Method { - name: "inputMethodQuery" - revision: 4 - type: "QVariant" - Parameter { name: "query"; type: "Qt::InputMethodQuery" } - Parameter { name: "argument"; type: "QVariant" } - } - Method { - name: "positionToRectangle" - type: "QRectF" - Parameter { type: "int" } - } - Method { - name: "positionAt" - type: "int" - Parameter { name: "x"; type: "double" } - Parameter { name: "y"; type: "double" } - } - Method { - name: "moveCursorSelection" - Parameter { name: "pos"; type: "int" } - } - Method { - name: "moveCursorSelection" - Parameter { name: "pos"; type: "int" } - Parameter { name: "mode"; type: "SelectionMode" } - } - Method { - name: "getText" - type: "string" - Parameter { name: "start"; type: "int" } - Parameter { name: "end"; type: "int" } - } - Method { - name: "getFormattedText" - type: "string" - Parameter { name: "start"; type: "int" } - Parameter { name: "end"; type: "int" } - } - Method { - name: "linkAt" - revision: 3 - type: "string" - Parameter { name: "x"; type: "double" } - Parameter { name: "y"; type: "double" } + name: "released" + revision: 1 + Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true } } } Component { + name: "QQuickTextAreaAttached" + prototype: "QObject" + Property { name: "flickable"; type: "QQuickTextArea"; isPointer: true } + } + Component { name: "QQuickTextField" defaultProperty: "data" prototype: "QQuickTextInput" - exports: ["QtQuick.Templates/TextField 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Templates/TextField 2.0", + "QtQuick.Templates/TextField 2.1" + ] + exportMetaObjectRevisions: [0, 1] Property { name: "font"; type: "QFont" } Property { name: "implicitWidth"; type: "double" } Property { name: "implicitHeight"; type: "double" } Property { name: "background"; type: "QQuickItem"; isPointer: true } Property { name: "placeholderText"; type: "string" } Property { name: "focusReason"; type: "Qt::FocusReason" } + Property { name: "hovered"; revision: 1; type: "bool"; isReadonly: true } + Property { name: "hoverEnabled"; revision: 1; type: "bool" } Signal { name: "implicitWidthChanged3" } Signal { name: "implicitHeightChanged3" } + Signal { name: "hoveredChanged"; revision: 1 } + Signal { name: "hoverEnabledChanged"; revision: 1 } Signal { name: "pressAndHold" - Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true } - } - } - Component { - name: "QQuickTextInput" - defaultProperty: "data" - prototype: "QQuickImplicitSizeItem" - Enum { - name: "EchoMode" - values: { - "Normal": 0, - "NoEcho": 1, - "Password": 2, - "PasswordEchoOnEdit": 3 - } - } - Enum { - name: "HAlignment" - values: { - "AlignLeft": 1, - "AlignRight": 2, - "AlignHCenter": 4 - } - } - Enum { - name: "VAlignment" - values: { - "AlignTop": 32, - "AlignBottom": 64, - "AlignVCenter": 128 - } - } - Enum { - name: "WrapMode" - values: { - "NoWrap": 0, - "WordWrap": 1, - "WrapAnywhere": 3, - "WrapAtWordBoundaryOrAnywhere": 4, - "Wrap": 4 - } - } - Enum { - name: "SelectionMode" - values: { - "SelectCharacters": 0, - "SelectWords": 1 - } - } - Enum { - name: "CursorPosition" - values: { - "CursorBetweenCharacters": 0, - "CursorOnCharacter": 1 - } - } - Enum { - name: "RenderType" - values: { - "QtRendering": 0, - "NativeRendering": 1 - } - } - Property { name: "text"; type: "string" } - Property { name: "length"; type: "int"; isReadonly: true } - Property { name: "color"; type: "QColor" } - Property { name: "selectionColor"; type: "QColor" } - Property { name: "selectedTextColor"; type: "QColor" } - Property { name: "font"; type: "QFont" } - Property { name: "horizontalAlignment"; type: "HAlignment" } - Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true } - Property { name: "verticalAlignment"; type: "VAlignment" } - Property { name: "wrapMode"; type: "WrapMode" } - Property { name: "readOnly"; type: "bool" } - Property { name: "cursorVisible"; type: "bool" } - Property { name: "cursorPosition"; type: "int" } - Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true } - Property { name: "cursorDelegate"; type: "QQmlComponent"; isPointer: true } - Property { name: "selectionStart"; type: "int"; isReadonly: true } - Property { name: "selectionEnd"; type: "int"; isReadonly: true } - Property { name: "selectedText"; type: "string"; isReadonly: true } - Property { name: "maximumLength"; type: "int" } - Property { name: "validator"; type: "QValidator"; isPointer: true } - Property { name: "inputMask"; type: "string" } - Property { name: "inputMethodHints"; type: "Qt::InputMethodHints" } - Property { name: "acceptableInput"; type: "bool"; isReadonly: true } - Property { name: "echoMode"; type: "EchoMode" } - Property { name: "activeFocusOnPress"; type: "bool" } - Property { name: "passwordCharacter"; type: "string" } - Property { name: "passwordMaskDelay"; revision: 3; type: "int" } - Property { name: "displayText"; type: "string"; isReadonly: true } - Property { name: "preeditText"; revision: 7; type: "string"; isReadonly: true } - Property { name: "autoScroll"; type: "bool" } - Property { name: "selectByMouse"; type: "bool" } - Property { name: "mouseSelectionMode"; type: "SelectionMode" } - Property { name: "persistentSelection"; type: "bool" } - Property { name: "canPaste"; type: "bool"; isReadonly: true } - Property { name: "canUndo"; type: "bool"; isReadonly: true } - Property { name: "canRedo"; type: "bool"; isReadonly: true } - Property { name: "inputMethodComposing"; type: "bool"; isReadonly: true } - Property { name: "contentWidth"; type: "double"; isReadonly: true } - Property { name: "contentHeight"; type: "double"; isReadonly: true } - Property { name: "renderType"; type: "RenderType" } - Property { name: "padding"; revision: 6; type: "double" } - Property { name: "topPadding"; revision: 6; type: "double" } - Property { name: "leftPadding"; revision: 6; type: "double" } - Property { name: "rightPadding"; revision: 6; type: "double" } - Property { name: "bottomPadding"; revision: 6; type: "double" } - Signal { name: "accepted" } - Signal { name: "editingFinished"; revision: 2 } - Signal { - name: "fontChanged" - Parameter { name: "font"; type: "QFont" } - } - Signal { - name: "horizontalAlignmentChanged" - Parameter { name: "alignment"; type: "QQuickTextInput::HAlignment" } - } - Signal { - name: "verticalAlignmentChanged" - Parameter { name: "alignment"; type: "QQuickTextInput::VAlignment" } - } - Signal { - name: "readOnlyChanged" - Parameter { name: "isReadOnly"; type: "bool" } - } - Signal { - name: "cursorVisibleChanged" - Parameter { name: "isCursorVisible"; type: "bool" } - } - Signal { - name: "maximumLengthChanged" - Parameter { name: "maximumLength"; type: "int" } - } - Signal { - name: "inputMaskChanged" - Parameter { name: "inputMask"; type: "string" } - } - Signal { - name: "echoModeChanged" - Parameter { name: "echoMode"; type: "QQuickTextInput::EchoMode" } - } - Signal { - name: "passwordMaskDelayChanged" - revision: 3 - Parameter { name: "delay"; type: "int" } - } - Signal { name: "preeditTextChanged"; revision: 7 } - Signal { - name: "activeFocusOnPressChanged" - Parameter { name: "activeFocusOnPress"; type: "bool" } - } - Signal { - name: "autoScrollChanged" - Parameter { name: "autoScroll"; type: "bool" } + Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true } } Signal { - name: "selectByMouseChanged" - Parameter { name: "selectByMouse"; type: "bool" } + name: "pressed" + revision: 1 + Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true } } Signal { - name: "mouseSelectionModeChanged" - Parameter { name: "mode"; type: "QQuickTextInput::SelectionMode" } - } - Signal { name: "contentSizeChanged" } - Signal { name: "paddingChanged"; revision: 6 } - Signal { name: "topPaddingChanged"; revision: 6 } - Signal { name: "leftPaddingChanged"; revision: 6 } - Signal { name: "rightPaddingChanged"; revision: 6 } - Signal { name: "bottomPaddingChanged"; revision: 6 } - Method { name: "selectAll" } - Method { name: "selectWord" } - Method { - name: "select" - Parameter { name: "start"; type: "int" } - Parameter { name: "end"; type: "int" } - } - Method { name: "deselect" } - Method { - name: "isRightToLeft" - type: "bool" - Parameter { name: "start"; type: "int" } - Parameter { name: "end"; type: "int" } - } - Method { name: "cut" } - Method { name: "copy" } - Method { name: "paste" } - Method { name: "undo" } - Method { name: "redo" } - Method { - name: "insert" - Parameter { name: "position"; type: "int" } - Parameter { name: "text"; type: "string" } - } - Method { - name: "remove" - Parameter { name: "start"; type: "int" } - Parameter { name: "end"; type: "int" } - } - Method { - name: "ensureVisible" - revision: 3 - Parameter { name: "position"; type: "int" } - } - Method { name: "clear"; revision: 7 } - Method { - name: "positionAt" - Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true } - } - Method { - name: "positionToRectangle" - type: "QRectF" - Parameter { name: "pos"; type: "int" } - } - Method { - name: "moveCursorSelection" - Parameter { name: "pos"; type: "int" } - } - Method { - name: "moveCursorSelection" - Parameter { name: "pos"; type: "int" } - Parameter { name: "mode"; type: "SelectionMode" } - } - Method { - name: "inputMethodQuery" - revision: 3 - type: "QVariant" - Parameter { name: "query"; type: "Qt::InputMethodQuery" } - Parameter { name: "argument"; type: "QVariant" } - } - Method { - name: "getText" - type: "string" - Parameter { name: "start"; type: "int" } - Parameter { name: "end"; type: "int" } + name: "released" + revision: 1 + Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true } } } Component { name: "QQuickToolBar" defaultProperty: "contentData" - prototype: "QQuickFrame" + prototype: "QQuickPane" exports: ["QtQuick.Templates/ToolBar 2.0"] exportMetaObjectRevisions: [0] Enum { @@ -2020,6 +1532,16 @@ Module { exportMetaObjectRevisions: [0] } Component { + name: "QQuickToolSeparator" + defaultProperty: "data" + prototype: "QQuickControl" + exports: ["QtQuick.Templates/ToolSeparator 2.1"] + exportMetaObjectRevisions: [0] + Property { name: "orientation"; type: "Qt::Orientation" } + Property { name: "horizontal"; type: "bool"; isReadonly: true } + Property { name: "vertical"; type: "bool"; isReadonly: true } + } + Component { name: "QQuickToolTip" defaultProperty: "contentData" prototype: "QQuickPopup" @@ -2029,8 +1551,6 @@ Module { Property { name: "delay"; type: "int" } Property { name: "timeout"; type: "int" } Property { name: "text"; type: "string" } - Method { name: "open" } - Method { name: "close" } } Component { name: "QQuickToolTipAttached" @@ -2055,8 +1575,11 @@ Module { name: "QQuickTumbler" defaultProperty: "data" prototype: "QQuickControl" - exports: ["QtQuick.Templates/Tumbler 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Templates/Tumbler 2.0", + "QtQuick.Templates/Tumbler 2.1" + ] + exportMetaObjectRevisions: [0, 1] attachedType: "QQuickTumblerAttached" Property { name: "model"; type: "QVariant" } Property { name: "count"; type: "int"; isReadonly: true } @@ -2064,6 +1587,8 @@ Module { Property { name: "currentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } Property { name: "visibleItemCount"; type: "int" } + Property { name: "wrap"; revision: 1; type: "bool" } + Signal { name: "wrapChanged"; revision: 1 } } Component { name: "QQuickTumblerAttached" @@ -2071,240 +1596,4 @@ Module { Property { name: "tumbler"; type: "QQuickTumbler"; isReadonly: true; isPointer: true } Property { name: "displacement"; type: "double"; isReadonly: true } } - - Component { - name: "QQuickWindowQmlImpl" - defaultProperty: "data" - prototype: "QQuickWindow" - exports: ["QtQuick.Window/Window 2.1", "QtQuick.Window/Window 2.2"] - exportMetaObjectRevisions: [0, 1] - attachedType: "QQuickWindowAttached" - Property { name: "visible"; type: "bool" } - Property { name: "visibility"; type: "Visibility" } - Signal { - name: "visibleChanged" - Parameter { name: "arg"; type: "bool" } - } - Signal { - name: "visibilityChanged" - Parameter { name: "visibility"; type: "QWindow::Visibility" } - } - } - - Component { - name: "QQuickWindow" - defaultProperty: "data" - prototype: "QWindow" - exports: ["QtQuick.Window/Window 2.0"] - exportMetaObjectRevisions: [0] - Enum { - name: "SceneGraphError" - values: { - "ContextNotAvailable": 1 - } - } - Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } - Property { name: "color"; type: "QColor" } - Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } - Property { - name: "activeFocusItem" - revision: 1 - type: "QQuickItem" - isReadonly: true - isPointer: true - } - Signal { name: "frameSwapped" } - Signal { - name: "openglContextCreated" - revision: 2 - Parameter { name: "context"; type: "QOpenGLContext"; isPointer: true } - } - Signal { name: "sceneGraphInitialized" } - Signal { name: "sceneGraphInvalidated" } - Signal { name: "beforeSynchronizing" } - Signal { name: "afterSynchronizing"; revision: 2 } - Signal { name: "beforeRendering" } - Signal { name: "afterRendering" } - Signal { name: "afterAnimating"; revision: 2 } - Signal { name: "sceneGraphAboutToStop"; revision: 2 } - Signal { - name: "closing" - revision: 1 - Parameter { name: "close"; type: "QQuickCloseEvent"; isPointer: true } - } - Signal { - name: "colorChanged" - Parameter { type: "QColor" } - } - Signal { name: "activeFocusItemChanged"; revision: 1 } - Signal { - name: "sceneGraphError" - revision: 2 - Parameter { name: "error"; type: "QQuickWindow::SceneGraphError" } - Parameter { name: "message"; type: "string" } - } - Method { name: "update" } - Method { name: "releaseResources" } - } - - Component { - name: "QWindow" - prototype: "QObject" - Enum { - name: "Visibility" - values: { - "Hidden": 0, - "AutomaticVisibility": 1, - "Windowed": 2, - "Minimized": 3, - "Maximized": 4, - "FullScreen": 5 - } - } - Property { name: "title"; type: "string" } - Property { name: "modality"; type: "Qt::WindowModality" } - Property { name: "flags"; type: "Qt::WindowFlags" } - Property { name: "x"; type: "int" } - Property { name: "y"; type: "int" } - Property { name: "width"; type: "int" } - Property { name: "height"; type: "int" } - Property { name: "minimumWidth"; type: "int" } - Property { name: "minimumHeight"; type: "int" } - Property { name: "maximumWidth"; type: "int" } - Property { name: "maximumHeight"; type: "int" } - Property { name: "visible"; type: "bool" } - Property { name: "active"; revision: 1; type: "bool"; isReadonly: true } - Property { name: "visibility"; revision: 1; type: "Visibility" } - Property { name: "contentOrientation"; type: "Qt::ScreenOrientation" } - Property { name: "opacity"; revision: 1; type: "double" } - Signal { - name: "screenChanged" - Parameter { name: "screen"; type: "QScreen"; isPointer: true } - } - Signal { - name: "modalityChanged" - Parameter { name: "modality"; type: "Qt::WindowModality" } - } - Signal { - name: "windowStateChanged" - Parameter { name: "windowState"; type: "Qt::WindowState" } - } - Signal { - name: "windowTitleChanged" - revision: 2 - Parameter { name: "title"; type: "string" } - } - Signal { - name: "xChanged" - Parameter { name: "arg"; type: "int" } - } - Signal { - name: "yChanged" - Parameter { name: "arg"; type: "int" } - } - Signal { - name: "widthChanged" - Parameter { name: "arg"; type: "int" } - } - Signal { - name: "heightChanged" - Parameter { name: "arg"; type: "int" } - } - Signal { - name: "minimumWidthChanged" - Parameter { name: "arg"; type: "int" } - } - Signal { - name: "minimumHeightChanged" - Parameter { name: "arg"; type: "int" } - } - Signal { - name: "maximumWidthChanged" - Parameter { name: "arg"; type: "int" } - } - Signal { - name: "maximumHeightChanged" - Parameter { name: "arg"; type: "int" } - } - Signal { - name: "visibleChanged" - Parameter { name: "arg"; type: "bool" } - } - Signal { - name: "visibilityChanged" - revision: 1 - Parameter { name: "visibility"; type: "QWindow::Visibility" } - } - Signal { name: "activeChanged"; revision: 1 } - Signal { - name: "contentOrientationChanged" - Parameter { name: "orientation"; type: "Qt::ScreenOrientation" } - } - Signal { - name: "focusObjectChanged" - Parameter { name: "object"; type: "QObject"; isPointer: true } - } - Signal { - name: "opacityChanged" - revision: 1 - Parameter { name: "opacity"; type: "double" } - } - Method { name: "requestActivate"; revision: 1 } - Method { - name: "setVisible" - Parameter { name: "visible"; type: "bool" } - } - Method { name: "show" } - Method { name: "hide" } - Method { name: "showMinimized" } - Method { name: "showMaximized" } - Method { name: "showFullScreen" } - Method { name: "showNormal" } - Method { name: "close"; type: "bool" } - Method { name: "raise" } - Method { name: "lower" } - Method { - name: "setTitle" - Parameter { type: "string" } - } - Method { - name: "setX" - Parameter { name: "arg"; type: "int" } - } - Method { - name: "setY" - Parameter { name: "arg"; type: "int" } - } - Method { - name: "setWidth" - Parameter { name: "arg"; type: "int" } - } - Method { - name: "setHeight" - Parameter { name: "arg"; type: "int" } - } - Method { - name: "setMinimumWidth" - Parameter { name: "w"; type: "int" } - } - Method { - name: "setMinimumHeight" - Parameter { name: "h"; type: "int" } - } - Method { - name: "setMaximumWidth" - Parameter { name: "w"; type: "int" } - } - Method { - name: "setMaximumHeight" - Parameter { name: "h"; type: "int" } - } - Method { - name: "alert" - revision: 1 - Parameter { name: "msec"; type: "int" } - } - Method { name: "requestUpdate"; revision: 3 } - } - } diff --git a/src/imports/controls/qquickbusyindicatorring.cpp b/src/imports/controls/qquickbusyindicatorring.cpp index 4f9e9977..d8c035d2 100644 --- a/src/imports/controls/qquickbusyindicatorring.cpp +++ b/src/imports/controls/qquickbusyindicatorring.cpp @@ -39,8 +39,9 @@ #include <QtCore/qset.h> #include <QtGui/qpainter.h> #include <QtQuick/private/qquickitem_p.h> -#include <QtQuick/qsgsimplerectnode.h> +#include <QtQuick/qsgnode.h> #include <QtQuick/qquickwindow.h> +#include <QtQuick/qsgrectanglenode.h> QT_BEGIN_NAMESPACE @@ -84,9 +85,11 @@ QSGNode *QQuickBusyIndicatorRing::updatePaintNode(QSGNode *oldNode, QQuickItem:: { QQuickItemPrivate *d = QQuickItemPrivate::get(this); - if (!oldNode) - oldNode = new QSGSimpleRectNode(boundingRect(), Qt::transparent); - static_cast<QSGSimpleRectNode *>(oldNode)->setRect(boundingRect()); + if (!oldNode) { + oldNode = window()->createRectangleNode(); + static_cast<QSGRectangleNode *>(oldNode)->setColor(Qt::transparent); + } + static_cast<QSGRectangleNode *>(oldNode)->setRect(boundingRect()); QSGTransformNode *rootTransformNode = static_cast<QSGTransformNode *>(oldNode->firstChild()); if (!rootTransformNode) { @@ -112,7 +115,7 @@ QSGNode *QQuickBusyIndicatorRing::updatePaintNode(QSGNode *oldNode, QQuickItem:: QSGOpacityNode *opacityNode = new QSGOpacityNode; transformNode->appendChildNode(opacityNode); - QSGRectangleNode *rectNode = d->sceneGraphContext()->createRectangleNode(); + QSGInternalRectangleNode *rectNode = d->sceneGraphContext()->createInternalRectangleNode(); rectNode->setAntialiasing(true); rectNode->setColor(color); rectNode->setPenColor(color); @@ -122,7 +125,7 @@ QSGNode *QQuickBusyIndicatorRing::updatePaintNode(QSGNode *oldNode, QQuickItem:: QSGNode *opacityNode = transformNode->firstChild(); Q_ASSERT(opacityNode->type() == QSGNode::OpacityNodeType); - QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(opacityNode->firstChild()); + QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode *>(opacityNode->firstChild()); Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType); QPointF pos = QPointF(sz / 2 - circleRadius, sz / 2 - circleRadius); @@ -178,7 +181,7 @@ void QQuickBusyIndicatorAnimatorJob::updateCurrentTime(int time) if (!m_node) return; - QSGSimpleRectNode *rootRectNode = static_cast<QSGSimpleRectNode*>(m_node->firstChild()); + QSGRectangleNode *rootRectNode = static_cast<QSGRectangleNode *>(m_node->firstChild()); if (!rootRectNode) return; @@ -199,7 +202,7 @@ void QQuickBusyIndicatorAnimatorJob::updateCurrentTime(int time) QSGOpacityNode *opacityNode = static_cast<QSGOpacityNode*>(transformNode->firstChild()); Q_ASSERT(opacityNode->type() == QSGNode::OpacityNodeType); - QSGRectangleNode *rectNode = static_cast<QSGRectangleNode*>(opacityNode->firstChild()); + QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode*>(opacityNode->firstChild()); Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType); const bool fill = (firstPhaseProgress > qreal(i) / circles) || (secondPhaseProgress > 0 && secondPhaseProgress < qreal(i) / circles); diff --git a/src/imports/controls/qquickdefaultstyle.cpp b/src/imports/controls/qquickdefaultstyle.cpp new file mode 100644 index 00000000..7dfedfb7 --- /dev/null +++ b/src/imports/controls/qquickdefaultstyle.cpp @@ -0,0 +1,241 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 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 "qquickdefaultstyle_p.h" + +QT_BEGIN_NAMESPACE + +QQuickDefaultStyle::QQuickDefaultStyle(QObject *parent) : + QObject(parent) +{ +} + +QColor QQuickDefaultStyle::backgroundColor() const +{ + return QColor::fromRgba(0xFFFFFFFF); +} + +QColor QQuickDefaultStyle::overlayModalColor() const +{ + return QColor::fromRgba(0x7F28282A); +} + +QColor QQuickDefaultStyle::overlayDimColor() const +{ + return QColor::fromRgba(0x1F28282A); +} + +QColor QQuickDefaultStyle::textColor() const +{ + return QColor::fromRgba(0xFF353637); +} + +QColor QQuickDefaultStyle::textDarkColor() const +{ + return QColor::fromRgba(0xFF26282A); +} + +QColor QQuickDefaultStyle::textLightColor() const +{ + return QColor::fromRgba(0xFFFFFFFF); +} + +QColor QQuickDefaultStyle::textLinkColor() const +{ + return QColor::fromRgba(0xFF45A7D7); +} + +QColor QQuickDefaultStyle::textSelectionColor() const +{ + return QColor::fromRgba(0xFFFDDD5C); +} + +QColor QQuickDefaultStyle::textDisabledColor() const +{ + return QColor::fromRgba(0xFFBDBEBF); +} + +QColor QQuickDefaultStyle::textDisabledLightColor() const +{ + return QColor::fromRgba(0xFFC2C2C2); +} + +QColor QQuickDefaultStyle::focusColor() const +{ + return QColor::fromRgba(0xFF0066FF); +} + +QColor QQuickDefaultStyle::focusLightColor() const +{ + return QColor::fromRgba(0xFFF0F6FF); +} + +QColor QQuickDefaultStyle::focusPressedColor() const +{ + return QColor::fromRgba(0xFFCCE0FF); +} + +QColor QQuickDefaultStyle::buttonColor() const +{ + return QColor::fromRgba(0xFFE0E0E0); +} + +QColor QQuickDefaultStyle::buttonPressedColor() const +{ + return QColor::fromRgba(0xFFD0D0D0); +} + +QColor QQuickDefaultStyle::buttonCheckedColor() const +{ + return QColor::fromRgba(0xFF353637); +} + +QColor QQuickDefaultStyle::buttonCheckedPressedColor() const +{ + return QColor::fromRgba(0xFF585A5C); +} + +QColor QQuickDefaultStyle::buttonCheckedFocusColor() const +{ + return QColor::fromRgba(0xFF599BFF); +} + +QColor QQuickDefaultStyle::toolButtonColor() const +{ + return QColor::fromRgba(0x33333333); +} + +QColor QQuickDefaultStyle::tabButtonColor() const +{ + return QColor::fromRgba(0xFF353637); +} + +QColor QQuickDefaultStyle::tabButtonPressedColor() const +{ + return QColor::fromRgba(0xFF585A5C); +} + +QColor QQuickDefaultStyle::tabButtonCheckedPressedColor() const +{ + return QColor::fromRgba(0xFFE4E4E4); +} + +QColor QQuickDefaultStyle::delegateColor() const +{ + return QColor::fromRgba(0xFFEEEEEE); +} + +QColor QQuickDefaultStyle::delegatePressedColor() const +{ + return QColor::fromRgba(0xFFBDBEBF); +} + +QColor QQuickDefaultStyle::delegateFocusColor() const +{ + return QColor::fromRgba(0xFFE5EFFF); +} + +QColor QQuickDefaultStyle::indicatorPressedColor() const +{ + return QColor::fromRgba(0xFFF6F6F6); +} + +QColor QQuickDefaultStyle::indicatorDisabledColor() const +{ + return QColor::fromRgba(0xFFFDFDFD); +} + +QColor QQuickDefaultStyle::indicatorFrameColor() const +{ + return QColor::fromRgba(0xFF909090); +} + +QColor QQuickDefaultStyle::indicatorFramePressedColor() const +{ + return QColor::fromRgba(0xFF808080); +} + +QColor QQuickDefaultStyle::indicatorFrameDisabledColor() const +{ + return QColor::fromRgba(0xFFD6D6D6); +} + +QColor QQuickDefaultStyle::frameDarkColor() const +{ + return QColor::fromRgba(0xFF353637); +} + +QColor QQuickDefaultStyle::frameLightColor() const +{ + return QColor::fromRgba(0xFFBDBEBF); +} + +QColor QQuickDefaultStyle::scrollBarColor() const +{ + return QColor::fromRgba(0xFFBDBEBF); +} + +QColor QQuickDefaultStyle::scrollBarPressedColor() const +{ + return QColor::fromRgba(0xFF28282A); +} + +QColor QQuickDefaultStyle::progressBarColor() const +{ + return QColor::fromRgba(0xFFE4E4E4); +} + +QColor QQuickDefaultStyle::pageIndicatorColor() const +{ + return QColor::fromRgba(0xFF28282A); +} + +QColor QQuickDefaultStyle::separatorColor() const +{ + return QColor::fromRgba(0xFFCCCCCC); +} + +QColor QQuickDefaultStyle::disabledDarkColor() const +{ + return QColor::fromRgba(0xFF353637); +} + +QColor QQuickDefaultStyle::disabledLightColor() const +{ + return QColor::fromRgba(0xFFBDBEBF); +} + +QT_END_NAMESPACE diff --git a/src/imports/controls/qquickdefaultstyle_p.h b/src/imports/controls/qquickdefaultstyle_p.h new file mode 100644 index 00000000..854dc6c8 --- /dev/null +++ b/src/imports/controls/qquickdefaultstyle_p.h @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 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 QQUICKDEFAULTSTYLE_P_H +#define QQUICKDEFAULTSTYLE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtCore/qobject.h> +#include <QtGui/qcolor.h> + +QT_BEGIN_NAMESPACE + +class QQuickDefaultStyle : public QObject +{ + Q_OBJECT + Q_PROPERTY(QColor backgroundColor READ backgroundColor CONSTANT FINAL) + Q_PROPERTY(QColor overlayModalColor READ overlayModalColor CONSTANT FINAL) + Q_PROPERTY(QColor overlayDimColor READ overlayDimColor CONSTANT FINAL) + Q_PROPERTY(QColor textColor READ textColor CONSTANT FINAL) + Q_PROPERTY(QColor textDarkColor READ textDarkColor CONSTANT FINAL) + Q_PROPERTY(QColor textLightColor READ textLightColor CONSTANT FINAL) + Q_PROPERTY(QColor textLinkColor READ textLinkColor CONSTANT FINAL) + Q_PROPERTY(QColor textSelectionColor READ textSelectionColor CONSTANT FINAL) + Q_PROPERTY(QColor textDisabledColor READ textDisabledColor CONSTANT FINAL) + Q_PROPERTY(QColor textDisabledLightColor READ textDisabledLightColor CONSTANT FINAL) + Q_PROPERTY(QColor focusColor READ focusColor CONSTANT FINAL) + Q_PROPERTY(QColor focusLightColor READ focusLightColor CONSTANT FINAL) + Q_PROPERTY(QColor focusPressedColor READ focusPressedColor CONSTANT FINAL) + Q_PROPERTY(QColor buttonColor READ buttonColor CONSTANT FINAL) + Q_PROPERTY(QColor buttonPressedColor READ buttonPressedColor CONSTANT FINAL) + Q_PROPERTY(QColor buttonCheckedColor READ buttonCheckedColor CONSTANT FINAL) + Q_PROPERTY(QColor buttonCheckedPressedColor READ buttonCheckedPressedColor CONSTANT FINAL) + Q_PROPERTY(QColor buttonCheckedFocusColor READ buttonCheckedFocusColor CONSTANT FINAL) + Q_PROPERTY(QColor toolButtonColor READ toolButtonColor CONSTANT FINAL) + Q_PROPERTY(QColor tabButtonColor READ tabButtonColor CONSTANT FINAL) + Q_PROPERTY(QColor tabButtonPressedColor READ tabButtonPressedColor CONSTANT FINAL) + Q_PROPERTY(QColor tabButtonCheckedPressedColor READ tabButtonCheckedPressedColor CONSTANT FINAL) + Q_PROPERTY(QColor delegateColor READ delegateColor CONSTANT FINAL) + Q_PROPERTY(QColor delegatePressedColor READ delegatePressedColor CONSTANT FINAL) + Q_PROPERTY(QColor delegateFocusColor READ delegateFocusColor CONSTANT FINAL) + Q_PROPERTY(QColor indicatorPressedColor READ indicatorPressedColor CONSTANT FINAL) + Q_PROPERTY(QColor indicatorDisabledColor READ indicatorDisabledColor CONSTANT FINAL) + Q_PROPERTY(QColor indicatorFrameColor READ indicatorFrameColor CONSTANT FINAL) + Q_PROPERTY(QColor indicatorFramePressedColor READ indicatorFramePressedColor CONSTANT FINAL) + Q_PROPERTY(QColor indicatorFrameDisabledColor READ indicatorFrameDisabledColor CONSTANT FINAL) + Q_PROPERTY(QColor frameDarkColor READ frameDarkColor CONSTANT FINAL) + Q_PROPERTY(QColor frameLightColor READ frameLightColor CONSTANT FINAL) + Q_PROPERTY(QColor scrollBarColor READ scrollBarColor CONSTANT FINAL) + Q_PROPERTY(QColor scrollBarPressedColor READ scrollBarPressedColor CONSTANT FINAL) + Q_PROPERTY(QColor progressBarColor READ progressBarColor CONSTANT FINAL) + Q_PROPERTY(QColor pageIndicatorColor READ pageIndicatorColor CONSTANT FINAL) + Q_PROPERTY(QColor separatorColor READ separatorColor CONSTANT FINAL) + Q_PROPERTY(QColor disabledDarkColor READ disabledDarkColor CONSTANT FINAL) + Q_PROPERTY(QColor disabledLightColor READ disabledLightColor CONSTANT FINAL) + +public: + explicit QQuickDefaultStyle(QObject *parent = nullptr); + + QColor backgroundColor() const; + QColor overlayModalColor() const; + QColor overlayDimColor() const; + QColor textColor() const; + QColor textDarkColor() const; + QColor textLightColor() const; + QColor textLinkColor() const; + QColor textSelectionColor() const; + QColor textDisabledColor() const; + QColor textDisabledLightColor() const; + QColor focusColor() const; + QColor focusLightColor() const; + QColor focusPressedColor() const; + QColor buttonColor() const; + QColor buttonPressedColor() const; + QColor buttonCheckedColor() const; + QColor buttonCheckedPressedColor() const; + QColor buttonCheckedFocusColor() const; + QColor toolButtonColor() const; + QColor tabButtonColor() const; + QColor tabButtonPressedColor() const; + QColor tabButtonCheckedPressedColor() const; + QColor delegateColor() const; + QColor delegatePressedColor() const; + QColor delegateFocusColor() const; + QColor indicatorPressedColor() const; + QColor indicatorDisabledColor() const; + QColor indicatorFrameColor() const; + QColor indicatorFramePressedColor() const; + QColor indicatorFrameDisabledColor() const; + QColor frameDarkColor() const; + QColor frameLightColor() const; + QColor scrollBarColor() const; + QColor scrollBarPressedColor() const; + QColor progressBarColor() const; + QColor pageIndicatorColor() const; + QColor separatorColor() const; + QColor disabledDarkColor() const; + QColor disabledLightColor() const; +}; + +QT_END_NAMESPACE + +#endif // QQUICKDEFAULTSTYLE_P_H diff --git a/src/imports/controls/qquickprogressstrip.cpp b/src/imports/controls/qquickprogressstrip.cpp index 5b50a28d..33a21848 100644 --- a/src/imports/controls/qquickprogressstrip.cpp +++ b/src/imports/controls/qquickprogressstrip.cpp @@ -37,7 +37,7 @@ #include "qquickprogressstrip_p.h" #include <QtQuick/private/qquickitem_p.h> -#include <QtQuick/qsgsimplerectnode.h> +#include <QtQuick/qsgrectanglenode.h> QT_BEGIN_NAMESPACE @@ -129,9 +129,11 @@ QSGNode *QQuickProgressStrip::updatePaintNode(QSGNode *oldNode, QQuickItem::Upda { QQuickItemPrivate *d = QQuickItemPrivate::get(this); - if (!oldNode) - oldNode = new QSGSimpleRectNode(boundingRect(), Qt::transparent); - static_cast<QSGSimpleRectNode *>(oldNode)->setRect(boundingRect()); + if (!oldNode) { + oldNode = window()->createRectangleNode(); + static_cast<QSGRectangleNode *>(oldNode)->setColor(Qt::transparent); + } + static_cast<QSGRectangleNode *>(oldNode)->setRect(boundingRect()); QSGTransformNode *rootTransformNode = static_cast<QSGTransformNode *>(oldNode->firstChild()); if (!rootTransformNode) { @@ -155,9 +157,9 @@ QSGNode *QQuickProgressStrip::updatePaintNode(QSGNode *oldNode, QQuickItem::Upda rootTransformNode->appendChildNode(transformNode); } - QSGRectangleNode *rectNode = static_cast<QSGRectangleNode*>(transformNode->firstChild()); + QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode*>(transformNode->firstChild()); if (!rectNode) { - rectNode = d->sceneGraphContext()->createRectangleNode(); + rectNode = d->sceneGraphContext()->createInternalRectangleNode(); rectNode->setColor(color); transformNode->appendChildNode(rectNode); } @@ -177,9 +179,9 @@ QSGNode *QQuickProgressStrip::updatePaintNode(QSGNode *oldNode, QQuickItem::Upda rootTransformNode->removeAllChildNodes(); } - QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(rootTransformNode->firstChild()); + QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode *>(rootTransformNode->firstChild()); if (!rectNode) { - rectNode = d->sceneGraphContext()->createRectangleNode(); + rectNode = d->sceneGraphContext()->createInternalRectangleNode(); rectNode->setColor(color); rootTransformNode->appendChildNode(rectNode); } @@ -233,7 +235,7 @@ void QQuickProgressAnimatorJob::updateCurrentTime(int time) if (!m_node) return; - QSGSimpleRectNode *rootRectNode = static_cast<QSGSimpleRectNode*>(m_node->firstChild()); + QSGRectangleNode *rootRectNode = static_cast<QSGRectangleNode *>(m_node->firstChild()); if (!rootRectNode) return; Q_ASSERT(rootRectNode->type() == QSGNode::GeometryNodeType); @@ -250,7 +252,7 @@ void QQuickProgressAnimatorJob::updateCurrentTime(int time) const qreal pixelsPerSecond = rootRectNode->rect().width(); for (int i = 0; i < blocks; ++i) { - QSGRectangleNode *rectNode = static_cast<QSGRectangleNode*>(transformNode->firstChild()); + QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode*>(transformNode->firstChild()); Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType); QMatrix4x4 m; diff --git a/src/imports/controls/qtquickcontrols2plugin.cpp b/src/imports/controls/qtquickcontrols2plugin.cpp index 8e41a58c..5b8868fe 100644 --- a/src/imports/controls/qtquickcontrols2plugin.cpp +++ b/src/imports/controls/qtquickcontrols2plugin.cpp @@ -36,12 +36,15 @@ #include <QtCore/private/qfileselector_p.h> #include <QtQuickControls2/qquickstyle.h> +#include <QtQuickControls2/private/qquickstyle_p.h> #include <QtQuickControls2/private/qquickstyleplugin_p.h> #include <QtQuickControls2/private/qquickstyleselector_p.h> #include <QtQuickControls2/private/qquickcolorimageprovider_p.h> #include <QtQuickTemplates2/private/qquickbuttongroup_p.h> +#include <QtQuickControls2/private/qquicktumblerview_p.h> #include "qquickbusyindicatorring_p.h" +#include "qquickdefaultstyle_p.h" #include "qquickdialring_p.h" #include "qquickprogressstrip_p.h" @@ -73,20 +76,21 @@ QtQuickControls2Plugin::QtQuickControls2Plugin(QObject *parent) : QQuickStylePlu void QtQuickControls2Plugin::registerTypes(const char *uri) { - qmlRegisterType<QQuickButtonGroup>(uri, 2, 0, "ButtonGroup"); - qmlRegisterType<QQuickButtonGroupAttached>(); - - QQuickStyleSelector selector; - selector.setBaseUrl(typeUrl()); - + QQuickStylePrivate::init(typeUrl()); const QString style = QQuickStyle::name(); if (!style.isEmpty()) QFileSelectorPrivate::addStatics(QStringList() << style.toLower()); + QQuickStyleSelector selector; + selector.setBaseUrl(typeUrl()); + + // QtQuick.Controls 2.0 (Qt 5.7) qmlRegisterType(selector.select(QStringLiteral("AbstractButton.qml")), uri, 2, 0, "AbstractButton"); qmlRegisterType(selector.select(QStringLiteral("ApplicationWindow.qml")), uri, 2, 0, "ApplicationWindow"); qmlRegisterType(selector.select(QStringLiteral("BusyIndicator.qml")), uri, 2, 0, "BusyIndicator"); qmlRegisterType(selector.select(QStringLiteral("Button.qml")), uri, 2, 0, "Button"); + qmlRegisterType<QQuickButtonGroup>(uri, 2, 0, "ButtonGroup"); + qmlRegisterType<QQuickButtonGroupAttached>(); qmlRegisterType(selector.select(QStringLiteral("CheckBox.qml")), uri, 2, 0, "CheckBox"); qmlRegisterType(selector.select(QStringLiteral("CheckDelegate.qml")), uri, 2, 0, "CheckDelegate"); qmlRegisterType(selector.select(QStringLiteral("ComboBox.qml")), uri, 2, 0, "ComboBox"); @@ -125,6 +129,21 @@ void QtQuickControls2Plugin::registerTypes(const char *uri) qmlRegisterType(selector.select(QStringLiteral("ToolButton.qml")), uri, 2, 0, "ToolButton"); qmlRegisterType(selector.select(QStringLiteral("ToolTip.qml")), uri, 2, 0, "ToolTip"); qmlRegisterType(selector.select(QStringLiteral("Tumbler.qml")), uri, 2, 0, "Tumbler"); + + // QtQuick.Controls 2.1 (Qt 5.8) + qmlRegisterType<QQuickButtonGroup,1 >(uri, 2, 1, "ButtonGroup"); + qmlRegisterType(selector.select(QStringLiteral("Dialog.qml")), uri, 2, 1, "Dialog"); + qmlRegisterType(selector.select(QStringLiteral("DialogButtonBox.qml")), uri, 2, 1, "DialogButtonBox"); + qmlRegisterType(selector.select(QStringLiteral("MenuSeparator.qml")), uri, 2, 1, "MenuSeparator"); + qmlRegisterType(selector.select(QStringLiteral("RoundButton.qml")), uri, 2, 1, "RoundButton"); + qmlRegisterType(selector.select(QStringLiteral("ToolSeparator.qml")), uri, 2, 1, "ToolSeparator"); +} + +static QObject *styleSingleton(QQmlEngine *engine, QJSEngine *scriptEngine) +{ + Q_UNUSED(engine); + Q_UNUSED(scriptEngine); + return new QQuickDefaultStyle; } void QtQuickControls2Plugin::initializeEngine(QQmlEngine *engine, const char *uri) @@ -139,6 +158,8 @@ void QtQuickControls2Plugin::initializeEngine(QQmlEngine *engine, const char *ur qmlRegisterType<QQuickProgressStrip>(import, 2, 0, "ProgressStrip"); qmlRegisterType<QQuickProgressAnimator>(import, 2, 0, "ProgressStripAnimator"); qmlRegisterType<QQuickDialRing>(import, 2, 0, "DialRing"); + qmlRegisterType<QQuickTumblerView>(import, 2, 1, "TumblerView"); + qmlRegisterSingletonType<QQuickDefaultStyle>(import, 2, 1, "Default", styleSingleton); qmlRegisterType(typeUrl(QStringLiteral("CheckIndicator.qml")), import, 2, 0, "CheckIndicator"); qmlRegisterType(typeUrl(QStringLiteral("RadioIndicator.qml")), import, 2, 0, "RadioIndicator"); diff --git a/src/imports/controls/universal/ApplicationWindow.qml b/src/imports/controls/universal/ApplicationWindow.qml index 70bd403c..ba07021a 100644 --- a/src/imports/controls/universal/ApplicationWindow.qml +++ b/src/imports/controls/universal/ApplicationWindow.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 -import QtQuick.Controls.Universal.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 +import QtQuick.Controls.Universal.impl 2.1 T.ApplicationWindow { id: window diff --git a/src/imports/controls/universal/BusyIndicator.qml b/src/imports/controls/universal/BusyIndicator.qml index fe2186a7..514a233e 100644 --- a/src/imports/controls/universal/BusyIndicator.qml +++ b/src/imports/controls/universal/BusyIndicator.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 -import QtQuick.Controls.Universal.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 +import QtQuick.Controls.Universal.impl 2.1 T.BusyIndicator { id: control diff --git a/src/imports/controls/universal/Button.qml b/src/imports/controls/universal/Button.qml index 6954d31a..aa65e714 100644 --- a/src/imports/controls/universal/Button.qml +++ b/src/imports/controls/universal/Button.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.Button { id: control @@ -72,5 +72,14 @@ T.Button { color: control.down ? control.Universal.baseMediumLowColor : control.enabled && (control.highlighted || control.checked) ? control.Universal.accent : control.Universal.baseLowColor + + Rectangle { + width: parent.width + height: parent.height + color: "transparent" + visible: control.hovered + border.width: 2 // ButtonBorderThemeThickness + border.color: control.Universal.baseMediumLowColor + } } } diff --git a/src/imports/controls/universal/CheckBox.qml b/src/imports/controls/universal/CheckBox.qml index a1c3ba6b..916348f9 100644 --- a/src/imports/controls/universal/CheckBox.qml +++ b/src/imports/controls/universal/CheckBox.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 -import QtQuick.Controls.Universal.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 +import QtQuick.Controls.Universal.impl 2.1 T.CheckBox { id: control diff --git a/src/imports/controls/universal/CheckDelegate.qml b/src/imports/controls/universal/CheckDelegate.qml index c0ca272e..42e7b10c 100644 --- a/src/imports/controls/universal/CheckDelegate.qml +++ b/src/imports/controls/universal/CheckDelegate.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.CheckDelegate { id: control @@ -76,8 +76,9 @@ T.CheckDelegate { } background: Rectangle { - visible: control.down || control.highlighted || control.visualFocus - color: control.down ? control.Universal.listMediumColor : control.Universal.altMediumLowColor + visible: control.down || control.highlighted || control.visualFocus || control.hovered + color: control.down ? control.Universal.listMediumColor : + control.hovered ? control.Universal.listLowColor : control.Universal.altMediumLowColor Rectangle { width: parent.width height: parent.height diff --git a/src/imports/controls/universal/CheckIndicator.qml b/src/imports/controls/universal/CheckIndicator.qml index eeecf264..166cf184 100644 --- a/src/imports/controls/universal/CheckIndicator.qml +++ b/src/imports/controls/universal/CheckIndicator.qml @@ -34,16 +34,16 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 Rectangle { implicitWidth: 20 implicitHeight: 20 color: !control.enabled ? "transparent" : - control.down && control.checkState !== Qt.PartiallyChecked ? control.Universal.baseMediumColor : + control.down && !partiallyChecked ? control.Universal.baseMediumColor : control.checkState === Qt.Checked ? control.Universal.accent : "transparent" border.color: !control.enabled ? control.Universal.baseLowColor : control.down ? control.Universal.baseMediumColor : @@ -51,6 +51,7 @@ Rectangle { border.width: 2 // CheckBoxBorderThemeThickness property Item control + readonly property bool partiallyChecked: control.checkState === Qt.PartiallyChecked Image { x: (parent.width - width) / 2 @@ -65,11 +66,15 @@ Rectangle { Rectangle { x: (parent.width - width) / 2 y: (parent.height - height) / 2 - width: parent.width / 2 - height: parent.height / 2 + width: partiallyChecked ? parent.width / 2 : parent.width + height: partiallyChecked ? parent.height / 2 : parent.height - visible: control.checkState === Qt.PartiallyChecked - color: !control.enabled ? control.Universal.baseLowColor : - control.down ? control.Universal.baseMediumColor : control.Universal.baseMediumHighColor + visible: !control.pressed && control.hovered || partiallyChecked + color: !partiallyChecked ? "transparent" : + !control.enabled ? control.Universal.baseLowColor : + control.down ? control.Universal.baseMediumColor : + control.hovered ? control.Universal.baseHighColor : control.Universal.baseMediumHighColor + border.width: partiallyChecked ? 0 : 2 // CheckBoxBorderThemeThickness + border.color: control.Universal.baseMediumLowColor } } diff --git a/src/imports/controls/universal/ComboBox.qml b/src/imports/controls/universal/ComboBox.qml index bb816fc1..2d768a1d 100644 --- a/src/imports/controls/universal/ComboBox.qml +++ b/src/imports/controls/universal/ComboBox.qml @@ -34,11 +34,11 @@ ** ****************************************************************************/ -import QtQuick 2.6 +import QtQuick 2.8 import QtQuick.Window 2.2 -import QtQuick.Controls 2.0 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Controls 2.1 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.ComboBox { id: control @@ -60,6 +60,7 @@ T.ComboBox { width: control.popup.width text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData highlighted: control.highlightedIndex === index + hoverEnabled: control.hoverEnabled } indicator: Image { @@ -88,11 +89,14 @@ T.ComboBox { implicitWidth: 120 implicitHeight: 32 - border.width: 2 // ComboBoxBorderThemeThickness + border.width: control.flat ? 0 : 2 // ComboBoxBorderThemeThickness border.color: !control.enabled ? control.Universal.baseLowColor : - control.pressed || popup.visible ? control.Universal.baseMediumLowColor : control.Universal.baseMediumLowColor + control.pressed || popup.visible ? control.Universal.baseMediumLowColor : + control.hovered ? control.Universal.baseMediumColor : control.Universal.baseMediumLowColor color: !control.enabled ? control.Universal.baseLowColor : - control.pressed || popup.visible ? control.Universal.listMediumColor : control.Universal.altMediumLowColor + control.pressed || popup.visible ? control.Universal.listMediumColor : + control.flat && control.hovered ? control.Universal.listLowColor : control.Universal.altMediumLowColor + visible: !control.flat || control.pressed || control.hovered || control.visualFocus Rectangle { x: 2 diff --git a/src/imports/controls/universal/Dial.qml b/src/imports/controls/universal/Dial.qml index 6781d387..9eaf69ba 100644 --- a/src/imports/controls/universal/Dial.qml +++ b/src/imports/controls/universal/Dial.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.Dial { id: control @@ -64,7 +64,8 @@ T.Dial { radius: width / 2 color: !control.enabled ? control.Universal.baseLowColor : - control.pressed ? control.Universal.baseMediumColor : control.Universal.baseMediumHighColor + control.pressed ? control.Universal.baseMediumColor : + control.hovered ? control.Universal.baseHighColor : control.Universal.baseMediumHighColor transform: [ Translate { diff --git a/src/imports/controls/universal/Dialog.qml b/src/imports/controls/universal/Dialog.qml new file mode 100644 index 00000000..f805581c --- /dev/null +++ b/src/imports/controls/universal/Dialog.qml @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 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.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls 2.1 +import QtQuick.Controls.Universal 2.1 + +T.Dialog { + id: control + + implicitWidth: Math.max(background ? background.implicitWidth : 0, + header && header.visible ? header.implicitWidth : 0, + footer && footer.visible ? footer.implicitWidth : 0, + contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0) + implicitHeight: Math.max(background ? background.implicitHeight : 0, + (header && header.visible ? header.implicitHeight + spacing : 0) + + (footer && footer.visible ? footer.implicitHeight + spacing : 0) + + (contentHeight > 0 ? contentHeight + topPadding + bottomPadding : 0)) + + contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) + contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) + + padding: 24 + topPadding: 18 + bottomPadding: 18 + + background: Rectangle { + color: control.Universal.chromeMediumLowColor + border.color: control.Universal.chromeHighColor + border.width: 1 // FlyoutBorderThemeThickness + } + + header: Label { + text: control.title + visible: control.title + elide: Label.ElideRight + topPadding: 18 + leftPadding: 24 + rightPadding: 24 + // TODO: QPlatformTheme::TitleBarFont + font.pixelSize: 20 + background: Rectangle { + x: 1; y: 1 // // FlyoutBorderThemeThickness + color: control.Universal.chromeMediumLowColor + width: parent.width - 2 + height: parent.height - 1 + } + } + + footer: DialogButtonBox { + visible: count > 0 + } +} diff --git a/src/imports/controls/universal/DialogButtonBox.qml b/src/imports/controls/universal/DialogButtonBox.qml new file mode 100644 index 00000000..043496d9 --- /dev/null +++ b/src/imports/controls/universal/DialogButtonBox.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 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.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 + +T.DialogButtonBox { + id: control + + implicitWidth: Math.max(background ? background.implicitWidth : 0, + contentItem.implicitWidth + leftPadding + rightPadding) + implicitHeight: Math.max(background ? background.implicitHeight : 0, + contentItem.implicitHeight + topPadding + bottomPadding) + + spacing: 4 + padding: 24 + topPadding: position === T.DialogButtonBox.Footer ? 6 : 24 + bottomPadding: position === T.DialogButtonBox.Header ? 6 : 24 + alignment: count === 1 ? Qt.AlignRight : undefined + + delegate: Button { + width: control.count === 1 ? control.availableWidth / 2 : undefined + } + + contentItem: ListView { + implicitWidth: contentWidth + implicitHeight: 32 + + model: control.contentModel + spacing: control.spacing + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + snapMode: ListView.SnapToItem + } + + background: Rectangle { + implicitHeight: 32 + color: control.Universal.chromeMediumLowColor + x: 1; y: 1 + width: parent.width - 2 + height: parent.height - 2 + } +} diff --git a/src/imports/controls/universal/Drawer.qml b/src/imports/controls/universal/Drawer.qml index 84831323..09b3751d 100644 --- a/src/imports/controls/universal/Drawer.qml +++ b/src/imports/controls/universal/Drawer.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.Drawer { id: control @@ -57,8 +57,6 @@ T.Drawer { enter: Transition { SmoothedAnimation { velocity: 5 } } exit: Transition { SmoothedAnimation { velocity: 5 } } - contentItem: Item { } - background: Rectangle { color: control.Universal.chromeMediumLowColor Rectangle { diff --git a/src/imports/controls/universal/Frame.qml b/src/imports/controls/universal/Frame.qml index d5b327c1..1c83f3fd 100644 --- a/src/imports/controls/universal/Frame.qml +++ b/src/imports/controls/universal/Frame.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.Frame { id: control @@ -49,8 +49,6 @@ T.Frame { padding: 12 - contentItem: Item { } - background: Rectangle { color: "transparent" border.color: control.Universal.chromeDisabledLowColor diff --git a/src/imports/controls/universal/GroupBox.qml b/src/imports/controls/universal/GroupBox.qml index c75c81a6..435a9755 100644 --- a/src/imports/controls/universal/GroupBox.qml +++ b/src/imports/controls/universal/GroupBox.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.GroupBox { id: control @@ -53,8 +53,6 @@ T.GroupBox { padding: 12 topPadding: padding + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0) - contentItem: Item { } - label: Text { x: control.leftPadding width: control.availableWidth diff --git a/src/imports/controls/universal/ItemDelegate.qml b/src/imports/controls/universal/ItemDelegate.qml index 6822d658..a8d55ba6 100644 --- a/src/imports/controls/universal/ItemDelegate.qml +++ b/src/imports/controls/universal/ItemDelegate.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.ItemDelegate { id: control @@ -70,8 +70,9 @@ T.ItemDelegate { } background: Rectangle { - visible: control.down || control.highlighted || control.visualFocus - color: control.down ? control.Universal.listMediumColor : control.Universal.altMediumLowColor + visible: control.down || control.highlighted || control.visualFocus || control.hovered + color: control.down ? control.Universal.listMediumColor : + control.hovered ? control.Universal.listLowColor : control.Universal.altMediumLowColor Rectangle { width: parent.width height: parent.height diff --git a/src/imports/controls/universal/Label.qml b/src/imports/controls/universal/Label.qml index 9b50f4f5..9e377f61 100644 --- a/src/imports/controls/universal/Label.qml +++ b/src/imports/controls/universal/Label.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.Label { id: control diff --git a/src/imports/controls/universal/Menu.qml b/src/imports/controls/universal/Menu.qml index 5ee2c243..afae51f0 100644 --- a/src/imports/controls/universal/Menu.qml +++ b/src/imports/controls/universal/Menu.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Controls 2.0 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.Menu { id: control diff --git a/src/imports/controls/universal/MenuItem.qml b/src/imports/controls/universal/MenuItem.qml index d8fdbcd0..380a5b0e 100644 --- a/src/imports/controls/universal/MenuItem.qml +++ b/src/imports/controls/universal/MenuItem.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.MenuItem { id: control @@ -81,7 +81,8 @@ T.MenuItem { implicitHeight: 40 color: !control.enabled ? control.Universal.baseLowColor : - control.down ? control.Universal.listMediumColor : control.Universal.altMediumLowColor + control.down ? control.Universal.listMediumColor : + control.hovered ? control.Universal.listLowColor : control.Universal.altMediumLowColor Rectangle { x: 1; y: 1 diff --git a/src/imports/controls/universal/MenuSeparator.qml b/src/imports/controls/universal/MenuSeparator.qml new file mode 100644 index 00000000..cd79c60f --- /dev/null +++ b/src/imports/controls/universal/MenuSeparator.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 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.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 + +T.MenuSeparator { + id: control + + implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding) + implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding) + + padding: 12 + topPadding: 9 + bottomPadding: 10 + + contentItem: Rectangle { + implicitWidth: 188 + implicitHeight: 1 + color: control.Universal.baseMediumLowColor + } + + background: Rectangle { + color: control.Universal.altMediumLowColor + } +} diff --git a/src/imports/controls/universal/Page.qml b/src/imports/controls/universal/Page.qml index 3150715f..e8c7bd4a 100644 --- a/src/imports/controls/universal/Page.qml +++ b/src/imports/controls/universal/Page.qml @@ -34,14 +34,24 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.Page { id: control - contentItem: Item { } + implicitWidth: Math.max(background ? background.implicitWidth : 0, + Math.max(contentWidth, + header && header.visible ? header.implicitWidth : 0, + footer && footer.visible ? footer.implicitWidth : 0) + leftPadding + rightPadding) + implicitHeight: Math.max(background ? background.implicitHeight : 0, + contentHeight + topPadding + bottomPadding + + (header && header.visible ? header.implicitHeight + spacing : 0) + + (footer && footer.visible ? footer.implicitHeight + spacing : 0)) + + contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) + contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) background: Rectangle { color: control.Universal.background diff --git a/src/imports/controls/universal/PageIndicator.qml b/src/imports/controls/universal/PageIndicator.qml index 0c4e3b80..817c89fb 100644 --- a/src/imports/controls/universal/PageIndicator.qml +++ b/src/imports/controls/universal/PageIndicator.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.PageIndicator { id: control diff --git a/src/imports/controls/universal/Pane.qml b/src/imports/controls/universal/Pane.qml index cd62b65c..903e501a 100644 --- a/src/imports/controls/universal/Pane.qml +++ b/src/imports/controls/universal/Pane.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.Pane { id: control @@ -49,8 +49,6 @@ T.Pane { padding: 12 - contentItem: Item { } - background: Rectangle { color: control.Universal.background } diff --git a/src/imports/controls/universal/Popup.qml b/src/imports/controls/universal/Popup.qml index 892db087..53178b71 100644 --- a/src/imports/controls/universal/Popup.qml +++ b/src/imports/controls/universal/Popup.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.Popup { id: control @@ -51,8 +51,6 @@ T.Popup { padding: 12 - contentItem: Item { } - background: Rectangle { color: control.Universal.chromeMediumLowColor border.color: control.Universal.chromeHighColor diff --git a/src/imports/controls/universal/ProgressBar.qml b/src/imports/controls/universal/ProgressBar.qml index 66d1aeb8..cd314c27 100644 --- a/src/imports/controls/universal/ProgressBar.qml +++ b/src/imports/controls/universal/ProgressBar.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 -import QtQuick.Controls.Universal.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 +import QtQuick.Controls.Universal.impl 2.1 T.ProgressBar { id: control diff --git a/src/imports/controls/universal/RadioButton.qml b/src/imports/controls/universal/RadioButton.qml index b8986488..8f599e55 100644 --- a/src/imports/controls/universal/RadioButton.qml +++ b/src/imports/controls/universal/RadioButton.qml @@ -34,10 +34,10 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 -import QtQuick.Controls.Universal.impl 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 +import QtQuick.Controls.Universal.impl 2.1 T.RadioButton { id: control diff --git a/src/imports/controls/universal/RadioDelegate.qml b/src/imports/controls/universal/RadioDelegate.qml index 09f86f15..14680cd6 100644 --- a/src/imports/controls/universal/RadioDelegate.qml +++ b/src/imports/controls/universal/RadioDelegate.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.RadioDelegate { id: control @@ -78,8 +78,9 @@ T.RadioDelegate { } background: Rectangle { - visible: control.down || control.highlighted || control.visualFocus - color: control.down ? control.Universal.listMediumColor : control.Universal.altMediumLowColor + visible: control.down || control.highlighted || control.visualFocus || control.hovered + color: control.down ? control.Universal.listMediumColor : + control.hovered ? control.Universal.listLowColor : control.Universal.altMediumLowColor Rectangle { width: parent.width height: parent.height diff --git a/src/imports/controls/universal/RadioIndicator.qml b/src/imports/controls/universal/RadioIndicator.qml index 65790e6a..c745b04e 100644 --- a/src/imports/controls/universal/RadioIndicator.qml +++ b/src/imports/controls/universal/RadioIndicator.qml @@ -34,8 +34,8 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Controls.Universal 2.1 Rectangle { implicitWidth: 20 @@ -45,7 +45,8 @@ Rectangle { border.width: 2 // RadioButtonBorderThemeThickness border.color: control.checked ? "transparent" : !control.enabled ? control.Universal.baseLowColor : - control.down ? control.Universal.baseMediumColor : control.Universal.baseMediumHighColor + control.down ? control.Universal.baseMediumColor : + control.hovered ? control.Universal.baseHighColor : control.Universal.baseMediumHighColor property var control @@ -72,6 +73,7 @@ Rectangle { radius: width / 2 opacity: control.checked ? 1 : 0 color: !control.enabled ? control.Universal.baseLowColor : - control.down ? control.Universal.baseMediumColor : control.Universal.baseMediumHighColor + control.down ? control.Universal.baseMediumColor : + control.hovered ? control.Universal.baseHighColor : control.Universal.baseMediumHighColor } } diff --git a/src/imports/controls/universal/RangeSlider.qml b/src/imports/controls/universal/RangeSlider.qml index ec2ff7c8..fec8bb18 100644 --- a/src/imports/controls/universal/RangeSlider.qml +++ b/src/imports/controls/universal/RangeSlider.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.RangeSlider { id: control @@ -60,7 +60,9 @@ T.RangeSlider { y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.first.visualPosition * (control.availableHeight - height)) radius: 4 - color: control.first.pressed ? control.Universal.chromeHighColor : control.enabled ? control.Universal.accent : control.Universal.chromeDisabledHighColor + color: control.first.pressed ? control.Universal.chromeHighColor : + control.first.hovered ? control.Universal.chromeAltLowColor : + control.enabled ? control.Universal.accent : control.Universal.chromeDisabledHighColor } second.handle: Rectangle { @@ -73,7 +75,9 @@ T.RangeSlider { y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.second.visualPosition * (control.availableHeight - height)) radius: 4 - color: control.second.pressed ? control.Universal.chromeHighColor : control.enabled ? control.Universal.accent : control.Universal.chromeDisabledHighColor + color: control.second.pressed ? control.Universal.chromeHighColor : + control.second.hovered ? control.Universal.chromeAltLowColor : + control.enabled ? control.Universal.accent : control.Universal.chromeDisabledHighColor } background: Item { @@ -95,7 +99,8 @@ T.RangeSlider { width: parent.horizontal ? parent.width : 2 // SliderBackgroundThemeHeight height: !parent.horizontal ? parent.height : 2 // SliderBackgroundThemeHeight - color: control.enabled ? control.Universal.baseMediumLowColor : control.Universal.chromeDisabledHighColor + color: control.hovered && !control.pressed ? control.Universal.baseMediumColor : + control.enabled ? control.Universal.baseMediumLowColor : control.Universal.chromeDisabledHighColor } Rectangle { diff --git a/src/imports/controls/universal/RoundButton.qml b/src/imports/controls/universal/RoundButton.qml new file mode 100644 index 00000000..9a50c0fe --- /dev/null +++ b/src/imports/controls/universal/RoundButton.qml @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 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.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 + +T.RoundButton { + id: control + + implicitWidth: Math.max(background ? background.implicitWidth : 0, + contentItem.implicitWidth + leftPadding + rightPadding) + implicitHeight: Math.max(background ? background.implicitHeight : 0, + contentItem.implicitHeight + topPadding + bottomPadding) + baselineOffset: contentItem.y + contentItem.baselineOffset + + padding: 8 + + property bool useSystemFocusVisuals: true + + contentItem: Text { + text: control.text + font: control.font + elide: Text.ElideRight + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + + opacity: enabled ? 1.0 : 0.2 + color: control.Universal.foreground + } + + background: Rectangle { + implicitWidth: 32 + implicitHeight: 32 + + radius: control.radius + visible: !control.flat || control.down || control.checked || control.highlighted + color: control.down ? control.Universal.baseMediumLowColor : + control.enabled && (control.highlighted || control.checked) ? control.Universal.accent : + control.Universal.baseLowColor + + Rectangle { + width: parent.width + height: parent.height + radius: control.radius + color: "transparent" + visible: control.hovered + border.width: 2 // ButtonBorderThemeThickness + border.color: control.Universal.baseMediumLowColor + } + } +} diff --git a/src/imports/controls/universal/ScrollBar.qml b/src/imports/controls/universal/ScrollBar.qml index 1ac627a7..6d5c84fe 100644 --- a/src/imports/controls/universal/ScrollBar.qml +++ b/src/imports/controls/universal/ScrollBar.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.ScrollBar { id: control @@ -52,7 +52,8 @@ T.ScrollBar { implicitWidth: 12 implicitHeight: 12 - color: control.pressed ? control.Universal.baseMediumColor : control.Universal.chromeHighColor + color: control.pressed ? control.Universal.baseMediumColor : + control.hovered ? control.Universal.baseMediumLowColor : control.Universal.chromeHighColor visible: control.size < 1.0 opacity: 0.0 } diff --git a/src/imports/controls/universal/ScrollIndicator.qml b/src/imports/controls/universal/ScrollIndicator.qml index ce289ce3..f03bc819 100644 --- a/src/imports/controls/universal/ScrollIndicator.qml +++ b/src/imports/controls/universal/ScrollIndicator.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.ScrollIndicator { id: control diff --git a/src/imports/controls/universal/Slider.qml b/src/imports/controls/universal/Slider.qml index baf91211..472f5455 100644 --- a/src/imports/controls/universal/Slider.qml +++ b/src/imports/controls/universal/Slider.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.Slider { id: control @@ -60,7 +60,9 @@ T.Slider { y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height)) radius: 4 - color: control.pressed ? control.Universal.chromeHighColor : control.enabled ? control.Universal.accent : control.Universal.chromeDisabledHighColor + color: control.pressed ? control.Universal.chromeHighColor : + control.hovered ? control.Universal.chromeAltLowColor : + control.enabled ? control.Universal.accent : control.Universal.chromeDisabledHighColor } background: Item { @@ -82,7 +84,8 @@ T.Slider { width: parent.horizontal ? parent.width : 2 // SliderTrackThemeHeight height: !parent.horizontal ? parent.height : 2 // SliderTrackThemeHeight - color: control.enabled ? control.Universal.baseMediumLowColor : control.Universal.chromeDisabledHighColor + color: control.hovered && !control.pressed ? control.Universal.baseMediumColor : + control.enabled ? control.Universal.baseMediumLowColor : control.Universal.chromeDisabledHighColor } Rectangle { diff --git a/src/imports/controls/universal/SpinBox.qml b/src/imports/controls/universal/SpinBox.qml index d3647114..40060038 100644 --- a/src/imports/controls/universal/SpinBox.qml +++ b/src/imports/controls/universal/SpinBox.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.SpinBox { id: control @@ -79,7 +79,7 @@ T.SpinBox { readOnly: !control.editable validator: control.validator - inputMethodHints: Qt.ImhFormattedNumbersOnly + inputMethodHints: Qt.ImhDigitsOnly } up.indicator: Item { @@ -92,9 +92,11 @@ T.SpinBox { x: 2; y: 4 width: parent.width - 4 height: parent.height - 8 - color: !control.up.pressed ? "transparent" : - control.activeFocus ? control.Universal.accent - : control.Universal.chromeDisabledLowColor + color: control.activeFocus ? control.Universal.accent : + control.up.pressed ? control.Universal.baseMediumLowColor : + control.up.hovered ? control.Universal.baseLowColor : "transparent" + visible: control.up.pressed || control.up.hovered + opacity: control.activeFocus && !control.up.pressed ? 0.4 : 1.0 } Image { @@ -118,9 +120,11 @@ T.SpinBox { x: 2; y: 4 width: parent.width - 4 height: parent.height - 8 - color: !control.down.pressed ? "transparent" : - control.activeFocus ? control.Universal.accent - : control.Universal.chromeDisabledLowColor + color: control.activeFocus ? control.Universal.accent : + control.down.pressed ? control.Universal.baseMediumLowColor : + control.down.hovered ? control.Universal.baseLowColor : "transparent" + visible: control.down.pressed || control.down.hovered + opacity: control.activeFocus && !control.down.pressed ? 0.4 : 1.0 } Image { @@ -140,7 +144,8 @@ T.SpinBox { border.width: 2 // TextControlBorderThemeThickness border.color: !control.enabled ? control.Universal.baseLowColor : - control.activeFocus ? control.Universal.accent : control.Universal.chromeDisabledLowColor + control.activeFocus ? control.Universal.accent : + control.hovered ? control.Universal.baseMediumColor : control.Universal.chromeDisabledLowColor color: control.enabled ? control.Universal.background : control.Universal.baseLowColor } } diff --git a/src/imports/controls/universal/StackView.qml b/src/imports/controls/universal/StackView.qml index 4f37bb76..6e6d1b50 100644 --- a/src/imports/controls/universal/StackView.qml +++ b/src/imports/controls/universal/StackView.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.StackView { id: control diff --git a/src/imports/controls/universal/SwipeDelegate.qml b/src/imports/controls/universal/SwipeDelegate.qml index 82c1e744..bc82e40e 100644 --- a/src/imports/controls/universal/SwipeDelegate.qml +++ b/src/imports/controls/universal/SwipeDelegate.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.SwipeDelegate { id: control @@ -84,7 +84,8 @@ T.SwipeDelegate { Rectangle { width: parent.width height: parent.height - color: control.down ? control.Universal.listMediumColor : control.Universal.altMediumLowColor + color: control.down ? control.Universal.listMediumColor : + control.hovered ? control.Universal.listLowColor : control.Universal.altMediumLowColor Rectangle { width: parent.width height: parent.height diff --git a/src/imports/controls/universal/Switch.qml b/src/imports/controls/universal/Switch.qml index b42361dc..2b0012d5 100644 --- a/src/imports/controls/universal/Switch.qml +++ b/src/imports/controls/universal/Switch.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.Switch { id: control diff --git a/src/imports/controls/universal/SwitchDelegate.qml b/src/imports/controls/universal/SwitchDelegate.qml index 558f5cfb..5e4a1c52 100644 --- a/src/imports/controls/universal/SwitchDelegate.qml +++ b/src/imports/controls/universal/SwitchDelegate.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.SwitchDelegate { id: control @@ -76,8 +76,9 @@ T.SwitchDelegate { } background: Rectangle { - visible: control.down || control.highlighted || control.visualFocus - color: control.down ? control.Universal.listMediumColor : control.Universal.altMediumLowColor + visible: control.down || control.highlighted || control.visualFocus || control.hovered + color: control.down ? control.Universal.listMediumColor : + control.hovered ? control.Universal.listLowColor : control.Universal.altMediumLowColor Rectangle { width: parent.width height: parent.height diff --git a/src/imports/controls/universal/SwitchIndicator.qml b/src/imports/controls/universal/SwitchIndicator.qml index b3d44d9e..0f68d26a 100644 --- a/src/imports/controls/universal/SwitchIndicator.qml +++ b/src/imports/controls/universal/SwitchIndicator.qml @@ -34,21 +34,28 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 -Rectangle { +Item { implicitWidth: 44 implicitHeight: 20 - radius: 10 - color: !control.enabled ? "transparent" : - control.pressed ? control.Universal.baseMediumColor : - control.checked ? control.Universal.accent : "transparent" - border.color: !control.enabled ? control.Universal.baseLowColor : - control.checked && !control.pressed ? control.Universal.accent : control.Universal.baseMediumColor - border.width: 2 + Rectangle { + width: parent.width + height: parent.height + + radius: 10 + color: !control.enabled ? "transparent" : + control.pressed ? control.Universal.baseMediumColor : + control.checked ? control.Universal.accent : "transparent" + border.color: !control.enabled ? control.Universal.baseLowColor : + control.checked && !control.pressed ? control.Universal.accent : + control.hovered && !control.checked && !control.pressed ? control.Universal.baseHighColor : control.Universal.baseMediumColor + opacity: control.hovered && control.checked && !control.pressed ? (control.Universal.theme === Universal.Light ? 0.7 : 0.9) : 1.0 + border.width: 2 + } property Item control @@ -58,7 +65,8 @@ Rectangle { radius: 5 color: !control.enabled ? control.Universal.baseLowColor : - control.pressed || control.checked ? control.Universal.chromeWhiteColor : control.Universal.baseMediumHighColor + control.pressed || control.checked ? control.Universal.chromeWhiteColor : + control.hovered && !control.checked ? control.Universal.baseHighColor : control.Universal.baseMediumHighColor x: Math.max(5, Math.min(parent.width - width - 5, control.visualPosition * parent.width - (width / 2))) diff --git a/src/imports/controls/universal/TabBar.qml b/src/imports/controls/universal/TabBar.qml index 7c2e83a6..a8d80fec 100644 --- a/src/imports/controls/universal/TabBar.qml +++ b/src/imports/controls/universal/TabBar.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.7 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.TabBar { id: control diff --git a/src/imports/controls/universal/TabButton.qml b/src/imports/controls/universal/TabButton.qml index d503c86a..04f04291 100644 --- a/src/imports/controls/universal/TabButton.qml +++ b/src/imports/controls/universal/TabButton.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.TabButton { id: control @@ -56,7 +56,7 @@ T.TabButton { horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter - opacity: control.checked || control.down ? 1.0 : 0.2 - color: control.Universal.foreground + opacity: control.checked || control.down || control.hovered ? 1.0 : 0.2 + color: control.hovered ? control.Universal.baseMediumHighColor : control.Universal.foreground } } diff --git a/src/imports/controls/universal/TextArea.qml b/src/imports/controls/universal/TextArea.qml index 43fd40f4..8d422a2c 100644 --- a/src/imports/controls/universal/TextArea.qml +++ b/src/imports/controls/universal/TextArea.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.TextArea { id: control @@ -83,7 +83,8 @@ T.TextArea { border.width: 2 // TextControlBorderThemeThickness border.color: !control.enabled ? control.Universal.baseLowColor : - control.activeFocus ? control.Universal.accent : control.Universal.chromeDisabledLowColor + control.activeFocus ? control.Universal.accent : + control.hovered ? control.Universal.baseMediumColor : control.Universal.chromeDisabledLowColor color: control.enabled ? control.Universal.background : control.Universal.baseLowColor } } diff --git a/src/imports/controls/universal/TextField.qml b/src/imports/controls/universal/TextField.qml index bd496ecc..5723e484 100644 --- a/src/imports/controls/universal/TextField.qml +++ b/src/imports/controls/universal/TextField.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.TextField { id: control @@ -84,7 +84,8 @@ T.TextField { border.width: 2 // TextControlBorderThemeThickness border.color: !control.enabled ? control.Universal.baseLowColor : - control.activeFocus ? control.Universal.accent : control.Universal.chromeDisabledLowColor + control.activeFocus ? control.Universal.accent : + control.hovered ? control.Universal.baseMediumColor : control.Universal.chromeDisabledLowColor color: control.enabled ? control.Universal.background : control.Universal.baseLowColor } } diff --git a/src/imports/controls/universal/ToolBar.qml b/src/imports/controls/universal/ToolBar.qml index 48e200c0..35f79806 100644 --- a/src/imports/controls/universal/ToolBar.qml +++ b/src/imports/controls/universal/ToolBar.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.ToolBar { id: control @@ -47,8 +47,6 @@ T.ToolBar { contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) - contentItem: Item { } - background: Rectangle { implicitHeight: 48 // AppBarThemeCompactHeight color: control.Universal.chromeMediumColor diff --git a/src/imports/controls/universal/ToolButton.qml b/src/imports/controls/universal/ToolButton.qml index cb87130d..4dad17f7 100644 --- a/src/imports/controls/universal/ToolButton.qml +++ b/src/imports/controls/universal/ToolButton.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.ToolButton { id: control @@ -66,7 +66,13 @@ T.ToolButton { implicitWidth: 68 implicitHeight: 48 // AppBarThemeCompactHeight - color: control.down ? control.Universal.listMediumColor : - control.enabled && (control.highlighted || control.checked) ? control.Universal.accent : "transparent" + color: control.enabled && (control.highlighted || control.checked) ? control.Universal.accent : "transparent" + + Rectangle { + width: parent.width + height: parent.height + visible: control.down || control.hovered + color: control.down ? control.Universal.listMediumColor : control.Universal.listLowColor + } } } diff --git a/src/imports/controls/universal/ToolSeparator.qml b/src/imports/controls/universal/ToolSeparator.qml new file mode 100644 index 00000000..a4a5f18c --- /dev/null +++ b/src/imports/controls/universal/ToolSeparator.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 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.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 + +T.ToolSeparator { + id: control + + implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding) + implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding) + + leftPadding: vertical ? 16 : 12 + rightPadding: vertical ? 15 : 12 + topPadding: vertical ? 12 : 16 + bottomPadding: vertical ? 12 : 15 + + //! [contentItem] + contentItem: Rectangle { + implicitWidth: vertical ? 1 : 20 + implicitHeight: vertical ? 20 : 1 + color: control.Universal.baseMediumLowColor + } + //! [contentItem] +} diff --git a/src/imports/controls/universal/ToolTip.qml b/src/imports/controls/universal/ToolTip.qml index 423e729d..bd3d54e7 100644 --- a/src/imports/controls/universal/ToolTip.qml +++ b/src/imports/controls/universal/ToolTip.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.ToolTip { id: control diff --git a/src/imports/controls/universal/Tumbler.qml b/src/imports/controls/universal/Tumbler.qml index 7b134b84..e7093d0a 100644 --- a/src/imports/controls/universal/Tumbler.qml +++ b/src/imports/controls/universal/Tumbler.qml @@ -34,10 +34,11 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 -import QtQuick.Controls 2.0 +import QtQuick 2.8 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 T.Tumbler { id: control @@ -54,22 +55,16 @@ T.Tumbler { verticalAlignment: Text.AlignVCenter } - contentItem: PathView { - id: pathView + contentItem: TumblerView { + id: tumblerView model: control.model delegate: control.delegate - clip: true - pathItemCount: control.visibleItemCount + 1 - preferredHighlightBegin: 0.5 - preferredHighlightEnd: 0.5 - dragMargin: width / 2 - path: Path { - startX: pathView.width / 2 - startY: -pathView.delegateHeight / 2 + startX: tumblerView.width / 2 + startY: -tumblerView.delegateHeight / 2 PathLine { - x: pathView.width / 2 - y: pathView.pathItemCount * pathView.delegateHeight - pathView.delegateHeight / 2 + x: tumblerView.width / 2 + y: (control.visibleItemCount + 1) * tumblerView.delegateHeight - tumblerView.delegateHeight / 2 } } diff --git a/src/imports/controls/universal/qquickuniversalprogressring.cpp b/src/imports/controls/universal/qquickuniversalprogressring.cpp index ac087c78..1d733fed 100644 --- a/src/imports/controls/universal/qquickuniversalprogressring.cpp +++ b/src/imports/controls/universal/qquickuniversalprogressring.cpp @@ -241,7 +241,7 @@ QSGNode *QQuickUniversalProgressRing::updatePaintNode(QSGNode *oldNode, UpdatePa QSGOpacityNode *opacityNode = new QSGOpacityNode; transformNode->appendChildNode(opacityNode); - QSGRectangleNode *rectNode = d->sceneGraphContext()->createRectangleNode(); + QSGInternalRectangleNode *rectNode = d->sceneGraphContext()->createInternalRectangleNode(); rectNode->setAntialiasing(true); opacityNode->appendChildNode(rectNode); } @@ -249,7 +249,7 @@ QSGNode *QQuickUniversalProgressRing::updatePaintNode(QSGNode *oldNode, UpdatePa QSGNode *opacityNode = transformNode->firstChild(); Q_ASSERT(opacityNode->type() == QSGNode::OpacityNodeType); - QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(opacityNode->firstChild()); + QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode *>(opacityNode->firstChild()); Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType); rectNode->setRect(rect); diff --git a/src/imports/controls/universal/qquickuniversalprogressstrip.cpp b/src/imports/controls/universal/qquickuniversalprogressstrip.cpp index 16f394f1..32af5113 100644 --- a/src/imports/controls/universal/qquickuniversalprogressstrip.cpp +++ b/src/imports/controls/universal/qquickuniversalprogressstrip.cpp @@ -38,10 +38,10 @@ #include <QtCore/qmath.h> #include <QtCore/qeasingcurve.h> -#include <QtQuick/qsgsimplerectnode.h> #include <QtQuick/private/qquickitem_p.h> #include <QtQuick/private/qquickanimatorjob_p.h> #include <QtQuick/private/qsgadaptationlayer_p.h> +#include <QtQuick/qsgrectanglenode.h> QT_BEGIN_NAMESPACE @@ -106,7 +106,7 @@ void QQuickUniversalProgressStripAnimatorJob::updateCurrentTime(int time) if (!m_node) return; - QSGSimpleRectNode *geometryNode = static_cast<QSGSimpleRectNode *>(m_node->firstChild()); + QSGRectangleNode *geometryNode = static_cast<QSGRectangleNode *>(m_node->firstChild()); Q_ASSERT(!geometryNode || geometryNode->type() == QSGNode::GeometryNodeType); if (!geometryNode) return; @@ -286,9 +286,9 @@ QSGNode *QQuickUniversalProgressStrip::updatePaintNode(QSGNode *oldNode, UpdateP if (!m_indeterminate) bounds.setWidth(m_progress * bounds.width()); - QSGSimpleRectNode *geometryNode = static_cast<QSGSimpleRectNode *>(oldNode); + QSGRectangleNode *geometryNode = static_cast<QSGRectangleNode *>(oldNode); if (!geometryNode) - geometryNode = new QSGSimpleRectNode(bounds, Qt::transparent); + geometryNode = window()->createRectangleNode(); geometryNode->setRect(bounds); geometryNode->setColor(m_indeterminate ? Qt::transparent : m_color); @@ -317,7 +317,7 @@ QSGNode *QQuickUniversalProgressStrip::updatePaintNode(QSGNode *oldNode, UpdateP QSGOpacityNode *opacityNode = new QSGOpacityNode; ellipseNode->appendChildNode(opacityNode); - QSGRectangleNode *rectNode = d->sceneGraphContext()->createRectangleNode(); + QSGInternalRectangleNode *rectNode = d->sceneGraphContext()->createInternalRectangleNode(); rectNode->setAntialiasing(true); rectNode->setRadius(EllipseDiameter / 2); opacityNode->appendChildNode(rectNode); @@ -330,7 +330,7 @@ QSGNode *QQuickUniversalProgressStrip::updatePaintNode(QSGNode *oldNode, UpdateP QSGNode *opacityNode = ellipseNode->firstChild(); Q_ASSERT(opacityNode->type() == QSGNode::OpacityNodeType); - QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(opacityNode->firstChild()); + QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode *>(opacityNode->firstChild()); Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType); rectNode->setRect(QRectF((EllipseCount - i - 1) * (EllipseDiameter + EllipseOffset), (height() - EllipseDiameter) / 2, EllipseDiameter, EllipseDiameter)); diff --git a/src/imports/controls/universal/qquickuniversalstyle.cpp b/src/imports/controls/universal/qquickuniversalstyle.cpp index 2328f1a5..b33c27e8 100644 --- a/src/imports/controls/universal/qquickuniversalstyle.cpp +++ b/src/imports/controls/universal/qquickuniversalstyle.cpp @@ -132,6 +132,15 @@ static QRgb qquickuniversal_accent_color(QQuickUniversalStyle::Color accent) return colors[accent]; } +extern bool qt_is_dark_system_theme(); + +static QQuickUniversalStyle::Theme qquickuniversal_effective_theme(QQuickUniversalStyle::Theme theme) +{ + if (theme == QQuickUniversalStyle::System) + theme = qt_is_dark_system_theme() ? QQuickUniversalStyle::Dark : QQuickUniversalStyle::Light; + return theme; +} + // If no value was inherited from a parent or explicitly set, the "global" values are used. // The initial, default values of the globals are hard-coded here, but the environment // variables and .conf file override them if specified. @@ -164,6 +173,7 @@ QQuickUniversalStyle::Theme QQuickUniversalStyle::theme() const void QQuickUniversalStyle::setTheme(Theme theme) { + theme = qquickuniversal_effective_theme(theme); m_explicitTheme = true; if (m_theme == theme) return; @@ -536,7 +546,7 @@ void QQuickUniversalStyle::init() QByteArray themeValue = resolveSetting("QT_QUICK_CONTROLS_UNIVERSAL_THEME", settings, QStringLiteral("Theme")); Theme themeEnum = toEnumValue<Theme>(themeValue, &ok); if (ok) - GlobalTheme = m_theme = themeEnum; + GlobalTheme = m_theme = qquickuniversal_effective_theme(themeEnum); else if (!themeValue.isEmpty()) qWarning().nospace().noquote() << "Universal: unknown theme value: " << themeValue; diff --git a/src/imports/controls/universal/qquickuniversalstyle_p.h b/src/imports/controls/universal/qquickuniversalstyle_p.h index bf0a84d8..0d3a6dab 100644 --- a/src/imports/controls/universal/qquickuniversalstyle_p.h +++ b/src/imports/controls/universal/qquickuniversalstyle_p.h @@ -93,7 +93,7 @@ public: static QQuickUniversalStyle *qmlAttachedProperties(QObject *object); - enum Theme { Light, Dark }; + enum Theme { Light, Dark, System }; Q_ENUM(Theme) Theme theme() const; diff --git a/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp b/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp index ddad6548..394e9162 100644 --- a/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp +++ b/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp @@ -77,6 +77,7 @@ QtQuickControls2UniversalStylePlugin::QtQuickControls2UniversalStylePlugin(QObje void QtQuickControls2UniversalStylePlugin::registerTypes(const char *uri) { qmlRegisterUncreatableType<QQuickUniversalStyle>(uri, 2, 0, "Universal", tr("Universal is an attached property")); + qmlRegisterRevision<QQuickUniversalStyle, 1>(uri, 2, 1); } void QtQuickControls2UniversalStylePlugin::initializeEngine(QQmlEngine *engine, const char *uri) @@ -87,6 +88,7 @@ void QtQuickControls2UniversalStylePlugin::initializeEngine(QQmlEngine *engine, QByteArray import = QByteArray(uri) + ".impl"; qmlRegisterType<QQuickUniversalFocusRectangle>(import, 2, 0, "FocusRectangle"); + qmlRegisterRevision<QQuickUniversalFocusRectangle, 1>(import, 2, 1); qmlRegisterType<QQuickUniversalProgressRing>(import, 2, 0, "ProgressRing"); qmlRegisterType<QQuickUniversalProgressRingAnimator>(import, 2, 0, "ProgressRingAnimator"); qmlRegisterType<QQuickUniversalProgressStrip>(import, 2, 0, "ProgressStrip"); diff --git a/src/imports/controls/universal/universal.pri b/src/imports/controls/universal/universal.pri index 61b6912a..3697a2a6 100644 --- a/src/imports/controls/universal/universal.pri +++ b/src/imports/controls/universal/universal.pri @@ -7,6 +7,8 @@ QML_FILES += \ $$PWD/CheckIndicator.qml \ $$PWD/ComboBox.qml \ $$PWD/Dial.qml \ + $$PWD/Dialog.qml \ + $$PWD/DialogButtonBox.qml \ $$PWD/Drawer.qml \ $$PWD/Frame.qml \ $$PWD/GroupBox.qml \ @@ -14,6 +16,7 @@ QML_FILES += \ $$PWD/Label.qml \ $$PWD/Menu.qml \ $$PWD/MenuItem.qml \ + $$PWD/MenuSeparator.qml \ $$PWD/Page.qml \ $$PWD/PageIndicator.qml \ $$PWD/Pane.qml \ @@ -23,6 +26,7 @@ QML_FILES += \ $$PWD/RadioDelegate.qml \ $$PWD/RadioIndicator.qml \ $$PWD/RangeSlider.qml \ + $$PWD/RoundButton.qml \ $$PWD/ScrollBar.qml \ $$PWD/ScrollIndicator.qml \ $$PWD/Slider.qml \ @@ -38,6 +42,7 @@ QML_FILES += \ $$PWD/TextField.qml \ $$PWD/ToolBar.qml \ $$PWD/ToolButton.qml \ + $$PWD/ToolSeparator.qml \ $$PWD/ToolTip.qml \ $$PWD/Tumbler.qml diff --git a/src/imports/controls/universal/universal.pro b/src/imports/controls/universal/universal.pro index f10f21b0..c3835016 100644 --- a/src/imports/controls/universal/universal.pro +++ b/src/imports/controls/universal/universal.pro @@ -1,6 +1,6 @@ TARGET = qtquickcontrols2universalstyleplugin TARGETPATH = QtQuick/Controls.2/Universal -IMPORT_VERSION = 2.0 +IMPORT_VERSION = 2.1 QT += qml quick QT_PRIVATE += core-private gui-private qml-private quick-private quicktemplates2-private quickcontrols2-private |