diff options
Diffstat (limited to 'src/imports/controls')
306 files changed, 3799 insertions, 1526 deletions
diff --git a/src/imports/controls/ApplicationWindow.qml b/src/imports/controls/ApplicationWindow.qml index 98de8946..14a0b508 100644 --- a/src/imports/controls/ApplicationWindow.qml +++ b/src/imports/controls/ApplicationWindow.qml @@ -36,7 +36,7 @@ import QtQuick 2.6 import QtQuick.Window 2.2 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates 2.1 as T T.ApplicationWindow { id: window diff --git a/src/imports/controls/BusyIndicator.qml b/src/imports/controls/BusyIndicator.qml index 44c61355..06c263a6 100644 --- a/src/imports/controls/BusyIndicator.qml +++ b/src/imports/controls/BusyIndicator.qml @@ -35,9 +35,9 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Controls 2.0 -import QtQuick.Controls.impl 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.BusyIndicator { id: control diff --git a/src/imports/controls/Button.qml b/src/imports/controls/Button.qml index f875a97a..3b55089c 100644 --- a/src/imports/controls/Button.qml +++ b/src/imports/controls/Button.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates 2.1 as T T.Button { id: control diff --git a/src/imports/controls/CheckBox.qml b/src/imports/controls/CheckBox.qml index 3615948a..bc837434 100644 --- a/src/imports/controls/CheckBox.qml +++ b/src/imports/controls/CheckBox.qml @@ -35,9 +35,9 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls 2.0 -import QtQuick.Controls.impl 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 T.CheckBox { id: control diff --git a/src/imports/controls/CheckDelegate.qml b/src/imports/controls/CheckDelegate.qml index dcef7f77..e951ff6f 100644 --- a/src/imports/controls/CheckDelegate.qml +++ b/src/imports/controls/CheckDelegate.qml @@ -35,9 +35,9 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls 2.0 -import QtQuick.Controls.impl 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 T.CheckDelegate { id: control diff --git a/src/imports/controls/ComboBox.qml b/src/imports/controls/ComboBox.qml index 01a6d2ab..aeeabbb7 100644 --- a/src/imports/controls/ComboBox.qml +++ b/src/imports/controls/ComboBox.qml @@ -36,8 +36,8 @@ import QtQuick 2.6 import QtQuick.Window 2.2 -import QtQuick.Controls 2.0 -import QtQuick.Templates 2.0 as T +import QtQuick.Controls 2.1 +import QtQuick.Templates 2.1 as T T.ComboBox { id: control @@ -62,6 +62,7 @@ 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 } //! [delegate] @@ -98,6 +99,7 @@ T.ComboBox { (control.pressed || popup.visible ? "#d0d0d0" : "#e0e0e0") border.color: "#0066ff" border.width: control.visualFocus ? 2 : 0 + visible: !control.flat || control.pressed } //! [background] diff --git a/src/imports/controls/Dial.qml b/src/imports/controls/Dial.qml index aa138126..87c44b38 100644 --- a/src/imports/controls/Dial.qml +++ b/src/imports/controls/Dial.qml @@ -35,9 +35,9 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Controls 2.0 -import QtQuick.Controls.impl 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.Dial { id: control diff --git a/src/imports/controls/Dialog.qml b/src/imports/controls/Dialog.qml new file mode 100644 index 00000000..79130a26 --- /dev/null +++ b/src/imports/controls/Dialog.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** 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.6 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls 2.1 + +T.Dialog { + id: control + + implicitWidth: Math.max(background ? background.implicitWidth : 0, + header ? header.implicitWidth : 0, + footer ? footer.implicitWidth : 0, + contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0) + implicitHeight: Math.max(background ? background.implicitHeight : 0, + (header ? header.implicitHeight : 0) + (footer ? footer.implicitHeight : 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 + + contentItem: Item { } + + background: Rectangle { + border.color: "#353637" + } + + buttonBox: DialogButtonBox { + position: DialogButtonBox.Footer + } +} diff --git a/src/imports/controls/DialogButtonBox.qml b/src/imports/controls/DialogButtonBox.qml new file mode 100644 index 00000000..4d8da360 --- /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.6 +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 8cf4e5e5..6abd40e4 100644 --- a/src/imports/controls/Drawer.qml +++ b/src/imports/controls/Drawer.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates 2.1 as T T.Drawer { id: control diff --git a/src/imports/controls/Frame.qml b/src/imports/controls/Frame.qml index cb2ffd35..aee658f4 100644 --- a/src/imports/controls/Frame.qml +++ b/src/imports/controls/Frame.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates 2.1 as T T.Frame { id: control diff --git a/src/imports/controls/GroupBox.qml b/src/imports/controls/GroupBox.qml index 0e9d79fc..3e9cdad6 100644 --- a/src/imports/controls/GroupBox.qml +++ b/src/imports/controls/GroupBox.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates 2.1 as T T.GroupBox { id: control diff --git a/src/imports/controls/ItemDelegate.qml b/src/imports/controls/ItemDelegate.qml index d884a328..7ef41723 100644 --- a/src/imports/controls/ItemDelegate.qml +++ b/src/imports/controls/ItemDelegate.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates 2.1 as T T.ItemDelegate { id: control diff --git a/src/imports/controls/Label.qml b/src/imports/controls/Label.qml index d0f01613..5c3de5de 100644 --- a/src/imports/controls/Label.qml +++ b/src/imports/controls/Label.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates 2.1 as T T.Label { id: control diff --git a/src/imports/controls/Menu.qml b/src/imports/controls/Menu.qml index e349a89d..8fe9155e 100644 --- a/src/imports/controls/Menu.qml +++ b/src/imports/controls/Menu.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Controls 2.0 -import QtQuick.Templates 2.0 as T +import QtQuick.Controls 2.1 +import QtQuick.Templates 2.1 as T T.Menu { id: control diff --git a/src/imports/controls/MenuItem.qml b/src/imports/controls/MenuItem.qml index ead943b0..9ee77685 100644 --- a/src/imports/controls/MenuItem.qml +++ b/src/imports/controls/MenuItem.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates 2.1 as T T.MenuItem { id: control diff --git a/src/imports/controls/MenuSeparator.qml b/src/imports/controls/MenuSeparator.qml new file mode 100644 index 00000000..f74047bb --- /dev/null +++ b/src/imports/controls/MenuSeparator.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** 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.6 +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: "#ccc" + } + //! [contentItem] +} diff --git a/src/imports/controls/Page.qml b/src/imports/controls/Page.qml index 3cbb1569..111d561c 100644 --- a/src/imports/controls/Page.qml +++ b/src/imports/controls/Page.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates 2.1 as T T.Page { id: control diff --git a/src/imports/controls/PageIndicator.qml b/src/imports/controls/PageIndicator.qml index 5b61acd5..86870db6 100644 --- a/src/imports/controls/PageIndicator.qml +++ b/src/imports/controls/PageIndicator.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates 2.1 as T T.PageIndicator { id: control diff --git a/src/imports/controls/Pane.qml b/src/imports/controls/Pane.qml index eb79129c..685cf24e 100644 --- a/src/imports/controls/Pane.qml +++ b/src/imports/controls/Pane.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates 2.1 as T T.Pane { id: control diff --git a/src/imports/controls/Popup.qml b/src/imports/controls/Popup.qml index 72428f23..b0015137 100644 --- a/src/imports/controls/Popup.qml +++ b/src/imports/controls/Popup.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates 2.1 as T T.Popup { id: control diff --git a/src/imports/controls/ProgressBar.qml b/src/imports/controls/ProgressBar.qml index fb312b18..31fc1bad 100644 --- a/src/imports/controls/ProgressBar.qml +++ b/src/imports/controls/ProgressBar.qml @@ -35,9 +35,9 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls 2.0 -import QtQuick.Controls.impl 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 T.ProgressBar { id: control diff --git a/src/imports/controls/RadioButton.qml b/src/imports/controls/RadioButton.qml index 8a2d7c99..f6f256c1 100644 --- a/src/imports/controls/RadioButton.qml +++ b/src/imports/controls/RadioButton.qml @@ -35,9 +35,9 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Controls 2.0 -import QtQuick.Controls.impl 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.RadioButton { id: control diff --git a/src/imports/controls/RadioDelegate.qml b/src/imports/controls/RadioDelegate.qml index d745054a..b2b82dd6 100644 --- a/src/imports/controls/RadioDelegate.qml +++ b/src/imports/controls/RadioDelegate.qml @@ -35,9 +35,9 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Controls 2.0 -import QtQuick.Controls.impl 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.RadioDelegate { id: control diff --git a/src/imports/controls/RangeSlider.qml b/src/imports/controls/RangeSlider.qml index 7353e2b5..a201d446 100644 --- a/src/imports/controls/RangeSlider.qml +++ b/src/imports/controls/RangeSlider.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates 2.1 as T T.RangeSlider { id: control diff --git a/src/imports/controls/ScrollBar.qml b/src/imports/controls/ScrollBar.qml index 8ccbc328..46a5bc5b 100644 --- a/src/imports/controls/ScrollBar.qml +++ b/src/imports/controls/ScrollBar.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates 2.1 as T T.ScrollBar { id: control diff --git a/src/imports/controls/ScrollIndicator.qml b/src/imports/controls/ScrollIndicator.qml index cd7b53fd..702611c7 100644 --- a/src/imports/controls/ScrollIndicator.qml +++ b/src/imports/controls/ScrollIndicator.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates 2.1 as T T.ScrollIndicator { id: control diff --git a/src/imports/controls/Slider.qml b/src/imports/controls/Slider.qml index 896dbca0..37eb618a 100644 --- a/src/imports/controls/Slider.qml +++ b/src/imports/controls/Slider.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates 2.1 as T T.Slider { id: control diff --git a/src/imports/controls/SpinBox.qml b/src/imports/controls/SpinBox.qml index 89853116..20ca0d5d 100644 --- a/src/imports/controls/SpinBox.qml +++ b/src/imports/controls/SpinBox.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates 2.1 as T T.SpinBox { id: control diff --git a/src/imports/controls/StackView.qml b/src/imports/controls/StackView.qml index aa95c6a7..610b3418 100644 --- a/src/imports/controls/StackView.qml +++ b/src/imports/controls/StackView.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.4 -import QtQuick.Controls 2.0 -import QtQuick.Templates 2.0 as T +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 7ffd5a29..6053aa94 100644 --- a/src/imports/controls/SwipeDelegate.qml +++ b/src/imports/controls/SwipeDelegate.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates 2.1 as T T.SwipeDelegate { id: control diff --git a/src/imports/controls/SwipeView.qml b/src/imports/controls/SwipeView.qml index 71676f12..53310810 100644 --- a/src/imports/controls/SwipeView.qml +++ b/src/imports/controls/SwipeView.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Controls 2.0 -import QtQuick.Templates 2.0 as T +import QtQuick.Controls 2.1 +import QtQuick.Templates 2.1 as T T.SwipeView { id: control @@ -51,6 +51,7 @@ T.SwipeView { //! [contentItem] 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 0810626f..124efda1 100644 --- a/src/imports/controls/Switch.qml +++ b/src/imports/controls/Switch.qml @@ -35,9 +35,9 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls 2.0 -import QtQuick.Controls.impl 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 T.Switch { id: control diff --git a/src/imports/controls/SwitchDelegate.qml b/src/imports/controls/SwitchDelegate.qml index 430fc8ec..4bbc3403 100644 --- a/src/imports/controls/SwitchDelegate.qml +++ b/src/imports/controls/SwitchDelegate.qml @@ -35,9 +35,9 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls 2.0 -import QtQuick.Controls.impl 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 T.SwitchDelegate { id: control diff --git a/src/imports/controls/TabBar.qml b/src/imports/controls/TabBar.qml index 6a575167..2c3a665b 100644 --- a/src/imports/controls/TabBar.qml +++ b/src/imports/controls/TabBar.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.7 -import QtQuick.Templates 2.0 as T +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 870edb6d..77a4ca17 100644 --- a/src/imports/controls/TabButton.qml +++ b/src/imports/controls/TabButton.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates 2.1 as T T.TabButton { id: control diff --git a/src/imports/controls/TextArea.qml b/src/imports/controls/TextArea.qml index f1ec6dfa..8fe34661 100644 --- a/src/imports/controls/TextArea.qml +++ b/src/imports/controls/TextArea.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates 2.1 as T T.TextArea { id: control diff --git a/src/imports/controls/TextField.qml b/src/imports/controls/TextField.qml index 2234646f..5fdb6fc9 100644 --- a/src/imports/controls/TextField.qml +++ b/src/imports/controls/TextField.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates 2.1 as T T.TextField { id: control diff --git a/src/imports/controls/ToolBar.qml b/src/imports/controls/ToolBar.qml index a787df61..c0a2c467 100644 --- a/src/imports/controls/ToolBar.qml +++ b/src/imports/controls/ToolBar.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates 2.1 as T T.ToolBar { id: control diff --git a/src/imports/controls/ToolButton.qml b/src/imports/controls/ToolButton.qml index 2887d6b4..276e1f83 100644 --- a/src/imports/controls/ToolButton.qml +++ b/src/imports/controls/ToolButton.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +import QtQuick.Templates 2.1 as T T.ToolButton { id: control diff --git a/src/imports/controls/ToolSeparator.qml b/src/imports/controls/ToolSeparator.qml new file mode 100644 index 00000000..7e2192a2 --- /dev/null +++ b/src/imports/controls/ToolSeparator.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** 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.6 +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: "#ccc" + } + //! [contentItem] +} diff --git a/src/imports/controls/ToolTip.qml b/src/imports/controls/ToolTip.qml index 876e2274..ec729a12 100644 --- a/src/imports/controls/ToolTip.qml +++ b/src/imports/controls/ToolTip.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Controls 2.0 -import QtQuick.Templates 2.0 as T +import QtQuick.Controls 2.1 +import QtQuick.Templates 2.1 as T T.ToolTip { id: control diff --git a/src/imports/controls/Tumbler.qml b/src/imports/controls/Tumbler.qml index 13bc0859..371c705f 100644 --- a/src/imports/controls/Tumbler.qml +++ b/src/imports/controls/Tumbler.qml @@ -35,15 +35,15 @@ ****************************************************************************/ import QtQuick 2.6 -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.Tumbler { id: control implicitWidth: 60 implicitHeight: 200 - //! [delegate] delegate: Text { id: label text: modelData @@ -53,29 +53,20 @@ T.Tumbler { horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } - //! [delegate] - //! [contentItem] - 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 } } property real delegateHeight: control.availableHeight / control.visibleItemCount } - //! [contentItem] } diff --git a/src/imports/controls/controls.pri b/src/imports/controls/controls.pri index 523356a1..9eeb2c1f 100644 --- a/src/imports/controls/controls.pri +++ b/src/imports/controls/controls.pri @@ -17,6 +17,8 @@ QML_CONTROLS = \ CheckIndicator.qml \ ComboBox.qml \ Dial.qml \ + Dialog.qml \ + DialogButtonBox.qml \ Drawer.qml \ Frame.qml \ GroupBox.qml \ @@ -24,6 +26,7 @@ QML_CONTROLS = \ Label.qml \ Menu.qml \ MenuItem.qml \ + MenuSeparator.qml \ Page.qml \ PageIndicator.qml \ Pane.qml \ @@ -49,6 +52,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 282c3217..999245c8 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..af2c6d5c 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" 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-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 bec995d3..49725b93 100644 --- a/src/imports/controls/doc/qtquickcontrols2.qdocconf +++ b/src/imports/controls/doc/qtquickcontrols2.qdocconf @@ -29,7 +29,7 @@ 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. @@ -37,19 +37,16 @@ depends = qtcore qtgui qtdoc qtqml qtquick qtquickdialogs qtquickcontrols qtquic exampledirs += ../../../../examples/quickcontrols2 \ ../ \ ../../../quicktemplates2 \ - ../../calendar \ - ../../../../tests/auto/controls/data \ snippets 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/qtquickcontrols2-busyindicator-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-busyindicator-custom.qml index 82ed9cdc..847ad736 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-busyindicator-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-button-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-button-custom.qml index eac6b831..dbe53f4d 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-button-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-button-disabled.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-button-disabled.qml index f4555c90..c7399b9a 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-button-disabled.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-button-focused.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-button-focused.qml index a99346a6..ea220fde 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-button-focused.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-button-normal.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-button-normal.qml index f206bcec..385d4abb 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-button-normal.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-button-pressed.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-button-pressed.qml index 8a941561..edf0b324 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-button-pressed.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-checkbox-checked.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-checked.qml index 075e6342..e5c466da 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-checked.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-checkbox-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-custom.qml index 0465ec80..9645a4b6 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-checkbox-disabled.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-disabled.qml index 4878cf31..3bfbb730 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-disabled.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-checkbox-focused.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-focused.qml index 93f1c214..fd7c7fea 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-focused.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-checkbox-normal.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-normal.qml index a840116e..dba9e7e9 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-normal.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-checkdelegate-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-checkdelegate-custom.qml index 483f9838..83f0ef86 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-checkdelegate-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-combobox-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-custom.qml index bd261e52..12d56a56 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-combobox-delegate.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-delegate.qml index d8b5d1fa..2817d956 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-delegate.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-combobox-popup.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-popup.qml index 36569e15..1ac43234 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-popup.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-dial-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-dial-custom.qml index 658acc4b..6742abf6 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-dial-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-dial-handle.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-dial-handle.qml index 19d943a6..d9a61682 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-dial-handle.qml +++ b/src/imports/controls/doc/snippets/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/qtlabscalendar-monthgrid.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-dialog-modal.qml index 16f872b8..c151ceed 100644 --- a/src/imports/controls/doc/snippets/qtlabscalendar-monthgrid.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,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] -MonthGrid { - month: Calendar.December - year: 2015 - locale: Qt.locale("en_US") +Dialog { + id: dialog + modal: true + standardButtons: Dialog.Ok } //! [1] +} diff --git a/src/imports/controls/doc/snippets/qtlabscalendar-dayofweekrow.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-dialog-modeless.qml index 5ea3714c..45e1c2c0 100644 --- a/src/imports/controls/doc/snippets/qtlabscalendar-dayofweekrow.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,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: false + standardButtons: Dialog.Ok } //! [1] +} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-dialog.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-dialog.qml new file mode 100644 index 00000000..c5de0b71 --- /dev/null +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-dialog.qml @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** 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 + +Item { + width: dialog.implicitWidth + height: dialog.implicitHeight +//! [1] +Dialog { + id: dialog + standardButtons: Dialog.Ok | Dialog.Cancel + + onAccepted: console.log("Ok clicked") + onRejected: console.log("Cancel clicked") +} +//! [1] +} diff --git a/src/imports/controls/doc/snippets/basic-example.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-dialogbuttonbox-attached.qml index 62ab2466..a93cda30 100644 --- a/src/imports/controls/doc/snippets/basic-example.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-dialogbuttonbox-attached.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,18 @@ ** ****************************************************************************/ -//! [0] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -ApplicationWindow { - title: "My Application" - width: 640 - height: 480 - visible: true +import QtQuick 2.0 +import QtQuick.Controls 2.1 +//! [1] +DialogButtonBox { + Button { + text: qsTr("Save") + DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole + } Button { - text: "Push Me" - anchors.centerIn: parent + text: qsTr("Close") + DialogButtonBox.buttonRole: DialogButtonBox.DestructiveRole } } -//! [0] +//! [1] diff --git a/src/imports/controls/doc/snippets/qtlabscalendar-weeknumbercolumn.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-dialogbuttonbox.qml index e58e5c7b..41e6cf23 100644 --- a/src/imports/controls/doc/snippets/qtlabscalendar-weeknumbercolumn.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. @@ -26,12 +26,13 @@ ****************************************************************************/ import QtQuick 2.0 -import Qt.labs.calendar 1.0 +import QtQuick.Controls 2.1 //! [1] -WeekNumberColumn { - month: Calendar.December - year: 2015 - locale: Qt.locale("en_US") +DialogButtonBox { + standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel + + onAccepted: console.log("Ok clicked") + onRejected: console.log("Cancel clicked") } //! [1] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-frame-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-frame-custom.qml index d11c431e..f2b5d254 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-frame-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-frame.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-frame.qml index 1ede733d..98f177ef 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-frame.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-groupbox-checkable.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-checkable.qml index a2999925..db58593f 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-checkable.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-groupbox-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-custom.qml index cb9ed049..bf21e022 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-groupbox-label.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-label.qml index 74d0ea52..bef99d0b 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-label.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-groupbox.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox.qml index f79f3aef..7d4f328c 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-itemdelegate-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-itemdelegate-custom.qml index 002aae69..0935d8f6 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-itemdelegate-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-itemdelegate.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-itemdelegate.qml index 143b3323..733434e8 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-itemdelegate.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-label-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-label-custom.qml index 98dbdc5e..2eedb29f 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-label-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-label.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-label.qml index 4346c0eb..cf59c49a 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-label.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-menu-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-menu-custom.qml index a6971232..f4507714 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-menu-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtlabscalendar-calendarmodel.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-menuseparator-custom.qml index dfbf4fbc..b5d8b18b 100644 --- a/src/imports/controls/doc/snippets/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/snippets/qtlabscalendar-dayofweekrow-layout.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-menuseparator.qml index ce41d224..d41d3cf9 100644 --- a/src/imports/controls/doc/snippets/qtlabscalendar-dayofweekrow-layout.qml +++ 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,23 +25,36 @@ ** ****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Layouts 1.0 -import Qt.labs.calendar 1.0 +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.1 -//! [1] -ColumnLayout { - DayOfWeekRow { - locale: grid.locale - Layout.fillWidth: true +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 {} - MonthGrid { - id: grid - month: Calendar.December - year: 2015 - locale: Qt.locale("en_US") - Layout.fillWidth: true + MenuItem { + text: qsTr("Exit") } } -//! [1] +} +//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-custom.qml index 65112ef4..225ba423 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-pageindicator-delegate.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-delegate.qml index 4b3ccf23..c7ae046f 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-delegate.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-pageindicator.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator.qml index 237bc6e7..cf91d6f2 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-pane-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-pane-custom.qml index 80519939..42c30795 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-pane-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-pane.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-pane.qml index 3d86499f..b7b8fa5d 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-pane.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-progressbar-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-custom.qml index 00c9ae67..c29956e4 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-progressbar-disabled.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-disabled.qml index 81c9f4ac..885f058a 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-disabled.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-disabled.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 ProgressBar { value: 0.5 diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-normal.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-normal.qml index a332d4c5..1a4eb8cc 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-normal.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-normal.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 ProgressBar { value: 0.5 diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-checked.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-checked.qml index c1b1acce..6d144589 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-checked.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-checked.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 RadioButton { text: "Checked" diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-custom.qml index dba262be..1d9661a5 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-radiobutton-disabled.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-disabled.qml index 7ab68910..3aefc293 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-disabled.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-disabled.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 RadioButton { text: "Disabled" diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-focused.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-focused.qml index 316a4653..2de742a4 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-focused.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-focused.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 RadioButton { text: "Focused" diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-normal.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-normal.qml index b5ea853b..cc4248c4 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-normal.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-normal.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 RadioButton { text: "Normal" diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-radiodelegate-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-radiodelegate-custom.qml index 6efb7803..91125921 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-radiodelegate-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-rangeslider-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-custom.qml index 7e488d14..86fae061 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-rangeslider-disabled.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-disabled.qml index e239b72f..e7ef44ef 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-disabled.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-disabled.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 RangeSlider { first.value: 0.25 diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-first-handle-focused.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-first-handle-focused.qml index a05c8291..4328c203 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-first-handle-focused.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-first-handle-focused.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 RangeSlider { first.value: 0.25 diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-first-handle.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-first-handle.qml index c5f064b0..a8d58ae0 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-first-handle.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-first-handle.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 RangeSlider { first.value: 0.25 diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-normal.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-normal.qml index a41fbfad..f2cbb1fa 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-normal.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-normal.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 RangeSlider { first.value: 0.25 diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-second-handle-focused.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-second-handle-focused.qml index ec19d0c0..37b4940d 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-second-handle-focused.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-second-handle-focused.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 RangeSlider { first.value: 0.25 diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-second-handle.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-second-handle.qml index 2e2123de..9e206ecb 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-second-handle.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-second-handle.qml @@ -26,7 +26,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.1 RangeSlider { first.value: 0.25 diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-active.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-active.qml index 086541c8..1570aff4 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-active.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-scrollbar-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-custom.qml index 0bf13b3c..05b3f3aa 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-scrollindicator-active.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-active.qml index c118c7aa..954b449c 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-active.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-scrollindicator-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-custom.qml index 5720f4f7..97930e1e 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-slider-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-slider-custom.qml index ebc11f46..6201cbf8 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-slider-disabled.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-slider-disabled.qml index bde161aa..bd60a974 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-disabled.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-slider-disabled.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/qtquickcontrols2-slider-focused.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-slider-focused.qml index b32f8b5a..05ee2ee3 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-focused.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-slider-focused.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/qtquickcontrols2-slider-handle.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-slider-handle.qml index 20b569f3..fa23972c 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-handle.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-slider-normal.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-slider-normal.qml index 8363e862..ab824904 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-normal.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-slider-normal.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/qtquickcontrols2-spinbox-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-custom.qml index 6433fd80..cfbd8400 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-spinbox-double.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-double.qml index 15af31ae..ad22b856 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-double.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-spinbox-down.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-down.qml index 419dae5c..ecd2a659 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-down.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-spinbox-textual.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-textual.qml index 814b8b28..e6b7c735 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-textual.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-spinbox-up.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-up.qml index b4b0fab3..0b2c3fea 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-up.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-spinbox.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox.qml index 6616ed60..d8c54714 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox.qml +++ b/src/imports/controls/doc/snippets/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/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-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate-custom.qml index ae63efed..087e17fe 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-swipedelegate.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate.qml new file mode 100644 index 00000000..36c96190 --- /dev/null +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate.qml @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** 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 + +//! [file] +ListView { + id: listView + anchors.fill: parent + model: ListModel { + 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: model.sender + " - " + model.title + width: parent.width + + 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: 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) + + background: Rectangle { + color: deleteLabel.SwipeDelegate.pressed ? Qt.darker("tomato", 1.1) : "tomato" + } + } + } +} +//! [file] 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-swipeview-indicator.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-swipeview-indicator.qml index 2ba8df9c..3afcc3e2 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-swipeview-indicator.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-switch-checked.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-switch-checked.qml index f9a18b1c..3a6dfc7c 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-checked.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-switch-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-switch-custom.qml index 698c1a05..5152040d 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-switch-disabled.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-switch-disabled.qml index a40586b5..6eb53084 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-disabled.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-switch-focused.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-switch-focused.qml index f98f2c90..6ca19062 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-focused.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-switch-normal.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-switch-normal.qml index a55c2854..339874d7 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-normal.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-switchdelegate-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-switchdelegate-custom.qml index 8d0daa0a..e06af484 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-switchdelegate-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-tabbar-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tabbar-custom.qml index 1873fba9..305101c0 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-tabbar-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-tabbar.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tabbar.qml index b445ee67..e3a67c30 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-tabbar.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-tabbutton.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tabbutton.qml index 67e5e1e0..9fef1e59 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-tabbutton.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-textarea-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-textarea-custom.qml index f70c7135..dd6035c0 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-textarea-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-textarea-flickable.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-textarea-flickable.qml index e11750cb..500e09c3 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-textarea-flickable.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-textfield-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-custom.qml index 0deb0e5c..8e5d897c 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-textfield-disabled.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-disabled.qml index ac798f53..21c351c4 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-disabled.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-textfield-focused.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-focused.qml index a4e1b3b1..ddea7c51 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-focused.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-textfield-normal.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-normal.qml index 12c7ead9..29f7fb9c 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-normal.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-toolbar-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-toolbar-custom.qml index 3e98808c..e8d268c5 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-toolbar-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-toolbar.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-toolbar.qml index fd6754f8..98a13b7b 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-toolbar.qml +++ b/src/imports/controls/doc/snippets/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 //! [1] ToolBar { diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-toolbutton-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-toolbutton-custom.qml index 10491cb5..449266c1 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-toolbutton-custom.qml +++ b/src/imports/controls/doc/snippets/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/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/qtlabscalendar-monthgrid-layout.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-toolseparator.qml index 346e6099..7770d14c 100644 --- a/src/imports/controls/doc/snippets/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/qtquickcontrols2-tooltip-hover.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-hover.qml index 330ab83c..27b03a63 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-hover.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-tooltip-pressandhold.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-pressandhold.qml index eddb09e6..7d285528 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-pressandhold.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-tooltip-slider.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-slider.qml index e6a386c1..ca08ce72 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-slider.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-tooltip.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip.qml index c85f91bb..ef08e174 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-tumbler-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-custom.qml index d2b4f960..f1c2b806 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-custom.qml +++ b/src/imports/controls/doc/snippets/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/qtquickcontrols2-tumbler-delegate.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-delegate.qml index 4d389ab7..4d2c7349 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-delegate.qml +++ b/src/imports/controls/doc/snippets/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/snippets/qtlabscalendar-weeknumbercolumn-layout.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-listView.qml index d105553f..ff3ecd81 100644 --- a/src/imports/controls/doc/snippets/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/src/calendar/qtlabscalendar-index.qdoc b/src/imports/controls/doc/src/calendar/qtlabscalendar-index.qdoc deleted file mode 100644 index d99b3880..00000000 --- a/src/imports/controls/doc/src/calendar/qtlabscalendar-index.qdoc +++ /dev/null @@ -1,51 +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 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 -*/ 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-customize.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc index 559c89f0..d98b70d1 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 { @@ -299,7 +299,7 @@ \qml import QtQuick 2.6 - import QtQuick.Controls 2.0 + import QtQuick.Controls 2.1 import MyStyle 1.0 @@ -456,7 +456,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 @@ -471,6 +471,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}. @@ -673,6 +690,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} @@ -680,7 +707,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 } @@ -697,4 +724,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 e6fdcb10..bbdf7f89 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc @@ -115,7 +115,7 @@ \row \li Can be used on Desktop \li Yes - \li Yes \b * + \li Yes \row \li Can be used on Mobile \li Yes @@ -130,8 +130,6 @@ \li C++ \endtable - \b {* No hover effects} - \section2 Porting Qt Quick Controls Code The API of Qt Quick Controls 2 is very similar to Qt Quick Controls, but it @@ -262,6 +260,9 @@ \li \l [QML QtQuickControls] {MenuItem} \li \l [QML QtQuickControls2] {MenuItem} \row + \li \l [QML QtQuickControls] {MenuSeparator} + \li \l [QML QtQuickControls2] {MenuSeparator} + \row \li \mdash \li \l [QML QtQuickControls2] {Page} \row @@ -349,6 +350,9 @@ \li \l [QML QtQuickControls2] {ToolButton} \row \li \mdash + \li \l [QML QtQuickControls2] {ToolSeparator} + \row + \li \mdash \li \l [QML QtQuickControls2] {ToolTip} \row \li \l [QML QtQuickControls] {TreeView} 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 171239ce..1155032b 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 @@ -91,5 +92,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 9416a505..74a7ece1 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 @@ -85,8 +85,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 Button { text: "Stop" @@ -110,8 +110,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 @@ -310,6 +310,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. \endstyleproperty @@ -323,7 +328,7 @@ \qml import QtQuick 2.0 - import QtQuick.Controls.Material 2.0 + import QtQuick.Controls.Material 2.1 Rectangle { color: Material.color(Material.Red) 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-styles.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc index 1ad0c228..1a1b7b3c 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc @@ -136,15 +136,15 @@ of the methods described earlier) and certain style-specific attributes. The following example specifies that the preferred style is the Material style. Furthermore, when the application is run with the Material style, its theme is light and the accent color is - brown. However, if the application is run with the Universal style instead, the theme - is dark and the accent color is red. + brown. However, if the application is run with the 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] @@ -154,25 +154,16 @@ In order to make it possible for Qt Quick Controls 2 to find the configuration file, it must be built into application's resources using the \l {The Qt Resource System}. - Here's an example \c .qrc file: - - \code - <!DOCTYPE RCC><RCC version="1.0"> - <qresource prefix="/"> - <file>qtquickcontrols2.conf</file> - </qresource> - </RCC> - \endcode \note Qt Quick Controls 2 uses a file selector to load the configuration file. It is possible to provide a different configuration file for different platforms and locales. See \l QFileSelector documentation for more details. - Finally, the \c .qrc file must be listed in the application's \c .pro file so that - the build system knows about it. For example: + Finally, the configuration file must be listed in the application's \c .pro file so + that the build system knows about it. For example: \code - RESOURCES = application.qrc + RESOURCES += qtquickcontrols2.conf \endcode \section1 Related Information diff --git a/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc index 2e9a7c60..cb6ac17e 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 @@ -85,8 +85,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 Button { text: "Stop" @@ -110,8 +110,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 @@ -229,6 +229,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. \endstyleproperty @@ -241,7 +246,7 @@ \qml import QtQuick 2.0 - import QtQuick.Controls.Universal 2.0 + import QtQuick.Controls.Universal 2.1 Rectangle { color: Universal.color(Universal.Red) 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..0514e5e3 100644 --- a/src/imports/controls/material/ApplicationWindow.qml +++ b/src/imports/controls/material/ApplicationWindow.qml @@ -36,8 +36,8 @@ import QtQuick 2.6 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..02950a60 100644 --- a/src/imports/controls/material/BoxShadow.qml +++ b/src/imports/controls/material/BoxShadow.qml @@ -35,9 +35,10 @@ ****************************************************************************/ import QtQuick 2.6 -import QtGraphicalEffects 1.0 +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..c2851b91 100644 --- a/src/imports/controls/material/BusyIndicator.qml +++ b/src/imports/controls/material/BusyIndicator.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.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..9ed5263c 100644 --- a/src/imports/controls/material/Button.qml +++ b/src/imports/controls/material/Button.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.Button { id: control @@ -53,6 +53,8 @@ T.Button { leftPadding: padding - 4 rightPadding: padding - 4 + hoverEnabled: Qt.styleHints.useHoverEffects + Material.elevation: flat ? control.down || control.hovered ? 2 : 0 : control.down ? 8 : 2 Material.background: flat ? "transparent" : undefined @@ -78,16 +80,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 +107,16 @@ T.Button { layer.effect: ElevationEffect { elevation: control.Material.elevation } + + Ripple { + clipRadius: 2 + width: parent.width + height: parent.height + trigger: control.flat ? Ripple.Press : Ripple.Release + 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..290dbe55 100644 --- a/src/imports/controls/material/CheckBox.qml +++ b/src/imports/controls/material/CheckBox.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.CheckBox { id: control @@ -54,10 +54,24 @@ T.CheckBox { topPadding: padding + 7 bottomPadding: padding + 7 + hoverEnabled: Qt.styleHints.useHoverEffects + indicator: CheckIndicator { 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 { diff --git a/src/imports/controls/material/CheckDelegate.qml b/src/imports/controls/material/CheckDelegate.qml index d5785467..9fff50d2 100644 --- a/src/imports/controls/material/CheckDelegate.qml +++ b/src/imports/controls/material/CheckDelegate.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.CheckDelegate { id: control @@ -54,6 +54,8 @@ T.CheckDelegate { bottomPadding: 14 spacing: 16 + hoverEnabled: Qt.styleHints.useHoverEffects + indicator: CheckIndicator { x: text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2 y: control.topPadding + (control.availableHeight - height) / 2 @@ -76,7 +78,18 @@ 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 + trigger: Ripple.Release + 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..a373bdb8 100644 --- a/src/imports/controls/material/CheckIndicator.qml +++ b/src/imports/controls/material/CheckIndicator.qml @@ -35,7 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Controls.Material 2.0 +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 f13c6922..a48c6884 100644 --- a/src/imports/controls/material/ComboBox.qml +++ b/src/imports/controls/material/ComboBox.qml @@ -36,16 +36,14 @@ import QtQuick 2.6 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, @@ -56,21 +54,25 @@ T.ComboBox { spacing: 6 padding: 16 - // Don't use toolTextColor, as that is often white when we have a white background. - Material.foreground: Material.foreground === Material.toolTextColor ? undefined : Material.foreground + hoverEnabled: Qt.styleHints.useHoverEffects + + Material.elevation: flat ? control.pressed || control.hovered ? 2 : 0 + : control.pressed ? 8 : 2 + Material.background: flat ? "transparent" : undefined + Material.foreground: flat ? undefined : Material.foreground 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.primaryTextColor : control.Material.hintTextColor) } contentItem: Text { @@ -89,7 +91,7 @@ T.ComboBox { implicitWidth: 120 implicitHeight: 48 - radius: 2 + radius: control.flat ? 0 : 2 color: control.Material.dialogColor Behavior on color { @@ -98,17 +100,21 @@ 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 + trigger: Ripple.Press + pressed: control.pressed + anchor: control + active: control.pressed || control.visualFocus || control.hovered + color: control.Material.rippleColor } } @@ -146,7 +152,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..7fbf351c 100644 --- a/src/imports/controls/material/Dial.qml +++ b/src/imports/controls/material/Dial.qml @@ -35,8 +35,9 @@ ****************************************************************************/ import QtQuick 2.6 -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 +import QtQuick.Controls.Material.impl 2.1 T.Dial { id: control @@ -44,6 +45,8 @@ T.Dial { implicitWidth: 100 implicitHeight: 100 + hoverEnabled: Qt.styleHints.useHoverEffects + background: Rectangle { x: control.width / 2 - width / 2 y: control.height / 2 - height / 2 @@ -55,7 +58,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 +75,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..55ff671b --- /dev/null +++ b/src/imports/controls/material/Dialog.qml @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** 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.6 +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.implicitWidth : 0, + footer ? footer.implicitWidth : 0, + contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0) + implicitHeight: Math.max(background ? background.implicitHeight : 0, + (header ? header.implicitHeight : 0) + (footer ? footer.implicitHeight : 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 + + 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 } + } + + contentItem: Item { } + + background: Rectangle { + radius: 2 + color: control.Material.dialogColor + + layer.enabled: control.Material.elevation > 0 + layer.effect: ElevationEffect { + elevation: control.Material.elevation + } + } + + buttonBox: DialogButtonBox { + position: DialogButtonBox.Footer + } +} diff --git a/src/imports/controls/material/DialogButtonBox.qml b/src/imports/controls/material/DialogButtonBox.qml new file mode 100644 index 00000000..46a2b3ba --- /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.6 +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 b3ee94f7..e0b698e2 100644 --- a/src/imports/controls/material/Drawer.qml +++ b/src/imports/controls/material/Drawer.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.Drawer { id: control diff --git a/src/imports/controls/material/ElevationEffect.qml b/src/imports/controls/material/ElevationEffect.qml index 4ee4369c..00d7b997 100644 --- a/src/imports/controls/material/ElevationEffect.qml +++ b/src/imports/controls/material/ElevationEffect.qml @@ -35,26 +35,26 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +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..4c8b7f01 100644 --- a/src/imports/controls/material/Frame.qml +++ b/src/imports/controls/material/Frame.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.Frame { id: control diff --git a/src/imports/controls/material/GroupBox.qml b/src/imports/controls/material/GroupBox.qml index 6d84197c..48827792 100644 --- a/src/imports/controls/material/GroupBox.qml +++ b/src/imports/controls/material/GroupBox.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.GroupBox { id: control diff --git a/src/imports/controls/material/ItemDelegate.qml b/src/imports/controls/material/ItemDelegate.qml index e43fc981..b9db276d 100644 --- a/src/imports/controls/material/ItemDelegate.qml +++ b/src/imports/controls/material/ItemDelegate.qml @@ -35,8 +35,9 @@ ****************************************************************************/ import QtQuick 2.6 -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 +import QtQuick.Controls.Material.impl 2.1 T.ItemDelegate { id: control @@ -51,6 +52,8 @@ T.ItemDelegate { padding: 16 spacing: 16 + hoverEnabled: Qt.styleHints.useHoverEffects + contentItem: Text { leftPadding: control.checkable && !control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0 rightPadding: control.checkable && control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0 @@ -67,7 +70,18 @@ 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 + trigger: Ripple.Release + 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..3a69207f 100644 --- a/src/imports/controls/material/Label.qml +++ b/src/imports/controls/material/Label.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -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.Label { id: control diff --git a/src/imports/controls/material/Menu.qml b/src/imports/controls/material/Menu.qml index b11c00b6..ed21dc46 100644 --- a/src/imports/controls/material/Menu.qml +++ b/src/imports/controls/material/Menu.qml @@ -35,10 +35,10 @@ ****************************************************************************/ 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.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..d3348d35 100644 --- a/src/imports/controls/material/MenuItem.qml +++ b/src/imports/controls/material/MenuItem.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.MenuItem { id: control @@ -54,6 +54,8 @@ T.MenuItem { bottomPadding: 12 spacing: 16 + hoverEnabled: Qt.styleHints.useHoverEffects + indicator: CheckIndicator { x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2 y: control.topPadding + (control.availableHeight - height) / 2 @@ -77,7 +79,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..c6ba401f 100644 --- a/src/imports/controls/material/Ripple.qml +++ b/src/imports/controls/material/MenuSeparator.qml @@ -35,17 +35,21 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Controls.Material 2.0 +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..f829788e 100644 --- a/src/imports/controls/material/Page.qml +++ b/src/imports/controls/material/Page.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -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.Page { id: control diff --git a/src/imports/controls/material/PageIndicator.qml b/src/imports/controls/material/PageIndicator.qml index 78372afe..d413adcc 100644 --- a/src/imports/controls/material/PageIndicator.qml +++ b/src/imports/controls/material/PageIndicator.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -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.PageIndicator { id: control diff --git a/src/imports/controls/material/Pane.qml b/src/imports/controls/material/Pane.qml index 251492ea..d9828a2a 100644 --- a/src/imports/controls/material/Pane.qml +++ b/src/imports/controls/material/Pane.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.Pane { id: control diff --git a/src/imports/controls/material/Popup.qml b/src/imports/controls/material/Popup.qml index 19fd6b79..2cd85846 100644 --- a/src/imports/controls/material/Popup.qml +++ b/src/imports/controls/material/Popup.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.Popup { id: control diff --git a/src/imports/controls/material/ProgressBar.qml b/src/imports/controls/material/ProgressBar.qml index eb8bf3ce..fa7867e6 100644 --- a/src/imports/controls/material/ProgressBar.qml +++ b/src/imports/controls/material/ProgressBar.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.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..a2450f49 100644 --- a/src/imports/controls/material/RadioButton.qml +++ b/src/imports/controls/material/RadioButton.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.RadioButton { id: control @@ -54,10 +54,24 @@ T.RadioButton { topPadding: padding + 6 bottomPadding: padding + 6 + hoverEnabled: Qt.styleHints.useHoverEffects + indicator: RadioIndicator { 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 { diff --git a/src/imports/controls/material/RadioDelegate.qml b/src/imports/controls/material/RadioDelegate.qml index 95bfb19b..1d056aa8 100644 --- a/src/imports/controls/material/RadioDelegate.qml +++ b/src/imports/controls/material/RadioDelegate.qml @@ -35,8 +35,9 @@ ****************************************************************************/ import QtQuick 2.6 -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 +import QtQuick.Controls.Material.impl 2.1 T.RadioDelegate { id: control @@ -53,6 +54,8 @@ T.RadioDelegate { bottomPadding: 8 spacing: 16 + hoverEnabled: Qt.styleHints.useHoverEffects + indicator: RadioIndicator { x: text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2 y: control.topPadding + (control.availableHeight - height) / 2 @@ -75,7 +78,18 @@ 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 + trigger: Ripple.Release + 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..2a2fabe4 100644 --- a/src/imports/controls/material/RadioIndicator.qml +++ b/src/imports/controls/material/RadioIndicator.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +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..c2672703 100644 --- a/src/imports/controls/material/RangeSlider.qml +++ b/src/imports/controls/material/RangeSlider.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.RangeSlider { id: control @@ -51,12 +51,15 @@ T.RangeSlider { padding: 6 + hoverEnabled: Qt.styleHints.useHoverEffects + first.handle: SliderHandle { x: control.leftPadding + (horizontal ? control.first.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2) y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.first.visualPosition * (control.availableHeight - height)) value: first.value handleHasFocus: activeFocus handlePressed: first.pressed + handleHovered: first.hovered } second.handle: SliderHandle { @@ -65,6 +68,7 @@ T.RangeSlider { value: second.value handleHasFocus: activeFocus handlePressed: second.pressed + handleHovered: second.hovered } background: Rectangle { 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/ScrollBar.qml b/src/imports/controls/material/ScrollBar.qml index 84f2d33a..4547a903 100644 --- a/src/imports/controls/material/ScrollBar.qml +++ b/src/imports/controls/material/ScrollBar.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -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.ScrollBar { id: control @@ -46,33 +46,45 @@ 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 + + hoverEnabled: Qt.styleHints.useHoverEffects 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 + } + + states: State { + name: "active" + when: control.active + } - transitions: Transition { + 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..1e0fd8ff 100644 --- a/src/imports/controls/material/ScrollIndicator.qml +++ b/src/imports/controls/material/ScrollIndicator.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -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.ScrollIndicator { id: control diff --git a/src/imports/controls/material/Slider.qml b/src/imports/controls/material/Slider.qml index 15c8edb2..dd6063bb 100644 --- a/src/imports/controls/material/Slider.qml +++ b/src/imports/controls/material/Slider.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.Slider { id: control @@ -49,12 +49,15 @@ T.Slider { padding: 6 + hoverEnabled: Qt.styleHints.useHoverEffects + handle: SliderHandle { x: control.leftPadding + (horizontal ? control.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2) y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height)) value: control.value handleHasFocus: control.visualFocus handlePressed: control.pressed + handleHovered: control.hovered } background: Rectangle { diff --git a/src/imports/controls/material/SliderHandle.qml b/src/imports/controls/material/SliderHandle.qml index 49f833d0..1c02cf16 100644 --- a/src/imports/controls/material/SliderHandle.qml +++ b/src/imports/controls/material/SliderHandle.qml @@ -35,7 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Controls.Material 2.0 +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 3325f172..74811c16 100644 --- a/src/imports/controls/material/SpinBox.qml +++ b/src/imports/controls/material/SpinBox.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.SpinBox { id: control @@ -58,6 +58,8 @@ T.SpinBox { leftPadding: (control.mirrored ? (up.indicator ? up.indicator.width : 0) : (down.indicator ? down.indicator.width : 0)) rightPadding: (control.mirrored ? (down.indicator ? down.indicator.width : 0) : (up.indicator ? up.indicator.width : 0)) + hoverEnabled: Qt.styleHints.useHoverEffects + validator: IntValidator { locale: control.locale.name bottom: Math.min(control.from, control.to) @@ -104,17 +106,23 @@ T.SpinBox { inputMethodHints: Qt.ImhFormattedNumbersOnly } - 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 @@ -132,17 +140,23 @@ T.SpinBox { } } - 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 diff --git a/src/imports/controls/material/StackView.qml b/src/imports/controls/material/StackView.qml index 982a37cb..dcbe0ad0 100644 --- a/src/imports/controls/material/StackView.qml +++ b/src/imports/controls/material/StackView.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.4 -import QtQuick.Templates 2.0 as T +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..bc9b49c2 100644 --- a/src/imports/controls/material/SwipeDelegate.qml +++ b/src/imports/controls/material/SwipeDelegate.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.SwipeDelegate { id: control @@ -54,6 +54,8 @@ T.SwipeDelegate { bottomPadding: 8 spacing: 16 + hoverEnabled: Qt.styleHints.useHoverEffects + contentItem: Text { leftPadding: !control.mirrored ? (control.indicator ? control.indicator.width + control.spacing : 0) : 0 rightPadding: control.mirrored ? (control.indicator ? control.indicator.width + control.spacing : 0) : 0 @@ -83,10 +85,21 @@ 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 + trigger: Ripple.Release + 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..0cdd0758 100644 --- a/src/imports/controls/material/SwipeView.qml +++ b/src/imports/controls/material/SwipeView.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T +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..32f083f8 100644 --- a/src/imports/controls/material/Switch.qml +++ b/src/imports/controls/material/Switch.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 +import QtQuick.Templates 2.1 as T T.Switch { id: control @@ -52,10 +52,21 @@ T.Switch { padding: 8 spacing: 8 + hoverEnabled: Qt.styleHints.useHoverEffects + indicator: SwitchIndicator { 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 { diff --git a/src/imports/controls/material/SwitchDelegate.qml b/src/imports/controls/material/SwitchDelegate.qml index 097f0acd..b88dbe01 100644 --- a/src/imports/controls/material/SwitchDelegate.qml +++ b/src/imports/controls/material/SwitchDelegate.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.SwitchDelegate { id: control @@ -54,6 +54,8 @@ T.SwitchDelegate { bottomPadding: 8 spacing: 16 + hoverEnabled: Qt.styleHints.useHoverEffects + indicator: SwitchIndicator { x: text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2 y: control.topPadding + (control.availableHeight - height) / 2 @@ -76,7 +78,18 @@ 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 + trigger: Ripple.Release + 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..114c3956 100644 --- a/src/imports/controls/material/SwitchIndicator.qml +++ b/src/imports/controls/material/SwitchIndicator.qml @@ -35,28 +35,19 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Controls.Material 2.0 -import QtQuick.Controls.Material.impl 2.0 +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..5b2c8888 100644 --- a/src/imports/controls/material/TabBar.qml +++ b/src/imports/controls/material/TabBar.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.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 095645b4..9e6e8333 100644 --- a/src/imports/controls/material/TabButton.qml +++ b/src/imports/controls/material/TabButton.qml @@ -35,8 +35,9 @@ ****************************************************************************/ import QtQuick 2.6 -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 +import QtQuick.Controls.Material.impl 2.1 T.TabButton { id: control @@ -49,6 +50,8 @@ T.TabButton { padding: 12 + hoverEnabled: Qt.styleHints.useHoverEffects + contentItem: Text { text: control.text font: control.font @@ -58,7 +61,14 @@ T.TabButton { verticalAlignment: Text.AlignVCenter } - background: Item { + background: Ripple { implicitHeight: 48 + + clip: true + trigger: Ripple.Release + 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 b37e2311..3a95600e 100644 --- a/src/imports/controls/material/TextArea.qml +++ b/src/imports/controls/material/TextArea.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -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.TextArea { id: control @@ -51,6 +51,8 @@ T.TextArea { topPadding: 8 bottomPadding: 16 + hoverEnabled: Qt.styleHints.useHoverEffects + color: enabled ? Material.primaryTextColor : Material.hintTextColor selectionColor: Material.accentColor selectedTextColor: Material.primaryHighlightedTextColor diff --git a/src/imports/controls/material/TextField.qml b/src/imports/controls/material/TextField.qml index 9c576ca6..a6406afa 100644 --- a/src/imports/controls/material/TextField.qml +++ b/src/imports/controls/material/TextField.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -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.TextField { id: control @@ -49,6 +49,8 @@ T.TextField { topPadding: 8 bottomPadding: 16 + hoverEnabled: Qt.styleHints.useHoverEffects + color: enabled ? Material.primaryTextColor : Material.hintTextColor selectionColor: Material.accentColor selectedTextColor: Material.primaryHighlightedTextColor diff --git a/src/imports/controls/material/ToolBar.qml b/src/imports/controls/material/ToolBar.qml index 1bcffd82..ce4f64ec 100644 --- a/src/imports/controls/material/ToolBar.qml +++ b/src/imports/controls/material/ToolBar.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.Templates 2.1 as T +import QtQuick.Controls.Material 2.1 +import QtQuick.Controls.Material.impl 2.1 T.ToolBar { id: control diff --git a/src/imports/controls/material/ToolButton.qml b/src/imports/controls/material/ToolButton.qml index d8c945a7..df4b23f8 100644 --- a/src/imports/controls/material/ToolButton.qml +++ b/src/imports/controls/material/ToolButton.qml @@ -35,8 +35,9 @@ ****************************************************************************/ import QtQuick 2.6 -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 +import QtQuick.Controls.Material.impl 2.1 T.ToolButton { id: control @@ -49,20 +50,33 @@ T.ToolButton { padding: 6 + hoverEnabled: Qt.styleHints.useHoverEffects + 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.primaryTextColor 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 + trigger: square ? Ripple.Press : Ripple.Release + 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..f48fffd4 --- /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.6 +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..d055bae6 100644 --- a/src/imports/controls/material/ToolTip.qml +++ b/src/imports/controls/material/ToolTip.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -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.ToolTip { id: control diff --git a/src/imports/controls/material/Tumbler.qml b/src/imports/controls/material/Tumbler.qml index 7e914319..255d4b5d 100644 --- a/src/imports/controls/material/Tumbler.qml +++ b/src/imports/controls/material/Tumbler.qml @@ -35,9 +35,10 @@ ****************************************************************************/ 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 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 @@ -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/material/material.pri b/src/imports/controls/material/material.pri index d6247895..437edeee 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,7 @@ QML_FILES += \ $$PWD/RadioDelegate.qml \ $$PWD/RadioIndicator.qml \ $$PWD/RangeSlider.qml \ - $$PWD/Ripple.qml \ + $$PWD/RectangularGlow.qml \ $$PWD/ScrollBar.qml \ $$PWD/ScrollIndicator.qml \ $$PWD/Slider.qml \ @@ -55,5 +60,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..a1cfed94 --- /dev/null +++ b/src/imports/controls/material/qquickmaterialripple_p.h @@ -0,0 +1,119 @@ +/**************************************************************************** +** +** 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> + +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 9361e535..76332c51 100644 --- a/src/imports/controls/material/qquickmaterialstyle.cpp +++ b/src/imports/controls/material/qquickmaterialstyle.cpp @@ -404,37 +404,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), @@ -471,6 +458,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; @@ -858,10 +848,9 @@ QColor QQuickMaterialStyle::dividerColor() const return QColor::fromRgba(m_theme == Light ? dividerColorLight : dividerColorDark); } -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; @@ -872,45 +861,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 @@ -925,37 +883,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 @@ -963,12 +891,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); @@ -1012,6 +940,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); @@ -1024,7 +957,9 @@ QColor QQuickMaterialStyle::drawerBackgroundColor() const QColor QQuickMaterialStyle::dialogColor() const { - return QColor::fromRgba(m_theme == Light ? dialogColorLight : dialogColorDark); + if (!m_hasBackground) + return QColor::fromRgba(m_theme == Light ? dialogColorLight : dialogColorDark); + return backgroundColor(); } QColor QQuickMaterialStyle::backgroundDimColor() const @@ -1217,7 +1152,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 044d30d9..78ba88da 100644 --- a/src/imports/controls/material/qquickmaterialstyle_p.h +++ b/src/imports/controls/material/qquickmaterialstyle_p.h @@ -77,19 +77,11 @@ class QQuickMaterialStyle : public QQuickStyleAttached Q_PROPERTY(QColor dropShadowColor READ dropShadowColor NOTIFY paletteChanged FINAL) Q_PROPERTY(QColor dividerColor READ dividerColor 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 drawerBackgroundColor READ drawerBackgroundColor NOTIFY paletteChanged FINAL) Q_PROPERTY(QColor dialogColor READ dialogColor NOTIFY paletteChanged FINAL) @@ -109,7 +102,8 @@ class QQuickMaterialStyle : public QQuickStyleAttached public: enum Theme { Light, - Dark + Dark, + System }; enum Color { @@ -204,20 +198,12 @@ public: QColor dropShadowColor() const; QColor dividerColor() 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; @@ -225,6 +211,7 @@ public: QColor switchDisabledTrackColor() const; QColor switchDisabledHandleColor() const; QColor scrollBarColor() const; + QColor scrollBarHoveredColor() const; QColor scrollBarPressedColor() const; QColor drawerBackgroundColor() const; QColor dialogColor() const; @@ -256,7 +243,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..0700e7bf 100644 --- a/src/imports/controls/plugins.qmltypes +++ b/src/imports/controls/plugins.qmltypes @@ -4,146 +4,48 @@ 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" prototype: "QQuickItem" - exports: ["QtQuick.Controls.impl/BusyRing 2.0"] + exports: ["QtQuick.Controls.impl/BusyRing 2.1"] exportMetaObjectRevisions: [0] } Component { - name: "QQuickButtonGroup" - 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 } - } - Component { name: "QQuickDialRing" defaultProperty: "data" prototype: "QQuickPaintedItem" - exports: ["QtQuick.Controls.impl/DialRing 2.0"] + exports: ["QtQuick.Controls.impl/DialRing 2.1"] exportMetaObjectRevisions: [0] Property { name: "progress"; type: "double" } Property { name: "color"; type: "QColor" } } Component { - name: "QQuickPaintedItem" + name: "QQuickProgressStrip" 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" } + exports: ["QtQuick.Controls.impl/ProgressStrip 2.1"] + exportMetaObjectRevisions: [0] + Property { name: "indeterminate"; type: "bool" } + Property { name: "progress"; type: "double" } } Component { - name: "QQuickProgressStrip" + name: "QQuickTumblerView" defaultProperty: "data" prototype: "QQuickItem" - exports: ["QtQuick.Controls.impl/ProgressStrip 2.0"] + exports: ["QtQuick.Controls.impl/TumblerView 2.1"] exportMetaObjectRevisions: [0] - Property { name: "indeterminate"; type: "bool" } - Property { name: "progress"; type: "double" } + Property { name: "model"; type: "QVariant" } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "path"; type: "QQuickPath"; isPointer: true } } Component { prototype: "QQuickApplicationWindow" @@ -186,17 +88,13 @@ Module { defaultProperty: "data" } Component { - prototype: "QQuickItem" - name: "QtQuick.Controls.impl/CheckIndicator 2.0" - exports: ["QtQuick.Controls.impl/CheckIndicator 2.0"] - exportMetaObjectRevisions: [0] + prototype: "QQuickRectangle" + name: "QtQuick.Controls.impl/CheckIndicator 2.1" + exports: ["QtQuick.Controls.impl/CheckIndicator 2.1"] + exportMetaObjectRevisions: [1] 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" @@ -215,6 +113,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"] @@ -327,17 +241,13 @@ Module { defaultProperty: "data" } Component { - prototype: "QQuickItem" - name: "QtQuick.Controls.impl/RadioIndicator 2.0" - exports: ["QtQuick.Controls.impl/RadioIndicator 2.0"] - exportMetaObjectRevisions: [0] + prototype: "QQuickRectangle" + name: "QtQuick.Controls.impl/RadioIndicator 2.1" + exports: ["QtQuick.Controls.impl/RadioIndicator 2.1"] + exportMetaObjectRevisions: [1] 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" @@ -421,9 +331,9 @@ Module { } Component { prototype: "QQuickItem" - name: "QtQuick.Controls.impl/SwitchIndicator 2.0" - exports: ["QtQuick.Controls.impl/SwitchIndicator 2.0"] - exportMetaObjectRevisions: [0] + name: "QtQuick.Controls.impl/SwitchIndicator 2.1" + exports: ["QtQuick.Controls.impl/SwitchIndicator 2.1"] + exportMetaObjectRevisions: [1] isComposite: true defaultProperty: "data" Property { name: "control"; type: "QQuickItem"; isPointer: true } @@ -477,6 +387,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 +410,7 @@ Module { isComposite: true defaultProperty: "data" } + Component { name: "QQuickAbstractButton" defaultProperty: "data" @@ -559,6 +478,36 @@ Module { 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" @@ -625,8 +574,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 +589,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 +669,58 @@ Module { Method { name: "decrease" } } Component { + name: "QQuickDialog" + defaultProperty: "contentData" + prototype: "QQuickPopup" + exports: ["QtQuick.Templates/Dialog 2.1"] + exportMetaObjectRevisions: [0] + Property { name: "header"; type: "QQuickItem"; isPointer: true } + Property { name: "footer"; type: "QQuickItem"; isPointer: true } + Property { name: "buttonBox"; type: "QQmlComponent"; 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" @@ -750,6 +756,172 @@ Module { Signal { name: "implicitHeightChanged2"; revision: 1 } } Component { + name: "QQuickItem" + defaultProperty: "data" + prototype: "QObject" + Enum { + name: "TransformOrigin" + values: { + "TopLeft": 0, + "Top": 1, + "TopRight": 2, + "Left": 3, + "Center": 4, + "Right": 5, + "BottomLeft": 6, + "Bottom": 7, + "BottomRight": 8 + } + } + Property { name: "parent"; type: "QQuickItem"; isPointer: true } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "x"; type: "double" } + Property { name: "y"; type: "double" } + Property { name: "z"; type: "double" } + Property { name: "width"; type: "double" } + Property { name: "height"; type: "double" } + Property { name: "opacity"; type: "double" } + Property { name: "enabled"; type: "bool" } + Property { name: "visible"; type: "bool" } + Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true } + Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true } + Property { name: "state"; type: "string" } + Property { name: "childrenRect"; type: "QRectF"; isReadonly: true } + Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true } + Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "baselineOffset"; type: "double" } + Property { name: "clip"; type: "bool" } + Property { name: "focus"; type: "bool" } + Property { name: "activeFocus"; type: "bool"; isReadonly: true } + Property { name: "activeFocusOnTab"; revision: 1; type: "bool" } + Property { name: "rotation"; type: "double" } + Property { name: "scale"; type: "double" } + Property { name: "transformOrigin"; type: "TransformOrigin" } + Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true } + Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true } + Property { name: "smooth"; type: "bool" } + Property { name: "antialiasing"; type: "bool" } + Property { name: "implicitWidth"; type: "double" } + Property { name: "implicitHeight"; type: "double" } + Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true } + Signal { + name: "childrenRectChanged" + Parameter { type: "QRectF" } + } + Signal { + name: "baselineOffsetChanged" + Parameter { type: "double" } + } + Signal { + name: "stateChanged" + Parameter { type: "string" } + } + Signal { + name: "focusChanged" + Parameter { type: "bool" } + } + Signal { + name: "activeFocusChanged" + Parameter { type: "bool" } + } + Signal { + name: "activeFocusOnTabChanged" + revision: 1 + Parameter { type: "bool" } + } + Signal { + name: "parentChanged" + Parameter { type: "QQuickItem"; isPointer: true } + } + Signal { + name: "transformOriginChanged" + Parameter { type: "TransformOrigin" } + } + Signal { + name: "smoothChanged" + Parameter { type: "bool" } + } + Signal { + name: "antialiasingChanged" + Parameter { type: "bool" } + } + Signal { + name: "clipChanged" + Parameter { type: "bool" } + } + Signal { + name: "windowChanged" + revision: 1 + Parameter { name: "window"; type: "QQuickWindow"; isPointer: true } + } + Method { name: "update" } + Method { + name: "grabToImage" + revision: 2 + type: "bool" + Parameter { name: "callback"; type: "QJSValue" } + Parameter { name: "targetSize"; type: "QSize" } + } + Method { + name: "grabToImage" + revision: 2 + type: "bool" + Parameter { name: "callback"; type: "QJSValue" } + } + Method { + name: "contains" + type: "bool" + Parameter { name: "point"; type: "QPointF" } + } + Method { + name: "mapToGlobal" + revision: 7 + type: "QPointF" + Parameter { name: "point"; type: "QPointF" } + } + Method { + name: "mapFromGlobal" + revision: 7 + type: "QPointF" + Parameter { name: "point"; type: "QPointF" } + } + Method { + name: "mapFromItem" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "mapToItem" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { name: "forceActiveFocus" } + Method { + name: "forceActiveFocus" + Parameter { name: "reason"; type: "Qt::FocusReason" } + } + Method { + name: "nextItemInFocusChain" + revision: 1 + type: "QQuickItem*" + Parameter { name: "forward"; type: "bool" } + } + Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" } + Method { + name: "childAt" + type: "QQuickItem*" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + } + Component { name: "QQuickItemDelegate" defaultProperty: "data" prototype: "QQuickAbstractButton" @@ -813,8 +985,8 @@ Module { 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" } } @@ -856,8 +1028,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: { @@ -904,6 +1079,8 @@ Module { Property { name: "leftPadding"; type: "double" } Property { name: "rightPadding"; type: "double" } Property { name: "bottomPadding"; type: "double" } + Property { name: "allowVerticalFlip"; revision: 1; type: "bool" } + Property { name: "allowHorizontalFlip"; revision: 1; type: "bool" } Property { name: "locale"; type: "QLocale" } Property { name: "font"; type: "QFont" } Property { name: "parent"; type: "QQuickItem"; isPointer: true } @@ -923,6 +1100,8 @@ Module { Property { name: "transformOrigin"; type: "TransformOrigin" } Property { name: "enter"; type: "QQuickTransition"; isPointer: true } Property { name: "exit"; type: "QQuickTransition"; isPointer: true } + Signal { name: "allowVerticalFlipChanged"; revision: 1 } + Signal { name: "allowHorizontalFlipChanged"; revision: 1 } Signal { name: "windowChanged" Parameter { name: "window"; type: "QQuickWindow"; isPointer: true } @@ -933,6 +1112,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 +1149,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,6 +1183,8 @@ 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" } } @@ -1072,8 +1261,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 +1286,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 +1319,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 +1329,20 @@ 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" } } 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 +1363,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 +1427,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 { @@ -1459,8 +1691,11 @@ Module { 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,12 +1703,26 @@ 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 } } + Signal { + name: "pressed" + revision: 1 + Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true } + } + Signal { + name: "released" + revision: 1 + Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true } + } } Component { name: "QQuickTextAreaAttached" @@ -1554,6 +1803,7 @@ Module { Property { name: "cursorPosition"; type: "int" } Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true } Property { name: "cursorDelegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "overwriteMode"; type: "bool" } Property { name: "selectionStart"; type: "int"; isReadonly: true } Property { name: "selectionEnd"; type: "int"; isReadonly: true } Property { name: "selectedText"; type: "string"; isReadonly: true } @@ -1623,6 +1873,10 @@ Module { Parameter { name: "isCursorVisible"; type: "bool" } } Signal { + name: "overwriteModeChanged" + Parameter { name: "overwriteMode"; type: "bool" } + } + Signal { name: "activeFocusOnPressChanged" Parameter { name: "activeFocusOnPressed"; type: "bool" } } @@ -1748,19 +2002,36 @@ Module { 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 } + Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true } + } + Signal { + name: "pressed" + revision: 1 + Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true } + } + Signal { + name: "released" + revision: 1 + Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true } } } Component { @@ -1838,6 +2109,7 @@ Module { Property { name: "cursorPosition"; type: "int" } Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true } Property { name: "cursorDelegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "overwriteMode"; type: "bool" } Property { name: "selectionStart"; type: "int"; isReadonly: true } Property { name: "selectionEnd"; type: "int"; isReadonly: true } Property { name: "selectedText"; type: "string"; isReadonly: true } @@ -1891,6 +2163,10 @@ Module { Parameter { name: "isCursorVisible"; type: "bool" } } Signal { + name: "overwriteModeChanged" + Parameter { name: "overwriteMode"; type: "bool" } + } + Signal { name: "maximumLengthChanged" Parameter { name: "maximumLength"; type: "int" } } @@ -2000,7 +2276,7 @@ Module { Component { name: "QQuickToolBar" defaultProperty: "contentData" - prototype: "QQuickFrame" + prototype: "QQuickPane" exports: ["QtQuick.Templates/ToolBar 2.0"] exportMetaObjectRevisions: [0] Enum { @@ -2020,6 +2296,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" @@ -2055,8 +2341,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 +2353,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 +2362,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/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 1982b392..3cd3b8b2 100644 --- a/src/imports/controls/qtquickcontrols2plugin.cpp +++ b/src/imports/controls/qtquickcontrols2plugin.cpp @@ -41,6 +41,7 @@ #include <QtCore/private/qfileselector_p.h> #include <QtQuickControls2/qquickstyle.h> +#include <QtQuickControls2/private/qquickstyle_p.h> #include <QtQuickTemplates2/private/qquickabstractbutton_p.h> #include <QtQuickTemplates2/private/qquickbuttongroup_p.h> #include <QtQuickTemplates2/private/qquickcontainer_p.h> @@ -49,6 +50,7 @@ #include <QtQuickControls2/private/qquickstyleplugin_p.h> #include <QtQuickControls2/private/qquickstyleselector_p.h> #include <QtQuickControls2/private/qquickcolorimageprovider_p.h> +#include <QtQuickControls2/private/qquicktumblerview_p.h> #include "qquickbusyindicatorring_p.h" #include "qquickdialring_p.h" @@ -88,13 +90,14 @@ void QtQuickControls2Plugin::registerTypes(const char *uri) qmlRegisterType<QQuickContainer>(uri, 2, 0, "Container"); qmlRegisterType<QQuickControl>(uri, 2, 0, "Control"); - 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()); + 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"); @@ -134,6 +137,14 @@ 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<QQuickContainer,1>(uri, 2, 1, "Container"); + 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("ToolSeparator.qml")), uri, 2, 1, "ToolSeparator"); } void QtQuickControls2Plugin::initializeEngine(QQmlEngine *engine, const char *uri) @@ -148,6 +159,7 @@ 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"); 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..bd3185a4 100644 --- a/src/imports/controls/universal/ApplicationWindow.qml +++ b/src/imports/controls/universal/ApplicationWindow.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.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..35b27bf8 100644 --- a/src/imports/controls/universal/BusyIndicator.qml +++ b/src/imports/controls/universal/BusyIndicator.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.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..f784c670 100644 --- a/src/imports/controls/universal/Button.qml +++ b/src/imports/controls/universal/Button.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.Button { id: control @@ -47,6 +47,8 @@ T.Button { contentItem.implicitHeight + topPadding + bottomPadding) baselineOffset: contentItem.y + contentItem.baselineOffset + hoverEnabled: Qt.styleHints.useHoverEffects + padding: 8 topPadding: padding - 4 bottomPadding: padding - 4 @@ -72,5 +74,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..d856f3ea 100644 --- a/src/imports/controls/universal/CheckBox.qml +++ b/src/imports/controls/universal/CheckBox.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 +import QtQuick.Controls.Universal.impl 2.1 T.CheckBox { id: control @@ -49,6 +49,8 @@ T.CheckBox { indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding) baselineOffset: contentItem.y + contentItem.baselineOffset + hoverEnabled: Qt.styleHints.useHoverEffects + padding: 6 spacing: 8 diff --git a/src/imports/controls/universal/CheckDelegate.qml b/src/imports/controls/universal/CheckDelegate.qml index c0ca272e..cd7245fa 100644 --- a/src/imports/controls/universal/CheckDelegate.qml +++ b/src/imports/controls/universal/CheckDelegate.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.CheckDelegate { id: control @@ -48,6 +48,8 @@ T.CheckDelegate { indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding) baselineOffset: contentItem.y + contentItem.baselineOffset + hoverEnabled: Qt.styleHints.useHoverEffects + spacing: 12 padding: 12 @@ -76,8 +78,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..2a985e2e 100644 --- a/src/imports/controls/universal/CheckIndicator.qml +++ b/src/imports/controls/universal/CheckIndicator.qml @@ -35,15 +35,15 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +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 a8bf58f8..e259d092 100644 --- a/src/imports/controls/universal/ComboBox.qml +++ b/src/imports/controls/universal/ComboBox.qml @@ -36,9 +36,9 @@ import QtQuick 2.6 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 @@ -50,6 +50,8 @@ T.ComboBox { indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding) baselineOffset: contentItem.y + contentItem.baselineOffset + hoverEnabled: Qt.styleHints.useHoverEffects + spacing: 10 padding: 12 topPadding: padding - 7 @@ -60,6 +62,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 +91,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..64dca3da 100644 --- a/src/imports/controls/universal/Dial.qml +++ b/src/imports/controls/universal/Dial.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.Dial { id: control @@ -44,6 +44,8 @@ T.Dial { implicitWidth: 100 implicitHeight: 100 + hoverEnabled: Qt.styleHints.useHoverEffects + background: Rectangle { x: control.width / 2 - width / 2 y: control.height / 2 - height / 2 @@ -64,7 +66,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..1a2d6839 --- /dev/null +++ b/src/imports/controls/universal/Dialog.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.6 +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.implicitWidth : 0, + footer ? footer.implicitWidth : 0, + contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0) + implicitHeight: Math.max(background ? background.implicitHeight : 0, + (header ? header.implicitHeight : 0) + (footer ? footer.implicitHeight : 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: 0 + + contentItem: Item { } + + background: Rectangle { + color: control.Universal.chromeMediumLowColor + border.color: control.Universal.chromeHighColor + border.width: 1 // FlyoutBorderThemeThickness + } + + buttonBox: DialogButtonBox { + position: DialogButtonBox.Footer + } +} diff --git a/src/imports/controls/universal/DialogButtonBox.qml b/src/imports/controls/universal/DialogButtonBox.qml new file mode 100644 index 00000000..4c1926da --- /dev/null +++ b/src/imports/controls/universal/DialogButtonBox.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** 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.7 +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 + 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 95fef8d1..1ce73f41 100644 --- a/src/imports/controls/universal/Drawer.qml +++ b/src/imports/controls/universal/Drawer.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.Drawer { id: control diff --git a/src/imports/controls/universal/Frame.qml b/src/imports/controls/universal/Frame.qml index d5b327c1..8c0118b0 100644 --- a/src/imports/controls/universal/Frame.qml +++ b/src/imports/controls/universal/Frame.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.Frame { id: control diff --git a/src/imports/controls/universal/GroupBox.qml b/src/imports/controls/universal/GroupBox.qml index c75c81a6..fea4efae 100644 --- a/src/imports/controls/universal/GroupBox.qml +++ b/src/imports/controls/universal/GroupBox.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.GroupBox { id: control diff --git a/src/imports/controls/universal/ItemDelegate.qml b/src/imports/controls/universal/ItemDelegate.qml index 6822d658..e0189082 100644 --- a/src/imports/controls/universal/ItemDelegate.qml +++ b/src/imports/controls/universal/ItemDelegate.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.ItemDelegate { id: control @@ -48,6 +48,8 @@ T.ItemDelegate { indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding) baselineOffset: contentItem.y + contentItem.baselineOffset + hoverEnabled: Qt.styleHints.useHoverEffects + spacing: 12 padding: 12 @@ -70,8 +72,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..c7210137 100644 --- a/src/imports/controls/universal/Label.qml +++ b/src/imports/controls/universal/Label.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +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..603c2c44 100644 --- a/src/imports/controls/universal/Menu.qml +++ b/src/imports/controls/universal/Menu.qml @@ -35,9 +35,9 @@ ****************************************************************************/ import QtQuick 2.6 -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.Menu { id: control diff --git a/src/imports/controls/universal/MenuItem.qml b/src/imports/controls/universal/MenuItem.qml index d8fdbcd0..a1c51eed 100644 --- a/src/imports/controls/universal/MenuItem.qml +++ b/src/imports/controls/universal/MenuItem.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.MenuItem { id: control @@ -48,6 +48,8 @@ T.MenuItem { indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding) baselineOffset: contentItem.y + contentItem.baselineOffset + hoverEnabled: Qt.styleHints.useHoverEffects + padding: 12 topPadding: padding - 1 bottomPadding: padding + 1 @@ -81,7 +83,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..d62d2b6c --- /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.6 +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..eca623f1 100644 --- a/src/imports/controls/universal/Page.qml +++ b/src/imports/controls/universal/Page.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.Page { id: control diff --git a/src/imports/controls/universal/PageIndicator.qml b/src/imports/controls/universal/PageIndicator.qml index 0c4e3b80..401b391e 100644 --- a/src/imports/controls/universal/PageIndicator.qml +++ b/src/imports/controls/universal/PageIndicator.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +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..183f278c 100644 --- a/src/imports/controls/universal/Pane.qml +++ b/src/imports/controls/universal/Pane.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.Pane { id: control diff --git a/src/imports/controls/universal/Popup.qml b/src/imports/controls/universal/Popup.qml index 892db087..36e87449 100644 --- a/src/imports/controls/universal/Popup.qml +++ b/src/imports/controls/universal/Popup.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.Popup { id: control diff --git a/src/imports/controls/universal/ProgressBar.qml b/src/imports/controls/universal/ProgressBar.qml index 66d1aeb8..3ebe17cd 100644 --- a/src/imports/controls/universal/ProgressBar.qml +++ b/src/imports/controls/universal/ProgressBar.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.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..7331879e 100644 --- a/src/imports/controls/universal/RadioButton.qml +++ b/src/imports/controls/universal/RadioButton.qml @@ -35,9 +35,9 @@ ****************************************************************************/ 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.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 +import QtQuick.Controls.Universal.impl 2.1 T.RadioButton { id: control @@ -49,6 +49,8 @@ T.RadioButton { indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding) baselineOffset: contentItem.y + contentItem.baselineOffset + hoverEnabled: Qt.styleHints.useHoverEffects + padding: 6 spacing: 8 diff --git a/src/imports/controls/universal/RadioDelegate.qml b/src/imports/controls/universal/RadioDelegate.qml index 09f86f15..15ca2180 100644 --- a/src/imports/controls/universal/RadioDelegate.qml +++ b/src/imports/controls/universal/RadioDelegate.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.RadioDelegate { id: control @@ -48,6 +48,8 @@ T.RadioDelegate { indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding) baselineOffset: contentItem.y + contentItem.baselineOffset + hoverEnabled: Qt.styleHints.useHoverEffects + spacing: 12 padding: 12 @@ -78,8 +80,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..dfccf759 100644 --- a/src/imports/controls/universal/RadioIndicator.qml +++ b/src/imports/controls/universal/RadioIndicator.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Controls.Universal 2.0 +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..d66e26a7 100644 --- a/src/imports/controls/universal/RangeSlider.qml +++ b/src/imports/controls/universal/RangeSlider.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.RangeSlider { id: control @@ -48,6 +48,8 @@ T.RangeSlider { Math.max(first.handle ? first.handle.implicitHeight : 0, second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding) + hoverEnabled: Qt.styleHints.useHoverEffects + padding: 6 first.handle: Rectangle { @@ -60,7 +62,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 +77,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 +101,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/ScrollBar.qml b/src/imports/controls/universal/ScrollBar.qml index 1ac627a7..4e654132 100644 --- a/src/imports/controls/universal/ScrollBar.qml +++ b/src/imports/controls/universal/ScrollBar.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.ScrollBar { id: control @@ -46,13 +46,16 @@ T.ScrollBar { implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding) + hoverEnabled: Qt.styleHints.useHoverEffects + // TODO: arrows contentItem: Rectangle { 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..a8cd71af 100644 --- a/src/imports/controls/universal/ScrollIndicator.qml +++ b/src/imports/controls/universal/ScrollIndicator.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +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..3ae6a578 100644 --- a/src/imports/controls/universal/Slider.qml +++ b/src/imports/controls/universal/Slider.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.Slider { id: control @@ -46,6 +46,8 @@ T.Slider { implicitHeight: Math.max(background ? background.implicitHeight : 0, (handle ? handle.implicitHeight : 0) + topPadding + bottomPadding) + hoverEnabled: Qt.styleHints.useHoverEffects + padding: 6 property bool useSystemFocusVisuals: true @@ -60,7 +62,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 +86,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..0e7143f6 100644 --- a/src/imports/controls/universal/SpinBox.qml +++ b/src/imports/controls/universal/SpinBox.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.SpinBox { id: control @@ -51,6 +51,8 @@ T.SpinBox { down.indicator ? down.indicator.implicitHeight : 0) baselineOffset: contentItem.y + contentItem.baselineOffset + hoverEnabled: Qt.styleHints.useHoverEffects + // TextControlThemePadding + 2 (border) padding: 12 topPadding: padding - 7 @@ -92,9 +94,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 +122,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 +146,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..b30684f6 100644 --- a/src/imports/controls/universal/StackView.qml +++ b/src/imports/controls/universal/StackView.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +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..77df02cf 100644 --- a/src/imports/controls/universal/SwipeDelegate.qml +++ b/src/imports/controls/universal/SwipeDelegate.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.SwipeDelegate { id: control @@ -48,6 +48,8 @@ T.SwipeDelegate { indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding) baselineOffset: contentItem.y + contentItem.baselineOffset + hoverEnabled: Qt.styleHints.useHoverEffects + spacing: 12 padding: 12 @@ -84,7 +86,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..44aa190d 100644 --- a/src/imports/controls/universal/Switch.qml +++ b/src/imports/controls/universal/Switch.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.Switch { id: control @@ -48,6 +48,8 @@ T.Switch { indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding) baselineOffset: contentItem.y + contentItem.baselineOffset + hoverEnabled: Qt.styleHints.useHoverEffects + padding: 5 spacing: 8 diff --git a/src/imports/controls/universal/SwitchDelegate.qml b/src/imports/controls/universal/SwitchDelegate.qml index 558f5cfb..9c715d06 100644 --- a/src/imports/controls/universal/SwitchDelegate.qml +++ b/src/imports/controls/universal/SwitchDelegate.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.SwitchDelegate { id: control @@ -48,6 +48,8 @@ T.SwitchDelegate { indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding) baselineOffset: contentItem.y + contentItem.baselineOffset + hoverEnabled: Qt.styleHints.useHoverEffects + spacing: 12 padding: 12 @@ -76,8 +78,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..82875568 100644 --- a/src/imports/controls/universal/SwitchIndicator.qml +++ b/src/imports/controls/universal/SwitchIndicator.qml @@ -35,20 +35,27 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +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..1cf895de 100644 --- a/src/imports/controls/universal/TabBar.qml +++ b/src/imports/controls/universal/TabBar.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.7 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +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..e9971298 100644 --- a/src/imports/controls/universal/TabButton.qml +++ b/src/imports/controls/universal/TabButton.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.TabButton { id: control @@ -47,6 +47,8 @@ T.TabButton { contentItem.implicitHeight + topPadding + bottomPadding) baselineOffset: contentItem.y + contentItem.baselineOffset + hoverEnabled: Qt.styleHints.useHoverEffects + padding: 12 // PivotItemMargin contentItem: Text { @@ -56,7 +58,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..0e2953ed 100644 --- a/src/imports/controls/universal/TextArea.qml +++ b/src/imports/controls/universal/TextArea.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.TextArea { id: control @@ -48,6 +48,8 @@ T.TextArea { background ? background.implicitHeight : 0, placeholder.implicitHeight + topPadding + bottomPadding) + hoverEnabled: Qt.styleHints.useHoverEffects + // TextControlThemePadding + 2 (border) padding: 12 topPadding: padding - 7 @@ -83,7 +85,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 a245ba39..88bc4fc9 100644 --- a/src/imports/controls/universal/TextField.qml +++ b/src/imports/controls/universal/TextField.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.TextField { id: control @@ -48,6 +48,8 @@ T.TextField { background ? background.implicitHeight : 0, placeholder.implicitHeight + topPadding + bottomPadding) + hoverEnabled: Qt.styleHints.useHoverEffects + // TextControlThemePadding + 2 (border) padding: 12 topPadding: padding - 7 @@ -84,7 +86,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..49889e19 100644 --- a/src/imports/controls/universal/ToolBar.qml +++ b/src/imports/controls/universal/ToolBar.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.ToolBar { id: control diff --git a/src/imports/controls/universal/ToolButton.qml b/src/imports/controls/universal/ToolButton.qml index cb87130d..45bf96ec 100644 --- a/src/imports/controls/universal/ToolButton.qml +++ b/src/imports/controls/universal/ToolButton.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +import QtQuick.Templates 2.1 as T +import QtQuick.Controls.Universal 2.1 T.ToolButton { id: control @@ -47,6 +47,8 @@ T.ToolButton { contentItem.implicitHeight + topPadding + bottomPadding) baselineOffset: contentItem.y + contentItem.baselineOffset + hoverEnabled: Qt.styleHints.useHoverEffects + padding: 6 property bool useSystemFocusVisuals: true @@ -66,7 +68,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..31990954 --- /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.6 +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..23f9d695 100644 --- a/src/imports/controls/universal/ToolTip.qml +++ b/src/imports/controls/universal/ToolTip.qml @@ -35,8 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 +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..7d639421 100644 --- a/src/imports/controls/universal/Tumbler.qml +++ b/src/imports/controls/universal/Tumbler.qml @@ -35,9 +35,10 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Templates 2.0 as T -import QtQuick.Controls.Universal 2.0 -import QtQuick.Controls 2.0 +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..72edbc32 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 \ @@ -38,6 +41,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 |