diff options
Diffstat (limited to 'src/imports/controls')
37 files changed, 436 insertions, 101 deletions
diff --git a/src/imports/controls/ComboBox.qml b/src/imports/controls/ComboBox.qml index b30293f5..e9f93d66 100644 --- a/src/imports/controls/ComboBox.qml +++ b/src/imports/controls/ComboBox.qml @@ -53,7 +53,7 @@ T.ComboBox { rightPadding: padding + (control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing) delegate: ItemDelegate { - width: parent.width + width: ListView.view.width text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData palette.text: control.palette.text palette.highlightedText: control.palette.highlightedText diff --git a/src/imports/controls/DialogButtonBox.qml b/src/imports/controls/DialogButtonBox.qml index 3c9d5b48..cc148ac4 100644 --- a/src/imports/controls/DialogButtonBox.qml +++ b/src/imports/controls/DialogButtonBox.qml @@ -55,6 +55,7 @@ T.DialogButtonBox { } contentItem: ListView { + implicitWidth: contentWidth model: control.contentModel spacing: control.spacing orientation: ListView.Horizontal diff --git a/src/imports/controls/designer/AbstractButtonSection.qml b/src/imports/controls/designer/AbstractButtonSection.qml index e8aa39c2..35fad2ab 100644 --- a/src/imports/controls/designer/AbstractButtonSection.qml +++ b/src/imports/controls/designer/AbstractButtonSection.qml @@ -104,8 +104,8 @@ Section { } Label { - text: qsTr("Repeat") - tooltip: qsTr("Whether the button repeats while pressed and held down.") + text: qsTr("Auto-Repeat") + tooltip: qsTr("Whether the button repeats pressed(), released() and clicked() signals while the button is pressed and held down.") } SecondColumnLayout { CheckBox { diff --git a/src/imports/controls/designer/ButtonSection.qml b/src/imports/controls/designer/ButtonSection.qml index fef46071..951c8cf4 100644 --- a/src/imports/controls/designer/ButtonSection.qml +++ b/src/imports/controls/designer/ButtonSection.qml @@ -43,17 +43,7 @@ Section { caption: qsTr("Button") SectionLayout { - Label { - text: qsTr("AutoRepeat") - tooltip: qsTr("Whether the button repeats pressed(), released() and clicked() signals while the button is pressed and held down.") - } - SecondColumnLayout { - CheckBox { - text: backendValues.autoRepeat.valueToString - backendValue: backendValues.autoRepeat - Layout.fillWidth: true - } - } + Label { text: qsTr("Flat") tooltip: qsTr("Whether the button is flat.") diff --git a/src/imports/controls/designer/ControlSection.qml b/src/imports/controls/designer/ControlSection.qml index 7c53ac73..3446c08f 100644 --- a/src/imports/controls/designer/ControlSection.qml +++ b/src/imports/controls/designer/ControlSection.qml @@ -69,7 +69,7 @@ Section { Label { text: qsTr("Hover") - tooltip: qsTr("Whether control accepts hover evets.") + tooltip: qsTr("Whether control accepts hover events.") } SecondColumnLayout { CheckBox { @@ -95,7 +95,7 @@ Section { Label { text: qsTr("Wheel") - tooltip: qsTr("Whether control accepts wheel evets.") + tooltip: qsTr("Whether control accepts wheel events.") } SecondColumnLayout { CheckBox { diff --git a/src/imports/controls/designer/DialSpecifics.qml b/src/imports/controls/designer/DialSpecifics.qml index fc5b5e83..a0df81ef 100644 --- a/src/imports/controls/designer/DialSpecifics.qml +++ b/src/imports/controls/designer/DialSpecifics.qml @@ -112,7 +112,7 @@ Column { } SecondColumnLayout { ComboBox { - backendValue: backendValues.orientation + backendValue: backendValues.snapMode model: [ "NoSnap", "SnapOnRelease", "SnapAlways" ] scope: "Dial" Layout.fillWidth: true @@ -143,6 +143,18 @@ Column { Layout.fillWidth: true } } + + Label { + text: qsTr("Wrap") + tooltip: qsTr("Whether the dial wraps when dragged.") + } + SecondColumnLayout { + CheckBox { + text: backendValues.wrap.valueToString + backendValue: backendValues.wrap + Layout.fillWidth: true + } + } } } diff --git a/src/imports/controls/designer/InsetSection.qml b/src/imports/controls/designer/InsetSection.qml new file mode 100644 index 00000000..4253b170 --- /dev/null +++ b/src/imports/controls/designer/InsetSection.qml @@ -0,0 +1,119 @@ +/**************************************************************************** +** +** 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 2.12 +import HelperWidgets 2.0 +import QtQuick.Layouts 1.12 + +Section { + caption: qsTr("Inset") + + SectionLayout { + Label { + text: qsTr("Vertical") + } + SecondColumnLayout { + Label { + text: qsTr("Top") + tooltip: qsTr("Top inset for the background.") + width: 42 + } + SpinBox { + maximumValue: 10000 + minimumValue: -10000 + realDragRange: 5000 + decimals: 0 + backendValue: backendValues.topInset + Layout.fillWidth: true + } + Item { + width: 4 + height: 4 + } + + Label { + text: qsTr("Bottom") + tooltip: qsTr("Bottom inset for the background.") + width: 42 + } + SpinBox { + maximumValue: 10000 + minimumValue: -10000 + realDragRange: 5000 + decimals: 0 + backendValue: backendValues.bottomInset + Layout.fillWidth: true + } + } + + Label { + text: qsTr("Horizontal") + } + SecondColumnLayout { + Label { + text: qsTr("Left") + tooltip: qsTr("Left inset for the background.") + width: 42 + } + SpinBox { + maximumValue: 10000 + minimumValue: -10000 + realDragRange: 5000 + decimals: 0 + backendValue: backendValues.leftInset + Layout.fillWidth: true + } + Item { + width: 4 + height: 4 + } + + Label { + text: qsTr("Right") + tooltip: qsTr("Right inset for the background.") + width: 42 + } + SpinBox { + maximumValue: 10000 + minimumValue: -10000 + realDragRange: 5000 + decimals: 0 + backendValue: backendValues.rightInset + Layout.fillWidth: true + } + } + } +} diff --git a/src/imports/controls/designer/LabelSpecifics.qml b/src/imports/controls/designer/LabelSpecifics.qml index c832f894..e5d5e04f 100644 --- a/src/imports/controls/designer/LabelSpecifics.qml +++ b/src/imports/controls/designer/LabelSpecifics.qml @@ -79,4 +79,8 @@ Column { PaddingSection { width: parent.width } + + InsetSection { + width: parent.width + } } diff --git a/src/imports/controls/designer/PageIndicatorSpecifics.qml b/src/imports/controls/designer/PageIndicatorSpecifics.qml index 042672a9..20aa8577 100644 --- a/src/imports/controls/designer/PageIndicatorSpecifics.qml +++ b/src/imports/controls/designer/PageIndicatorSpecifics.qml @@ -73,6 +73,18 @@ Column { Layout.fillWidth: true } } + + Label { + text: qsTr("Interactive") + tooltip: qsTr("Whether the control is interactive.") + } + SecondColumnLayout { + CheckBox { + text: backendValues.interactive.valueToString + backendValue: backendValues.interactive + Layout.fillWidth: true + } + } } } @@ -80,10 +92,6 @@ Column { width: parent.width } - FontSection { - width: parent.width - } - PaddingSection { width: parent.width } diff --git a/src/imports/controls/designer/RangeSliderSpecifics.qml b/src/imports/controls/designer/RangeSliderSpecifics.qml index 79d2404f..9372a4ff 100644 --- a/src/imports/controls/designer/RangeSliderSpecifics.qml +++ b/src/imports/controls/designer/RangeSliderSpecifics.qml @@ -127,7 +127,7 @@ Column { } SecondColumnLayout { ComboBox { - backendValue: backendValues.orientation + backendValue: backendValues.snapMode model: [ "NoSnap", "SnapOnRelease", "SnapAlways" ] scope: "RangeSlider" Layout.fillWidth: true @@ -158,6 +158,20 @@ Column { Layout.fillWidth: true } } + + Label { + text: qsTr("Touch drag threshold") + tooltip: qsTr("The threshold (in logical pixels) at which a touch drag event will be initiated.") + } + SecondColumnLayout { + SpinBox { + minimumValue: 0 + maximumValue: 10000 + decimals: 0 + backendValue: backendValues.touchDragThreshold + Layout.fillWidth: true + } + } } } diff --git a/src/imports/controls/designer/RoundButtonSpecifics.qml b/src/imports/controls/designer/RoundButtonSpecifics.qml index 2da4cda6..af4ab5d0 100644 --- a/src/imports/controls/designer/RoundButtonSpecifics.qml +++ b/src/imports/controls/designer/RoundButtonSpecifics.qml @@ -42,6 +42,7 @@ Column { width: parent.width Section { + width: parent.width caption: qsTr("RoundButton") SectionLayout { @@ -51,8 +52,8 @@ Column { } SecondColumnLayout { SpinBox { - maximumValue: 9999999 - minimumValue: -9999999 + minimumValue: 0 + maximumValue: 10000 decimals: 0 backendValue: backendValues.radius Layout.fillWidth: true diff --git a/src/imports/controls/designer/SliderSpecifics.qml b/src/imports/controls/designer/SliderSpecifics.qml index 076d8a1c..d126dd06 100644 --- a/src/imports/controls/designer/SliderSpecifics.qml +++ b/src/imports/controls/designer/SliderSpecifics.qml @@ -143,6 +143,20 @@ Column { Layout.fillWidth: true } } + + Label { + text: qsTr("Touch drag threshold") + tooltip: qsTr("The threshold (in logical pixels) at which a touch drag event will be initiated.") + } + SecondColumnLayout { + SpinBox { + minimumValue: 0 + maximumValue: 10000 + decimals: 0 + backendValue: backendValues.touchDragThreshold + Layout.fillWidth: true + } + } } } diff --git a/src/imports/controls/designer/SpinBoxSpecifics.qml b/src/imports/controls/designer/SpinBoxSpecifics.qml index d6375d7c..db59f074 100644 --- a/src/imports/controls/designer/SpinBoxSpecifics.qml +++ b/src/imports/controls/designer/SpinBoxSpecifics.qml @@ -113,6 +113,18 @@ Column { Layout.fillWidth: true } } + + Label { + text: qsTr("Wrap") + tooltip: qsTr("Whether the spinbox wraps.") + } + SecondColumnLayout { + CheckBox { + text: backendValues.wrap.valueToString + backendValue: backendValues.wrap + Layout.fillWidth: true + } + } } } diff --git a/src/imports/controls/designer/TextAreaSpecifics.qml b/src/imports/controls/designer/TextAreaSpecifics.qml index a14584e7..f8cf92e8 100644 --- a/src/imports/controls/designer/TextAreaSpecifics.qml +++ b/src/imports/controls/designer/TextAreaSpecifics.qml @@ -57,6 +57,29 @@ Column { } } + + Label { + text: qsTr("Hover") + tooltip: qsTr("Whether text area accepts hover events.") + } + SecondColumnLayout { + CheckBox { + text: backendValues.hoverEnabled.valueToString + backendValue: backendValues.hoverEnabled + Layout.fillWidth: true + } + } + } + } + + Section { + width: parent.width + caption: qsTr("Placeholder Text Color") + + ColorEditor { + caption: qsTr("Placeholder Text Color") + backendValue: backendValues.placeholderTextColor + supportGradient: false } } @@ -74,4 +97,8 @@ Column { PaddingSection { width: parent.width } + + InsetSection { + width: parent.width + } } diff --git a/src/imports/controls/designer/TextFieldSpecifics.qml b/src/imports/controls/designer/TextFieldSpecifics.qml index 67a63ec4..f95f282c 100644 --- a/src/imports/controls/designer/TextFieldSpecifics.qml +++ b/src/imports/controls/designer/TextFieldSpecifics.qml @@ -57,6 +57,29 @@ Column { } } + + Label { + text: qsTr("Hover") + tooltip: qsTr("Whether text field accepts hover events.") + } + SecondColumnLayout { + CheckBox { + text: backendValues.hoverEnabled.valueToString + backendValue: backendValues.hoverEnabled + Layout.fillWidth: true + } + } + } + } + + Section { + width: parent.width + caption: qsTr("Placeholder Text Color") + + ColorEditor { + caption: qsTr("Placeholder Text Color") + backendValue: backendValues.placeholderTextColor + supportGradient: false } } @@ -71,4 +94,8 @@ Column { PaddingSection { width: parent.width } + + InsetSection { + width: parent.width + } } diff --git a/src/imports/controls/designer/designer.pri b/src/imports/controls/designer/designer.pri index 3ad99df7..6692b203 100644 --- a/src/imports/controls/designer/designer.pri +++ b/src/imports/controls/designer/designer.pri @@ -17,6 +17,7 @@ AUX_QML_FILES += \ $$PWD/DialSpecifics.qml \ $$PWD/FrameSpecifics.qml \ $$PWD/GroupBoxSpecifics.qml \ + $$PWD/InsetSection.qml \ $$PWD/ItemDelegateSection.qml \ $$PWD/ItemDelegateSpecifics.qml \ $$PWD/LabelSpecifics.qml \ diff --git a/src/imports/controls/doc/src/includes/qquickicon.qdocinc b/src/imports/controls/doc/src/includes/qquickicon.qdocinc index ba7cede9..beef5624 100644 --- a/src/imports/controls/doc/src/includes/qquickicon.qdocinc +++ b/src/imports/controls/doc/src/includes/qquickicon.qdocinc @@ -44,5 +44,7 @@ \li This property specifies whether the icon should be cached. The default value is true. + + This property was introduced in QtQuick.Controls 2.13. \endtable //! [grouped-properties] diff --git a/src/imports/controls/doc/src/qtquickcontrols2-icons.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-icons.qdoc index f8cb1f52..190aafd9 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-icons.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-icons.qdoc @@ -44,6 +44,7 @@ \li \c icon.width \li \c icon.height \li \c icon.color + \li \c icon.cache \endlist Theme icons are referenced by a name, and regular icons by a source URL. Both diff --git a/src/imports/controls/fusion/ComboBox.qml b/src/imports/controls/fusion/ComboBox.qml index d8ef1888..5e26f90e 100644 --- a/src/imports/controls/fusion/ComboBox.qml +++ b/src/imports/controls/fusion/ComboBox.qml @@ -55,7 +55,7 @@ T.ComboBox { rightPadding: padding + (control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing) delegate: MenuItem { - width: parent.width + width: ListView.view.width text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal highlighted: control.highlightedIndex === index diff --git a/src/imports/controls/fusion/DialogButtonBox.qml b/src/imports/controls/fusion/DialogButtonBox.qml index a0b0f243..4673e421 100644 --- a/src/imports/controls/fusion/DialogButtonBox.qml +++ b/src/imports/controls/fusion/DialogButtonBox.qml @@ -56,6 +56,7 @@ T.DialogButtonBox { delegate: Button { } contentItem: ListView { + implicitWidth: contentWidth model: control.contentModel spacing: control.spacing orientation: ListView.Horizontal diff --git a/src/imports/controls/fusion/plugins.qmltypes b/src/imports/controls/fusion/plugins.qmltypes index 5140d1e8..681b8b90 100644 --- a/src/imports/controls/fusion/plugins.qmltypes +++ b/src/imports/controls/fusion/plugins.qmltypes @@ -4,7 +4,7 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Controls.Fusion 2.14' +// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Controls.Fusion 2.15' Module { dependencies: ["QtQuick.Controls 2.0"] diff --git a/src/imports/controls/imagine/ComboBox.qml b/src/imports/controls/imagine/ComboBox.qml index 92937826..d657e734 100644 --- a/src/imports/controls/imagine/ComboBox.qml +++ b/src/imports/controls/imagine/ComboBox.qml @@ -59,7 +59,7 @@ T.ComboBox { bottomInset: background ? -background.bottomInset || 0 : 0 delegate: ItemDelegate { - width: parent.width + width: ListView.view.width text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal highlighted: control.highlightedIndex === index diff --git a/src/imports/controls/imagine/DialogButtonBox.qml b/src/imports/controls/imagine/DialogButtonBox.qml index c24b29fc..fd27a876 100644 --- a/src/imports/controls/imagine/DialogButtonBox.qml +++ b/src/imports/controls/imagine/DialogButtonBox.qml @@ -66,6 +66,7 @@ T.DialogButtonBox { } contentItem: ListView { + implicitWidth: contentWidth model: control.contentModel spacing: control.spacing orientation: ListView.Horizontal diff --git a/src/imports/controls/imagine/GroupBox.qml b/src/imports/controls/imagine/GroupBox.qml index 7abdb6f0..46f9c98a 100644 --- a/src/imports/controls/imagine/GroupBox.qml +++ b/src/imports/controls/imagine/GroupBox.qml @@ -53,7 +53,6 @@ T.GroupBox { leftPadding: background ? background.leftPadding : 0 rightPadding: background ? background.rightPadding : 0 bottomPadding: background ? background.bottomPadding : 0 - padding: 12 label: Label { width: control.width @@ -88,7 +87,7 @@ T.GroupBox { x: -leftInset y: control.topPadding - control.bottomPadding - topInset width: control.width + leftInset + rightInset - height: control.height + topInset + bottomInset - control.topPadding + control.padding + height: control.height + topInset + bottomInset - control.topPadding + control.bottomPadding source: Imagine.url + "groupbox-background" NinePatchImageSelector on source { diff --git a/src/imports/controls/imagine/plugins.qmltypes b/src/imports/controls/imagine/plugins.qmltypes index 191807ae..785b6dba 100644 --- a/src/imports/controls/imagine/plugins.qmltypes +++ b/src/imports/controls/imagine/plugins.qmltypes @@ -4,7 +4,7 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Controls.Imagine 2.14' +// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Controls.Imagine 2.15' Module { dependencies: ["QtQuick.Controls 2.0"] @@ -54,6 +54,7 @@ Module { Property { name: "verticalAlignment"; type: "VAlignment" } Property { name: "mipmap"; revision: 3; type: "bool" } Property { name: "autoTransform"; revision: 5; type: "bool" } + Property { name: "sourceClipRect"; revision: 15; type: "QRectF" } Signal { name: "paintedGeometryChanged" } Signal { name: "horizontalAlignmentChanged" @@ -75,6 +76,14 @@ Module { defaultProperty: "data" prototype: "QQuickImplicitSizeItem" Enum { + name: "LoadPixmapOptions" + values: { + "NoOption": 0, + "HandleDPR": 1, + "UseProviderOptions": 2 + } + } + Enum { name: "Status" values: { "Null": 0, @@ -92,6 +101,7 @@ Module { Property { name: "mirror"; type: "bool" } Property { name: "currentFrame"; revision: 14; type: "int" } Property { name: "frameCount"; revision: 14; type: "int"; isReadonly: true } + Property { name: "colorSpace"; revision: 15; type: "QColorSpace" } Signal { name: "sourceChanged" Parameter { type: "QUrl" } @@ -106,6 +116,8 @@ Module { } Signal { name: "currentFrameChanged"; revision: 14 } Signal { name: "frameCountChanged"; revision: 14 } + Signal { name: "sourceClipRectChanged"; revision: 15 } + Signal { name: "colorSpaceChanged"; revision: 15 } } Component { name: "QQuickImageSelector" diff --git a/src/imports/controls/imagine/qquickninepatchimage.cpp b/src/imports/controls/imagine/qquickninepatchimage.cpp index 7d5e4f71..ed388ec1 100644 --- a/src/imports/controls/imagine/qquickninepatchimage.cpp +++ b/src/imports/controls/imagine/qquickninepatchimage.cpp @@ -386,7 +386,12 @@ void QQuickNinePatchImage::pixmapChange() { Q_D(QQuickNinePatchImage); if (QFileInfo(d->url.fileName()).completeSuffix().toLower() == QLatin1String("9.png")) { - d->resetNode = d->ninePatch.isNull(); + // Keep resetNode if it is already set, we do not want to miss an + // ImageNode->NinePatchNode change. Without this there's a chance one gets + // an incorrect cast on oldNode every once in a while with source changes. + if (!d->resetNode) + d->resetNode = d->ninePatch.isNull(); + d->ninePatch = d->pix.image(); if (d->ninePatch.depth() != 32) d->ninePatch = d->ninePatch.convertToFormat(QImage::Format_ARGB32); @@ -434,6 +439,8 @@ QSGNode *QQuickNinePatchImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNode QSizeF sz = size(); QImage image = d->pix.image(); if (!sz.isValid() || image.isNull()) { + if (d->provider) + d->provider->updateTexture(nullptr); delete oldNode; return nullptr; } @@ -449,6 +456,13 @@ QSGNode *QQuickNinePatchImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNode qsgnode_set_description(patchNode, QString::fromLatin1("QQuickNinePatchImage: '%1'").arg(d->url.toString())); #endif + // The image may wrap non-owned data (due to pixmapChange). Ensure we never + // pass such an image to the scenegraph, because with a separate render + // thread the data may become invalid (in a subsequent pixmapChange on the + // gui thread) by the time the renderer gets to do something with the QImage + // passed in here. + image.detach(); + QSGTexture *texture = window()->createTextureFromImage(image); patchNode->initialize(texture, sz * d->devicePixelRatio, image.size(), d->xDivs, d->yDivs, d->devicePixelRatio); return patchNode; diff --git a/src/imports/controls/material/ComboBox.qml b/src/imports/controls/material/ComboBox.qml index e4ee332b..6aada8c5 100644 --- a/src/imports/controls/material/ComboBox.qml +++ b/src/imports/controls/material/ComboBox.qml @@ -63,9 +63,9 @@ T.ComboBox { Material.foreground: flat ? undefined : Material.primaryTextColor delegate: MenuItem { - width: parent.width + width: ListView.view.width text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData - Material.foreground: control.currentIndex === index ? parent.Material.accent : parent.Material.foreground + Material.foreground: control.currentIndex === index ? ListView.view.contentItem.Material.accent : ListView.view.contentItem.Material.foreground highlighted: control.highlightedIndex === index hoverEnabled: control.hoverEnabled } @@ -147,14 +147,14 @@ T.ComboBox { 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 } + 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"; 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 } + 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 { diff --git a/src/imports/controls/material/DialogButtonBox.qml b/src/imports/controls/material/DialogButtonBox.qml index c53b8210..d148fb24 100644 --- a/src/imports/controls/material/DialogButtonBox.qml +++ b/src/imports/controls/material/DialogButtonBox.qml @@ -60,6 +60,7 @@ T.DialogButtonBox { delegate: Button { flat: true } contentItem: ListView { + implicitWidth: contentWidth model: control.contentModel spacing: control.spacing orientation: ListView.Horizontal diff --git a/src/imports/controls/material/material.pro b/src/imports/controls/material/material.pro index cf08b925..ea74d277 100644 --- a/src/imports/controls/material/material.pro +++ b/src/imports/controls/material/material.pro @@ -1,4 +1,4 @@ -TARGET = qtquickcontrols2materialstyleplugin +TARGET = qqc2materialstyleplugin TARGETPATH = QtQuick/Controls.2/Material IMPORT_NAME = QtQuick.Controls.Material diff --git a/src/imports/controls/material/plugins.qmltypes b/src/imports/controls/material/plugins.qmltypes index 7546a7b0..e290e0ea 100644 --- a/src/imports/controls/material/plugins.qmltypes +++ b/src/imports/controls/material/plugins.qmltypes @@ -4,7 +4,7 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Controls.Material 2.14' +// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Controls.Material 2.15' Module { dependencies: ["QtQuick.Controls 2.0"] @@ -328,6 +328,7 @@ Module { Property { name: "toolBarColor"; type: "QColor"; isReadonly: true } Property { name: "toolTextColor"; type: "QColor"; isReadonly: true } Property { name: "spinBoxDisabledIconColor"; type: "QColor"; isReadonly: true } + Property { name: "sliderDisabledColor"; revision: 15; type: "QColor"; isReadonly: true } Property { name: "touchTarget"; type: "int"; isReadonly: true } Property { name: "buttonHeight"; type: "int"; isReadonly: true } Property { name: "delegateHeight"; type: "int"; isReadonly: true } diff --git a/src/imports/controls/material/qmldir b/src/imports/controls/material/qmldir index 870a0382..d48b7b12 100644 --- a/src/imports/controls/material/qmldir +++ b/src/imports/controls/material/qmldir @@ -1,4 +1,4 @@ module QtQuick.Controls.Material -plugin qtquickcontrols2materialstyleplugin +plugin qqc2materialstyleplugin classname QtQuickControls2MaterialStylePlugin depends QtQuick.Controls 2.5 diff --git a/src/imports/controls/material/qquickmaterialstyle.cpp b/src/imports/controls/material/qquickmaterialstyle.cpp index 35afeb00..d343f2f5 100644 --- a/src/imports/controls/material/qquickmaterialstyle.cpp +++ b/src/imports/controls/material/qquickmaterialstyle.cpp @@ -469,14 +469,13 @@ void QQuickMaterialStyle::setTheme(Theme theme) m_theme = theme; propagateTheme(); - emit themeChanged(); - emit paletteChanged(); + themeChange(); if (!m_customAccent) - emit accentChanged(); + accentChange(); if (!m_hasBackground) - emit backgroundChanged(); + backgroundChange(); if (!m_hasForeground) - emit foregroundChanged(); + foregroundChange(); } void QQuickMaterialStyle::inheritTheme(Theme theme) @@ -486,14 +485,13 @@ void QQuickMaterialStyle::inheritTheme(Theme theme) m_theme = theme; propagateTheme(); - emit themeChanged(); - emit paletteChanged(); + themeChange(); if (!m_customAccent) - emit accentChanged(); + accentChange(); if (!m_hasBackground) - emit backgroundChanged(); + backgroundChange(); if (!m_hasForeground) - emit foregroundChanged(); + foregroundChange(); } void QQuickMaterialStyle::propagateTheme() @@ -516,6 +514,19 @@ void QQuickMaterialStyle::resetTheme() 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(); @@ -535,8 +546,7 @@ void QQuickMaterialStyle::setPrimary(const QVariant &var) m_customPrimary = custom; m_primary = primary; propagatePrimary(); - emit primaryChanged(); - emit paletteChanged(); + primaryChange(); } void QQuickMaterialStyle::inheritPrimary(uint primary, bool custom) @@ -547,8 +557,7 @@ void QQuickMaterialStyle::inheritPrimary(uint primary, bool custom) m_customPrimary = custom; m_primary = primary; propagatePrimary(); - emit primaryChanged(); - emit paletteChanged(); + primaryChange(); } void QQuickMaterialStyle::propagatePrimary() @@ -575,6 +584,13 @@ void QQuickMaterialStyle::resetPrimary() inheritPrimary(globalPrimary, false); } +void QQuickMaterialStyle::primaryChange() +{ + emit primaryChanged(); + emit toolBarColorChanged(); + emit toolTextColorChanged(); +} + QVariant QQuickMaterialStyle::accent() const { return accentColor(); @@ -594,8 +610,7 @@ void QQuickMaterialStyle::setAccent(const QVariant &var) m_customAccent = custom; m_accent = accent; propagateAccent(); - emit accentChanged(); - emit paletteChanged(); + accentChange(); } void QQuickMaterialStyle::inheritAccent(uint accent, bool custom) @@ -606,8 +621,7 @@ void QQuickMaterialStyle::inheritAccent(uint accent, bool custom) m_customAccent = custom; m_accent = accent; propagateAccent(); - emit accentChanged(); - emit paletteChanged(); + accentChange(); } void QQuickMaterialStyle::propagateAccent() @@ -634,6 +648,13 @@ void QQuickMaterialStyle::resetAccent() inheritAccent(globalAccent, false); } +void QQuickMaterialStyle::accentChange() +{ + emit accentChanged(); + emit themeOrAccentChanged(); + emit buttonColorChanged(); +} + QVariant QQuickMaterialStyle::foreground() const { if (!m_hasForeground) @@ -660,7 +681,7 @@ void QQuickMaterialStyle::setForeground(const QVariant &var) m_customForeground = custom; m_foreground = foreground; propagateForeground(); - emit foregroundChanged(); + foregroundChange(); } void QQuickMaterialStyle::inheritForeground(uint foreground, bool custom, bool has) @@ -672,7 +693,7 @@ void QQuickMaterialStyle::inheritForeground(uint foreground, bool custom, bool h m_customForeground = custom; m_foreground = foreground; propagateForeground(); - emit foregroundChanged(); + foregroundChange(); } void QQuickMaterialStyle::propagateForeground() @@ -697,6 +718,14 @@ void QQuickMaterialStyle::resetForeground() 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(); @@ -717,8 +746,7 @@ void QQuickMaterialStyle::setBackground(const QVariant &var) m_customBackground = custom; m_background = background; propagateBackground(); - emit backgroundChanged(); - emit paletteChanged(); + backgroundChange(); } void QQuickMaterialStyle::inheritBackground(uint background, bool custom, bool has) @@ -730,8 +758,7 @@ void QQuickMaterialStyle::inheritBackground(uint background, bool custom, bool h m_customBackground = custom; m_background = background; propagateBackground(); - emit backgroundChanged(); - emit paletteChanged(); + backgroundChange(); } void QQuickMaterialStyle::propagateBackground() @@ -756,6 +783,15 @@ void QQuickMaterialStyle::resetBackground() 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; @@ -767,7 +803,7 @@ void QQuickMaterialStyle::setElevation(int elevation) return; m_elevation = elevation; - emit elevationChanged(); + elevationChange(); } void QQuickMaterialStyle::resetElevation() @@ -775,6 +811,12 @@ void QQuickMaterialStyle::resetElevation() setElevation(0); } +void QQuickMaterialStyle::elevationChange() +{ + emit elevationChanged(); + emit buttonDisabledColorChanged(); +} + QColor QQuickMaterialStyle::primaryColor() const { if (m_customPrimary) diff --git a/src/imports/controls/material/qquickmaterialstyle_p.h b/src/imports/controls/material/qquickmaterialstyle_p.h index d2a89761..1207e9cc 100644 --- a/src/imports/controls/material/qquickmaterialstyle_p.h +++ b/src/imports/controls/material/qquickmaterialstyle_p.h @@ -66,38 +66,38 @@ class QQuickMaterialStyle : public QQuickAttachedObject 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 paletteChanged FINAL) - Q_PROPERTY(QColor primaryHighlightedTextColor READ primaryHighlightedTextColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor secondaryTextColor READ secondaryTextColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor hintTextColor READ hintTextColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor textSelectionColor READ textSelectionColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor dropShadowColor READ dropShadowColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor dividerColor READ dividerColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor iconColor READ iconColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor iconDisabledColor READ iconDisabledColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor buttonColor READ buttonColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor buttonDisabledColor READ buttonDisabledColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor highlightedButtonColor READ highlightedButtonColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor frameColor READ frameColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor rippleColor READ rippleColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor highlightedRippleColor READ highlightedRippleColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor switchUncheckedTrackColor READ switchUncheckedTrackColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor switchCheckedTrackColor READ switchCheckedTrackColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor switchUncheckedHandleColor READ switchUncheckedHandleColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor switchCheckedHandleColor READ switchCheckedHandleColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor switchDisabledTrackColor READ switchDisabledTrackColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor switchDisabledHandleColor READ switchDisabledHandleColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor scrollBarColor READ scrollBarColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor scrollBarHoveredColor READ scrollBarHoveredColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor scrollBarPressedColor READ scrollBarPressedColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor dialogColor READ dialogColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor backgroundDimColor READ backgroundDimColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor listHighlightColor READ listHighlightColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor tooltipColor READ tooltipColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor toolBarColor READ toolBarColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor toolTextColor READ toolTextColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor spinBoxDisabledIconColor READ spinBoxDisabledIconColor NOTIFY paletteChanged FINAL) - Q_PROPERTY(QColor sliderDisabledColor READ sliderDisabledColor NOTIFY paletteChanged 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) @@ -174,34 +174,40 @@ public: 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; @@ -265,7 +271,15 @@ Q_SIGNALS: void backgroundChanged(); void elevationChanged(); - void paletteChanged(); + void themeOrAccentChanged(); + + void primaryHighlightedTextColorChanged(); + void buttonColorChanged(); + void buttonDisabledColorChanged(); + void dialogColorChanged(); + void tooltipColorChanged(); + void toolBarColorChanged(); + void toolTextColorChanged(); protected: void attachedParentChange(QQuickAttachedObject *newParent, QQuickAttachedObject *oldParent) override; diff --git a/src/imports/controls/plugins.qmltypes b/src/imports/controls/plugins.qmltypes index c3e53431..e8212c55 100644 --- a/src/imports/controls/plugins.qmltypes +++ b/src/imports/controls/plugins.qmltypes @@ -4,7 +4,7 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Controls 2.14' +// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Controls 2.15' Module { dependencies: [ @@ -589,6 +589,14 @@ Module { defaultProperty: "contentData" } Component { + prototype: "QQuickHorizontalHeaderView" + name: "QtQuick.Controls/HorizontalHeaderView 2.15" + exports: ["QtQuick.Controls/HorizontalHeaderView 2.15"] + exportMetaObjectRevisions: [15] + isComposite: true + defaultProperty: "flickableData" + } + Component { prototype: "QQuickItemDelegate" name: "QtQuick.Controls/ItemDelegate 2.0" exports: ["QtQuick.Controls/ItemDelegate 2.0"] @@ -876,4 +884,12 @@ Module { isComposite: true defaultProperty: "data" } + Component { + prototype: "QQuickVerticalHeaderView" + name: "QtQuick.Controls/VerticalHeaderView 2.15" + exports: ["QtQuick.Controls/VerticalHeaderView 2.15"] + exportMetaObjectRevisions: [15] + isComposite: true + defaultProperty: "flickableData" + } } diff --git a/src/imports/controls/universal/ComboBox.qml b/src/imports/controls/universal/ComboBox.qml index fd2d8935..9b88ccf9 100644 --- a/src/imports/controls/universal/ComboBox.qml +++ b/src/imports/controls/universal/ComboBox.qml @@ -56,7 +56,7 @@ T.ComboBox { Universal.theme: editable && activeFocus ? Universal.Light : undefined delegate: ItemDelegate { - width: parent.width + width: ListView.view.width text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal highlighted: control.highlightedIndex === index diff --git a/src/imports/controls/universal/DialogButtonBox.qml b/src/imports/controls/universal/DialogButtonBox.qml index 0458c39d..103b46c2 100644 --- a/src/imports/controls/universal/DialogButtonBox.qml +++ b/src/imports/controls/universal/DialogButtonBox.qml @@ -59,6 +59,7 @@ T.DialogButtonBox { } contentItem: ListView { + implicitWidth: contentWidth model: control.contentModel spacing: control.spacing orientation: ListView.Horizontal diff --git a/src/imports/controls/universal/plugins.qmltypes b/src/imports/controls/universal/plugins.qmltypes index 1734c01b..c38e39e1 100644 --- a/src/imports/controls/universal/plugins.qmltypes +++ b/src/imports/controls/universal/plugins.qmltypes @@ -4,7 +4,7 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Controls.Universal 2.14' +// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Controls.Universal 2.15' Module { dependencies: ["QtQuick.Controls 2.0"] |