diff options
Diffstat (limited to 'src/quickcontrols2/material')
96 files changed, 0 insertions, 9099 deletions
diff --git a/src/quickcontrols2/material/ApplicationWindow.qml b/src/quickcontrols2/material/ApplicationWindow.qml deleted file mode 100644 index 82a0da8b..00000000 --- a/src/quickcontrols2/material/ApplicationWindow.qml +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Window -import QtQuick.Templates as T -import QtQuick.Controls.Material - -T.ApplicationWindow { - id: window - - color: Material.backgroundColor -} diff --git a/src/quickcontrols2/material/BusyIndicator.qml b/src/quickcontrols2/material/BusyIndicator.qml deleted file mode 100644 index 621b2b43..00000000 --- a/src/quickcontrols2/material/BusyIndicator.qml +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.BusyIndicator { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) - - padding: 6 - - contentItem: BusyIndicatorImpl { - implicitWidth: control.Material.touchTarget - implicitHeight: control.Material.touchTarget - color: control.Material.accentColor - - running: control.running - opacity: control.running ? 1 : 0 - Behavior on opacity { OpacityAnimator { duration: 250 } } - } -} diff --git a/src/quickcontrols2/material/Button.qml b/src/quickcontrols2/material/Button.qml deleted file mode 100644 index 352eebec..00000000 --- a/src/quickcontrols2/material/Button.qml +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.impl -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.Button { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) - - topInset: 6 - bottomInset: 6 - padding: 12 - horizontalPadding: padding - 4 - spacing: 6 - - icon.width: 24 - icon.height: 24 - icon.color: !enabled ? Material.hintTextColor : - flat && highlighted ? Material.accentColor : - highlighted ? Material.primaryHighlightedTextColor : Material.foreground - - Material.elevation: flat ? control.down || control.hovered ? 2 : 0 - : control.down ? 8 : 2 - Material.background: flat ? "transparent" : undefined - - contentItem: IconLabel { - spacing: control.spacing - mirrored: control.mirrored - display: control.display - - icon: control.icon - text: control.text - font: control.font - color: !control.enabled ? control.Material.hintTextColor : - control.flat && control.highlighted ? control.Material.accentColor : - control.highlighted ? control.Material.primaryHighlightedTextColor : control.Material.foreground - } - - background: Rectangle { - implicitWidth: 64 - implicitHeight: control.Material.buttonHeight - - radius: 2 - 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 - } - - // The layer is disabled when the button color is transparent so you can do - // Material.background: "transparent" and get a proper flat button without needing - // to set Material.elevation as well - layer.enabled: control.enabled && control.Material.buttonColor.a > 0 - layer.effect: ElevationEffect { - elevation: control.Material.elevation - } - - Ripple { - clipRadius: 2 - width: parent.width - height: parent.height - pressed: control.pressed - anchor: control - active: control.down || control.visualFocus || control.hovered - color: control.flat && control.highlighted ? control.Material.highlightedRippleColor : control.Material.rippleColor - } - } -} diff --git a/src/quickcontrols2/material/CMakeLists.txt b/src/quickcontrols2/material/CMakeLists.txt deleted file mode 100644 index bc73bdb9..00000000 --- a/src/quickcontrols2/material/CMakeLists.txt +++ /dev/null @@ -1,262 +0,0 @@ -##################################################################### -## qtquickcontrols2materialstyleplugin Plugin: -##################################################################### - -set(qml_files - "ApplicationWindow.qml" - "BusyIndicator.qml" - "Button.qml" - "CheckBox.qml" - "CheckDelegate.qml" - "ComboBox.qml" - "DelayButton.qml" - "Dial.qml" - "Dialog.qml" - "DialogButtonBox.qml" - "Drawer.qml" - "Frame.qml" - "GroupBox.qml" - "HorizontalHeaderView.qml" - "ItemDelegate.qml" - "Label.qml" - "Menu.qml" - "MenuBar.qml" - "MenuBarItem.qml" - "MenuItem.qml" - "MenuSeparator.qml" - "Page.qml" - "PageIndicator.qml" - "Pane.qml" - "Popup.qml" - "ProgressBar.qml" - "RadioButton.qml" - "RadioDelegate.qml" - "RangeSlider.qml" - "RoundButton.qml" - "ScrollView.qml" - "ScrollBar.qml" - "ScrollIndicator.qml" - "Slider.qml" - "SpinBox.qml" - "SplitView.qml" - "StackView.qml" - "SwipeDelegate.qml" - "SwipeView.qml" - "Switch.qml" - "SwitchDelegate.qml" - "TabBar.qml" - "TabButton.qml" - "TextArea.qml" - "TextField.qml" - "ToolBar.qml" - "ToolButton.qml" - "ToolSeparator.qml" - "ToolTip.qml" - "Tumbler.qml" - "VerticalHeaderView.qml" -) -set_source_files_properties(ApplicationWindow.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(BusyIndicator.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(Button.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(CheckBox.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(CheckDelegate.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(ComboBox.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(DelayButton.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.2;6.0" -) -set_source_files_properties(Dial.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(Dialog.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.1;6.0" -) -set_source_files_properties(DialogButtonBox.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.1;6.0" -) -set_source_files_properties(Drawer.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(Frame.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(GroupBox.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(HorizontalHeaderView.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.15;6.0" -) -set_source_files_properties(ItemDelegate.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(Label.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(Menu.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(MenuBar.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.3;6.0" -) -set_source_files_properties(MenuBarItem.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.3;6.0" -) -set_source_files_properties(MenuItem.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(MenuSeparator.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.1;6.0" -) -set_source_files_properties(Page.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(PageIndicator.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(Pane.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(Popup.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(ProgressBar.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(RadioButton.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(RadioDelegate.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(RangeSlider.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(RoundButton.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.1;6.0" -) -set_source_files_properties(ScrollView.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(ScrollBar.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(ScrollIndicator.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(Slider.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(SpinBox.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(SplitView.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.13;6.0" -) -set_source_files_properties(StackView.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(SwipeDelegate.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(SwipeView.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(Switch.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(SwitchDelegate.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(TabBar.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(TabButton.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(TextArea.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(TextField.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(ToolBar.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(ToolButton.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(ToolSeparator.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.1;6.0" -) -set_source_files_properties(ToolTip.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(Tumbler.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.0;6.0" -) -set_source_files_properties(VerticalHeaderView.qml PROPERTIES - QT_QML_SOURCE_VERSION "2.15;6.0" -) - -qt_internal_add_qml_module(qtquickcontrols2materialstyleplugin - URI "QtQuick.Controls.Material" - VERSION "${PROJECT_VERSION}" - CLASS_NAME QtQuickControls2MaterialStylePlugin - IMPORTS - QtQuick.Controls.Basic/auto - PLUGIN_TARGET qtquickcontrols2materialstyleplugin - NO_PLUGIN_OPTIONAL - NO_GENERATE_PLUGIN_SOURCE - SOURCES - qquickmaterialstyle.cpp qquickmaterialstyle_p.h - qquickmaterialtheme.cpp qquickmaterialtheme_p.h - qtquickcontrols2materialstyleplugin.cpp - QML_FILES - ${qml_files} - DEFINES - QT_NO_CAST_FROM_ASCII - QT_NO_CAST_TO_ASCII - LIBRARIES - Qt::CorePrivate - Qt::GuiPrivate - Qt::QmlPrivate - Qt::QuickControls2ImplPrivate - Qt::QuickControls2Private - Qt::QuickPrivate - Qt::QuickTemplates2Private -) - -qt_internal_add_resource(qtquickcontrols2materialstyleplugin "qtquickcontrols2materialstyleplugin" - PREFIX - "/qt-project.org/imports/QtQuick/Controls/Material" - FILES - "images/arrow-indicator.png" - "images/[email protected]" - "images/[email protected]" - "images/[email protected]" - "images/check.png" - "images/[email protected]" - "images/[email protected]" - "images/[email protected]" - "images/drop-indicator.png" - "images/[email protected]" - "images/[email protected]" - "images/[email protected]" - "shaders/+glslcore/RectangularGlow.frag" - "shaders/+hlsl/RectangularGlow.frag" - "shaders/+qsb/RectangularGlow.frag" - "shaders/RectangularGlow.frag" -) - -add_subdirectory(impl) diff --git a/src/quickcontrols2/material/CheckBox.qml b/src/quickcontrols2/material/CheckBox.qml deleted file mode 100644 index a3f717be..00000000 --- a/src/quickcontrols2/material/CheckBox.qml +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.CheckBox { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding, - implicitIndicatorHeight + topPadding + bottomPadding) - - spacing: 8 - padding: 8 - verticalPadding: padding + 7 - - indicator: CheckIndicator { - x: control.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 { - leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0 - rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0 - - text: control.text - font: control.font - color: control.enabled ? control.Material.foreground : control.Material.hintTextColor - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - } -} diff --git a/src/quickcontrols2/material/CheckDelegate.qml b/src/quickcontrols2/material/CheckDelegate.qml deleted file mode 100644 index ea42d666..00000000 --- a/src/quickcontrols2/material/CheckDelegate.qml +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.impl -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.CheckDelegate { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding, - implicitIndicatorHeight + topPadding + bottomPadding) - - padding: 16 - verticalPadding: 8 - spacing: 16 - - icon.width: 24 - icon.height: 24 - icon.color: enabled ? Material.foreground : Material.hintTextColor - - indicator: CheckIndicator { - x: control.text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2 - y: control.topPadding + (control.availableHeight - height) / 2 - control: control - } - - contentItem: IconLabel { - leftPadding: !control.mirrored ? 0 : control.indicator.width + control.spacing - rightPadding: control.mirrored ? 0 : control.indicator.width + control.spacing - - spacing: control.spacing - mirrored: control.mirrored - display: control.display - alignment: control.display === IconLabel.IconOnly || control.display === IconLabel.TextUnderIcon ? Qt.AlignCenter : Qt.AlignLeft - - icon: control.icon - text: control.text - font: control.font - color: control.enabled ? control.Material.foreground : control.Material.hintTextColor - } - - background: Rectangle { - implicitHeight: control.Material.delegateHeight - - 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/quickcontrols2/material/ComboBox.qml b/src/quickcontrols2/material/ComboBox.qml deleted file mode 100644 index 15f4c1ad..00000000 --- a/src/quickcontrols2/material/ComboBox.qml +++ /dev/null @@ -1,179 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Window -import QtQuick.Controls.impl -import QtQuick.Templates as T -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.ComboBox { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding, - implicitIndicatorHeight + topPadding + bottomPadding) - - topInset: 6 - bottomInset: 6 - - leftPadding: padding + (!control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing) - rightPadding: padding + (control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing) - - Material.elevation: flat ? control.pressed || control.hovered ? 2 : 0 - : control.pressed ? 8 : 2 - Material.background: flat ? "transparent" : undefined - Material.foreground: flat ? undefined : Material.primaryTextColor - - delegate: MenuItem { - width: ListView.view.width - text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData - Material.foreground: control.currentIndex === index ? ListView.view.contentItem.Material.accent : ListView.view.contentItem.Material.foreground - highlighted: control.highlightedIndex === index - hoverEnabled: control.hoverEnabled - } - - indicator: ColorImage { - x: control.mirrored ? control.padding : control.width - width - control.padding - y: control.topPadding + (control.availableHeight - height) / 2 - color: control.enabled ? control.Material.foreground : control.Material.hintTextColor - source: "qrc:/qt-project.org/imports/QtQuick/Controls/Material/images/drop-indicator.png" - } - - contentItem: T.TextField { - padding: 6 - leftPadding: control.editable ? 2 : control.mirrored ? 0 : 12 - rightPadding: control.editable ? 2 : control.mirrored ? 12 : 0 - - text: control.editable ? control.editText : control.displayText - - enabled: control.editable - autoScroll: control.editable - readOnly: control.down - inputMethodHints: control.inputMethodHints - validator: control.validator - selectByMouse: control.selectTextByMouse - - font: control.font - color: control.enabled ? control.Material.foreground : control.Material.hintTextColor - selectionColor: control.Material.accentColor - selectedTextColor: control.Material.primaryHighlightedTextColor - verticalAlignment: Text.AlignVCenter - - cursorDelegate: CursorDelegate { } - } - - background: Rectangle { - implicitWidth: 120 - implicitHeight: control.Material.buttonHeight - - radius: control.flat ? 0 : 2 - color: !control.editable ? control.Material.dialogColor : "transparent" - - layer.enabled: control.enabled && !control.editable && control.Material.background.a > 0 - layer.effect: ElevationEffect { - elevation: control.Material.elevation - } - - Rectangle { - visible: control.editable - y: parent.y + control.baselineOffset - width: parent.width - height: control.activeFocus ? 2 : 1 - color: control.editable && control.activeFocus ? control.Material.accentColor : control.Material.hintTextColor - } - - Ripple { - clip: control.flat - clipRadius: control.flat ? 0 : 2 - x: control.editable && control.indicator ? control.indicator.x : 0 - width: control.editable && control.indicator ? control.indicator.width : parent.width - height: parent.height - pressed: control.pressed - anchor: control.editable && control.indicator ? control.indicator : control - active: control.pressed || control.visualFocus || control.hovered - color: control.Material.rippleColor - } - } - - popup: T.Popup { - y: control.editable ? control.height - 5 : 0 - width: control.width - height: Math.min(contentItem.implicitHeight, control.Window.height - topMargin - bottomMargin) - transformOrigin: Item.Top - topMargin: 12 - bottomMargin: 12 - - Material.theme: control.Material.theme - Material.accent: control.Material.accent - Material.primary: control.Material.primary - - enter: Transition { - // grow_fade_in - NumberAnimation { property: "scale"; from: 0.9; easing.type: Easing.OutQuint; duration: 220 } - NumberAnimation { property: "opacity"; from: 0.0; easing.type: Easing.OutCubic; duration: 150 } - } - - exit: Transition { - // shrink_fade_out - NumberAnimation { property: "scale"; to: 0.9; easing.type: Easing.OutQuint; duration: 220 } - NumberAnimation { property: "opacity"; to: 0.0; easing.type: Easing.OutCubic; duration: 150 } - } - - contentItem: ListView { - clip: true - implicitHeight: contentHeight - model: control.delegateModel - currentIndex: control.highlightedIndex - highlightMoveDuration: 0 - - T.ScrollIndicator.vertical: ScrollIndicator { } - } - - background: Rectangle { - radius: 2 - color: parent.Material.dialogColor - - layer.enabled: control.enabled - layer.effect: ElevationEffect { - elevation: 8 - } - } - } -} diff --git a/src/quickcontrols2/material/DelayButton.qml b/src/quickcontrols2/material/DelayButton.qml deleted file mode 100644 index d35df35c..00000000 --- a/src/quickcontrols2/material/DelayButton.qml +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.impl -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.DelayButton { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) - - topInset: 6 - bottomInset: 6 - padding: 12 - horizontalPadding: padding - 4 - - Material.elevation: control.down ? 8 : 2 - - transition: Transition { - NumberAnimation { - duration: control.delay * (control.pressed ? 1.0 - control.progress : 0.3 * control.progress) - } - } - - contentItem: Text { - text: control.text - font: control.font - color: !control.enabled ? control.Material.hintTextColor : control.Material.foreground - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - elide: Text.ElideRight - } - - // TODO: Add a proper ripple/ink effect for mouse/touch input and focus state - background: Rectangle { - implicitWidth: 64 - implicitHeight: control.Material.buttonHeight - - radius: 2 - color: !control.enabled ? control.Material.buttonDisabledColor : control.Material.buttonColor - - PaddedRectangle { - y: parent.height - 4 - width: parent.width - height: 4 - radius: 2 - topPadding: -2 - clip: true - color: control.checked && control.enabled ? control.Material.accentColor : control.Material.secondaryTextColor - - PaddedRectangle { - width: parent.width * control.progress - height: 4 - radius: 2 - topPadding: -2 - rightPadding: Math.max(-2, width - parent.width) - clip: true - color: control.Material.accentColor - } - } - - layer.enabled: control.enabled && control.Material.buttonColor.a > 0 - layer.effect: ElevationEffect { - elevation: control.Material.elevation - } - - Ripple { - clipRadius: 2 - width: parent.width - height: parent.height - pressed: control.pressed - anchor: control - active: control.down || control.visualFocus || control.hovered - color: control.Material.rippleColor - } - } -} diff --git a/src/quickcontrols2/material/Dial.qml b/src/quickcontrols2/material/Dial.qml deleted file mode 100644 index 2731436f..00000000 --- a/src/quickcontrols2/material/Dial.qml +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.Dial { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) - - background: Rectangle { - implicitWidth: 100 - implicitHeight: 100 - - x: control.width / 2 - width / 2 - y: control.height / 2 - height / 2 - width: Math.max(64, Math.min(control.width, control.height)) - height: width - color: "transparent" - radius: width / 2 - - border.color: control.enabled ? control.Material.accentColor : control.Material.hintTextColor - } - - handle: SliderHandle { - x: control.background.x + control.background.width / 2 - width / 2 - y: control.background.y + control.background.height / 2 - height / 2 - transform: [ - Translate { - y: -control.background.height * 0.4 + control.handle.height / 2 - }, - Rotation { - angle: control.angle - origin.x: control.handle.width / 2 - origin.y: control.handle.height / 2 - } - ] - implicitWidth: 10 - implicitHeight: 10 - - value: control.value - handleHasFocus: control.visualFocus - handlePressed: control.pressed - handleHovered: control.hovered - } -} diff --git a/src/quickcontrols2/material/Dialog.qml b/src/quickcontrols2/material/Dialog.qml deleted file mode 100644 index 1cb7f8c1..00000000 --- a/src/quickcontrols2/material/Dialog.qml +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.impl -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.Dialog { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - contentWidth + leftPadding + rightPadding, - implicitHeaderWidth, - implicitFooterWidth) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - contentHeight + topPadding + bottomPadding - + (implicitHeaderHeight > 0 ? implicitHeaderHeight + spacing : 0) - + (implicitFooterHeight > 0 ? implicitFooterHeight + spacing : 0)) - - padding: 24 - topPadding: 20 - - Material.elevation: 24 - - enter: Transition { - // grow_fade_in - NumberAnimation { property: "scale"; from: 0.9; to: 1.0; easing.type: Easing.OutQuint; duration: 220 } - NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; easing.type: Easing.OutCubic; duration: 150 } - } - - exit: Transition { - // shrink_fade_out - NumberAnimation { property: "scale"; from: 1.0; to: 0.9; easing.type: Easing.OutQuint; duration: 220 } - NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; easing.type: Easing.OutCubic; duration: 150 } - } - - background: Rectangle { - radius: 2 - color: control.Material.dialogColor - - layer.enabled: control.Material.elevation > 0 - layer.effect: ElevationEffect { - elevation: control.Material.elevation - } - } - - header: Label { - text: control.title - visible: control.title - elide: Label.ElideRight - padding: 24 - bottomPadding: 0 - // TODO: QPlatformTheme::TitleBarFont - font.bold: true - font.pixelSize: 16 - background: PaddedRectangle { - radius: 2 - color: control.Material.dialogColor - bottomPadding: -2 - clip: true - } - } - - footer: DialogButtonBox { - visible: count > 0 - } - - T.Overlay.modal: Rectangle { - color: control.Material.backgroundDimColor - Behavior on opacity { NumberAnimation { duration: 150 } } - } - - T.Overlay.modeless: Rectangle { - color: control.Material.backgroundDimColor - Behavior on opacity { NumberAnimation { duration: 150 } } - } -} diff --git a/src/quickcontrols2/material/DialogButtonBox.qml b/src/quickcontrols2/material/DialogButtonBox.qml deleted file mode 100644 index e32fa812..00000000 --- a/src/quickcontrols2/material/DialogButtonBox.qml +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.impl -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.DialogButtonBox { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - contentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - contentHeight + topPadding + bottomPadding) - - spacing: 8 - padding: 8 - verticalPadding: 2 - alignment: Qt.AlignRight - buttonLayout: T.DialogButtonBox.AndroidLayout - - Material.foreground: Material.accent - - delegate: Button { flat: true } - - contentItem: ListView { - model: control.contentModel - spacing: control.spacing - orientation: ListView.Horizontal - boundsBehavior: Flickable.StopAtBounds - snapMode: ListView.SnapToItem - } - - background: PaddedRectangle { - implicitHeight: control.Material.dialogButtonBoxHeight - radius: 2 - color: control.Material.dialogColor - // Rounded corners should be only at the top or at the bottom - topPadding: control.position === T.DialogButtonBox.Footer ? -2 : 0 - bottomPadding: control.position === T.DialogButtonBox.Header ? -2 : 0 - clip: true - } -} diff --git a/src/quickcontrols2/material/Drawer.qml b/src/quickcontrols2/material/Drawer.qml deleted file mode 100644 index 93c4bf56..00000000 --- a/src/quickcontrols2/material/Drawer.qml +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.Drawer { - id: control - - parent: T.Overlay.overlay - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - contentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - contentHeight + topPadding + bottomPadding) - - topPadding: !dim && edge === Qt.BottomEdge && Material.elevation === 0 - leftPadding: !dim && edge === Qt.RightEdge && Material.elevation === 0 - rightPadding: !dim && edge === Qt.LeftEdge && Material.elevation === 0 - bottomPadding: !dim && edge === Qt.TopEdge && Material.elevation === 0 - - enter: Transition { SmoothedAnimation { velocity: 5 } } - exit: Transition { SmoothedAnimation { velocity: 5 } } - - Material.elevation: !interactive && !dim ? 0 : 16 - - background: Rectangle { - color: control.Material.dialogColor - - Rectangle { - readonly property bool horizontal: control.edge === Qt.LeftEdge || control.edge === Qt.RightEdge - width: horizontal ? 1 : parent.width - height: horizontal ? parent.height : 1 - color: control.Material.dividerColor - x: control.edge === Qt.LeftEdge ? parent.width - 1 : 0 - y: control.edge === Qt.TopEdge ? parent.height - 1 : 0 - visible: !control.dim && control.Material.elevation === 0 - } - - layer.enabled: control.position > 0 - layer.effect: ElevationEffect { - elevation: control.Material.elevation - fullHeight: true - } - } - - T.Overlay.modal: Rectangle { - color: control.Material.backgroundDimColor - Behavior on opacity { NumberAnimation { duration: 150 } } - } - - T.Overlay.modeless: Rectangle { - color: control.Material.backgroundDimColor - Behavior on opacity { NumberAnimation { duration: 150 } } - } -} diff --git a/src/quickcontrols2/material/Frame.qml b/src/quickcontrols2/material/Frame.qml deleted file mode 100644 index 8626f766..00000000 --- a/src/quickcontrols2/material/Frame.qml +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.Frame { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - contentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - contentHeight + topPadding + bottomPadding) - - padding: 12 - verticalPadding: Material.frameVerticalPadding - - background: Rectangle { - radius: 2 - color: control.Material.elevation > 0 ? control.Material.backgroundColor : "transparent" - border.color: control.Material.frameColor - - layer.enabled: control.enabled && control.Material.elevation > 0 - layer.effect: ElevationEffect { - elevation: control.Material.elevation - } - } -} diff --git a/src/quickcontrols2/material/GroupBox.qml b/src/quickcontrols2/material/GroupBox.qml deleted file mode 100644 index 4a27b832..00000000 --- a/src/quickcontrols2/material/GroupBox.qml +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.GroupBox { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - contentWidth + leftPadding + rightPadding, - implicitLabelWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - contentHeight + topPadding + bottomPadding) - - spacing: 6 - padding: 12 - topPadding: Material.frameVerticalPadding + (implicitLabelWidth > 0 ? implicitLabelHeight + spacing : 0) - bottomPadding: Material.frameVerticalPadding - - label: Text { - x: control.leftPadding - width: control.availableWidth - - text: control.title - font: control.font - color: control.enabled ? control.Material.foreground : control.Material.hintTextColor - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - } - - background: Rectangle { - y: control.topPadding - control.bottomPadding - width: parent.width - height: parent.height - control.topPadding + control.bottomPadding - - radius: 2 - color: control.Material.elevation > 0 ? control.Material.backgroundColor : "transparent" - border.color: control.Material.frameColor - - layer.enabled: control.enabled && control.Material.elevation > 0 - layer.effect: ElevationEffect { - elevation: control.Material.elevation - } - } -} diff --git a/src/quickcontrols2/material/HorizontalHeaderView.qml b/src/quickcontrols2/material/HorizontalHeaderView.qml deleted file mode 100644 index d2608c76..00000000 --- a/src/quickcontrols2/material/HorizontalHeaderView.qml +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.HorizontalHeaderView { - id: control - - implicitWidth: syncView ? syncView.width : 0 - implicitHeight: contentHeight - - delegate: Rectangle { - // Qt6: add cellPadding (and font etc) as public API in headerview - readonly property real cellPadding: 8 - - implicitWidth: text.implicitWidth + (cellPadding * 2) - implicitHeight: Math.max(control.height, text.implicitHeight + (cellPadding * 2)) - color: control.Material.backgroundColor - - Text { - id: text - text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] - : model[control.textRole]) - : modelData - width: parent.width - height: parent.height - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - color: enabled ? control.Material.foreground : control.Material.hintTextColor - } - } -} diff --git a/src/quickcontrols2/material/ItemDelegate.qml b/src/quickcontrols2/material/ItemDelegate.qml deleted file mode 100644 index 7d06b05b..00000000 --- a/src/quickcontrols2/material/ItemDelegate.qml +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.impl -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.ItemDelegate { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding, - implicitIndicatorHeight + topPadding + bottomPadding) - - padding: 16 - verticalPadding: 8 - spacing: 16 - - icon.width: 24 - icon.height: 24 - icon.color: enabled ? Material.foreground : Material.hintTextColor - - contentItem: IconLabel { - spacing: control.spacing - mirrored: control.mirrored - display: control.display - alignment: control.display === IconLabel.IconOnly || control.display === IconLabel.TextUnderIcon ? Qt.AlignCenter : Qt.AlignLeft - - icon: control.icon - text: control.text - font: control.font - color: control.enabled ? control.Material.foreground : control.Material.hintTextColor - } - - background: Rectangle { - implicitHeight: control.Material.delegateHeight - - 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/quickcontrols2/material/LICENSE_ANGULARJS.txt b/src/quickcontrols2/material/LICENSE_ANGULARJS.txt deleted file mode 100644 index c1f2a826..00000000 --- a/src/quickcontrols2/material/LICENSE_ANGULARJS.txt +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2014-2016 Google, Inc. http://angularjs.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/src/quickcontrols2/material/Label.qml b/src/quickcontrols2/material/Label.qml deleted file mode 100644 index 77e85f42..00000000 --- a/src/quickcontrols2/material/Label.qml +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material - -T.Label { - id: control - - color: enabled ? Material.foreground : Material.hintTextColor - linkColor: Material.accentColor -} diff --git a/src/quickcontrols2/material/Menu.qml b/src/quickcontrols2/material/Menu.qml deleted file mode 100644 index b7e80c92..00000000 --- a/src/quickcontrols2/material/Menu.qml +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl -import QtQuick.Window - -T.Menu { - id: control - - Material.elevation: 8 - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - contentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - contentHeight + topPadding + bottomPadding) - - margins: 0 - verticalPadding: 8 - - transformOrigin: !cascade ? Item.Top : (mirrored ? Item.TopRight : Item.TopLeft) - - delegate: MenuItem { } - - 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: ListView { - implicitHeight: contentHeight - - model: control.contentModel - interactive: Window.window - ? contentHeight + control.topPadding + control.bottomPadding > Window.window.height - : false - clip: true - currentIndex: control.currentIndex - - ScrollIndicator.vertical: ScrollIndicator {} - } - - background: Rectangle { - implicitWidth: 200 - implicitHeight: control.Material.menuItemHeight - - radius: 3 - color: control.Material.dialogColor - - layer.enabled: control.Material.elevation > 0 - layer.effect: ElevationEffect { - elevation: control.Material.elevation - } - } - - T.Overlay.modal: Rectangle { - color: control.Material.backgroundDimColor - Behavior on opacity { NumberAnimation { duration: 150 } } - } - - T.Overlay.modeless: Rectangle { - color: control.Material.backgroundDimColor - Behavior on opacity { NumberAnimation { duration: 150 } } - } -} diff --git a/src/quickcontrols2/material/MenuBar.qml b/src/quickcontrols2/material/MenuBar.qml deleted file mode 100644 index a0c3bd3f..00000000 --- a/src/quickcontrols2/material/MenuBar.qml +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.impl -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.MenuBar { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - contentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - contentHeight + topPadding + bottomPadding) - - delegate: MenuBarItem { } - - contentItem: Row { - spacing: control.spacing - Repeater { - model: control.contentModel - } - } - - background: Rectangle { - implicitHeight: 40 - color: control.Material.dialogColor - } -} diff --git a/src/quickcontrols2/material/MenuBarItem.qml b/src/quickcontrols2/material/MenuBarItem.qml deleted file mode 100644 index f1d4e87d..00000000 --- a/src/quickcontrols2/material/MenuBarItem.qml +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.impl -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.MenuBarItem { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding, - implicitIndicatorHeight + topPadding + bottomPadding) - - padding: 16 - verticalPadding: 12 - spacing: 16 - - icon.width: 24 - icon.height: 24 - icon.color: enabled ? Material.foreground : Material.hintTextColor - - contentItem: IconLabel { - spacing: control.spacing - mirrored: control.mirrored - display: control.display - alignment: Qt.AlignLeft - - icon: control.icon - text: control.text - font: control.font - color: control.enabled ? control.Material.foreground : control.Material.hintTextColor - } - - background: Rectangle { - implicitWidth: 40 - implicitHeight: 40 - 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.highlighted - color: control.Material.rippleColor - } - } -} diff --git a/src/quickcontrols2/material/MenuItem.qml b/src/quickcontrols2/material/MenuItem.qml deleted file mode 100644 index fab2de26..00000000 --- a/src/quickcontrols2/material/MenuItem.qml +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.impl -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.MenuItem { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding, - implicitIndicatorHeight + topPadding + bottomPadding) - - padding: 16 - verticalPadding: Material.menuItemVerticalPadding - spacing: 16 - - icon.width: 24 - icon.height: 24 - icon.color: enabled ? Material.foreground : Material.hintTextColor - - indicator: CheckIndicator { - x: control.text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2 - y: control.topPadding + (control.availableHeight - height) / 2 - visible: control.checkable - control: control - checkState: control.checked ? Qt.Checked : Qt.Unchecked - } - - arrow: ColorImage { - x: control.mirrored ? control.padding : control.width - width - control.padding - y: control.topPadding + (control.availableHeight - height) / 2 - - visible: control.subMenu - mirror: control.mirrored - color: control.enabled ? control.Material.foreground : control.Material.hintTextColor - source: "qrc:/qt-project.org/imports/QtQuick/Controls/Material/images/arrow-indicator.png" - } - - contentItem: IconLabel { - readonly property real arrowPadding: control.subMenu && control.arrow ? control.arrow.width + control.spacing : 0 - readonly property real indicatorPadding: control.checkable && control.indicator ? control.indicator.width + control.spacing : 0 - leftPadding: !control.mirrored ? indicatorPadding : arrowPadding - rightPadding: control.mirrored ? indicatorPadding : arrowPadding - - spacing: control.spacing - mirrored: control.mirrored - display: control.display - alignment: Qt.AlignLeft - - icon: control.icon - text: control.text - font: control.font - color: control.enabled ? control.Material.foreground : control.Material.hintTextColor - } - - background: Rectangle { - implicitWidth: 200 - implicitHeight: control.Material.menuItemHeight - 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.highlighted - color: control.Material.rippleColor - } - } -} diff --git a/src/quickcontrols2/material/MenuSeparator.qml b/src/quickcontrols2/material/MenuSeparator.qml deleted file mode 100644 index 08a33ffe..00000000 --- a/src/quickcontrols2/material/MenuSeparator.qml +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material - -T.MenuSeparator { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) - - verticalPadding: 8 - - contentItem: Rectangle { - implicitWidth: 200 - implicitHeight: 1 - color: control.Material.dividerColor - } -} diff --git a/src/quickcontrols2/material/Page.qml b/src/quickcontrols2/material/Page.qml deleted file mode 100644 index 711fac2d..00000000 --- a/src/quickcontrols2/material/Page.qml +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material - -T.Page { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - contentWidth + leftPadding + rightPadding, - implicitHeaderWidth, - implicitFooterWidth) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - contentHeight + topPadding + bottomPadding - + (implicitHeaderHeight > 0 ? implicitHeaderHeight + spacing : 0) - + (implicitFooterHeight > 0 ? implicitFooterHeight + spacing : 0)) - - background: Rectangle { - color: control.Material.backgroundColor - } -} diff --git a/src/quickcontrols2/material/PageIndicator.qml b/src/quickcontrols2/material/PageIndicator.qml deleted file mode 100644 index 8ccd7de3..00000000 --- a/src/quickcontrols2/material/PageIndicator.qml +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material - -T.PageIndicator { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) - - padding: 6 - spacing: 6 - - delegate: Rectangle { - implicitWidth: 8 - implicitHeight: 8 - - radius: width / 2 - color: control.enabled ? control.Material.foreground : control.Material.hintTextColor - - opacity: index === currentIndex ? 0.95 : pressed ? 0.7 : 0.45 - Behavior on opacity { OpacityAnimator { duration: 100 } } - } - - contentItem: Row { - spacing: control.spacing - - Repeater { - model: control.count - delegate: control.delegate - } - } -} diff --git a/src/quickcontrols2/material/Pane.qml b/src/quickcontrols2/material/Pane.qml deleted file mode 100644 index 055a8d23..00000000 --- a/src/quickcontrols2/material/Pane.qml +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.Pane { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - contentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - contentHeight + topPadding + bottomPadding) - - padding: 12 - - background: Rectangle { - color: control.Material.backgroundColor - radius: control.Material.elevation > 0 ? 2 : 0 - - layer.enabled: control.enabled && control.Material.elevation > 0 - layer.effect: ElevationEffect { - elevation: control.Material.elevation - } - } -} diff --git a/src/quickcontrols2/material/Popup.qml b/src/quickcontrols2/material/Popup.qml deleted file mode 100644 index cb5b62ec..00000000 --- a/src/quickcontrols2/material/Popup.qml +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.Popup { - id: control - - Material.elevation: 24 - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - contentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - contentHeight + topPadding + bottomPadding) - - padding: 12 - - enter: Transition { - // grow_fade_in - NumberAnimation { property: "scale"; from: 0.9; to: 1.0; easing.type: Easing.OutQuint; duration: 220 } - NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; easing.type: Easing.OutCubic; duration: 150 } - } - - exit: Transition { - // shrink_fade_out - NumberAnimation { property: "scale"; from: 1.0; to: 0.9; easing.type: Easing.OutQuint; duration: 220 } - NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; easing.type: Easing.OutCubic; duration: 150 } - } - - background: Rectangle { - radius: 2 - color: control.Material.dialogColor - - layer.enabled: control.Material.elevation > 0 - layer.effect: ElevationEffect { - elevation: control.Material.elevation - } - } - - T.Overlay.modal: Rectangle { - color: control.Material.backgroundDimColor - Behavior on opacity { NumberAnimation { duration: 150 } } - } - - T.Overlay.modeless: Rectangle { - color: control.Material.backgroundDimColor - Behavior on opacity { NumberAnimation { duration: 150 } } - } -} diff --git a/src/quickcontrols2/material/ProgressBar.qml b/src/quickcontrols2/material/ProgressBar.qml deleted file mode 100644 index dd4fae0e..00000000 --- a/src/quickcontrols2/material/ProgressBar.qml +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.ProgressBar { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) - - contentItem: ProgressBarImpl { - implicitHeight: 4 - - scale: control.mirrored ? -1 : 1 - color: control.Material.accentColor - progress: control.position - indeterminate: control.visible && control.indeterminate - } - - background: Rectangle { - implicitWidth: 200 - implicitHeight: 4 - y: (control.height - height) / 2 - height: 4 - - color: Qt.rgba(control.Material.accentColor.r, control.Material.accentColor.g, control.Material.accentColor.b, 0.25) - } -} diff --git a/src/quickcontrols2/material/RadioButton.qml b/src/quickcontrols2/material/RadioButton.qml deleted file mode 100644 index 664cb19e..00000000 --- a/src/quickcontrols2/material/RadioButton.qml +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.RadioButton { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding, - implicitIndicatorHeight + topPadding + bottomPadding) - - spacing: 8 - padding: 8 - verticalPadding: padding + 6 - - indicator: RadioIndicator { - x: control.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 { - leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0 - rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0 - - text: control.text - font: control.font - color: control.enabled ? control.Material.foreground : control.Material.hintTextColor - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - } -} diff --git a/src/quickcontrols2/material/RadioDelegate.qml b/src/quickcontrols2/material/RadioDelegate.qml deleted file mode 100644 index 334e570b..00000000 --- a/src/quickcontrols2/material/RadioDelegate.qml +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.impl -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.RadioDelegate { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding, - implicitIndicatorHeight + topPadding + bottomPadding) - - padding: 16 - verticalPadding: 8 - spacing: 16 - - icon.width: 24 - icon.height: 24 - icon.color: enabled ? Material.foreground : Material.hintTextColor - - indicator: RadioIndicator { - x: control.text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2 - y: control.topPadding + (control.availableHeight - height) / 2 - control: control - } - - contentItem: IconLabel { - leftPadding: !control.mirrored ? 0 : control.indicator.width + control.spacing - rightPadding: control.mirrored ? 0 : control.indicator.width + control.spacing - - spacing: control.spacing - mirrored: control.mirrored - display: control.display - alignment: control.display === IconLabel.IconOnly || control.display === IconLabel.TextUnderIcon ? Qt.AlignCenter : Qt.AlignLeft - - icon: control.icon - text: control.text - font: control.font - color: control.enabled ? control.Material.foreground : control.Material.hintTextColor - } - - background: Rectangle { - implicitHeight: control.Material.delegateHeight - - 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/quickcontrols2/material/RangeSlider.qml b/src/quickcontrols2/material/RangeSlider.qml deleted file mode 100644 index d1d22115..00000000 --- a/src/quickcontrols2/material/RangeSlider.qml +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.impl -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.RangeSlider { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - first.implicitHandleWidth + leftPadding + rightPadding, - second.implicitHandleWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - first.implicitHandleHeight + topPadding + bottomPadding, - second.implicitHandleHeight + topPadding + bottomPadding) - - padding: 6 - - first.handle: SliderHandle { - x: control.leftPadding + (control.horizontal ? control.first.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2) - y: control.topPadding + (control.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 { - x: control.leftPadding + (control.horizontal ? control.second.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2) - y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : control.second.visualPosition * (control.availableHeight - height)) - value: second.value - handleHasFocus: activeFocus - handlePressed: second.pressed - handleHovered: second.hovered - } - - background: Rectangle { - x: control.leftPadding + (control.horizontal ? 0 : (control.availableWidth - width) / 2) - y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : 0) - implicitWidth: control.horizontal ? 200 : 48 - implicitHeight: control.horizontal ? 48 : 200 - width: control.horizontal ? control.availableWidth : 4 - height: control.horizontal ? 4 : control.availableHeight - scale: control.horizontal && control.mirrored ? -1 : 1 - color: control.enabled ? Color.transparent(control.Material.accentColor, 0.33) : control.Material.sliderDisabledColor - - Rectangle { - x: control.horizontal ? control.first.position * parent.width : 0 - y: control.horizontal ? 0 : control.second.visualPosition * parent.height - width: control.horizontal ? control.second.position * parent.width - control.first.position * parent.width : 4 - height: control.horizontal ? 4 : control.second.position * parent.height - control.first.position * parent.height - - color: control.enabled ? control.Material.accentColor : control.Material.sliderDisabledColor - } - } -} diff --git a/src/quickcontrols2/material/RoundButton.qml b/src/quickcontrols2/material/RoundButton.qml deleted file mode 100644 index f93f2425..00000000 --- a/src/quickcontrols2/material/RoundButton.qml +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.impl -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.RoundButton { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) - - topInset: 6 - leftInset: 6 - rightInset: 6 - bottomInset: 6 - padding: 12 - spacing: 6 - - icon.width: 24 - icon.height: 24 - icon.color: !enabled ? Material.hintTextColor : - flat && highlighted ? Material.accentColor : - highlighted ? Material.primaryHighlightedTextColor : Material.foreground - - Material.elevation: flat ? control.down || control.hovered ? 2 : 0 - : control.down ? 12 : 6 - Material.background: flat ? "transparent" : undefined - - contentItem: IconLabel { - spacing: control.spacing - mirrored: control.mirrored - display: control.display - - icon: control.icon - text: control.text - font: control.font - color: !control.enabled ? control.Material.hintTextColor : - control.flat && control.highlighted ? control.Material.accentColor : - control.highlighted ? control.Material.primaryHighlightedTextColor : control.Material.foreground - } - - // TODO: Add a proper ripple/ink effect for mouse/touch input and focus state - background: Rectangle { - implicitWidth: control.Material.buttonHeight - implicitHeight: control.Material.buttonHeight - - radius: control.radius - color: !control.enabled ? control.Material.buttonDisabledColor - : control.checked || control.highlighted ? control.Material.highlightedButtonColor : control.Material.buttonColor - - Rectangle { - width: parent.width - height: parent.height - radius: control.radius - visible: control.hovered || control.visualFocus - color: control.Material.rippleColor - } - - Rectangle { - width: parent.width - height: parent.height - radius: control.radius - visible: control.down - color: control.Material.rippleColor - } - - // The layer is disabled when the button color is transparent so that you can do - // Material.background: "transparent" and get a proper flat button without needing - // to set Material.elevation as well - layer.enabled: control.enabled && control.Material.buttonColor.a > 0 - layer.effect: ElevationEffect { - elevation: control.Material.elevation - } - } -} diff --git a/src/quickcontrols2/material/ScrollBar.qml b/src/quickcontrols2/material/ScrollBar.qml deleted file mode 100644 index 55de0d13..00000000 --- a/src/quickcontrols2/material/ScrollBar.qml +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material - -T.ScrollBar { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) - - padding: control.interactive ? 1 : 2 - visible: control.policy !== T.ScrollBar.AlwaysOff - minimumSize: orientation == Qt.Horizontal ? height / width : width / height - - contentItem: Rectangle { - implicitWidth: control.interactive ? 13 : 4 - implicitHeight: control.interactive ? 13 : 4 - - color: control.pressed ? control.Material.scrollBarPressedColor : - control.interactive && control.hovered ? control.Material.scrollBarHoveredColor : control.Material.scrollBarColor - opacity: 0.0 - } - - background: Rectangle { - implicitWidth: control.interactive ? 16 : 4 - implicitHeight: control.interactive ? 16 : 4 - color: "#0e000000" - opacity: 0.0 - visible: control.interactive - } - - states: State { - name: "active" - when: control.policy === T.ScrollBar.AlwaysOn || (control.active && control.size < 1.0) - } - - transitions: [ - Transition { - to: "active" - NumberAnimation { targets: [control.contentItem, control.background]; property: "opacity"; to: 1.0 } - }, - Transition { - from: "active" - SequentialAnimation { - PropertyAction{ targets: [control.contentItem, control.background]; property: "opacity"; value: 1.0 } - PauseAnimation { duration: 2450 } - NumberAnimation { targets: [control.contentItem, control.background]; property: "opacity"; to: 0.0 } - } - } - ] -} diff --git a/src/quickcontrols2/material/ScrollIndicator.qml b/src/quickcontrols2/material/ScrollIndicator.qml deleted file mode 100644 index bc81c630..00000000 --- a/src/quickcontrols2/material/ScrollIndicator.qml +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material - -T.ScrollIndicator { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) - - padding: 2 - - contentItem: Rectangle { - implicitWidth: 4 - implicitHeight: 4 - - color: control.Material.scrollBarColor - visible: control.size < 1.0 - opacity: 0.0 - - states: State { - name: "active" - when: control.active - PropertyChanges { target: control.contentItem; opacity: 0.75 } - } - - transitions: [ - Transition { - from: "active" - SequentialAnimation { - PauseAnimation { duration: 450 } - NumberAnimation { target: control.contentItem; duration: 200; property: "opacity"; to: 0.0 } - } - } - ] - } -} diff --git a/src/quickcontrols2/material/ScrollView.qml b/src/quickcontrols2/material/ScrollView.qml deleted file mode 100644 index a6bba9de..00000000 --- a/src/quickcontrols2/material/ScrollView.qml +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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 -import QtQuick.Controls.impl -import QtQuick.Templates as T - -T.ScrollView { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - contentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - contentHeight + topPadding + bottomPadding) - - ScrollBar.vertical: ScrollBar { - parent: control - x: control.mirrored ? 0 : control.width - width - y: control.topPadding - height: control.availableHeight - active: control.ScrollBar.horizontal.active - } - - ScrollBar.horizontal: ScrollBar { - parent: control - x: control.leftPadding - y: control.height - height - width: control.availableWidth - active: control.ScrollBar.vertical.active - } -} diff --git a/src/quickcontrols2/material/Slider.qml b/src/quickcontrols2/material/Slider.qml deleted file mode 100644 index 2a366734..00000000 --- a/src/quickcontrols2/material/Slider.qml +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.impl -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.Slider { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitHandleWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitHandleHeight + topPadding + bottomPadding) - - padding: 6 - - handle: SliderHandle { - x: control.leftPadding + (control.horizontal ? control.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2) - y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height)) - value: control.value - handleHasFocus: control.visualFocus - handlePressed: control.pressed - handleHovered: control.hovered - } - - background: Rectangle { - x: control.leftPadding + (control.horizontal ? 0 : (control.availableWidth - width) / 2) - y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : 0) - implicitWidth: control.horizontal ? 200 : 48 - implicitHeight: control.horizontal ? 48 : 200 - width: control.horizontal ? control.availableWidth : 4 - height: control.horizontal ? 4 : control.availableHeight - scale: control.horizontal && control.mirrored ? -1 : 1 - color: control.enabled ? Color.transparent(control.Material.accentColor, 0.33) : control.Material.sliderDisabledColor - - Rectangle { - x: control.horizontal ? 0 : (parent.width - width) / 2 - y: control.horizontal ? (parent.height - height) / 2 : control.visualPosition * parent.height - width: control.horizontal ? control.position * parent.width : 4 - height: control.horizontal ? 4 : control.position * parent.height - - color: control.enabled ? control.Material.accentColor : control.Material.sliderDisabledColor - } - } -} diff --git a/src/quickcontrols2/material/SpinBox.qml b/src/quickcontrols2/material/SpinBox.qml deleted file mode 100644 index 4f69dd25..00000000 --- a/src/quickcontrols2/material/SpinBox.qml +++ /dev/null @@ -1,156 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.SpinBox { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - contentItem.implicitWidth + - up.implicitIndicatorWidth + - down.implicitIndicatorWidth) - implicitHeight: Math.max(implicitContentHeight + topPadding + bottomPadding, - implicitBackgroundHeight, - up.implicitIndicatorHeight, - down.implicitIndicatorHeight) - - spacing: 6 - topPadding: 8 - bottomPadding: 16 - 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)) - - validator: IntValidator { - locale: control.locale.name - bottom: Math.min(control.from, control.to) - top: Math.max(control.from, control.to) - } - - contentItem: TextInput { - text: control.displayText - - font: control.font - color: enabled ? control.Material.foreground : control.Material.hintTextColor - selectionColor: control.Material.textSelectionColor - selectedTextColor: control.Material.foreground - horizontalAlignment: Qt.AlignHCenter - verticalAlignment: Qt.AlignVCenter - - cursorDelegate: CursorDelegate { } - - readOnly: !control.editable - validator: control.validator - inputMethodHints: control.inputMethodHints - } - - up.indicator: Item { - x: control.mirrored ? 0 : parent.width - width - implicitWidth: control.Material.touchTarget - implicitHeight: control.Material.touchTarget - height: parent.height - width: height - - Ripple { - clipRadius: 2 - x: control.spacing - y: control.spacing - width: parent.width - 2 * control.spacing - height: parent.height - 2 * control.spacing - pressed: control.up.pressed - active: control.up.pressed || control.up.hovered || control.visualFocus - color: control.Material.rippleColor - } - - Rectangle { - x: (parent.width - width) / 2 - y: (parent.height - height) / 2 - width: Math.min(parent.width / 3, parent.height / 3) - height: 2 - color: enabled ? control.Material.foreground : control.Material.spinBoxDisabledIconColor - } - Rectangle { - x: (parent.width - width) / 2 - y: (parent.height - height) / 2 - width: 2 - height: Math.min(parent.width / 3, parent.height / 3) - color: enabled ? control.Material.foreground : control.Material.spinBoxDisabledIconColor - } - } - - down.indicator: Item { - x: control.mirrored ? parent.width - width : 0 - implicitWidth: control.Material.touchTarget - implicitHeight: control.Material.touchTarget - height: parent.height - width: height - - Ripple { - clipRadius: 2 - x: control.spacing - y: control.spacing - width: parent.width - 2 * control.spacing - height: parent.height - 2 * control.spacing - pressed: control.down.pressed - active: control.down.pressed || control.down.hovered || control.visualFocus - color: control.Material.rippleColor - } - - Rectangle { - x: (parent.width - width) / 2 - y: (parent.height - height) / 2 - width: parent.width / 3 - height: 2 - color: enabled ? control.Material.foreground : control.Material.spinBoxDisabledIconColor - } - } - - background: Item { - implicitWidth: 192 - implicitHeight: control.Material.touchTarget - - Rectangle { - x: parent.width / 2 - width / 2 - y: parent.y + parent.height - height - control.bottomPadding / 2 - width: control.availableWidth - height: control.activeFocus ? 2 : 1 - color: control.activeFocus ? control.Material.accentColor : control.Material.hintTextColor - } - } -} diff --git a/src/quickcontrols2/material/SplitView.qml b/src/quickcontrols2/material/SplitView.qml deleted file mode 100644 index 95556cd0..00000000 --- a/src/quickcontrols2/material/SplitView.qml +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 -import QtQuick.Templates as T -import QtQuick.Controls.impl -import QtQuick.Controls.Material - -T.SplitView { - id: control - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) - - handle: Rectangle { - implicitWidth: control.orientation === Qt.Horizontal ? 6 : control.width - implicitHeight: control.orientation === Qt.Horizontal ? control.height : 6 - color: T.SplitHandle.pressed ? control.Material.background - : Qt.lighter(control.Material.background, T.SplitHandle.hovered ? 1.2 : 1.1) - - Rectangle { - color: control.Material.secondaryTextColor - width: control.orientation === Qt.Horizontal ? thickness : length - height: control.orientation === Qt.Horizontal ? length : thickness - radius: thickness - x: (parent.width - width) / 2 - y: (parent.height - height) / 2 - - property int length: parent.T.SplitHandle.pressed ? 3 : 8 - readonly property int thickness: parent.T.SplitHandle.pressed ? 3 : 1 - - Behavior on length { - NumberAnimation { - duration: 100 - } - } - } - } -} diff --git a/src/quickcontrols2/material/StackView.qml b/src/quickcontrols2/material/StackView.qml deleted file mode 100644 index 4c3e6749..00000000 --- a/src/quickcontrols2/material/StackView.qml +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material - -T.StackView { - id: control - - popEnter: Transition { - // slide_in_left - NumberAnimation { property: "x"; from: (control.mirrored ? -0.5 : 0.5) * -control.width; to: 0; duration: 200; easing.type: Easing.OutCubic } - NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; duration: 200; easing.type: Easing.OutCubic } - } - - popExit: Transition { - // slide_out_right - NumberAnimation { property: "x"; from: 0; to: (control.mirrored ? -0.5 : 0.5) * control.width; duration: 200; easing.type: Easing.OutCubic } - NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; duration: 200; easing.type: Easing.OutCubic } - } - - pushEnter: Transition { - // slide_in_right - NumberAnimation { property: "x"; from: (control.mirrored ? -0.5 : 0.5) * control.width; to: 0; duration: 200; easing.type: Easing.OutCubic } - NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; duration: 200; easing.type: Easing.OutCubic } - } - - pushExit: Transition { - // slide_out_left - NumberAnimation { property: "x"; from: 0; to: (control.mirrored ? -0.5 : 0.5) * -control.width; duration: 200; easing.type: Easing.OutCubic } - NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; duration: 200; easing.type: Easing.OutCubic } - } - - replaceEnter: Transition { - // slide_in_right - NumberAnimation { property: "x"; from: (control.mirrored ? -0.5 : 0.5) * control.width; to: 0; duration: 200; easing.type: Easing.OutCubic } - NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; duration: 200; easing.type: Easing.OutCubic } - } - - replaceExit: Transition { - // slide_out_left - NumberAnimation { property: "x"; from: 0; to: (control.mirrored ? -0.5 : 0.5) * -control.width; duration: 200; easing.type: Easing.OutCubic } - NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; duration: 200; easing.type: Easing.OutCubic } - } -} diff --git a/src/quickcontrols2/material/SwipeDelegate.qml b/src/quickcontrols2/material/SwipeDelegate.qml deleted file mode 100644 index c7aff94a..00000000 --- a/src/quickcontrols2/material/SwipeDelegate.qml +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.impl -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.SwipeDelegate { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding, - implicitIndicatorHeight + topPadding + bottomPadding) - - padding: 16 - verticalPadding: 8 - spacing: 16 - - icon.width: 24 - icon.height: 24 - icon.color: enabled ? Material.foreground : Material.hintTextColor - - swipe.transition: Transition { SmoothedAnimation { velocity: 3; easing.type: Easing.InOutCubic } } - - contentItem: IconLabel { - spacing: control.spacing - mirrored: control.mirrored - display: control.display - alignment: control.display === IconLabel.IconOnly || control.display === IconLabel.TextUnderIcon ? Qt.AlignCenter : Qt.AlignLeft - - icon: control.icon - text: control.text - font: control.font - color: control.enabled ? control.Material.foreground : control.Material.hintTextColor - } - - background: Rectangle { - implicitHeight: control.Material.delegateHeight - - color: control.Material.backgroundColor - - Rectangle { - width: parent.width - height: parent.height - visible: control.highlighted - color: control.Material.listHighlightColor - } - - Ripple { - width: parent.width - height: parent.height - - clip: visible - pressed: control.pressed - anchor: control - active: control.down || control.visualFocus || control.hovered - color: control.Material.rippleColor - enabled: control.swipe.position === 0 - } - } -} diff --git a/src/quickcontrols2/material/SwipeView.qml b/src/quickcontrols2/material/SwipeView.qml deleted file mode 100644 index cd4da229..00000000 --- a/src/quickcontrols2/material/SwipeView.qml +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material - -T.SwipeView { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - contentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - contentHeight + topPadding + bottomPadding) - - contentItem: ListView { - model: control.contentModel - interactive: control.interactive - currentIndex: control.currentIndex - focus: control.focus - - spacing: control.spacing - orientation: control.orientation - snapMode: ListView.SnapOneItem - boundsBehavior: Flickable.StopAtBounds - - highlightRangeMode: ListView.StrictlyEnforceRange - preferredHighlightBegin: 0 - preferredHighlightEnd: 0 - highlightMoveDuration: 250 - maximumFlickVelocity: 4 * (control.orientation === Qt.Horizontal ? width : height) - } -} diff --git a/src/quickcontrols2/material/Switch.qml b/src/quickcontrols2/material/Switch.qml deleted file mode 100644 index a43e8730..00000000 --- a/src/quickcontrols2/material/Switch.qml +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl -import QtQuick.Templates as T - -T.Switch { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding, - implicitIndicatorHeight + topPadding + bottomPadding) - - padding: 8 - spacing: 8 - - 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 { - leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0 - rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0 - - text: control.text - font: control.font - color: control.enabled ? control.Material.foreground : control.Material.hintTextColor - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - } -} diff --git a/src/quickcontrols2/material/SwitchDelegate.qml b/src/quickcontrols2/material/SwitchDelegate.qml deleted file mode 100644 index fd7b7ab0..00000000 --- a/src/quickcontrols2/material/SwitchDelegate.qml +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.impl -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.SwitchDelegate { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding, - implicitIndicatorHeight + topPadding + bottomPadding) - - padding: 16 - verticalPadding: Material.switchDelegateVerticalPadding - spacing: 16 - - icon.width: 24 - icon.height: 24 - icon.color: enabled ? Material.foreground : Material.hintTextColor - - indicator: SwitchIndicator { - x: control.text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2 - y: control.topPadding + (control.availableHeight - height) / 2 - control: control - } - - contentItem: IconLabel { - leftPadding: !control.mirrored ? 0 : control.indicator.width + control.spacing - rightPadding: control.mirrored ? 0 : control.indicator.width + control.spacing - - spacing: control.spacing - mirrored: control.mirrored - display: control.display - alignment: control.display === IconLabel.IconOnly || control.display === IconLabel.TextUnderIcon ? Qt.AlignCenter : Qt.AlignLeft - - icon: control.icon - text: control.text - font: control.font - color: control.enabled ? control.Material.foreground : control.Material.hintTextColor - } - - background: Rectangle { - implicitHeight: control.Material.delegateHeight - - 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/quickcontrols2/material/TabBar.qml b/src/quickcontrols2/material/TabBar.qml deleted file mode 100644 index 9e9585f3..00000000 --- a/src/quickcontrols2/material/TabBar.qml +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.TabBar { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - contentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - contentHeight + topPadding + bottomPadding) - - spacing: 1 - - contentItem: ListView { - model: control.contentModel - currentIndex: control.currentIndex - - spacing: control.spacing - orientation: ListView.Horizontal - boundsBehavior: Flickable.StopAtBounds - flickableDirection: Flickable.AutoFlickIfNeeded - snapMode: ListView.SnapToItem - - highlightMoveDuration: 250 - highlightResizeDuration: 0 - highlightFollowsCurrentItem: true - highlightRangeMode: ListView.ApplyRange - preferredHighlightBegin: 48 - preferredHighlightEnd: width - 48 - - highlight: Item { - z: 2 - Rectangle { - height: 2 - width: parent.width - y: control.position === T.TabBar.Footer ? 0 : parent.height - height - color: control.Material.accentColor - } - } - } - - background: Rectangle { - color: control.Material.backgroundColor - - layer.enabled: control.Material.elevation > 0 - layer.effect: ElevationEffect { - elevation: control.Material.elevation - fullWidth: true - } - } -} diff --git a/src/quickcontrols2/material/TabButton.qml b/src/quickcontrols2/material/TabButton.qml deleted file mode 100644 index bae0cdb8..00000000 --- a/src/quickcontrols2/material/TabButton.qml +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.impl -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.TabButton { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) - - padding: 12 - spacing: 6 - - icon.width: 24 - icon.height: 24 - icon.color: !enabled ? Material.hintTextColor : down || checked ? Material.accentColor : Material.foreground - - contentItem: IconLabel { - spacing: control.spacing - mirrored: control.mirrored - display: control.display - - icon: control.icon - text: control.text - font: control.font - color: !control.enabled ? control.Material.hintTextColor : control.down || control.checked ? control.Material.accentColor : control.Material.foreground - } - - background: Ripple { - implicitHeight: control.Material.touchTarget - - clip: true - pressed: control.pressed - anchor: control - active: control.down || control.visualFocus || control.hovered - color: control.Material.rippleColor - } -} diff --git a/src/quickcontrols2/material/TextArea.qml b/src/quickcontrols2/material/TextArea.qml deleted file mode 100644 index a213bd7a..00000000 --- a/src/quickcontrols2/material/TextArea.qml +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.impl -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.TextArea { - id: control - - implicitWidth: Math.max(contentWidth + leftPadding + rightPadding, - implicitBackgroundWidth + leftInset + rightInset, - placeholder.implicitWidth + leftPadding + rightPadding) - implicitHeight: Math.max(contentHeight + topPadding + bottomPadding, - implicitBackgroundHeight + topInset + bottomInset, - placeholder.implicitHeight + 1 + topPadding + bottomPadding) - - topPadding: 8 - bottomPadding: 16 - - color: enabled ? Material.foreground : Material.hintTextColor - selectionColor: Material.accentColor - selectedTextColor: Material.primaryHighlightedTextColor - placeholderTextColor: Material.hintTextColor - cursorDelegate: CursorDelegate { } - - PlaceholderText { - id: placeholder - x: control.leftPadding - y: control.topPadding - width: control.width - (control.leftPadding + control.rightPadding) - height: control.height - (control.topPadding + control.bottomPadding) - text: control.placeholderText - font: control.font - color: control.placeholderTextColor - verticalAlignment: control.verticalAlignment - elide: Text.ElideRight - renderType: control.renderType - visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter) - } - - background: Rectangle { - y: parent.height - height - control.bottomPadding / 2 - implicitWidth: 120 - height: control.activeFocus ? 2 : 1 - color: control.activeFocus ? control.Material.accentColor : control.Material.hintTextColor - } -} diff --git a/src/quickcontrols2/material/TextField.qml b/src/quickcontrols2/material/TextField.qml deleted file mode 100644 index 8623ddf5..00000000 --- a/src/quickcontrols2/material/TextField.qml +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.impl -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.TextField { - id: control - - implicitWidth: implicitBackgroundWidth + leftInset + rightInset - || Math.max(contentWidth, placeholder.implicitWidth) + leftPadding + rightPadding - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - contentHeight + topPadding + bottomPadding, - placeholder.implicitHeight + topPadding + bottomPadding) - - topPadding: 8 - bottomPadding: 16 - - color: enabled ? Material.foreground : Material.hintTextColor - selectionColor: Material.accentColor - selectedTextColor: Material.primaryHighlightedTextColor - placeholderTextColor: Material.hintTextColor - verticalAlignment: TextInput.AlignVCenter - - cursorDelegate: CursorDelegate { } - - PlaceholderText { - id: placeholder - x: control.leftPadding - y: control.topPadding - width: control.width - (control.leftPadding + control.rightPadding) - height: control.height - (control.topPadding + control.bottomPadding) - text: control.placeholderText - font: control.font - color: control.placeholderTextColor - verticalAlignment: control.verticalAlignment - elide: Text.ElideRight - renderType: control.renderType - visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter) - } - - background: Rectangle { - y: control.height - height - control.bottomPadding + 8 - implicitWidth: 120 - height: control.activeFocus || control.hovered ? 2 : 1 - color: control.activeFocus ? control.Material.accentColor - : (control.hovered ? control.Material.primaryTextColor : control.Material.hintTextColor) - } -} diff --git a/src/quickcontrols2/material/ToolBar.qml b/src/quickcontrols2/material/ToolBar.qml deleted file mode 100644 index a1aa82bd..00000000 --- a/src/quickcontrols2/material/ToolBar.qml +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.ToolBar { - id: control - - Material.elevation: 4 - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - contentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - contentHeight + topPadding + bottomPadding) - - Material.foreground: Material.toolTextColor - - spacing: 16 - - background: Rectangle { - implicitHeight: 48 - color: control.Material.toolBarColor - - layer.enabled: control.Material.elevation > 0 - layer.effect: ElevationEffect { - elevation: control.Material.elevation - fullWidth: true - } - } -} diff --git a/src/quickcontrols2/material/ToolButton.qml b/src/quickcontrols2/material/ToolButton.qml deleted file mode 100644 index be7ae332..00000000 --- a/src/quickcontrols2/material/ToolButton.qml +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.impl -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.ToolButton { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) - - padding: 6 - spacing: 6 - - icon.width: 24 - icon.height: 24 - icon.color: !enabled ? Material.hintTextColor : checked || highlighted ? Material.accent : Material.foreground - - contentItem: IconLabel { - spacing: control.spacing - mirrored: control.mirrored - display: control.display - - icon: control.icon - text: control.text - font: control.font - color: !control.enabled ? control.Material.hintTextColor : - control.checked || control.highlighted ? control.Material.accent : control.Material.foreground - } - - background: Ripple { - implicitWidth: control.Material.touchTarget - implicitHeight: control.Material.touchTarget - - readonly property bool square: control.contentItem.width <= control.contentItem.height - - x: (parent.width - width) / 2 - y: (parent.height - height) / 2 - clip: !square - width: square ? parent.height / 2 : parent.width - height: square ? parent.height / 2 : parent.height - pressed: control.pressed - anchor: control - active: control.enabled && (control.down || control.visualFocus || control.hovered) - color: control.Material.rippleColor - } -} diff --git a/src/quickcontrols2/material/ToolSeparator.qml b/src/quickcontrols2/material/ToolSeparator.qml deleted file mode 100644 index 4bce553d..00000000 --- a/src/quickcontrols2/material/ToolSeparator.qml +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material - -T.ToolSeparator { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) - - horizontalPadding: vertical ? 12 : 5 - verticalPadding: vertical ? 5 : 12 - - contentItem: Rectangle { - implicitWidth: vertical ? 1 : 38 - implicitHeight: vertical ? 38 : 1 - color: control.Material.hintTextColor - } -} diff --git a/src/quickcontrols2/material/ToolTip.qml b/src/quickcontrols2/material/ToolTip.qml deleted file mode 100644 index 033e48a3..00000000 --- a/src/quickcontrols2/material/ToolTip.qml +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material - -T.ToolTip { - id: control - - x: parent ? (parent.width - implicitWidth) / 2 : 0 - y: -implicitHeight - 24 - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - contentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - contentHeight + topPadding + bottomPadding) - - margins: 12 - padding: 8 - horizontalPadding: padding + 8 - - closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent | T.Popup.CloseOnReleaseOutsideParent - - Material.theme: Material.Dark - - enter: Transition { - // toast_enter - NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; easing.type: Easing.OutQuad; duration: 500 } - } - - exit: Transition { - // toast_exit - NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; easing.type: Easing.InQuad; duration: 500 } - } - - contentItem: Text { - text: control.text - font: control.font - wrapMode: Text.Wrap - color: control.Material.foreground - } - - background: Rectangle { - implicitHeight: control.Material.tooltipHeight - color: control.Material.tooltipColor - opacity: 0.9 - radius: 2 - } -} diff --git a/src/quickcontrols2/material/Tumbler.qml b/src/quickcontrols2/material/Tumbler.qml deleted file mode 100644 index 2c1e5d66..00000000 --- a/src/quickcontrols2/material/Tumbler.qml +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Controls.impl -import QtQuick.Templates as T -import QtQuick.Controls.Material - -T.Tumbler { - id: control - - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) - - delegate: Text { - text: modelData - color: control.Material.foreground - font: control.font - opacity: (1.0 - Math.abs(Tumbler.displacement) / (control.visibleItemCount / 2)) * (control.enabled ? 1 : 0.6) - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - - contentItem: TumblerView { - implicitWidth: 60 - implicitHeight: 200 - model: control.model - delegate: control.delegate - path: Path { - startX: control.contentItem.width / 2 - startY: -control.contentItem.delegateHeight / 2 - PathLine { - x: control.contentItem.width / 2 - y: (control.visibleItemCount + 1) * control.contentItem.delegateHeight - control.contentItem.delegateHeight / 2 - } - } - - property real delegateHeight: control.availableHeight / control.visibleItemCount - } -} diff --git a/src/quickcontrols2/material/VerticalHeaderView.qml b/src/quickcontrols2/material/VerticalHeaderView.qml deleted file mode 100644 index 9769627e..00000000 --- a/src/quickcontrols2/material/VerticalHeaderView.qml +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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 -import QtQuick.Templates as T -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -T.VerticalHeaderView { - id: control - - implicitWidth: contentWidth - implicitHeight: syncView ? syncView.height : 0 - - delegate: Rectangle { - // Qt6: add cellPadding (and font etc) as public API in headerview - readonly property real cellPadding: 8 - - implicitWidth: Math.max(control.width, text.implicitWidth + (cellPadding * 2)) - implicitHeight: text.implicitHeight + (cellPadding * 2) - color: control.Material.backgroundColor - - Text { - id: text - text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] - : model[control.textRole]) - : modelData - width: parent.width - height: parent.height - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - color: enabled ? control.Material.foreground : control.Material.hintTextColor - } - } -} diff --git a/src/quickcontrols2/material/images/arrow-indicator.png b/src/quickcontrols2/material/images/arrow-indicator.png Binary files differdeleted file mode 100644 index 5a978001..00000000 --- a/src/quickcontrols2/material/images/arrow-indicator.png +++ /dev/null diff --git a/src/quickcontrols2/material/images/arrow-indicator.svg b/src/quickcontrols2/material/images/arrow-indicator.svg deleted file mode 100644 index 1e7217c8..00000000 --- a/src/quickcontrols2/material/images/arrow-indicator.svg +++ /dev/null @@ -1,56 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="5" - height="10" - viewBox="0 0 5 10" - version="1.1" - id="svg2" - inkscape:version="0.91 r13725" - sodipodi:docname="arrow-indicator.svg"> - <metadata - id="metadata10"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> - </cc:Work> - </rdf:RDF> - </metadata> - <defs - id="defs8" /> - <sodipodi:namedview - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1" - objecttolerance="10" - gridtolerance="10" - guidetolerance="10" - inkscape:pageopacity="0" - inkscape:pageshadow="2" - inkscape:window-width="2560" - inkscape:window-height="1571" - id="namedview6" - showgrid="false" - inkscape:zoom="27.812867" - inkscape:cx="13.137558" - inkscape:cy="12.83583" - inkscape:window-x="0" - inkscape:window-y="55" - inkscape:window-maximized="1" - inkscape:current-layer="svg2" /> - <path - d="M 0,10 5,5 0,0 Z" - id="path4" - inkscape:connector-curvature="0" - style="fill:#757575" /> -</svg> diff --git a/src/quickcontrols2/material/images/[email protected] b/src/quickcontrols2/material/images/[email protected] Binary files differdeleted file mode 100644 index 37ce3a95..00000000 --- a/src/quickcontrols2/material/images/[email protected] +++ /dev/null diff --git a/src/quickcontrols2/material/images/[email protected] b/src/quickcontrols2/material/images/[email protected] Binary files differdeleted file mode 100644 index 57abd972..00000000 --- a/src/quickcontrols2/material/images/[email protected] +++ /dev/null diff --git a/src/quickcontrols2/material/images/[email protected] b/src/quickcontrols2/material/images/[email protected] Binary files differdeleted file mode 100644 index 26d3d7c1..00000000 --- a/src/quickcontrols2/material/images/[email protected] +++ /dev/null diff --git a/src/quickcontrols2/material/images/check.png b/src/quickcontrols2/material/images/check.png Binary files differdeleted file mode 100644 index 756a43a5..00000000 --- a/src/quickcontrols2/material/images/check.png +++ /dev/null diff --git a/src/quickcontrols2/material/images/[email protected] b/src/quickcontrols2/material/images/[email protected] Binary files differdeleted file mode 100644 index 9d1d6a32..00000000 --- a/src/quickcontrols2/material/images/[email protected] +++ /dev/null diff --git a/src/quickcontrols2/material/images/[email protected] b/src/quickcontrols2/material/images/[email protected] Binary files differdeleted file mode 100644 index 32ed72f0..00000000 --- a/src/quickcontrols2/material/images/[email protected] +++ /dev/null diff --git a/src/quickcontrols2/material/images/[email protected] b/src/quickcontrols2/material/images/[email protected] Binary files differdeleted file mode 100644 index 1767cee6..00000000 --- a/src/quickcontrols2/material/images/[email protected] +++ /dev/null diff --git a/src/quickcontrols2/material/images/drop-indicator.png b/src/quickcontrols2/material/images/drop-indicator.png Binary files differdeleted file mode 100644 index 93560f50..00000000 --- a/src/quickcontrols2/material/images/drop-indicator.png +++ /dev/null diff --git a/src/quickcontrols2/material/images/drop-indicator.svg b/src/quickcontrols2/material/images/drop-indicator.svg deleted file mode 100644 index 94b5ca15..00000000 --- a/src/quickcontrols2/material/images/drop-indicator.svg +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" standalone="no"?> -<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> -<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" version="1.1"> - <path d="M7,10l5,5,5-5z" fill="#757575"/> -</svg> diff --git a/src/quickcontrols2/material/images/[email protected] b/src/quickcontrols2/material/images/[email protected] Binary files differdeleted file mode 100644 index d32f8160..00000000 --- a/src/quickcontrols2/material/images/[email protected] +++ /dev/null diff --git a/src/quickcontrols2/material/images/[email protected] b/src/quickcontrols2/material/images/[email protected] Binary files differdeleted file mode 100644 index 34c3e7d1..00000000 --- a/src/quickcontrols2/material/images/[email protected] +++ /dev/null diff --git a/src/quickcontrols2/material/images/[email protected] b/src/quickcontrols2/material/images/[email protected] Binary files differdeleted file mode 100644 index 0613f6dd..00000000 --- a/src/quickcontrols2/material/images/[email protected] +++ /dev/null diff --git a/src/quickcontrols2/material/impl/BoxShadow.qml b/src/quickcontrols2/material/impl/BoxShadow.qml deleted file mode 100644 index ea09570e..00000000 --- a/src/quickcontrols2/material/impl/BoxShadow.qml +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -/* - A implementation of CSS's box-shadow, used by ElevationEffect for a Material Design - elevation shadow effect. - */ -RectangularGlow { - // The 4 properties from CSS box-shadow, plus the inherited color property - property int offsetX - property int offsetY - property int blurRadius - property int spreadRadius - - // The source item the shadow is being applied to, used for correctly - // calculating the corner radious - property Item source - - property bool fullWidth - property bool fullHeight - - x: (parent.width - width)/2 + offsetX - y: (parent.height - height)/2 + offsetY - - implicitWidth: source ? source.width : parent.width - implicitHeight: source ? source.height : parent.height - - width: implicitWidth + 2 * spreadRadius + (fullWidth ? 2 * cornerRadius : 0) - height: implicitHeight + 2 * spreadRadius + (fullHeight ? 2 * cornerRadius : 0) - glowRadius: blurRadius/2 - spread: 0.05 - cornerRadius: blurRadius + (source && source.radius || 0) -} diff --git a/src/quickcontrols2/material/impl/CMakeLists.txt b/src/quickcontrols2/material/impl/CMakeLists.txt deleted file mode 100644 index 289a4b05..00000000 --- a/src/quickcontrols2/material/impl/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -##################################################################### -## qtquickcontrols2materialstyleimplplugin Plugin: -##################################################################### - -set(qml_files - "BoxShadow.qml" - "CheckIndicator.qml" - "CursorDelegate.qml" - "ElevationEffect.qml" - "RadioIndicator.qml" - "RectangularGlow.qml" - "SliderHandle.qml" - "SwitchIndicator.qml" -) -set_source_files_properties(${qml_files} PROPERTIES - QT_QML_SOURCE_VERSION "2.0" -) - -qt_internal_add_qml_module(qtquickcontrols2materialstyleimplplugin - URI "QtQuick.Controls.Material.impl" - VERSION "${PROJECT_VERSION}" - CLASS_NAME QtQuickControls2MaterialStyleImplPlugin - PLUGIN_TARGET qtquickcontrols2materialstyleimplplugin - NO_PLUGIN_OPTIONAL - SOURCES - qquickmaterialbusyindicator.cpp qquickmaterialbusyindicator_p.h - qquickmaterialprogressbar.cpp qquickmaterialprogressbar_p.h - qquickmaterialripple.cpp qquickmaterialripple_p.h - QML_FILES - ${qml_files} - DEFINES - QT_NO_CAST_FROM_ASCII - QT_NO_CAST_TO_ASCII - LIBRARIES - Qt::CorePrivate - Qt::Gui - Qt::QmlPrivate - Qt::QuickControls2ImplPrivate - Qt::QuickPrivate - Qt::QuickTemplates2Private -) diff --git a/src/quickcontrols2/material/impl/CheckIndicator.qml b/src/quickcontrols2/material/impl/CheckIndicator.qml deleted file mode 100644 index b6593fab..00000000 --- a/src/quickcontrols2/material/impl/CheckIndicator.qml +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -Rectangle { - id: indicatorItem - implicitWidth: 18 - implicitHeight: 18 - color: "transparent" - border.color: !control.enabled ? control.Material.hintTextColor - : checkState !== Qt.Unchecked ? control.Material.accentColor : control.Material.secondaryTextColor - border.width: checkState !== Qt.Unchecked ? width / 2 : 2 - radius: 2 - - property Item control - property int checkState: control.checkState - - Behavior on border.width { - NumberAnimation { - duration: 100 - easing.type: Easing.OutCubic - } - } - - Behavior on border.color { - ColorAnimation { - duration: 100 - easing.type: Easing.OutCubic - } - } - - // TODO: This needs to be transparent - Image { - id: checkImage - x: (parent.width - width) / 2 - y: (parent.height - height) / 2 - width: 14 - height: 14 - source: "qrc:/qt-project.org/imports/QtQuick/Controls/Material/images/check.png" - fillMode: Image.PreserveAspectFit - - scale: indicatorItem.checkState === Qt.Checked ? 1 : 0 - Behavior on scale { NumberAnimation { duration: 100 } } - } - - Rectangle { - x: (parent.width - width) / 2 - y: (parent.height - height) / 2 - width: 12 - height: 3 - - scale: indicatorItem.checkState === Qt.PartiallyChecked ? 1 : 0 - Behavior on scale { NumberAnimation { duration: 100 } } - } - - states: [ - State { - name: "checked" - when: indicatorItem.checkState === Qt.Checked - }, - State { - name: "partiallychecked" - when: indicatorItem.checkState === Qt.PartiallyChecked - } - ] - - transitions: Transition { - SequentialAnimation { - NumberAnimation { - target: indicatorItem - property: "scale" - // Go down 2 pixels in size. - to: 1 - 2 / indicatorItem.width - duration: 120 - } - NumberAnimation { - target: indicatorItem - property: "scale" - to: 1 - duration: 120 - } - } - } -} diff --git a/src/quickcontrols2/material/impl/CursorDelegate.qml b/src/quickcontrols2/material/impl/CursorDelegate.qml deleted file mode 100644 index a913ab84..00000000 --- a/src/quickcontrols2/material/impl/CursorDelegate.qml +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Controls.Material - -Rectangle { - id: cursor - - color: parent.Material.accentColor - width: 2 - visible: parent.activeFocus && !parent.readOnly && parent.selectionStart === parent.selectionEnd - - Connections { - target: cursor.parent - function onCursorPositionChanged() { - // keep a moving cursor visible - cursor.opacity = 1 - timer.restart() - } - } - - Timer { - id: timer - running: cursor.parent.activeFocus && !cursor.parent.readOnly && interval != 0 - repeat: true - interval: Qt.styleHints.cursorFlashTime / 2 - onTriggered: cursor.opacity = !cursor.opacity ? 1 : 0 - // force the cursor visible when gaining focus - onRunningChanged: cursor.opacity = 1 - } -} diff --git a/src/quickcontrols2/material/impl/ElevationEffect.qml b/src/quickcontrols2/material/impl/ElevationEffect.qml deleted file mode 100644 index 8a4e98e3..00000000 --- a/src/quickcontrols2/material/impl/ElevationEffect.qml +++ /dev/null @@ -1,279 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -/* - 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. - - \sa fullHeight - */ - 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. - - \sa fullWidth - */ - property bool fullHeight: false - - /* - \internal - - The actual source Item the effect is applied to. - */ - readonly property Item sourceItem: source.sourceItem - - /* - * The following shadow values are taken from Angular Material - * - * The MIT License (MIT) - * - * Copyright (c) 2014-2016 Google, Inc. http://angularjs.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * 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 - make up the elevation. - */ - readonly property var _shadows: [ - [{offset: 0, blur: 0, spread: 0}, - {offset: 0, blur: 0, spread: 0}, - {offset: 0, blur: 0, spread: 0}], - - [{offset: 1, blur: 3, spread: 0}, - {offset: 1, blur: 1, spread: 0}, - {offset: 2, blur: 1, spread: -1}], - - [{offset: 1, blur: 5, spread: 0}, - {offset: 2, blur: 2, spread: 0}, - {offset: 3, blur: 1, spread: -2}], - - [{offset: 1, blur: 8, spread: 0}, - {offset: 3, blur: 4, spread: 0}, - {offset: 3, blur: 3, spread: -2}], - - [{offset: 2, blur: 4, spread: -1}, - {offset: 4, blur: 5, spread: 0}, - {offset: 1, blur: 10, spread: 0}], - - [{offset: 3, blur: 5, spread: -1}, - {offset: 5, blur: 8, spread: 0}, - {offset: 1, blur: 14, spread: 0}], - - [{offset: 3, blur: 5, spread: -1}, - {offset: 6, blur: 10, spread: 0}, - {offset: 1, blur: 18, spread: 0}], - - [{offset: 4, blur: 5, spread: -2}, - {offset: 7, blur: 10, spread: 1}, - {offset: 2, blur: 16, spread: 1}], - - [{offset: 5, blur: 5, spread: -3}, - {offset: 8, blur: 10, spread: 1}, - {offset: 3, blur: 14, spread: 2}], - - [{offset: 5, blur: 6, spread: -3}, - {offset: 9, blur: 12, spread: 1}, - {offset: 3, blur: 16, spread: 2}], - - [{offset: 6, blur: 6, spread: -3}, - {offset: 10, blur: 14, spread: 1}, - {offset: 4, blur: 18, spread: 3}], - - [{offset: 6, blur: 7, spread: -4}, - {offset: 11, blur: 15, spread: 1}, - {offset: 4, blur: 20, spread: 3}], - - [{offset: 7, blur: 8, spread: -4}, - {offset: 12, blur: 17, spread: 2}, - {offset: 5, blur: 22, spread: 4}], - - [{offset: 7, blur: 8, spread: -4}, - {offset: 13, blur: 19, spread: 2}, - {offset: 5, blur: 24, spread: 4}], - - [{offset: 7, blur: 9, spread: -4}, - {offset: 14, blur: 21, spread: 2}, - {offset: 5, blur: 26, spread: 4}], - - [{offset: 8, blur: 9, spread: -5}, - {offset: 15, blur: 22, spread: 2}, - {offset: 6, blur: 28, spread: 5}], - - [{offset: 8, blur: 10, spread: -5}, - {offset: 16, blur: 24, spread: 2}, - {offset: 6, blur: 30, spread: 5}], - - [{offset: 8, blur: 11, spread: -5}, - {offset: 17, blur: 26, spread: 2}, - {offset: 6, blur: 32, spread: 5}], - - [{offset: 9, blur: 11, spread: -5}, - {offset: 18, blur: 28, spread: 2}, - {offset: 7, blur: 34, spread: 6}], - - [{offset: 9, blur: 12, spread: -6}, - {offset: 19, blur: 29, spread: 2}, - {offset: 7, blur: 36, spread: 6}], - - [{offset: 10, blur: 13, spread: -6}, - {offset: 20, blur: 31, spread: 3}, - {offset: 8, blur: 38, spread: 7}], - - [{offset: 10, blur: 13, spread: -6}, - {offset: 21, blur: 33, spread: 3}, - {offset: 8, blur: 40, spread: 7}], - - [{offset: 10, blur: 14, spread: -6}, - {offset: 22, blur: 35, spread: 3}, - {offset: 8, blur: 42, spread: 7}], - - [{offset: 11, blur: 14, spread: -7}, - {offset: 23, blur: 36, spread: 3}, - {offset: 9, blur: 44, spread: 8}], - - [{offset: 11, blur: 15, spread: -7}, - {offset: 24, blur: 38, spread: 3}, - {offset: 9, blur: 46, spread: 8}] - ] - - /* - \internal - - The current shadow based on the elevation. - */ - readonly property var _shadow: _shadows[Math.max(0, Math.min(elevation, _shadows.length - 1))] - - // Nest the shadows and source view in two items rendered as a layer - // so the shadow is not clipped by the bounds of the source view - Item { - property int margin: -100 - - x: margin - y: margin - width: parent.width - 2 * margin - height: parent.height - 2 * margin - - // By rendering as a layer, the shadow will never show through the source item, - // even when the source item's opacity is less than 1 - layer.enabled: true - - // The box shadows automatically pick up the size of the source Item and not - // the size of the parent, so we don't need to worry about the extra padding - // in the parent Item - BoxShadow { - offsetY: effect._shadow[0].offset - blurRadius: effect._shadow[0].blur - spreadRadius: effect._shadow[0].spread - color: Qt.rgba(0,0,0, 0.2) - - fullWidth: effect.fullWidth - fullHeight: effect.fullHeight - source: effect.sourceItem - } - - BoxShadow { - offsetY: effect._shadow[1].offset - blurRadius: effect._shadow[1].blur - spreadRadius: effect._shadow[1].spread - color: Qt.rgba(0,0,0, 0.14) - - fullWidth: effect.fullWidth - fullHeight: effect.fullHeight - source: effect.sourceItem - } - - BoxShadow { - offsetY: effect._shadow[2].offset - blurRadius: effect._shadow[2].blur - spreadRadius: effect._shadow[2].spread - color: Qt.rgba(0,0,0, 0.12) - - fullWidth: effect.fullWidth - fullHeight: effect.fullHeight - source: effect.sourceItem - } - - ShaderEffect { - property alias source: effect.source - - x: (parent.width - width)/2 - y: (parent.height - height)/2 - width: effect.sourceItem.width - height: effect.sourceItem.height - } - } -} diff --git a/src/quickcontrols2/material/impl/RadioIndicator.qml b/src/quickcontrols2/material/impl/RadioIndicator.qml deleted file mode 100644 index 68681c44..00000000 --- a/src/quickcontrols2/material/impl/RadioIndicator.qml +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -Rectangle { - id: indicator - implicitWidth: 20 - implicitHeight: 20 - radius: width / 2 - border.width: 2 - border.color: !control.enabled ? control.Material.hintTextColor - : control.checked || control.down ? control.Material.accentColor : control.Material.secondaryTextColor - color: "transparent" - - property Item control - - Rectangle { - x: (parent.width - width) / 2 - y: (parent.height - height) / 2 - width: 10 - height: 10 - radius: width / 2 - color: parent.border.color - visible: indicator.control.checked || indicator.control.down - } -} diff --git a/src/quickcontrols2/material/impl/RectangularGlow.qml b/src/quickcontrols2/material/impl/RectangularGlow.qml deleted file mode 100644 index b2337afc..00000000 --- a/src/quickcontrols2/material/impl/RectangularGlow.qml +++ /dev/null @@ -1,240 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 - -/* - 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 + rootItem.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/Material/shaders/RectangularGlow.frag" - } -} diff --git a/src/quickcontrols2/material/impl/SliderHandle.qml b/src/quickcontrols2/material/impl/SliderHandle.qml deleted file mode 100644 index 60fd7aed..00000000 --- a/src/quickcontrols2/material/impl/SliderHandle.qml +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -Item { - id: root - implicitWidth: initialSize - implicitHeight: initialSize - - property real value: 0 - property bool handleHasFocus: false - property bool handlePressed: false - property bool handleHovered: false - readonly property int initialSize: 13 - readonly property var control: parent - - Rectangle { - id: handleRect - width: parent.width - height: parent.height - radius: width / 2 - scale: root.handlePressed ? 1.5 : 1 - color: control.enabled ? root.control.Material.accentColor : root.control.Material.sliderDisabledColor - - Behavior on scale { - NumberAnimation { - duration: 250 - } - } - } - - Ripple { - 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: root.control.Material.highlightedRippleColor - } -} diff --git a/src/quickcontrols2/material/impl/SwitchIndicator.qml b/src/quickcontrols2/material/impl/SwitchIndicator.qml deleted file mode 100644 index ae1709b6..00000000 --- a/src/quickcontrols2/material/impl/SwitchIndicator.qml +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Controls.Material -import QtQuick.Controls.Material.impl - -Item { - id: indicator - implicitWidth: 38 - implicitHeight: 32 - - property Item control - property alias handle: handle - - Material.elevation: 1 - - Rectangle { - width: parent.width - height: 14 - radius: height / 2 - y: parent.height / 2 - height / 2 - color: indicator.control.enabled ? (indicator.control.checked ? indicator.control.Material.switchCheckedTrackColor : indicator.control.Material.switchUncheckedTrackColor) - : indicator.control.Material.switchDisabledTrackColor - } - - Rectangle { - id: handle - x: Math.max(0, Math.min(parent.width - width, indicator.control.visualPosition * parent.width - (width / 2))) - y: (parent.height - height) / 2 - width: 20 - height: 20 - radius: width / 2 - color: indicator.control.enabled ? (indicator.control.checked ? indicator.control.Material.switchCheckedHandleColor : indicator.control.Material.switchUncheckedHandleColor) - : indicator.control.Material.switchDisabledHandleColor - - Behavior on x { - enabled: !indicator.control.pressed - SmoothedAnimation { - duration: 300 - } - } - layer.enabled: indicator.Material.elevation > 0 - layer.effect: ElevationEffect { - elevation: indicator.Material.elevation - } - } -} diff --git a/src/quickcontrols2/material/impl/qquickmaterialbusyindicator.cpp b/src/quickcontrols2/material/impl/qquickmaterialbusyindicator.cpp deleted file mode 100644 index 10bcc035..00000000 --- a/src/quickcontrols2/material/impl/qquickmaterialbusyindicator.cpp +++ /dev/null @@ -1,245 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "qquickmaterialbusyindicator_p.h" - -#include <QtCore/qmath.h> -#include <QtCore/qeasingcurve.h> -#include <QtGui/qpainter.h> -#include <QtQuick/qsgimagenode.h> -#include <QtQuick/qquickwindow.h> -#include <QtQuickControls2Impl/private/qquickanimatednode_p.h> - -QT_BEGIN_NAMESPACE - -/* - Relevant Android code: - - - core/res/res/anim/progress_indeterminate_rotation_material.xml contains - the rotation animation data. - - core/res/res/anim/progress_indeterminate_material.xml contains the trim - animation data. - - core/res/res/interpolator/trim_start_interpolator.xml and - core/res/res/interpolator/trim_end_interpolator.xml contain the start - and end trim path interpolators. - - addCommand() in core/java/android/util/PathParser.java has a list of the - different path commands available. -*/ - -static const int SpanAnimationDuration = 700; -static const int RotationAnimationDuration = SpanAnimationDuration * 6; -static const int TargetRotation = 720; -static const int OneDegree = 16; -static const qreal MinSweepSpan = 10 * OneDegree; -static const qreal MaxSweepSpan = 300 * OneDegree; - -class QQuickMaterialBusyIndicatorNode : public QQuickAnimatedNode -{ -public: - QQuickMaterialBusyIndicatorNode(QQuickMaterialBusyIndicator *item); - - void sync(QQuickItem *item) override; - -protected: - void updateCurrentTime(int time) override; - -private: - int m_lastStartAngle = 0; - int m_lastEndAngle = 0; - qreal m_width = 0; - qreal m_height = 0; - qreal m_devicePixelRatio = 1; - QColor m_color; -}; - -QQuickMaterialBusyIndicatorNode::QQuickMaterialBusyIndicatorNode(QQuickMaterialBusyIndicator *item) - : QQuickAnimatedNode(item) -{ - setLoopCount(Infinite); - setCurrentTime(item->elapsed()); - setDuration(RotationAnimationDuration); - - QSGImageNode *textureNode = item->window()->createImageNode(); - textureNode->setOwnsTexture(true); - appendChildNode(textureNode); - - // A texture seems to be required here, but we don't have one yet, as we haven't drawn anything, - // so just use a blank image. - QImage blankImage(item->width(), item->height(), QImage::Format_ARGB32_Premultiplied); - blankImage.fill(Qt::transparent); - textureNode->setTexture(item->window()->createTextureFromImage(blankImage)); -} - -void QQuickMaterialBusyIndicatorNode::updateCurrentTime(int time) -{ - const qreal w = m_width; - const qreal h = m_height; - const qreal size = qMin(w, h); - const qreal dx = (w - size) / 2; - const qreal dy = (h - size) / 2; - - QImage image(size * m_devicePixelRatio, size * m_devicePixelRatio, QImage::Format_ARGB32_Premultiplied); - image.fill(Qt::transparent); - - QPainter painter(&image); - painter.setRenderHint(QPainter::Antialiasing); - - QPen pen; - QSGImageNode *textureNode = static_cast<QSGImageNode *>(firstChild()); - pen.setColor(m_color); - pen.setWidth(qCeil(size / 12) * m_devicePixelRatio); - painter.setPen(pen); - - const qreal percentageComplete = time / qreal(RotationAnimationDuration); - const qreal spanPercentageComplete = (time % SpanAnimationDuration) / qreal(SpanAnimationDuration); - const int iteration = time / SpanAnimationDuration; - int startAngle = 0; - int endAngle = 0; - - if (iteration % 2 == 0) { - if (m_lastStartAngle > 360 * OneDegree) - m_lastStartAngle -= 360 * OneDegree; - - // The start angle is only affected by the rotation animation for the "grow" phase. - startAngle = m_lastStartAngle; - QEasingCurve angleCurve(QEasingCurve::OutQuad); - const qreal percentage = angleCurve.valueForProgress(spanPercentageComplete); - endAngle = m_lastStartAngle + MinSweepSpan + percentage * (MaxSweepSpan - MinSweepSpan); - m_lastEndAngle = endAngle; - } else { - // Both the start angle *and* the span are affected by the "shrink" phase. - QEasingCurve angleCurve(QEasingCurve::InQuad); - const qreal percentage = angleCurve.valueForProgress(spanPercentageComplete); - startAngle = m_lastEndAngle - MaxSweepSpan + percentage * (MaxSweepSpan - MinSweepSpan); - endAngle = m_lastEndAngle; - m_lastStartAngle = startAngle; - } - - const int halfPen = pen.width() / 2; - const QRectF arcBounds = QRectF(halfPen, halfPen, - m_devicePixelRatio * size - pen.width(), - m_devicePixelRatio * size - pen.width()); - // The current angle of the rotation animation. - const qreal rotation = OneDegree * percentageComplete * -TargetRotation; - startAngle -= rotation; - endAngle -= rotation; - const int angleSpan = endAngle - startAngle; - painter.drawArc(arcBounds, -startAngle, -angleSpan); - painter.end(); - - textureNode->setRect(QRectF(dx, dy, size, size)); - textureNode->setTexture(window()->createTextureFromImage(image)); -} - -void QQuickMaterialBusyIndicatorNode::sync(QQuickItem *item) -{ - QQuickMaterialBusyIndicator *indicator = static_cast<QQuickMaterialBusyIndicator *>(item); - m_color = indicator->color(); - m_width = indicator->width(); - m_height = indicator->height(); - m_devicePixelRatio = indicator->window()->effectiveDevicePixelRatio(); -} - -QQuickMaterialBusyIndicator::QQuickMaterialBusyIndicator(QQuickItem *parent) : - QQuickItem(parent) -{ - setFlag(ItemHasContents); -} - -QColor QQuickMaterialBusyIndicator::color() const -{ - return m_color; -} - -void QQuickMaterialBusyIndicator::setColor(const QColor &color) -{ - if (m_color == color) - return; - - m_color = color; - update(); -} - -bool QQuickMaterialBusyIndicator::isRunning() const -{ - return isVisible(); -} - -void QQuickMaterialBusyIndicator::setRunning(bool running) -{ - if (running) - setVisible(true); -} - -int QQuickMaterialBusyIndicator::elapsed() const -{ - return m_elapsed; -} - -void QQuickMaterialBusyIndicator::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data) -{ - QQuickItem::itemChange(change, data); - switch (change) { - case ItemOpacityHasChanged: - if (qFuzzyIsNull(data.realValue)) - setVisible(false); - break; - case ItemVisibleHasChanged: - update(); - break; - default: - break; - } -} - -QSGNode *QQuickMaterialBusyIndicator::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) -{ - QQuickMaterialBusyIndicatorNode *node = static_cast<QQuickMaterialBusyIndicatorNode *>(oldNode); - if (isRunning() && width() > 0 && height() > 0) { - if (!node) { - node = new QQuickMaterialBusyIndicatorNode(this); - node->start(); - } - node->sync(this); - } else { - m_elapsed = node ? node->currentTime() : 0; - delete node; - node = nullptr; - } - return node; -} - -QT_END_NAMESPACE diff --git a/src/quickcontrols2/material/impl/qquickmaterialbusyindicator_p.h b/src/quickcontrols2/material/impl/qquickmaterialbusyindicator_p.h deleted file mode 100644 index 72aeaf66..00000000 --- a/src/quickcontrols2/material/impl/qquickmaterialbusyindicator_p.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 QQUICKMATERIALBUSYINDICATOR_P_H -#define QQUICKMATERIALBUSYINDICATOR_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 <QtGui/qcolor.h> -#include <QtQuick/qquickitem.h> - -QT_BEGIN_NAMESPACE - -class QQuickMaterialBusyIndicator : public QQuickItem -{ - Q_OBJECT - Q_PROPERTY(QColor color READ color WRITE setColor FINAL) - Q_PROPERTY(bool running READ isRunning WRITE setRunning FINAL) - QML_NAMED_ELEMENT(BusyIndicatorImpl) - QML_ADDED_IN_VERSION(2, 0) - -public: - explicit QQuickMaterialBusyIndicator(QQuickItem *parent = nullptr); - - QColor color() const; - void setColor(const QColor &color); - - bool isRunning() const; - void setRunning(bool running); - - int elapsed() const; - -protected: - void itemChange(ItemChange change, const ItemChangeData &data) override; - QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override; - -private: - int m_elapsed = 0; - QColor m_color = Qt::black; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QQuickMaterialBusyIndicator) - -#endif // QQUICKMATERIALBUSYINDICATOR_P_H diff --git a/src/quickcontrols2/material/impl/qquickmaterialprogressbar.cpp b/src/quickcontrols2/material/impl/qquickmaterialprogressbar.cpp deleted file mode 100644 index 8b3dde23..00000000 --- a/src/quickcontrols2/material/impl/qquickmaterialprogressbar.cpp +++ /dev/null @@ -1,245 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "qquickmaterialprogressbar_p.h" - -#include <QtCore/qmath.h> -#include <QtCore/qeasingcurve.h> -#include <QtQuick/private/qquickitem_p.h> -#include <QtQuick/private/qsgadaptationlayer_p.h> -#include <QtQuick/qsgrectanglenode.h> -#include <QtQuick/qsgimagenode.h> -#include <QtQuick/qquickwindow.h> -#include <QtQuickControls2Impl/private/qquickanimatednode_p.h> - -QT_BEGIN_NAMESPACE - -static const int PauseDuration = 520; -static const int SlideDuration = 1240; -static const int TotalDuration = SlideDuration + PauseDuration; - -class QQuickMaterialProgressBarNode : public QQuickAnimatedNode -{ -public: - QQuickMaterialProgressBarNode(QQuickMaterialProgressBar *item); - - void updateCurrentTime(int time) override; - void sync(QQuickItem *item) override; - -private: - void moveNode(QSGTransformNode *node, const QRectF &geometry, qreal progress); - - bool m_indeterminate = false; - QEasingCurve m_easing = QEasingCurve::OutCubic; -}; - -QQuickMaterialProgressBarNode::QQuickMaterialProgressBarNode(QQuickMaterialProgressBar *item) - : QQuickAnimatedNode(item) -{ - setLoopCount(Infinite); - setDuration(TotalDuration); -} - -void QQuickMaterialProgressBarNode::updateCurrentTime(int time) -{ - QSGRectangleNode *geometryNode = static_cast<QSGRectangleNode *>(firstChild()); - Q_ASSERT(geometryNode->type() == QSGNode::GeometryNodeType); - const QRectF geometry = geometryNode->rect(); - - QSGTransformNode *firstNode = static_cast<QSGTransformNode *>(geometryNode->firstChild()); - if (firstNode) { - Q_ASSERT(firstNode->type() == QSGNode::TransformNodeType); - - const qreal progress = qMin<qreal>(1.0, static_cast<qreal>(time) / SlideDuration); - moveNode(static_cast<QSGTransformNode *>(firstNode), geometry, progress); - } - - QSGTransformNode *secondNode = static_cast<QSGTransformNode *>(geometryNode->lastChild()); - if (secondNode) { - Q_ASSERT(secondNode->type() == QSGNode::TransformNodeType); - - const qreal progress = qMax<qreal>(0.0, static_cast<qreal>(time - PauseDuration) / SlideDuration); - moveNode(static_cast<QSGTransformNode *>(secondNode), geometry, progress); - } -} - -void QQuickMaterialProgressBarNode::sync(QQuickItem *item) -{ - QQuickMaterialProgressBar *bar = static_cast<QQuickMaterialProgressBar *>(item); - if (m_indeterminate != bar->isIndeterminate()) { - m_indeterminate = bar->isIndeterminate(); - if (m_indeterminate) - start(); - else - stop(); - } - - QQuickItemPrivate *d = QQuickItemPrivate::get(item); - - QRectF bounds = item->boundingRect(); - bounds.setHeight(item->implicitHeight()); - bounds.moveTop((item->height() - bounds.height()) / 2.0); - - QSGRectangleNode *geometryNode = static_cast<QSGRectangleNode *>(firstChild()); - if (!geometryNode) { - geometryNode = item->window()->createRectangleNode(); - geometryNode->setColor(Qt::transparent); - appendChildNode(geometryNode); - } - geometryNode->setRect(bounds); - - const int count = m_indeterminate ? 2 : 1; - const qreal w = m_indeterminate ? 0 : bar->progress() * item->width(); - const QRectF rect(0, bounds.y(), w, bounds.height()); - - QSGNode *transformNode = geometryNode->firstChild(); - for (int i = 0; i < count; ++i) { - if (!transformNode) { - transformNode = new QSGTransformNode; - geometryNode->appendChildNode(transformNode); - - QSGInternalRectangleNode *rectNode = d->sceneGraphContext()->createInternalRectangleNode(); - rectNode->setAntialiasing(true); - transformNode->appendChildNode(rectNode); - } - Q_ASSERT(transformNode->type() == QSGNode::TransformNodeType); - static_cast<QSGTransformNode *>(transformNode)->setMatrix(QMatrix4x4()); - - QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode *>(transformNode->firstChild()); - Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType); - - rectNode->setRect(rect); - rectNode->setColor(bar->color()); - rectNode->update(); - - transformNode = transformNode->nextSibling(); - } - - while (transformNode) { - QSGNode *nextSibling = transformNode->nextSibling(); - delete transformNode; - transformNode = nextSibling; - } -} - -void QQuickMaterialProgressBarNode::moveNode(QSGTransformNode *transformNode, const QRectF &geometry, qreal progress) -{ - const qreal value = m_easing.valueForProgress(progress); - const qreal x = value * geometry.width(); - - QMatrix4x4 matrix; - matrix.translate(x, 0); - transformNode->setMatrix(matrix); - - QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode *>(transformNode->firstChild()); - Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType); - - QRectF r = geometry; - r.setWidth(value * (geometry.width() - x)); - rectNode->setRect(r); - rectNode->update(); -} - -QQuickMaterialProgressBar::QQuickMaterialProgressBar(QQuickItem *parent) - : QQuickItem(parent) -{ - setFlag(ItemHasContents); -} - -QColor QQuickMaterialProgressBar::color() const -{ - return m_color; -} - -void QQuickMaterialProgressBar::setColor(const QColor &color) -{ - if (color == m_color) - return; - - m_color = color; - update(); -} - -qreal QQuickMaterialProgressBar::progress() const -{ - return m_progress; -} - -void QQuickMaterialProgressBar::setProgress(qreal progress) -{ - if (progress == m_progress) - return; - - m_progress = progress; - update(); -} - -bool QQuickMaterialProgressBar::isIndeterminate() const -{ - return m_indeterminate; -} - -void QQuickMaterialProgressBar::setIndeterminate(bool indeterminate) -{ - if (indeterminate == m_indeterminate) - return; - - m_indeterminate = indeterminate; - update(); -} - -void QQuickMaterialProgressBar::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data) -{ - QQuickItem::itemChange(change, data); - if (change == ItemVisibleHasChanged) - update(); -} - -QSGNode *QQuickMaterialProgressBar::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *) -{ - QQuickMaterialProgressBarNode *node = static_cast<QQuickMaterialProgressBarNode *>(oldNode); - if (isVisible() && width() > 0 && height() > 0) { - if (!node) - node = new QQuickMaterialProgressBarNode(this); - node->sync(this); - } else { - delete node; - node = nullptr; - } - return node; -} - -QT_END_NAMESPACE diff --git a/src/quickcontrols2/material/impl/qquickmaterialprogressbar_p.h b/src/quickcontrols2/material/impl/qquickmaterialprogressbar_p.h deleted file mode 100644 index bf93812d..00000000 --- a/src/quickcontrols2/material/impl/qquickmaterialprogressbar_p.h +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 QQUICKMATERIALPROGRESSBAR_P_H -#define QQUICKMATERIALPROGRESSBAR_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 <QtGui/qcolor.h> -#include <QtQuick/qquickitem.h> - -QT_BEGIN_NAMESPACE - -class QQuickMaterialProgressBar : public QQuickItem -{ - Q_OBJECT - Q_PROPERTY(QColor color READ color WRITE setColor FINAL) - Q_PROPERTY(qreal progress READ progress WRITE setProgress FINAL) - Q_PROPERTY(bool indeterminate READ isIndeterminate WRITE setIndeterminate FINAL) - QML_NAMED_ELEMENT(ProgressBarImpl) - QML_ADDED_IN_VERSION(2, 0) - -public: - explicit QQuickMaterialProgressBar(QQuickItem *parent = nullptr); - - QColor color() const; - void setColor(const QColor &color); - - qreal progress() const; - void setProgress(qreal progress); - - bool isIndeterminate() const; - void setIndeterminate(bool indeterminate); - -protected: - void itemChange(ItemChange change, const ItemChangeData &data) override; - QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override; - -private: - QColor m_color = Qt::black; - qreal m_progress = 0.0; - bool m_indeterminate = false; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QQuickMaterialProgressBar) - -#endif // QQUICKMATERIALPROGRESSBAR_P_H diff --git a/src/quickcontrols2/material/impl/qquickmaterialripple.cpp b/src/quickcontrols2/material/impl/qquickmaterialripple.cpp deleted file mode 100644 index a39a115b..00000000 --- a/src/quickcontrols2/material/impl/qquickmaterialripple.cpp +++ /dev/null @@ -1,442 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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/qsgadaptationlayer_p.h> -#include <QtQuickControls2Impl/private/qquickanimatednode_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_DOWN_ACCELERATION = 1024.0; - -class QQuickMaterialRippleWaveNode : public QQuickAnimatedNode -{ -public: - QQuickMaterialRippleWaveNode(QQuickMaterialRipple *ripple); - - void exit(); - void updateCurrentTime(int time) override; - void sync(QQuickItem *item) override; - -private: - qreal m_from = 0; - qreal m_to = 0; - qreal m_value = 0; - WavePhase m_phase = WaveEnter; - QPointF m_anchor; - QRectF m_bounds; -}; - -QQuickMaterialRippleWaveNode::QQuickMaterialRippleWaveNode(QQuickMaterialRipple *ripple) - : QQuickAnimatedNode(ripple) -{ - start(qRound(1000.0 * qSqrt(ripple->diameter() / 2.0 / WAVE_TOUCH_DOWN_ACCELERATION))); - - QSGOpacityNode *opacityNode = new QSGOpacityNode; - appendChildNode(opacityNode); - - QQuickItemPrivate *d = QQuickItemPrivate::get(ripple); - QSGInternalRectangleNode *rectNode = d->sceneGraphContext()->createInternalRectangleNode(); - rectNode->setAntialiasing(true); - opacityNode->appendChildNode(rectNode); -} - -void QQuickMaterialRippleWaveNode::exit() -{ - m_phase = WaveExit; - m_from = m_value; - setDuration(WAVE_OPACITY_DECAY_DURATION); - restart(); - connect(this, &QQuickAnimatedNode::stopped, this, &QObject::deleteLater); -} - -void QQuickMaterialRippleWaveNode::updateCurrentTime(int time) -{ - qreal p = 1.0; - if (duration() > 0) - p = time / static_cast<qreal>(duration()); - - m_value = m_from + (m_to - m_from) * p; - p = m_value / m_to; - - 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); - - QMatrix4x4 m; - m.translate(qRound((m_bounds.width() - m_value) / 2 + dx), - qRound((m_bounds.height() - m_value) / 2 + dy)); - setMatrix(m); - - QSGOpacityNode *opacityNode = static_cast<QSGOpacityNode *>(firstChild()); - Q_ASSERT(opacityNode->type() == QSGNode::OpacityNodeType); - qreal opacity = 1.0; - if (m_phase == WaveExit) - opacity -= static_cast<qreal>(time) / WAVE_OPACITY_DECAY_DURATION; - opacityNode->setOpacity(opacity); - - QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode *>(opacityNode->firstChild()); - Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType); - rectNode->setRect(QRectF(0, 0, m_value, m_value)); - rectNode->setRadius(m_value / 2); - rectNode->update(); -} - -void QQuickMaterialRippleWaveNode::sync(QQuickItem *item) -{ - QQuickMaterialRipple *ripple = static_cast<QQuickMaterialRipple *>(item); - m_to = ripple->diameter(); - m_anchor = ripple->anchorPoint(); - m_bounds = ripple->boundingRect(); - - QSGOpacityNode *opacityNode = static_cast<QSGOpacityNode *>(firstChild()); - Q_ASSERT(opacityNode->type() == QSGNode::OpacityNodeType); - - QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode *>(opacityNode->firstChild()); - Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType); - rectNode->setColor(ripple->color()); -} - -class QQuickMaterialRippleBackgroundNode : public QQuickAnimatedNode -{ - Q_OBJECT - -public: - QQuickMaterialRippleBackgroundNode(QQuickMaterialRipple *ripple); - - void updateCurrentTime(int time) override; - void sync(QQuickItem *item) override; - -private: - bool m_active = false; -}; - -QQuickMaterialRippleBackgroundNode::QQuickMaterialRippleBackgroundNode(QQuickMaterialRipple *ripple) - : QQuickAnimatedNode(ripple) -{ - setDuration(OPACITY_ENTER_DURATION_FAST); - - QSGOpacityNode *opacityNode = new QSGOpacityNode; - opacityNode->setOpacity(0.0); - appendChildNode(opacityNode); - - QQuickItemPrivate *d = QQuickItemPrivate::get(ripple); - QSGInternalRectangleNode *rectNode = d->sceneGraphContext()->createInternalRectangleNode(); - rectNode->setAntialiasing(true); - opacityNode->appendChildNode(rectNode); -} - -void QQuickMaterialRippleBackgroundNode::updateCurrentTime(int time) -{ - qreal opacity = time / static_cast<qreal>(duration()); - if (!m_active) - opacity = 1.0 - opacity; - - QSGOpacityNode *opacityNode = static_cast<QSGOpacityNode *>(firstChild()); - Q_ASSERT(opacityNode->type() == QSGNode::OpacityNodeType); - opacityNode->setOpacity(opacity); -} - -void QQuickMaterialRippleBackgroundNode::sync(QQuickItem *item) -{ - QQuickMaterialRipple *ripple = static_cast<QQuickMaterialRipple *>(item); - if (m_active != ripple->isActive()) { - m_active = ripple->isActive(); - setDuration(m_active ? OPACITY_ENTER_DURATION_FAST : WAVE_OPACITY_DECAY_DURATION); - restart(); - } - - QSGOpacityNode *opacityNode = static_cast<QSGOpacityNode *>(firstChild()); - Q_ASSERT(opacityNode->type() == QSGNode::OpacityNodeType); - - QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode *>(opacityNode->firstChild()); - Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType); - - const qreal w = ripple->width(); - const qreal h = ripple->height(); - const qreal sz = qSqrt(w * w + h * h); - - QMatrix4x4 matrix; - if (qFuzzyIsNull(ripple->clipRadius())) { - matrix.translate(qRound((w - sz) / 2), qRound((h - sz) / 2)); - rectNode->setRect(QRectF(0, 0, sz, sz)); - rectNode->setRadius(sz / 2); - } else { - rectNode->setRect(QRectF(0, 0, w, h)); - rectNode->setRadius(ripple->clipRadius()); - } - - setMatrix(matrix); - rectNode->setColor(ripple->color()); - rectNode->update(); -} - -QQuickMaterialRipple::QQuickMaterialRipple(QQuickItem *parent) - : QQuickItem(parent) -{ - setFlag(ItemHasContents); -} - -bool QQuickMaterialRipple::isActive() const -{ - return m_active; -} - -void QQuickMaterialRipple::setActive(bool active) -{ - if (active == m_active) - return; - - m_active = active; - update(); -} - -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()) { - exitWave(); - 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; -} - -qreal QQuickMaterialRipple::diameter() const -{ - const qreal w = width(); - const qreal h = height(); - return qSqrt(w * w + h * h); -} - -void QQuickMaterialRipple::itemChange(ItemChange change, const ItemChangeData &data) -{ - QQuickItem::itemChange(change, data); -} - -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(); - } - - QSGNode *container = oldNode; - if (!container) - container = new QSGNode; - - QQuickMaterialRippleBackgroundNode *backgroundNode = static_cast<QQuickMaterialRippleBackgroundNode *>(container->firstChild()); - if (!backgroundNode) { - backgroundNode = new QQuickMaterialRippleBackgroundNode(this); - backgroundNode->setObjectName(objectName()); - container->appendChildNode(backgroundNode); - } - backgroundNode->sync(this); - - // enter new waves - int i = m_waves; - QQuickMaterialRippleWaveNode *enterNode = static_cast<QQuickMaterialRippleWaveNode *>(backgroundNode->nextSibling()); - while (i-- > 0) { - if (!enterNode) { - enterNode = new QQuickMaterialRippleWaveNode(this); - container->appendChildNode(enterNode); - } - enterNode->sync(this); - enterNode = static_cast<QQuickMaterialRippleWaveNode *>(enterNode->nextSibling()); - } - - // exit old waves - int j = container->childCount() - 1 - m_waves; - while (j-- > 0) { - QQuickMaterialRippleWaveNode *exitNode = static_cast<QQuickMaterialRippleWaveNode *>(backgroundNode->nextSibling()); - if (exitNode) { - exitNode->exit(); - exitNode->sync(this); - } - } - - return container; -} - -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; - } - - ++m_waves; - update(); -} - -void QQuickMaterialRipple::exitWave() -{ - if (m_enterDelay > 0) { - killTimer(m_enterDelay); - m_enterDelay = 0; - } - - if (m_waves > 0) { - --m_waves; - update(); - } -} - -QT_END_NAMESPACE - -#include "qquickmaterialripple.moc" diff --git a/src/quickcontrols2/material/impl/qquickmaterialripple_p.h b/src/quickcontrols2/material/impl/qquickmaterialripple_p.h deleted file mode 100644 index 51728389..00000000 --- a/src/quickcontrols2/material/impl/qquickmaterialripple_p.h +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKMATERIALRIPPLE_P_H -#define QQUICKMATERIALRIPPLE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtQuick/qquickitem.h> -#include <QtGui/qcolor.h> - -QT_BEGIN_NAMESPACE - -class 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) - QML_NAMED_ELEMENT(Ripple) - QML_ADDED_IN_VERSION(2, 0) - -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); - - qreal diameter() const; - -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 = false; - bool m_pressed = false; - int m_waves = 0; - int m_enterDelay = 0; - Trigger m_trigger = Press; - qreal m_clipRadius = 0.0; - QColor m_color; - QQuickItem *m_anchor = nullptr; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QQuickMaterialRipple) - -#endif // QQUICKMATERIALRIPPLE_P_H diff --git a/src/quickcontrols2/material/material.pri b/src/quickcontrols2/material/material.pri deleted file mode 100644 index 9eb14233..00000000 --- a/src/quickcontrols2/material/material.pri +++ /dev/null @@ -1,60 +0,0 @@ -HEADERS += \ - $$PWD/qquickmaterialstyle_p.h \ - $$PWD/qquickmaterialtheme_p.h - -SOURCES += \ - $$PWD/qquickmaterialstyle.cpp \ - $$PWD/qquickmaterialtheme.cpp - -QML_FILES += \ - $$PWD/ApplicationWindow.qml \ - $$PWD/BusyIndicator.qml \ - $$PWD/Button.qml \ - $$PWD/CheckBox.qml \ - $$PWD/CheckDelegate.qml \ - $$PWD/ComboBox.qml \ - $$PWD/DelayButton.qml \ - $$PWD/Dial.qml \ - $$PWD/Dialog.qml \ - $$PWD/DialogButtonBox.qml \ - $$PWD/Drawer.qml \ - $$PWD/Frame.qml \ - $$PWD/GroupBox.qml \ - $$PWD/HorizontalHeaderView.qml \ - $$PWD/ItemDelegate.qml \ - $$PWD/Label.qml \ - $$PWD/Menu.qml \ - $$PWD/MenuBar.qml \ - $$PWD/MenuBarItem.qml \ - $$PWD/MenuItem.qml \ - $$PWD/MenuSeparator.qml \ - $$PWD/Page.qml \ - $$PWD/PageIndicator.qml \ - $$PWD/Pane.qml \ - $$PWD/Popup.qml \ - $$PWD/ProgressBar.qml \ - $$PWD/RadioButton.qml \ - $$PWD/RadioDelegate.qml \ - $$PWD/RangeSlider.qml \ - $$PWD/RoundButton.qml \ - $$PWD/ScrollView.qml \ - $$PWD/ScrollBar.qml \ - $$PWD/ScrollIndicator.qml \ - $$PWD/Slider.qml \ - $$PWD/SpinBox.qml \ - $$PWD/SplitView.qml \ - $$PWD/StackView.qml \ - $$PWD/SwipeDelegate.qml \ - $$PWD/SwipeView.qml \ - $$PWD/Switch.qml \ - $$PWD/SwitchDelegate.qml \ - $$PWD/TabBar.qml \ - $$PWD/TabButton.qml \ - $$PWD/TextArea.qml \ - $$PWD/TextField.qml \ - $$PWD/ToolBar.qml \ - $$PWD/ToolButton.qml \ - $$PWD/ToolSeparator.qml \ - $$PWD/ToolTip.qml \ - $$PWD/Tumbler.qml \ - $$PWD/VerticalHeaderView.qml diff --git a/src/quickcontrols2/material/qquickmaterialstyle.cpp b/src/quickcontrols2/material/qquickmaterialstyle.cpp deleted file mode 100644 index d70728a0..00000000 --- a/src/quickcontrols2/material/qquickmaterialstyle.cpp +++ /dev/null @@ -1,1383 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "qquickmaterialstyle_p.h" - -#include <QtCore/qdebug.h> -#include <QtCore/qsettings.h> -#include <QtQml/qqmlinfo.h> -#include <QtQuickControls2/private/qquickstyle_p.h> - -QT_BEGIN_NAMESPACE - -static const QRgb colors[][14] = { - // Red - { - 0xFFFFEBEE, // Shade50 - 0xFFFFCDD2, // Shade100 - 0xFFEF9A9A, // Shade200 - 0xFFE57373, // Shade300 - 0xFFEF5350, // Shade400 - 0xFFF44336, // Shade500 - 0xFFE53935, // Shade600 - 0xFFD32F2F, // Shade700 - 0xFFC62828, // Shade800 - 0xFFB71C1C, // Shade900 - 0xFFFF8A80, // ShadeA100 - 0xFFFF5252, // ShadeA200 - 0xFFFF1744, // ShadeA400 - 0xFFD50000 // ShadeA700 - }, - // Pink - { - 0xFFFCE4EC, // Shade50 - 0xFFF8BBD0, // Shade100 - 0xFFF48FB1, // Shade200 - 0xFFF06292, // Shade300 - 0xFFEC407A, // Shade400 - 0xFFE91E63, // Shade500 - 0xFFD81B60, // Shade600 - 0xFFC2185B, // Shade700 - 0xFFAD1457, // Shade800 - 0xFF880E4F, // Shade900 - 0xFFFF80AB, // ShadeA100 - 0xFFFF4081, // ShadeA200 - 0xFFF50057, // ShadeA400 - 0xFFC51162 // ShadeA700 - }, - // Purple - { - 0xFFF3E5F5, // Shade50 - 0xFFE1BEE7, // Shade100 - 0xFFCE93D8, // Shade200 - 0xFFBA68C8, // Shade300 - 0xFFAB47BC, // Shade400 - 0xFF9C27B0, // Shade500 - 0xFF8E24AA, // Shade600 - 0xFF7B1FA2, // Shade700 - 0xFF6A1B9A, // Shade800 - 0xFF4A148C, // Shade900 - 0xFFEA80FC, // ShadeA100 - 0xFFE040FB, // ShadeA200 - 0xFFD500F9, // ShadeA400 - 0xFFAA00FF // ShadeA700 - }, - // DeepPurple - { - 0xFFEDE7F6, // Shade50 - 0xFFD1C4E9, // Shade100 - 0xFFB39DDB, // Shade200 - 0xFF9575CD, // Shade300 - 0xFF7E57C2, // Shade400 - 0xFF673AB7, // Shade500 - 0xFF5E35B1, // Shade600 - 0xFF512DA8, // Shade700 - 0xFF4527A0, // Shade800 - 0xFF311B92, // Shade900 - 0xFFB388FF, // ShadeA100 - 0xFF7C4DFF, // ShadeA200 - 0xFF651FFF, // ShadeA400 - 0xFF6200EA // ShadeA700 - }, - // Indigo - { - 0xFFE8EAF6, // Shade50 - 0xFFC5CAE9, // Shade100 - 0xFF9FA8DA, // Shade200 - 0xFF7986CB, // Shade300 - 0xFF5C6BC0, // Shade400 - 0xFF3F51B5, // Shade500 - 0xFF3949AB, // Shade600 - 0xFF303F9F, // Shade700 - 0xFF283593, // Shade800 - 0xFF1A237E, // Shade900 - 0xFF8C9EFF, // ShadeA100 - 0xFF536DFE, // ShadeA200 - 0xFF3D5AFE, // ShadeA400 - 0xFF304FFE // ShadeA700 - }, - // Blue - { - 0xFFE3F2FD, // Shade50 - 0xFFBBDEFB, // Shade100 - 0xFF90CAF9, // Shade200 - 0xFF64B5F6, // Shade300 - 0xFF42A5F5, // Shade400 - 0xFF2196F3, // Shade500 - 0xFF1E88E5, // Shade600 - 0xFF1976D2, // Shade700 - 0xFF1565C0, // Shade800 - 0xFF0D47A1, // Shade900 - 0xFF82B1FF, // ShadeA100 - 0xFF448AFF, // ShadeA200 - 0xFF2979FF, // ShadeA400 - 0xFF2962FF // ShadeA700 - }, - // LightBlue - { - 0xFFE1F5FE, // Shade50 - 0xFFB3E5FC, // Shade100 - 0xFF81D4FA, // Shade200 - 0xFF4FC3F7, // Shade300 - 0xFF29B6F6, // Shade400 - 0xFF03A9F4, // Shade500 - 0xFF039BE5, // Shade600 - 0xFF0288D1, // Shade700 - 0xFF0277BD, // Shade800 - 0xFF01579B, // Shade900 - 0xFF80D8FF, // ShadeA100 - 0xFF40C4FF, // ShadeA200 - 0xFF00B0FF, // ShadeA400 - 0xFF0091EA // ShadeA700 - }, - // Cyan - { - 0xFFE0F7FA, // Shade50 - 0xFFB2EBF2, // Shade100 - 0xFF80DEEA, // Shade200 - 0xFF4DD0E1, // Shade300 - 0xFF26C6DA, // Shade400 - 0xFF00BCD4, // Shade500 - 0xFF00ACC1, // Shade600 - 0xFF0097A7, // Shade700 - 0xFF00838F, // Shade800 - 0xFF006064, // Shade900 - 0xFF84FFFF, // ShadeA100 - 0xFF18FFFF, // ShadeA200 - 0xFF00E5FF, // ShadeA400 - 0xFF00B8D4 // ShadeA700 - }, - // Teal - { - 0xFFE0F2F1, // Shade50 - 0xFFB2DFDB, // Shade100 - 0xFF80CBC4, // Shade200 - 0xFF4DB6AC, // Shade300 - 0xFF26A69A, // Shade400 - 0xFF009688, // Shade500 - 0xFF00897B, // Shade600 - 0xFF00796B, // Shade700 - 0xFF00695C, // Shade800 - 0xFF004D40, // Shade900 - 0xFFA7FFEB, // ShadeA100 - 0xFF64FFDA, // ShadeA200 - 0xFF1DE9B6, // ShadeA400 - 0xFF00BFA5 // ShadeA700 - }, - // Green - { - 0xFFE8F5E9, // Shade50 - 0xFFC8E6C9, // Shade100 - 0xFFA5D6A7, // Shade200 - 0xFF81C784, // Shade300 - 0xFF66BB6A, // Shade400 - 0xFF4CAF50, // Shade500 - 0xFF43A047, // Shade600 - 0xFF388E3C, // Shade700 - 0xFF2E7D32, // Shade800 - 0xFF1B5E20, // Shade900 - 0xFFB9F6CA, // ShadeA100 - 0xFF69F0AE, // ShadeA200 - 0xFF00E676, // ShadeA400 - 0xFF00C853 // ShadeA700 - }, - // LightGreen - { - 0xFFF1F8E9, // Shade50 - 0xFFDCEDC8, // Shade100 - 0xFFC5E1A5, // Shade200 - 0xFFAED581, // Shade300 - 0xFF9CCC65, // Shade400 - 0xFF8BC34A, // Shade500 - 0xFF7CB342, // Shade600 - 0xFF689F38, // Shade700 - 0xFF558B2F, // Shade800 - 0xFF33691E, // Shade900 - 0xFFCCFF90, // ShadeA100 - 0xFFB2FF59, // ShadeA200 - 0xFF76FF03, // ShadeA400 - 0xFF64DD17 // ShadeA700 - }, - // Lime - { - 0xFFF9FBE7, // Shade50 - 0xFFF0F4C3, // Shade100 - 0xFFE6EE9C, // Shade200 - 0xFFDCE775, // Shade300 - 0xFFD4E157, // Shade400 - 0xFFCDDC39, // Shade500 - 0xFFC0CA33, // Shade600 - 0xFFAFB42B, // Shade700 - 0xFF9E9D24, // Shade800 - 0xFF827717, // Shade900 - 0xFFF4FF81, // ShadeA100 - 0xFFEEFF41, // ShadeA200 - 0xFFC6FF00, // ShadeA400 - 0xFFAEEA00 // ShadeA700 - }, - // Yellow - { - 0xFFFFFDE7, // Shade50 - 0xFFFFF9C4, // Shade100 - 0xFFFFF59D, // Shade200 - 0xFFFFF176, // Shade300 - 0xFFFFEE58, // Shade400 - 0xFFFFEB3B, // Shade500 - 0xFFFDD835, // Shade600 - 0xFFFBC02D, // Shade700 - 0xFFF9A825, // Shade800 - 0xFFF57F17, // Shade900 - 0xFFFFFF8D, // ShadeA100 - 0xFFFFFF00, // ShadeA200 - 0xFFFFEA00, // ShadeA400 - 0xFFFFD600 // ShadeA700 - }, - // Amber - { - 0xFFFFF8E1, // Shade50 - 0xFFFFECB3, // Shade100 - 0xFFFFE082, // Shade200 - 0xFFFFD54F, // Shade300 - 0xFFFFCA28, // Shade400 - 0xFFFFC107, // Shade500 - 0xFFFFB300, // Shade600 - 0xFFFFA000, // Shade700 - 0xFFFF8F00, // Shade800 - 0xFFFF6F00, // Shade900 - 0xFFFFE57F, // ShadeA100 - 0xFFFFD740, // ShadeA200 - 0xFFFFC400, // ShadeA400 - 0xFFFFAB00 // ShadeA700 - }, - // Orange - { - 0xFFFFF3E0, // Shade50 - 0xFFFFE0B2, // Shade100 - 0xFFFFCC80, // Shade200 - 0xFFFFB74D, // Shade300 - 0xFFFFA726, // Shade400 - 0xFFFF9800, // Shade500 - 0xFFFB8C00, // Shade600 - 0xFFF57C00, // Shade700 - 0xFFEF6C00, // Shade800 - 0xFFE65100, // Shade900 - 0xFFFFD180, // ShadeA100 - 0xFFFFAB40, // ShadeA200 - 0xFFFF9100, // ShadeA400 - 0xFFFF6D00 // ShadeA700 - }, - // DeepOrange - { - 0xFFFBE9E7, // Shade50 - 0xFFFFCCBC, // Shade100 - 0xFFFFAB91, // Shade200 - 0xFFFF8A65, // Shade300 - 0xFFFF7043, // Shade400 - 0xFFFF5722, // Shade500 - 0xFFF4511E, // Shade600 - 0xFFE64A19, // Shade700 - 0xFFD84315, // Shade800 - 0xFFBF360C, // Shade900 - 0xFFFF9E80, // ShadeA100 - 0xFFFF6E40, // ShadeA200 - 0xFFFF3D00, // ShadeA400 - 0xFFDD2C00 // ShadeA700 - }, - // Brown - { - 0xFFEFEBE9, // Shade50 - 0xFFD7CCC8, // Shade100 - 0xFFBCAAA4, // Shade200 - 0xFFA1887F, // Shade300 - 0xFF8D6E63, // Shade400 - 0xFF795548, // Shade500 - 0xFF6D4C41, // Shade600 - 0xFF5D4037, // Shade700 - 0xFF4E342E, // Shade800 - 0xFF3E2723, // Shade900 - 0xFF000000, // ShadeA100 - 0xFF000000, // ShadeA200 - 0xFF000000, // ShadeA400 - 0xFF000000 // ShadeA700 - }, - // Grey - { - 0xFFFAFAFA, // Shade50 - 0xFFF5F5F5, // Shade100 - 0xFFEEEEEE, // Shade200 - 0xFFE0E0E0, // Shade300 - 0xFFBDBDBD, // Shade400 - 0xFF9E9E9E, // Shade500 - 0xFF757575, // Shade600 - 0xFF616161, // Shade700 - 0xFF424242, // Shade800 - 0xFF212121, // Shade900 - 0xFF000000, // ShadeA100 - 0xFF000000, // ShadeA200 - 0xFF000000, // ShadeA400 - 0xFF000000 // ShadeA700 - }, - // BlueGrey - { - 0xFFECEFF1, // Shade50 - 0xFFCFD8DC, // Shade100 - 0xFFB0BEC5, // Shade200 - 0xFF90A4AE, // Shade300 - 0xFF78909C, // Shade400 - 0xFF607D8B, // Shade500 - 0xFF546E7A, // Shade600 - 0xFF455A64, // Shade700 - 0xFF37474F, // Shade800 - 0xFF263238, // Shade900 - 0xFF000000, // ShadeA100 - 0xFF000000, // ShadeA200 - 0xFF000000, // ShadeA400 - 0xFF000000 // ShadeA700 - } -}; - -// 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. -static QQuickMaterialStyle::Theme globalTheme = QQuickMaterialStyle::Light; -static uint globalPrimary = QQuickMaterialStyle::Indigo; -static uint globalAccent = QQuickMaterialStyle::Pink; -static uint globalForeground = 0xDD000000; // primaryTextColorLight -static uint globalBackground = 0xFFFAFAFA; // backgroundColorLight -// These represent whether a global foreground/background was set. -// Each style's m_hasForeground/m_hasBackground are initialized to these values. -static bool hasGlobalForeground = false; -static bool hasGlobalBackground = false; -// These represent whether or not the global color value was specified as one of the -// values that QColor accepts, as opposed to one of the pre-defined colors like Red. -static bool globalPrimaryCustom = false; -static bool globalAccentCustom = false; -static bool globalForegroundCustom = true; -static bool globalBackgroundCustom = true; -// This is global because: -// 1) The theme needs access to it to determine font sizes. -// 2) There can only be one variant used for the whole application. -static QQuickMaterialStyle::Variant globalVariant = QQuickMaterialStyle::Normal; - -static const QRgb backgroundColorLight = 0xFFFAFAFA; -static const QRgb backgroundColorDark = 0xFF303030; -static const QRgb dialogColorLight = 0xFFFFFFFF; -static const QRgb dialogColorDark = 0xFF424242; -static const QRgb primaryTextColorLight = 0xDD000000; -static const QRgb primaryTextColorDark = 0xFFFFFFFF; -static const QRgb secondaryTextColorLight = 0x89000000; -static const QRgb secondaryTextColorDark = 0xB2FFFFFF; -static const QRgb hintTextColorLight = 0x60000000; -static const QRgb hintTextColorDark = 0x4CFFFFFF; -static const QRgb dividerColorLight = 0x1E000000; -static const QRgb dividerColorDark = 0x1EFFFFFF; -static const QRgb iconColorLight = 0x89000000; -static const QRgb iconColorDark = 0xFFFFFFFF; -static const QRgb iconDisabledColorLight = 0x42000000; -static const QRgb iconDisabledColorDark = 0x4CFFFFFF; -static const QRgb raisedButtonColorLight = 0xFFD6D7D7; -static const QRgb raisedButtonColorDark = 0x3FCCCCCC; -static const QRgb raisedButtonDisabledColorLight = dividerColorLight; -static const QRgb raisedButtonDisabledColorDark = dividerColorDark; -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 rippleColorLight = 0x10000000; -static const QRgb rippleColorDark = 0x20FFFFFF; -static const QRgb spinBoxDisabledIconColorLight = 0xFFCCCCCC; -static const QRgb spinBoxDisabledIconColorDark = 0xFF666666; -static const QRgb sliderDisabledColorLight = 0xFF9E9E9E; -static const QRgb sliderDisabledColorDark = 0xFF616161; - -static QQuickMaterialStyle::Theme effectiveTheme(QQuickMaterialStyle::Theme theme) -{ - if (theme == QQuickMaterialStyle::System) - theme = QQuickStylePrivate::isDarkSystemTheme() ? QQuickMaterialStyle::Dark : QQuickMaterialStyle::Light; - return theme; -} - -QQuickMaterialStyle::QQuickMaterialStyle(QObject *parent) : QQuickAttachedObject(parent), - m_customPrimary(globalPrimaryCustom), - m_customAccent(globalAccentCustom), - m_customForeground(globalForegroundCustom), - m_customBackground(globalBackgroundCustom), - m_hasForeground(hasGlobalForeground), - m_hasBackground(hasGlobalBackground), - m_theme(globalTheme), - m_primary(globalPrimary), - m_accent(globalAccent), - m_foreground(globalForeground), - m_background(globalBackground) -{ - QQuickAttachedObject::init(); -} - -QQuickMaterialStyle *QQuickMaterialStyle::qmlAttachedProperties(QObject *object) -{ - return new QQuickMaterialStyle(object); -} - -QQuickMaterialStyle::Theme QQuickMaterialStyle::theme() const -{ - return m_theme; -} - -void QQuickMaterialStyle::setTheme(Theme theme) -{ - if (theme == System) - theme = QQuickStylePrivate::isDarkSystemTheme() ? Dark : Light; - - m_explicitTheme = true; - if (m_theme == theme) - return; - - m_theme = theme; - propagateTheme(); - themeChange(); - if (!m_customAccent) - accentChange(); - if (!m_hasBackground) - backgroundChange(); - if (!m_hasForeground) - foregroundChange(); -} - -void QQuickMaterialStyle::inheritTheme(Theme theme) -{ - if (m_explicitTheme || m_theme == theme) - return; - - m_theme = theme; - propagateTheme(); - themeChange(); - if (!m_customAccent) - accentChange(); - if (!m_hasBackground) - backgroundChange(); - if (!m_hasForeground) - foregroundChange(); -} - -void QQuickMaterialStyle::propagateTheme() -{ - const auto styles = attachedChildren(); - for (QQuickAttachedObject *child : styles) { - QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(child); - if (material) - material->inheritTheme(m_theme); - } -} - -void QQuickMaterialStyle::resetTheme() -{ - if (!m_explicitTheme) - return; - - m_explicitTheme = false; - QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(attachedParent()); - inheritTheme(material ? material->theme() : globalTheme); -} - -void QQuickMaterialStyle::themeChange() -{ - emit themeChanged(); - emit themeOrAccentChanged(); - emit primaryHighlightedTextColor(); - emit buttonColorChanged(); - emit buttonDisabledColorChanged(); - emit dialogColorChanged(); - emit tooltipColorChanged(); - emit toolBarColorChanged(); - emit toolTextColorChanged(); -} - -QVariant QQuickMaterialStyle::primary() const -{ - return primaryColor(); -} - -void QQuickMaterialStyle::setPrimary(const QVariant &var) -{ - QRgb primary = 0; - bool custom = false; - if (!variantToRgba(var, "primary", &primary, &custom)) - return; - - m_explicitPrimary = true; - if (m_primary == primary) - return; - - m_customPrimary = custom; - m_primary = primary; - propagatePrimary(); - primaryChange(); -} - -void QQuickMaterialStyle::inheritPrimary(uint primary, bool custom) -{ - if (m_explicitPrimary || m_primary == primary) - return; - - m_customPrimary = custom; - m_primary = primary; - propagatePrimary(); - primaryChange(); -} - -void QQuickMaterialStyle::propagatePrimary() -{ - const auto styles = attachedChildren(); - for (QQuickAttachedObject *child : styles) { - QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(child); - if (material) - material->inheritPrimary(m_primary, m_customPrimary); - } -} - -void QQuickMaterialStyle::resetPrimary() -{ - if (!m_explicitPrimary) - return; - - m_customPrimary = false; - m_explicitPrimary = false; - QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(attachedParent()); - if (material) - inheritPrimary(material->m_primary, material->m_customPrimary); - else - inheritPrimary(globalPrimary, false); -} - -void QQuickMaterialStyle::primaryChange() -{ - emit primaryChanged(); - emit toolBarColorChanged(); - emit toolTextColorChanged(); -} - -QVariant QQuickMaterialStyle::accent() const -{ - return accentColor(); -} - -void QQuickMaterialStyle::setAccent(const QVariant &var) -{ - QRgb accent = 0; - bool custom = false; - if (!variantToRgba(var, "accent", &accent, &custom)) - return; - - m_explicitAccent = true; - if (m_accent == accent) - return; - - m_customAccent = custom; - m_accent = accent; - propagateAccent(); - accentChange(); -} - -void QQuickMaterialStyle::inheritAccent(uint accent, bool custom) -{ - if (m_explicitAccent || m_accent == accent) - return; - - m_customAccent = custom; - m_accent = accent; - propagateAccent(); - accentChange(); -} - -void QQuickMaterialStyle::propagateAccent() -{ - const auto styles = attachedChildren(); - for (QQuickAttachedObject *child : styles) { - QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(child); - if (material) - material->inheritAccent(m_accent, m_customAccent); - } -} - -void QQuickMaterialStyle::resetAccent() -{ - if (!m_explicitAccent) - return; - - m_customAccent = false; - m_explicitAccent = false; - QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(attachedParent()); - if (material) - inheritAccent(material->m_accent, material->m_customAccent); - else - inheritAccent(globalAccent, false); -} - -void QQuickMaterialStyle::accentChange() -{ - emit accentChanged(); - emit themeOrAccentChanged(); - emit buttonColorChanged(); -} - -QVariant QQuickMaterialStyle::foreground() const -{ - if (!m_hasForeground) - return QColor::fromRgba(m_theme == Light ? primaryTextColorLight : primaryTextColorDark); - if (m_customForeground) - return QColor::fromRgba(m_foreground); - if (m_foreground > BlueGrey) - return QColor(); - return QColor::fromRgba(colors[m_foreground][Shade500]); -} - -void QQuickMaterialStyle::setForeground(const QVariant &var) -{ - QRgb foreground = 0; - bool custom = false; - if (!variantToRgba(var, "foreground", &foreground, &custom)) - return; - - m_hasForeground = true; - m_explicitForeground = true; - if (m_foreground == foreground) - return; - - m_customForeground = custom; - m_foreground = foreground; - propagateForeground(); - foregroundChange(); -} - -void QQuickMaterialStyle::inheritForeground(uint foreground, bool custom, bool has) -{ - if (m_explicitForeground || m_foreground == foreground) - return; - - m_hasForeground = has; - m_customForeground = custom; - m_foreground = foreground; - propagateForeground(); - foregroundChange(); -} - -void QQuickMaterialStyle::propagateForeground() -{ - const auto styles = attachedChildren(); - for (QQuickAttachedObject *child : styles) { - QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(child); - if (material) - material->inheritForeground(m_foreground, m_customForeground, m_hasForeground); - } -} - -void QQuickMaterialStyle::resetForeground() -{ - if (!m_explicitForeground) - return; - - m_hasForeground = false; - m_customForeground = false; - m_explicitForeground = false; - QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(attachedParent()); - inheritForeground(material ? material->m_foreground : globalForeground, true, material ? material->m_hasForeground : false); -} - -void QQuickMaterialStyle::foregroundChange() -{ - emit foregroundChanged(); - emit primaryHighlightedTextColorChanged(); - // TODO: This causes a binding loop: see QTBUG-85699 and the comments on its fix -// emit toolTextColorChanged(); -} - -QVariant QQuickMaterialStyle::background() const -{ - return backgroundColor(); -} - -void QQuickMaterialStyle::setBackground(const QVariant &var) -{ - QRgb background = 0; - bool custom = false; - if (!variantToRgba(var, "background", &background, &custom)) - return; - - m_hasBackground = true; - m_explicitBackground = true; - if (m_background == background) - return; - - m_customBackground = custom; - m_background = background; - propagateBackground(); - backgroundChange(); -} - -void QQuickMaterialStyle::inheritBackground(uint background, bool custom, bool has) -{ - if (m_explicitBackground || m_background == background) - return; - - m_hasBackground = has; - m_customBackground = custom; - m_background = background; - propagateBackground(); - backgroundChange(); -} - -void QQuickMaterialStyle::propagateBackground() -{ - const auto styles = attachedChildren(); - for (QQuickAttachedObject *child : styles) { - QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(child); - if (material) - material->inheritBackground(m_background, m_customBackground, m_hasBackground); - } -} - -void QQuickMaterialStyle::resetBackground() -{ - if (!m_explicitBackground) - return; - - m_hasBackground = false; - m_customBackground = false; - m_explicitBackground = false; - QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(attachedParent()); - inheritBackground(material ? material->m_background : globalBackground, true, material ? material->m_hasBackground : false); -} - -void QQuickMaterialStyle::backgroundChange() -{ - emit backgroundChanged(); - emit buttonColorChanged(); - emit dialogColorChanged(); - emit tooltipColorChanged(); - emit toolBarColorChanged(); -} - -int QQuickMaterialStyle::elevation() const -{ - return m_elevation; -} - -void QQuickMaterialStyle::setElevation(int elevation) -{ - if (m_elevation == elevation) - return; - - m_elevation = elevation; - elevationChange(); -} - -void QQuickMaterialStyle::resetElevation() -{ - setElevation(0); -} - -void QQuickMaterialStyle::elevationChange() -{ - emit elevationChanged(); - emit buttonDisabledColorChanged(); -} - -QColor QQuickMaterialStyle::primaryColor() const -{ - if (m_customPrimary) - return QColor::fromRgba(m_primary); - if (m_primary > BlueGrey) - return QColor(); - return colors[m_primary][Shade500]; -} - -QColor QQuickMaterialStyle::accentColor(Shade shade) const -{ - if (m_customAccent) - return shade == themeShade() ? QColor::fromRgba(m_accent) - : this->shade(QColor::fromRgba(m_accent), shade); - if (m_accent > BlueGrey) - return QColor(); - return colors[m_accent][shade]; -} - -QColor QQuickMaterialStyle::accentColor() const -{ - return accentColor(themeShade()); -} - -QColor QQuickMaterialStyle::backgroundColor(Shade shade) const -{ - if (!m_hasBackground) - return QColor::fromRgba(m_theme == Light ? backgroundColorLight : backgroundColorDark); - if (m_customBackground) - return shade == themeShade() ? QColor::fromRgba(m_background) - : this->shade(QColor::fromRgba(m_background), shade); - if (m_background > BlueGrey) - return QColor(); - return colors[m_background][shade]; -} - -QColor QQuickMaterialStyle::backgroundColor() const -{ - return backgroundColor(themeShade()); -} - -QColor QQuickMaterialStyle::primaryTextColor() const -{ - return QColor::fromRgba(m_theme == Light ? primaryTextColorLight : primaryTextColorDark); -} - -QColor QQuickMaterialStyle::primaryHighlightedTextColor() const -{ - if (m_explicitForeground) - return primaryTextColor(); - return QColor::fromRgba(primaryTextColorDark); -} - -QColor QQuickMaterialStyle::secondaryTextColor() const -{ - return QColor::fromRgba(m_theme == Light ? secondaryTextColorLight : secondaryTextColorDark); -} - -QColor QQuickMaterialStyle::hintTextColor() const -{ - return QColor::fromRgba(m_theme == Light ? hintTextColorLight : hintTextColorDark); -} - -QColor QQuickMaterialStyle::textSelectionColor() const -{ - QColor color = accentColor(); - color.setAlphaF(0.4f); - return color; -} - -QColor QQuickMaterialStyle::dropShadowColor() const -{ - return QColor::fromRgba(0x40000000); -} - -QColor QQuickMaterialStyle::dividerColor() const -{ - return QColor::fromRgba(m_theme == Light ? dividerColorLight : dividerColorDark); -} - -QColor QQuickMaterialStyle::iconColor() const -{ - return QColor::fromRgba(m_theme == Light ? iconColorLight : iconColorDark); -} - -QColor QQuickMaterialStyle::iconDisabledColor() const -{ - return QColor::fromRgba(m_theme == Light ? iconDisabledColorLight : iconDisabledColorDark); -} - -QColor QQuickMaterialStyle::buttonColor(bool highlighted) const -{ - Shade shade = themeShade(); - - QColor color = Qt::transparent; - - if (m_explicitBackground) { - color = backgroundColor(shade); - } else if (highlighted) { - color = accentColor(shade); - } else if (elevation() > 0) { - color = QColor::fromRgba(m_theme == Light ? raisedButtonColorLight - : raisedButtonColorDark); - } - - return color; -} - -QColor QQuickMaterialStyle::buttonColor() const -{ - return buttonColor(false); -} - -QColor QQuickMaterialStyle::buttonDisabledColor() const -{ - if (elevation() > 0) { - return QColor::fromRgba(m_theme == Light ? raisedButtonDisabledColorLight - : raisedButtonDisabledColorDark); - } else { - return Qt::transparent; - } -} - -QColor QQuickMaterialStyle::highlightedButtonColor() const -{ - return buttonColor(true); -} - -QColor QQuickMaterialStyle::frameColor() const -{ - return QColor::fromRgba(m_theme == Light ? frameColorLight : frameColorDark); -} - -QColor QQuickMaterialStyle::rippleColor() const -{ - return QColor::fromRgba(m_theme == Light ? rippleColorLight : rippleColorDark); -} - -QColor QQuickMaterialStyle::highlightedRippleColor() const -{ - QColor pressColor = accentColor(); - pressColor.setAlpha(m_theme == Light ? 30 : 50); - return pressColor; -} - -QColor QQuickMaterialStyle::switchUncheckedTrackColor() const -{ - return QColor::fromRgba(m_theme == Light ? switchUncheckedTrackColorLight : switchUncheckedTrackColorDark); -} - -QColor QQuickMaterialStyle::switchCheckedTrackColor() const -{ - QColor trackColor(accentColor()); - trackColor.setAlphaF(0.5); - return trackColor; -} - -QColor QQuickMaterialStyle::switchUncheckedHandleColor() const -{ - return m_theme == Light ? color(Grey, Shade50) : color(Grey, Shade400); -} - -QColor QQuickMaterialStyle::switchCheckedHandleColor() const -{ - return m_theme == Light ? accentColor() : shade(accentColor(), Shade200); -} - -QColor QQuickMaterialStyle::switchDisabledTrackColor() const -{ - return QColor::fromRgba(m_theme == Light ? switchDisabledTrackColorLight : switchDisabledTrackColorDark); -} - -QColor QQuickMaterialStyle::switchDisabledHandleColor() const -{ - return m_theme == Light ? color(Grey, Shade400) : color(Grey, Shade800); -} - -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); -} - -QColor QQuickMaterialStyle::dialogColor() const -{ - if (m_hasBackground) - return backgroundColor(); - return QColor::fromRgba(m_theme == Light ? dialogColorLight : dialogColorDark); -} - -QColor QQuickMaterialStyle::backgroundDimColor() const -{ - return QColor::fromRgba(m_theme == Light ? 0x99303030 : 0x99fafafa); -} - -QColor QQuickMaterialStyle::listHighlightColor() const -{ - return QColor::fromRgba(m_theme == Light ? 0x1e000000 : 0x1effffff); -} - -QColor QQuickMaterialStyle::tooltipColor() const -{ - if (m_explicitBackground) - return backgroundColor(); - return color(Grey, Shade700); -} - -QColor QQuickMaterialStyle::toolBarColor() const -{ - if (m_explicitBackground) - return backgroundColor(); - return primaryColor(); -} - -QColor QQuickMaterialStyle::toolTextColor() const -{ - if (m_hasForeground || m_customPrimary) - return primaryTextColor(); - - switch (m_primary) { - case Red: - case Pink: - case Purple: - case DeepPurple: - case Indigo: - case Blue: - case Teal: - case DeepOrange: - case Brown: - case BlueGrey: - return QColor::fromRgba(primaryTextColorDark); - - case LightBlue: - case Cyan: - case Green: - case LightGreen: - case Lime: - case Yellow: - case Amber: - case Orange: - case Grey: - return QColor::fromRgba(primaryTextColorLight); - - default: - break; - } - - return primaryTextColor(); -} - -QColor QQuickMaterialStyle::spinBoxDisabledIconColor() const -{ - return QColor::fromRgba(m_theme == Light ? spinBoxDisabledIconColorLight : spinBoxDisabledIconColorDark); -} - -QColor QQuickMaterialStyle::sliderDisabledColor() const -{ - return QColor::fromRgba(m_theme == Light ? sliderDisabledColorLight : sliderDisabledColorDark); -} - -QColor QQuickMaterialStyle::color(QQuickMaterialStyle::Color color, QQuickMaterialStyle::Shade shade) const -{ - int count = sizeof(colors) / sizeof(colors[0]); - if (color < 0 || color >= count) - return QColor(); - - count = sizeof(colors[0]) / sizeof(colors[0][0]); - if (shade < 0 || shade >= count) - return QColor(); - - return colors[color][shade]; -} - -static QColor lighterShade(const QColor &color, qreal amount) -{ - QColor hsl = color.toHsl(); - hsl.setHslF(hsl.hueF(), hsl.saturationF(), qBound<qreal>(0.0, hsl.lightnessF() + amount, 1.0), color.alphaF()); - return hsl.convertTo(color.spec()); -} - -static QColor darkerShade(const QColor &color, qreal amount) -{ - QColor hsl = color.toHsl(); - hsl.setHslF(hsl.hueF(), hsl.saturationF(), qBound<qreal>(0.0, hsl.lightnessF() - amount, 1.0), color.alphaF()); - return hsl.convertTo(color.spec()); -} - -QQuickMaterialStyle::Shade QQuickMaterialStyle::themeShade() const -{ - return m_theme == Light ? Shade500 : Shade200; -} - -/* - * The following lightness values originate from the Material Design Color Generator project. - * - * The MIT License (MIT) - * - * Copyright (c) 2015 mbitson - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -// Returns the same color, if shade == themeShade() -QColor QQuickMaterialStyle::shade(const QColor &color, Shade shade) const -{ - switch (shade) { - case Shade50: - return lighterShade(color, m_theme == Light ? 0.52 : 0.26); - case Shade100: - return lighterShade(color, m_theme == Light ? 0.37 : 0.11); - case Shade200: - return m_theme == Light ? lighterShade(color, 0.26) : color; - case Shade300: - return m_theme == Light ? lighterShade(color, 0.12) : darkerShade(color, 0.14); - case Shade400: - return m_theme == Light ? lighterShade(color, 0.06) : darkerShade(color, 0.20); - case Shade500: - return m_theme == Light ? color : darkerShade(color, 0.26); - case Shade600: - return darkerShade(color, m_theme == Light ? 0.06 : 0.32); - case Shade700: - return darkerShade(color, m_theme == Light ? 0.12 : 0.38); - case Shade800: - return darkerShade(color, m_theme == Light ? 0.18 : 0.44); - case Shade900: - return darkerShade(color, m_theme == Light ? 0.24 : 0.50); - case ShadeA100: - return lighterShade(color, m_theme == Light ? 0.54 : 0.28); - case ShadeA200: - return lighterShade(color, m_theme == Light ? 0.37 : 0.11); - case ShadeA400: - return m_theme == Light ? lighterShade(color, 0.06) : darkerShade(color, 0.20); - case ShadeA700: - return darkerShade(color, m_theme == Light ? 0.12 : 0.38); - default: - Q_UNREACHABLE(); - return QColor(); - } -} - -int QQuickMaterialStyle::touchTarget() const -{ - // https://material.io/guidelines/components/buttons.html#buttons-style - return globalVariant == Dense ? 44 : 48; -} - -int QQuickMaterialStyle::buttonHeight() const -{ - // https://material.io/guidelines/components/buttons.html#buttons-style - return globalVariant == Dense ? 32 : 36; -} - -int QQuickMaterialStyle::delegateHeight() const -{ - // https://material.io/guidelines/components/lists.html#lists-specs - return globalVariant == Dense ? 40 : 48; -} - -int QQuickMaterialStyle::dialogButtonBoxHeight() const -{ - return globalVariant == Dense ? 48 : 52; -} - -int QQuickMaterialStyle::frameVerticalPadding() const -{ - return globalVariant == Dense ? 8 : 12; -} - -int QQuickMaterialStyle::menuItemHeight() const -{ - // https://material.io/guidelines/components/menus.html#menus-simple-menus - return globalVariant == Dense ? 32 : 48; -} - -int QQuickMaterialStyle::menuItemVerticalPadding() const -{ - return globalVariant == Dense ? 8 : 12; -} - -int QQuickMaterialStyle::switchDelegateVerticalPadding() const -{ - // SwitchDelegate's indicator is much larger than the others due to the shadow, - // so we must reduce its padding to ensure its implicitHeight is 40 when dense. - return globalVariant == Dense ? 4 : 8; -} - -int QQuickMaterialStyle::tooltipHeight() const -{ - // https://material.io/guidelines/components/tooltips.html - return globalVariant == Dense ? 22 : 32; -} - -QQuickMaterialStyle::Variant QQuickMaterialStyle::variant() -{ - return globalVariant; -} - -template <typename Enum> -static Enum toEnumValue(const QByteArray &value, bool *ok) -{ - QMetaEnum enumeration = QMetaEnum::fromType<Enum>(); - return static_cast<Enum>(enumeration.keyToValue(value, ok)); -} - -static QByteArray resolveSetting(const QByteArray &env, const QSharedPointer<QSettings> &settings, const QString &name) -{ - QByteArray value = qgetenv(env); -#if QT_CONFIG(settings) - if (value.isNull() && !settings.isNull()) - value = settings->value(name).toByteArray(); -#endif - return value; -} - -void QQuickMaterialStyle::initGlobals() -{ - QSharedPointer<QSettings> settings = QQuickStylePrivate::settings(QStringLiteral("Material")); - - bool ok = false; - QByteArray themeValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_THEME", settings, QStringLiteral("Theme")); - Theme themeEnum = toEnumValue<Theme>(themeValue, &ok); - if (ok) - globalTheme = effectiveTheme(themeEnum); - else if (!themeValue.isEmpty()) - qWarning().nospace().noquote() << "Material: unknown theme value: " << themeValue; - - QByteArray variantValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_VARIANT", settings, QStringLiteral("Variant")); - Variant variantEnum = toEnumValue<Variant>(variantValue, &ok); - if (ok) - globalVariant = variantEnum; - else if (!variantValue.isEmpty()) - qWarning().nospace().noquote() << "Material: unknown variant value: " << variantValue; - - QByteArray primaryValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_PRIMARY", settings, QStringLiteral("Primary")); - Color primaryEnum = toEnumValue<Color>(primaryValue, &ok); - if (ok) { - globalPrimaryCustom = false; - globalPrimary = primaryEnum; - } else { - QColor color(primaryValue.constData()); - if (color.isValid()) { - globalPrimaryCustom = true; - globalPrimary = color.rgba(); - } else if (!primaryValue.isEmpty()) { - qWarning().nospace().noquote() << "Material: unknown primary value: " << primaryValue; - } - } - - QByteArray accentValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_ACCENT", settings, QStringLiteral("Accent")); - Color accentEnum = toEnumValue<Color>(accentValue, &ok); - if (ok) { - globalAccentCustom = false; - globalAccent = accentEnum; - } else if (!accentValue.isEmpty()) { - QColor color(accentValue.constData()); - if (color.isValid()) { - globalAccentCustom = true; - globalAccent = color.rgba(); - } else { - qWarning().nospace().noquote() << "Material: unknown accent value: " << accentValue; - } - } - - QByteArray foregroundValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_FOREGROUND", settings, QStringLiteral("Foreground")); - Color foregroundEnum = toEnumValue<Color>(foregroundValue, &ok); - if (ok) { - globalForegroundCustom = false; - globalForeground = foregroundEnum; - hasGlobalForeground = true; - } else if (!foregroundValue.isEmpty()) { - QColor color(foregroundValue.constData()); - if (color.isValid()) { - globalForegroundCustom = true; - globalForeground = color.rgba(); - hasGlobalForeground = true; - } else { - qWarning().nospace().noquote() << "Material: unknown foreground value: " << foregroundValue; - } - } - - QByteArray backgroundValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_BACKGROUND", settings, QStringLiteral("Background")); - Color backgroundEnum = toEnumValue<Color>(backgroundValue, &ok); - if (ok) { - globalBackgroundCustom = false; - globalBackground = backgroundEnum; - hasGlobalBackground = true; - } else if (!backgroundValue.isEmpty()) { - QColor color(backgroundValue.constData()); - if (color.isValid()) { - globalBackgroundCustom = true; - globalBackground = color.rgba(); - hasGlobalBackground = true; - } else { - qWarning().nospace().noquote() << "Material: unknown background value: " << backgroundValue; - } - } -} - -void QQuickMaterialStyle::attachedParentChange(QQuickAttachedObject *newParent, QQuickAttachedObject *oldParent) -{ - Q_UNUSED(oldParent); - QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(newParent); - if (material) { - inheritPrimary(material->m_primary, material->m_customPrimary); - inheritAccent(material->m_accent, material->m_customAccent); - inheritForeground(material->m_foreground, material->m_customForeground, material->m_hasForeground); - inheritBackground(material->m_background, material->m_customBackground, material->m_hasBackground); - inheritTheme(material->theme()); - } -} - -bool QQuickMaterialStyle::variantToRgba(const QVariant &var, const char *name, QRgb *rgba, bool *custom) const -{ - *custom = false; - if (var.metaType().id() == QMetaType::Int) { - int val = var.toInt(); - if (val > BlueGrey) { - qmlWarning(parent()) << "unknown Material." << name << " value: " << val; - return false; - } - *rgba = val; - } else { - int val = QMetaEnum::fromType<Color>().keyToValue(var.toByteArray()); - if (val != -1) { - *rgba = val; - } else { - QColor color(var.toString()); - if (!color.isValid()) { - qmlWarning(parent()) << "unknown Material." << name << " value: " << var.toString(); - return false; - } - *custom = true; - *rgba = color.rgba(); - } - } - return true; -} - -QT_END_NAMESPACE diff --git a/src/quickcontrols2/material/qquickmaterialstyle_p.h b/src/quickcontrols2/material/qquickmaterialstyle_p.h deleted file mode 100644 index 56cf141c..00000000 --- a/src/quickcontrols2/material/qquickmaterialstyle_p.h +++ /dev/null @@ -1,334 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 QQUICKMATERIALSTYLE_P_H -#define QQUICKMATERIALSTYLE_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 <QtGui/qcolor.h> -#include <QtQuickControls2Impl/private/qquickattachedobject_p.h> - -QT_BEGIN_NAMESPACE - -class QQuickMaterialStyle : public QQuickAttachedObject -{ - Q_OBJECT - Q_PROPERTY(Theme theme READ theme WRITE setTheme RESET resetTheme NOTIFY themeChanged FINAL) - Q_PROPERTY(QVariant primary READ primary WRITE setPrimary RESET resetPrimary NOTIFY primaryChanged FINAL) - Q_PROPERTY(QVariant accent READ accent WRITE setAccent RESET resetAccent NOTIFY accentChanged FINAL) - Q_PROPERTY(QVariant foreground READ foreground WRITE setForeground RESET resetForeground NOTIFY foregroundChanged FINAL) - Q_PROPERTY(QVariant background READ background WRITE setBackground RESET resetBackground NOTIFY backgroundChanged FINAL) - Q_PROPERTY(int elevation READ elevation WRITE setElevation RESET resetElevation NOTIFY elevationChanged FINAL) - - Q_PROPERTY(QColor primaryColor READ primaryColor NOTIFY primaryChanged FINAL) // TODO: remove? - Q_PROPERTY(QColor accentColor READ accentColor NOTIFY accentChanged FINAL) // TODO: remove? - Q_PROPERTY(QColor backgroundColor READ backgroundColor NOTIFY backgroundChanged FINAL) - Q_PROPERTY(QColor primaryTextColor READ primaryTextColor NOTIFY themeChanged FINAL) - Q_PROPERTY(QColor primaryHighlightedTextColor READ primaryHighlightedTextColor NOTIFY primaryHighlightedTextColorChanged FINAL) - Q_PROPERTY(QColor secondaryTextColor READ secondaryTextColor NOTIFY themeChanged FINAL) - Q_PROPERTY(QColor hintTextColor READ hintTextColor NOTIFY themeChanged FINAL) - Q_PROPERTY(QColor textSelectionColor READ textSelectionColor NOTIFY themeOrAccentChanged FINAL) - Q_PROPERTY(QColor dropShadowColor READ dropShadowColor CONSTANT FINAL) - Q_PROPERTY(QColor dividerColor READ dividerColor NOTIFY themeChanged FINAL) - Q_PROPERTY(QColor iconColor READ iconColor NOTIFY themeChanged FINAL) - Q_PROPERTY(QColor iconDisabledColor READ iconDisabledColor NOTIFY themeChanged FINAL) - Q_PROPERTY(QColor buttonColor READ buttonColor NOTIFY buttonColorChanged FINAL) - Q_PROPERTY(QColor buttonDisabledColor READ buttonDisabledColor NOTIFY buttonDisabledColorChanged FINAL) - Q_PROPERTY(QColor highlightedButtonColor READ highlightedButtonColor NOTIFY buttonColorChanged FINAL) - Q_PROPERTY(QColor frameColor READ frameColor NOTIFY themeChanged FINAL) - Q_PROPERTY(QColor rippleColor READ rippleColor NOTIFY themeChanged FINAL) - Q_PROPERTY(QColor highlightedRippleColor READ highlightedRippleColor NOTIFY themeOrAccentChanged FINAL) - Q_PROPERTY(QColor switchUncheckedTrackColor READ switchUncheckedTrackColor NOTIFY themeChanged FINAL) - Q_PROPERTY(QColor switchCheckedTrackColor READ switchCheckedTrackColor NOTIFY themeOrAccentChanged FINAL) - Q_PROPERTY(QColor switchUncheckedHandleColor READ switchUncheckedHandleColor NOTIFY themeChanged FINAL) - Q_PROPERTY(QColor switchCheckedHandleColor READ switchCheckedHandleColor NOTIFY themeOrAccentChanged FINAL) - Q_PROPERTY(QColor switchDisabledTrackColor READ switchDisabledTrackColor NOTIFY themeChanged FINAL) - Q_PROPERTY(QColor switchDisabledHandleColor READ switchDisabledHandleColor NOTIFY themeChanged FINAL) - Q_PROPERTY(QColor scrollBarColor READ scrollBarColor NOTIFY themeChanged FINAL) - Q_PROPERTY(QColor scrollBarHoveredColor READ scrollBarHoveredColor NOTIFY themeChanged FINAL) - Q_PROPERTY(QColor scrollBarPressedColor READ scrollBarPressedColor NOTIFY themeChanged FINAL) - Q_PROPERTY(QColor dialogColor READ dialogColor NOTIFY dialogColorChanged FINAL) - Q_PROPERTY(QColor backgroundDimColor READ backgroundDimColor NOTIFY themeChanged FINAL) - Q_PROPERTY(QColor listHighlightColor READ listHighlightColor NOTIFY themeChanged FINAL) - Q_PROPERTY(QColor tooltipColor READ tooltipColor NOTIFY tooltipColorChanged FINAL) - Q_PROPERTY(QColor toolBarColor READ toolBarColor NOTIFY toolBarColorChanged FINAL) - Q_PROPERTY(QColor toolTextColor READ toolTextColor NOTIFY toolTextColorChanged FINAL) - Q_PROPERTY(QColor spinBoxDisabledIconColor READ spinBoxDisabledIconColor NOTIFY themeChanged FINAL) - Q_PROPERTY(QColor sliderDisabledColor READ sliderDisabledColor NOTIFY themeChanged FINAL REVISION 15) - - Q_PROPERTY(int touchTarget READ touchTarget CONSTANT FINAL) - Q_PROPERTY(int buttonHeight READ buttonHeight CONSTANT FINAL) - Q_PROPERTY(int delegateHeight READ delegateHeight CONSTANT FINAL) - Q_PROPERTY(int dialogButtonBoxHeight READ dialogButtonBoxHeight CONSTANT FINAL) - Q_PROPERTY(int frameVerticalPadding READ frameVerticalPadding CONSTANT FINAL) - Q_PROPERTY(int menuItemHeight READ menuItemHeight CONSTANT FINAL) - Q_PROPERTY(int menuItemVerticalPadding READ menuItemVerticalPadding CONSTANT FINAL) - Q_PROPERTY(int switchDelegateVerticalPadding READ switchDelegateVerticalPadding CONSTANT FINAL) - Q_PROPERTY(int tooltipHeight READ tooltipHeight CONSTANT FINAL) - - QML_NAMED_ELEMENT(Material) - QML_ATTACHED(QQuickMaterialStyle) - QML_UNCREATABLE("") - QML_ADDED_IN_VERSION(2, 0) - -public: - enum Theme { - Light, - Dark, - System - }; - - enum Variant { - Normal, - Dense - }; - - enum Color { - Red, - Pink, - Purple, - DeepPurple, - Indigo, - Blue, - LightBlue, - Cyan, - Teal, - Green, - LightGreen, - Lime, - Yellow, - Amber, - Orange, - DeepOrange, - Brown, - Grey, - BlueGrey - }; - - enum Shade { - Shade50, - Shade100, - Shade200, - Shade300, - Shade400, - Shade500, - Shade600, - Shade700, - Shade800, - Shade900, - ShadeA100, - ShadeA200, - ShadeA400, - ShadeA700, - }; - - Q_ENUM(Theme) - Q_ENUM(Variant) - Q_ENUM(Color) - Q_ENUM(Shade) - - explicit QQuickMaterialStyle(QObject *parent = nullptr); - - static QQuickMaterialStyle *qmlAttachedProperties(QObject *object); - - Theme theme() const; - void setTheme(Theme theme); - void inheritTheme(Theme theme); - void propagateTheme(); - void resetTheme(); - void themeChange(); - - QVariant primary() const; - void setPrimary(const QVariant &accent); - void inheritPrimary(uint primary, bool custom); - void propagatePrimary(); - void resetPrimary(); - void primaryChange(); - - QVariant accent() const; - void setAccent(const QVariant &accent); - void inheritAccent(uint accent, bool custom); - void propagateAccent(); - void resetAccent(); - void accentChange(); - - QVariant foreground() const; - void setForeground(const QVariant &foreground); - void inheritForeground(uint foreground, bool custom, bool has); - void propagateForeground(); - void resetForeground(); - void foregroundChange(); - - QVariant background() const; - void setBackground(const QVariant &background); - void inheritBackground(uint background, bool custom, bool has); - void propagateBackground(); - void resetBackground(); - void backgroundChange(); - - int elevation() const; - void setElevation(int elevation); - void resetElevation(); - void elevationChange(); - - QColor primaryColor() const; - QColor accentColor() const; - QColor backgroundColor() const; - QColor primaryTextColor() const; - QColor primaryHighlightedTextColor() const; - QColor secondaryTextColor() const; - QColor hintTextColor() const; - QColor textSelectionColor() const; - QColor dropShadowColor() const; - QColor dividerColor() const; - QColor iconColor() const; - QColor iconDisabledColor() const; - QColor buttonColor() const; - QColor buttonDisabledColor() const; - QColor highlightedButtonColor() const; - QColor highlightedButtonDisabledColor() const; - QColor frameColor() const; - QColor rippleColor() const; - QColor highlightedRippleColor() const; - QColor switchUncheckedTrackColor() const; - QColor switchCheckedTrackColor() const; - QColor switchUncheckedHandleColor() const; - QColor switchCheckedHandleColor() const; - QColor switchDisabledTrackColor() const; - QColor switchDisabledHandleColor() const; - QColor scrollBarColor() const; - QColor scrollBarHoveredColor() const; - QColor scrollBarPressedColor() const; - QColor dialogColor() const; - QColor backgroundDimColor() const; - QColor listHighlightColor() const; - QColor tooltipColor() const; - QColor toolBarColor() const; - QColor toolTextColor() const; - QColor spinBoxDisabledIconColor() const; - QColor sliderDisabledColor() const; - - Q_INVOKABLE QColor color(Color color, Shade shade = Shade500) const; - Q_INVOKABLE QColor shade(const QColor &color, Shade shade) const; - - int touchTarget() const; - int buttonHeight() const; - int delegateHeight() const; - int dialogButtonBoxHeight() const; - int frameVerticalPadding() const; - int menuItemHeight() const; - int menuItemVerticalPadding() const; - int switchDelegateVerticalPadding() const; - int tooltipHeight() const; - - static void initGlobals(); - - static Variant variant(); - -Q_SIGNALS: - void themeChanged(); - void primaryChanged(); - void accentChanged(); - void foregroundChanged(); - void backgroundChanged(); - void elevationChanged(); - - void themeOrAccentChanged(); - - void primaryHighlightedTextColorChanged(); - void buttonColorChanged(); - void buttonDisabledColorChanged(); - void dialogColorChanged(); - void tooltipColorChanged(); - void toolBarColorChanged(); - void toolTextColorChanged(); - -protected: - void attachedParentChange(QQuickAttachedObject *newParent, QQuickAttachedObject *oldParent) override; - -private: - void init(); - bool variantToRgba(const QVariant &var, const char *name, QRgb *rgba, bool *custom) const; - - QColor backgroundColor(Shade shade) const; - QColor accentColor(Shade shade) const; - QColor buttonColor(bool highlighted) const; - Shade themeShade() const; - - // These reflect whether a color value was explicitly set on the specific - // item that this attached style object represents. - bool m_explicitTheme = false; - bool m_explicitPrimary = false; - bool m_explicitAccent = false; - bool m_explicitForeground = false; - bool m_explicitBackground = false; - // These reflect whether the color value that was either inherited or - // explicitly set is in the form that QColor expects, rather than one of - // our pre-defined color enum values. - bool m_customPrimary = false; - bool m_customAccent = false; - bool m_customForeground = false; - bool m_customBackground = false; - // These will be true when this item has an explicit or inherited foreground/background - // color, or these colors were declared globally via settings (e.g. conf or env vars). - // Some color properties of the style will return different values depending on whether - // or not these are set. - bool m_hasForeground = false; - bool m_hasBackground = false; - // The actual values for this item, whether explicit, inherited or globally set. - Theme m_theme = Light; - uint m_primary = 0; - uint m_accent = 0; - uint m_foreground = 0; - uint m_background = 0; - int m_elevation = 0; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPEINFO(QQuickMaterialStyle, QML_HAS_ATTACHED_PROPERTIES) - -#endif // QQUICKMATERIALSTYLE_P_H diff --git a/src/quickcontrols2/material/qquickmaterialtheme.cpp b/src/quickcontrols2/material/qquickmaterialtheme.cpp deleted file mode 100644 index aec9e232..00000000 --- a/src/quickcontrols2/material/qquickmaterialtheme.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "qquickmaterialtheme_p.h" -#include "qquickmaterialstyle_p.h" - -#include <QtGui/qpa/qplatformdialoghelper.h> -#include <QtGui/qfont.h> -#include <QtGui/qfontinfo.h> -#include <QtQuickTemplates2/private/qquicktheme_p.h> - -QT_BEGIN_NAMESPACE - -void QQuickMaterialTheme::initialize(QQuickTheme *theme) -{ - QFont systemFont; - QFont buttonFont; - QFont toolTipFont; - QFont itemViewFont; - QFont listViewFont; - QFont menuItemFont; - QFont editorFont; - - QFont font; - font.setFamilies(QStringList{QLatin1String("Roboto")}); - QString family = QFontInfo(font).family(); - - if (family != QLatin1String("Roboto")) { - font.setFamilies(QStringList{QLatin1String("Noto")}); - family = QFontInfo(font).family(); - } - - if (family == QLatin1String("Roboto") || family == QLatin1String("Noto")) { - const QStringList families{family}; - systemFont.setFamilies(families); - buttonFont.setFamilies(families); - toolTipFont.setFamilies(families); - itemViewFont.setFamilies(families); - listViewFont.setFamilies(families); - menuItemFont.setFamilies(families); - editorFont.setFamilies(families); - } - - const bool dense = QQuickMaterialStyle::variant() == QQuickMaterialStyle::Dense; - systemFont.setPixelSize(dense ? 13 : 14); - theme->setFont(QQuickTheme::System, systemFont); - - // https://material.io/guidelines/components/buttons.html#buttons-style - buttonFont.setPixelSize(dense ? 13 : 14); - buttonFont.setCapitalization(QFont::AllUppercase); - buttonFont.setWeight(QFont::Medium); - theme->setFont(QQuickTheme::Button, buttonFont); - theme->setFont(QQuickTheme::TabBar, buttonFont); - theme->setFont(QQuickTheme::ToolBar, buttonFont); - - // https://material.io/guidelines/components/tooltips.html - toolTipFont.setPixelSize(dense ? 10 : 14); - toolTipFont.setWeight(QFont::Medium); - theme->setFont(QQuickTheme::ToolTip, toolTipFont); - - itemViewFont.setPixelSize(dense ? 13 : 14); - itemViewFont.setWeight(QFont::Medium); - theme->setFont(QQuickTheme::ItemView, itemViewFont); - - // https://material.io/guidelines/components/lists.html#lists-specs - listViewFont.setPixelSize(dense ? 13 : 16); - theme->setFont(QQuickTheme::ListView, listViewFont); - - menuItemFont.setPixelSize(dense ? 13 : 16); - theme->setFont(QQuickTheme::Menu, menuItemFont); - theme->setFont(QQuickTheme::MenuBar, menuItemFont); - theme->setFont(QQuickTheme::ComboBox, menuItemFont); - - editorFont.setPixelSize(dense ? 13 : 16); - theme->setFont(QQuickTheme::TextArea, editorFont); - theme->setFont(QQuickTheme::TextField, editorFont); - theme->setFont(QQuickTheme::SpinBox, editorFont); -} - -QT_END_NAMESPACE diff --git a/src/quickcontrols2/material/qquickmaterialtheme_p.h b/src/quickcontrols2/material/qquickmaterialtheme_p.h deleted file mode 100644 index 9a1362b8..00000000 --- a/src/quickcontrols2/material/qquickmaterialtheme_p.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 QQUICKMATERIALTHEME_P_H -#define QQUICKMATERIALTHEME_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtCore/qglobal.h> - -QT_BEGIN_NAMESPACE - -class QQuickTheme; - -class QQuickMaterialTheme -{ -public: - static void initialize(QQuickTheme *theme); -}; - -QT_END_NAMESPACE - -#endif // QQUICKMATERIALTHEME_P_H diff --git a/src/quickcontrols2/material/qt_attribution.json b/src/quickcontrols2/material/qt_attribution.json deleted file mode 100644 index 85fdadf9..00000000 --- a/src/quickcontrols2/material/qt_attribution.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "Id": "shadow_angular_material", - "Name": "Shadow values from Angular Material", - "QDocModule": "qtquickcontrols", - "QtUsage": "Used in the Material Style of Qt Quick Controls 2.", - "Files": "ElevationEffect.qml", - "Description": "Shadow values for the elevation effect.", - "Homepage": "https://angularjs.org/", - "License": "MIT License", - "LicenseId": "MIT", - "LicenseFile": "LICENSE_ANGULARJS.txt", - "Copyright": "Copyright (c) 2014-2016 Google, Inc" -} diff --git a/src/quickcontrols2/material/qtquickcontrols2materialstyleplugin.cpp b/src/quickcontrols2/material/qtquickcontrols2materialstyleplugin.cpp deleted file mode 100644 index c8e7ebbc..00000000 --- a/src/quickcontrols2/material/qtquickcontrols2materialstyleplugin.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "qquickmaterialstyle_p.h" -#include "qquickmaterialtheme_p.h" - -#include <QtQuickControls2/private/qquickstyleplugin_p.h> -#include <QtQuickControls2Impl/private/qquickpaddedrectangle_p.h> -#include <QtQuickTemplates2/private/qquicktheme_p.h> - -extern void qml_register_types_QtQuick_Controls_Material(); - -QT_BEGIN_NAMESPACE - -class QtQuickControls2MaterialStylePlugin : public QQuickStylePlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) - -public: - QtQuickControls2MaterialStylePlugin(QObject *parent = nullptr); - - QString name() const override; - void initializeTheme(QQuickTheme *theme) override; - - QQuickMaterialTheme theme; -}; - -QtQuickControls2MaterialStylePlugin::QtQuickControls2MaterialStylePlugin(QObject *parent) : QQuickStylePlugin(parent) -{ - volatile auto registration = &qml_register_types_QtQuick_Controls_Material; - Q_UNUSED(registration); -} - -QString QtQuickControls2MaterialStylePlugin::name() const -{ - return QStringLiteral("Material"); -} - -void QtQuickControls2MaterialStylePlugin::initializeTheme(QQuickTheme *theme) -{ - QQuickMaterialStyle::initGlobals(); - this->theme.initialize(theme); -} - -QT_END_NAMESPACE - -#include "qtquickcontrols2materialstyleplugin.moc" diff --git a/src/quickcontrols2/material/qtquickcontrols2materialstyleplugin.qrc b/src/quickcontrols2/material/qtquickcontrols2materialstyleplugin.qrc deleted file mode 100644 index 981960c4..00000000 --- a/src/quickcontrols2/material/qtquickcontrols2materialstyleplugin.qrc +++ /dev/null @@ -1,20 +0,0 @@ -<RCC> - <qresource prefix="/qt-project.org/imports/QtQuick/Controls/Material"> - <file>images/arrow-indicator.png</file> - <file>images/[email protected]</file> - <file>images/[email protected]</file> - <file>images/[email protected]</file> - <file>images/check.png</file> - <file>images/[email protected]</file> - <file>images/[email protected]</file> - <file>images/[email protected]</file> - <file>images/drop-indicator.png</file> - <file>images/[email protected]</file> - <file>images/[email protected]</file> - <file>images/[email protected]</file> - <file>shaders/RectangularGlow.frag</file> - <file>shaders/+glslcore/RectangularGlow.frag</file> - <file>shaders/+hlsl/RectangularGlow.frag</file> - <file>shaders/+qsb/RectangularGlow.frag</file> - </qresource> -</RCC> diff --git a/src/quickcontrols2/material/shaders/+glslcore/RectangularGlow.frag b/src/quickcontrols2/material/shaders/+glslcore/RectangularGlow.frag deleted file mode 100644 index 432d86b5..00000000 --- a/src/quickcontrols2/material/shaders/+glslcore/RectangularGlow.frag +++ /dev/null @@ -1,25 +0,0 @@ -#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/quickcontrols2/material/shaders/+hlsl/RectangularGlow.frag b/src/quickcontrols2/material/shaders/+hlsl/RectangularGlow.frag deleted file mode 100644 index 69d9f852..00000000 --- a/src/quickcontrols2/material/shaders/+hlsl/RectangularGlow.frag +++ /dev/null @@ -1,21 +0,0 @@ -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/quickcontrols2/material/shaders/+qsb/RectangularGlow.frag b/src/quickcontrols2/material/shaders/+qsb/RectangularGlow.frag Binary files differdeleted file mode 100644 index 5cfa2db6..00000000 --- a/src/quickcontrols2/material/shaders/+qsb/RectangularGlow.frag +++ /dev/null diff --git a/src/quickcontrols2/material/shaders/RectangularGlow.frag b/src/quickcontrols2/material/shaders/RectangularGlow.frag deleted file mode 100644 index 40bab580..00000000 --- a/src/quickcontrols2/material/shaders/RectangularGlow.frag +++ /dev/null @@ -1,19 +0,0 @@ -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/quickcontrols2/material/shaders/RectangularGlow_rhi.frag b/src/quickcontrols2/material/shaders/RectangularGlow_rhi.frag deleted file mode 100644 index 3e7d2dfe..00000000 --- a/src/quickcontrols2/material/shaders/RectangularGlow_rhi.frag +++ /dev/null @@ -1,28 +0,0 @@ -#version 440 - -layout(location = 0) in vec2 qt_TexCoord0; -layout(location = 0) out vec4 fragColor; - -layout(std140, binding = 0) uniform buf { - mat4 qt_Matrix; - float qt_Opacity; - float relativeSizeX; - float relativeSizeY; - float spread; - vec4 color; -} ubuf; - -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, ubuf.relativeSizeX, 0.5 - abs(0.5 - qt_TexCoord0.x)) * - smoothstep(0.0, ubuf.relativeSizeY, 0.5 - abs(0.5 - qt_TexCoord0.y)); - - float spreadMultiplier = linearstep(ubuf.spread, 1.0 - ubuf.spread, alpha); - fragColor = ubuf.color * ubuf.qt_Opacity * spreadMultiplier * spreadMultiplier; -} diff --git a/src/quickcontrols2/material/shaders/compile.bat b/src/quickcontrols2/material/shaders/compile.bat deleted file mode 100644 index e87efa7a..00000000 --- a/src/quickcontrols2/material/shaders/compile.bat +++ /dev/null @@ -1,40 +0,0 @@ -::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: -:: Copyright (C) 2019 The Qt Company Ltd. -:: Contact: https://www.qt.io/licensing/ -:: -:: This file is part of the QtQuick module of the Qt Toolkit. -:: -:: $QT_BEGIN_LICENSE:LGPL$ -:: 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 https://www.qt.io/terms-conditions. For further -:: information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -:: Public license version 3 or any later version approved by the KDE Free -:: Qt Foundation. The licenses are as published by the Free Software -:: Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -:: included in the packaging of this file. Please review the following -:: information to ensure the GNU General Public License requirements will -:: be met: https://www.gnu.org/licenses/gpl-2.0.html and -:: https://www.gnu.org/licenses/gpl-3.0.html. -:: -:: $QT_END_LICENSE$ -:: -::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/RectangularGlow.frag RectangularGlow_rhi.frag |