aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf5
-rw-r--r--src/imports/controls/CheckBox.qml2
-rw-r--r--src/imports/controls/ComboBox.qml10
-rw-r--r--src/imports/controls/Dial.qml10
-rw-r--r--src/imports/controls/RadioButton.qml2
-rw-r--r--src/imports/controls/ScrollBar.qml1
-rw-r--r--src/imports/controls/SpinBox.qml8
-rw-r--r--src/imports/controls/Switch.qml2
-rw-r--r--src/imports/controls/SwitchDelegate.qml2
-rw-r--r--src/imports/controls/TabButton.qml2
-rw-r--r--src/imports/controls/Tumbler.qml8
-rw-r--r--src/imports/controls/designer/designer.pri2
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-combobox-valuerole.qml58
-rw-r--r--src/imports/controls/fusion/ButtonPanel.qml4
-rw-r--r--src/imports/controls/fusion/CheckBox.qml2
-rw-r--r--src/imports/controls/fusion/CheckIndicator.qml6
-rw-r--r--src/imports/controls/fusion/ComboBox.qml16
-rw-r--r--src/imports/controls/fusion/Dial.qml10
-rw-r--r--src/imports/controls/fusion/Page.qml2
-rw-r--r--src/imports/controls/fusion/Pane.qml2
-rw-r--r--src/imports/controls/fusion/RadioButton.qml2
-rw-r--r--src/imports/controls/fusion/RadioIndicator.qml4
-rw-r--r--src/imports/controls/fusion/ScrollBar.qml1
-rw-r--r--src/imports/controls/fusion/SliderGroove.qml18
-rw-r--r--src/imports/controls/fusion/SpinBox.qml4
-rw-r--r--src/imports/controls/fusion/Switch.qml2
-rw-r--r--src/imports/controls/fusion/SwitchDelegate.qml2
-rw-r--r--src/imports/controls/fusion/SwitchIndicator.qml30
-rw-r--r--src/imports/controls/fusion/Tumbler.qml8
-rw-r--r--src/imports/controls/fusion/qquickfusionstyle.cpp4
-rw-r--r--src/imports/controls/imagine/ComboBox.qml12
-rw-r--r--src/imports/controls/imagine/RadioButton.qml2
-rw-r--r--src/imports/controls/imagine/ScrollBar.qml7
-rw-r--r--src/imports/controls/imagine/ScrollIndicator.qml4
-rw-r--r--src/imports/controls/imagine/Switch.qml2
-rw-r--r--src/imports/controls/imagine/SwitchDelegate.qml2
-rw-r--r--src/imports/controls/imagine/Tumbler.qml8
-rw-r--r--src/imports/controls/material/CheckBox.qml2
-rw-r--r--src/imports/controls/material/CheckDelegate.qml2
-rw-r--r--src/imports/controls/material/CheckIndicator.qml8
-rw-r--r--src/imports/controls/material/ComboBox.qml14
-rw-r--r--src/imports/controls/material/Dial.qml10
-rw-r--r--src/imports/controls/material/ElevationEffect.qml22
-rw-r--r--src/imports/controls/material/MenuItem.qml2
-rw-r--r--src/imports/controls/material/RadioButton.qml2
-rw-r--r--src/imports/controls/material/RadioDelegate.qml2
-rw-r--r--src/imports/controls/material/RadioIndicator.qml3
-rw-r--r--src/imports/controls/material/RectangularGlow.qml2
-rw-r--r--src/imports/controls/material/ScrollBar.qml7
-rw-r--r--src/imports/controls/material/SliderHandle.qml2
-rw-r--r--src/imports/controls/material/SwitchDelegate.qml2
-rw-r--r--src/imports/controls/material/SwitchIndicator.qml12
-rw-r--r--src/imports/controls/material/Tumbler.qml8
-rw-r--r--src/imports/controls/material/qquickmaterialbusyindicator.cpp2
-rw-r--r--src/imports/controls/material/qquickmaterialbusyindicator_p.h2
-rw-r--r--src/imports/controls/material/qtquickcontrols2materialstyleplugin.qrc1
-rw-r--r--src/imports/controls/material/shaders/+qsb/RectangularGlow.fragbin0 -> 2321 bytes
-rw-r--r--src/imports/controls/material/shaders/RectangularGlow_rhi.frag28
-rw-r--r--src/imports/controls/universal/CheckBox.qml2
-rw-r--r--src/imports/controls/universal/CheckDelegate.qml2
-rw-r--r--src/imports/controls/universal/CheckIndicator.qml23
-rw-r--r--src/imports/controls/universal/ComboBox.qml12
-rw-r--r--src/imports/controls/universal/Dial.qml10
-rw-r--r--src/imports/controls/universal/RadioButton.qml2
-rw-r--r--src/imports/controls/universal/RadioDelegate.qml2
-rw-r--r--src/imports/controls/universal/RadioIndicator.qml15
-rw-r--r--src/imports/controls/universal/ScrollBar.qml7
-rw-r--r--src/imports/controls/universal/Switch.qml2
-rw-r--r--src/imports/controls/universal/SwitchDelegate.qml2
-rw-r--r--src/imports/controls/universal/SwitchIndicator.qml25
-rw-r--r--src/imports/controls/universal/Tumbler.qml8
-rw-r--r--src/imports/platform/qtlabsplatformplugin.cpp4
-rw-r--r--src/imports/templates/qtquicktemplates2plugin.cpp43
-rw-r--r--src/quickcontrols2/qquickattachedobject.cpp6
-rw-r--r--src/quickcontrols2/qquickiconlabel.cpp2
-rw-r--r--src/quickcontrols2/qquickiconlabel_p.h2
-rw-r--r--src/quickcontrols2/qquickmnemoniclabel.cpp2
-rw-r--r--src/quickcontrols2/qquickstyle.cpp2
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp226
-rw-r--r--src/quicktemplates2/qquickcombobox_p.h14
-rw-r--r--src/quicktemplates2/qquickcontainer_p_p.h2
-rw-r--r--src/quicktemplates2/qquickmenu.cpp2
-rw-r--r--src/quicktemplates2/qquickpresshandler.cpp35
-rw-r--r--src/quicktemplates2/qquickpresshandler_p_p.h2
-rw-r--r--src/quicktemplates2/qquickstackview_p_p.h1
-rw-r--r--src/quicktemplates2/qquicktextarea_p.h2
-rw-r--r--src/quicktemplates2/qquicktextfield_p.h2
-rw-r--r--src/quicktemplates2/quicktemplates2.pro1
-rw-r--r--tests/auto/accessibility/tst_accessibility.cpp14
-rw-r--r--tests/auto/calendar/data/tst_monthgrid.qml9
-rw-r--r--tests/auto/calendar/data/tst_weeknumbercolumn.qml8
-rw-r--r--tests/auto/controls/data/tst_combobox.qml66
-rw-r--r--tests/auto/controls/data/tst_scrollbar.qml5
-rw-r--r--tests/auto/controls/default/BLACKLIST3
-rw-r--r--tests/auto/sanity/tst_sanity.cpp4
95 files changed, 664 insertions, 304 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 55e31e9b..0e68ba10 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -1,7 +1,8 @@
load(qt_build_config)
CONFIG += warning_clean
-DEFINES += QT_NO_FOREACH
+
+DEFINES += QT_NO_FOREACH QT_NO_JAVA_STYLE_ITERATORS QT_NO_LINKED_LIST
QQC2_SOURCE_TREE = $$PWD
-MODULE_VERSION = 5.13.1
+MODULE_VERSION = 5.14.0
diff --git a/src/imports/controls/CheckBox.qml b/src/imports/controls/CheckBox.qml
index c58399f7..b1f50ed1 100644
--- a/src/imports/controls/CheckBox.qml
+++ b/src/imports/controls/CheckBox.qml
@@ -56,7 +56,7 @@ T.CheckBox {
implicitWidth: 28
implicitHeight: 28
- x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ 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
color: control.down ? control.palette.light : control.palette.base
diff --git a/src/imports/controls/ComboBox.qml b/src/imports/controls/ComboBox.qml
index 3bca9c02..8eefc686 100644
--- a/src/imports/controls/ComboBox.qml
+++ b/src/imports/controls/ComboBox.qml
@@ -34,11 +34,11 @@
**
****************************************************************************/
-import QtQuick 2.12
-import QtQuick.Window 2.12
-import QtQuick.Controls 2.12
-import QtQuick.Controls.impl 2.12
-import QtQuick.Templates 2.12 as T
+import QtQuick 2.14
+import QtQuick.Window 2.14
+import QtQuick.Controls 2.14
+import QtQuick.Controls.impl 2.14
+import QtQuick.Templates 2.14 as T
T.ComboBox {
id: control
diff --git a/src/imports/controls/Dial.qml b/src/imports/controls/Dial.qml
index b6324db5..cc4618a5 100644
--- a/src/imports/controls/Dial.qml
+++ b/src/imports/controls/Dial.qml
@@ -56,8 +56,8 @@ T.Dial {
}
handle: ColorImage {
- x: background.x + background.width / 2 - handle.width / 2
- y: background.y + background.height / 2 - handle.height / 2
+ x: control.background.x + control.background.width / 2 - control.handle.width / 2
+ y: control.background.y + control.background.height / 2 - control.handle.height / 2
width: 14
height: 10
defaultColor: "#353637"
@@ -67,12 +67,12 @@ T.Dial {
opacity: control.enabled ? 1 : 0.3
transform: [
Translate {
- y: -Math.min(background.width, background.height) * 0.4 + handle.height / 2
+ y: -Math.min(control.background.width, control.background.height) * 0.4 + control.handle.height / 2
},
Rotation {
angle: control.angle
- origin.x: handle.width / 2
- origin.y: handle.height / 2
+ origin.x: control.handle.width / 2
+ origin.y: control.handle.height / 2
}
]
}
diff --git a/src/imports/controls/RadioButton.qml b/src/imports/controls/RadioButton.qml
index 726e8862..cdf0c30e 100644
--- a/src/imports/controls/RadioButton.qml
+++ b/src/imports/controls/RadioButton.qml
@@ -56,7 +56,7 @@ T.RadioButton {
implicitWidth: 28
implicitHeight: 28
- x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ 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
radius: width / 2
diff --git a/src/imports/controls/ScrollBar.qml b/src/imports/controls/ScrollBar.qml
index 1cff0afc..0948fb1d 100644
--- a/src/imports/controls/ScrollBar.qml
+++ b/src/imports/controls/ScrollBar.qml
@@ -49,6 +49,7 @@ T.ScrollBar {
padding: 2
visible: control.policy !== T.ScrollBar.AlwaysOff
+ minimumSize: orientation == Qt.Horizontal ? height / width : width / height
contentItem: Rectangle {
implicitWidth: control.interactive ? 6 : 2
diff --git a/src/imports/controls/SpinBox.qml b/src/imports/controls/SpinBox.qml
index 824ce061..d1c2ea5b 100644
--- a/src/imports/controls/SpinBox.qml
+++ b/src/imports/controls/SpinBox.qml
@@ -77,9 +77,9 @@ T.SpinBox {
inputMethodHints: control.inputMethodHints
Rectangle {
- x: -6 - (down.indicator ? 1 : 0)
+ x: -6 - (control.down.indicator ? 1 : 0)
y: -6
- width: control.width - (up.indicator ? up.indicator.width - 1 : 0) - (down.indicator ? down.indicator.width - 1 : 0)
+ width: control.width - (control.up.indicator ? control.up.indicator.width - 1 : 0) - (control.down.indicator ? control.down.indicator.width - 1 : 0)
height: control.height
visible: control.activeFocus
color: "transparent"
@@ -93,7 +93,7 @@ T.SpinBox {
height: parent.height
implicitWidth: 40
implicitHeight: 40
- color: up.pressed ? control.palette.mid : control.palette.button
+ color: control.up.pressed ? control.palette.mid : control.palette.button
Rectangle {
x: (parent.width - width) / 2
@@ -116,7 +116,7 @@ T.SpinBox {
height: parent.height
implicitWidth: 40
implicitHeight: 40
- color: down.pressed ? control.palette.mid : control.palette.button
+ color: control.down.pressed ? control.palette.mid : control.palette.button
Rectangle {
x: (parent.width - width) / 2
diff --git a/src/imports/controls/Switch.qml b/src/imports/controls/Switch.qml
index 522d9980..f62e2502 100644
--- a/src/imports/controls/Switch.qml
+++ b/src/imports/controls/Switch.qml
@@ -55,7 +55,7 @@ T.Switch {
implicitWidth: 56
implicitHeight: 28
- x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ 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
radius: 8
diff --git a/src/imports/controls/SwitchDelegate.qml b/src/imports/controls/SwitchDelegate.qml
index 0abf7641..d6447e77 100644
--- a/src/imports/controls/SwitchDelegate.qml
+++ b/src/imports/controls/SwitchDelegate.qml
@@ -59,7 +59,7 @@ T.SwitchDelegate {
implicitWidth: 56
implicitHeight: 28
- x: text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ 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
radius: 8
diff --git a/src/imports/controls/TabButton.qml b/src/imports/controls/TabButton.qml
index 34a5a115..f8b303ea 100644
--- a/src/imports/controls/TabButton.qml
+++ b/src/imports/controls/TabButton.qml
@@ -62,7 +62,7 @@ T.TabButton {
icon: control.icon
text: control.text
font: control.font
- color: checked ? control.palette.windowText : control.palette.brightText
+ color: control.checked ? control.palette.windowText : control.palette.brightText
}
background: Rectangle {
diff --git a/src/imports/controls/Tumbler.qml b/src/imports/controls/Tumbler.qml
index 621f4113..cd10263b 100644
--- a/src/imports/controls/Tumbler.qml
+++ b/src/imports/controls/Tumbler.qml
@@ -62,11 +62,11 @@ T.Tumbler {
model: control.model
delegate: control.delegate
path: Path {
- startX: contentItem.width / 2
- startY: -contentItem.delegateHeight / 2
+ startX: control.contentItem.width / 2
+ startY: -control.contentItem.delegateHeight / 2
PathLine {
- x: contentItem.width / 2
- y: (control.visibleItemCount + 1) * contentItem.delegateHeight - contentItem.delegateHeight / 2
+ x: control.contentItem.width / 2
+ y: (control.visibleItemCount + 1) * control.contentItem.delegateHeight - control.contentItem.delegateHeight / 2
}
}
diff --git a/src/imports/controls/designer/designer.pri b/src/imports/controls/designer/designer.pri
index 6ae9d5bb..3ad99df7 100644
--- a/src/imports/controls/designer/designer.pri
+++ b/src/imports/controls/designer/designer.pri
@@ -48,4 +48,4 @@ AUX_QML_FILES += \
$$PWD/TumblerSpecifics.qml
AUX_QML_FILES += \
- $$PWD/images/*.png
+ $$files($$PWD/images/*.png)
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-valuerole.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-valuerole.qml
new file mode 100644
index 00000000..4d7ae3d3
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-valuerole.qml
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.14
+import QtQuick.Controls 2.14
+
+//! [file]
+ApplicationWindow {
+ width: 640
+ height: 480
+ visible: true
+
+ // Used as an example of a backend - this would usually be
+ // e.g. a C++ type exposed to QML.
+ QtObject {
+ id: backend
+ property int modifier
+ }
+
+ ComboBox {
+ textRole: "text"
+ valueRole: "value"
+ // When an item is selected, update the backend.
+ onActivated: backend.modifier = currentValue
+ // Set the initial currentIndex to the value stored in the backend.
+ Component.onCompleted: currentIndex = indexOfValue(backend.modifier)
+ model: [
+ { value: Qt.NoModifier, text: qsTr("No modifier") },
+ { value: Qt.ShiftModifier, text: qsTr("Shift") },
+ { value: Qt.ControlModifier, text: qsTr("Control") }
+ ]
+ }
+}
+//! [file]
diff --git a/src/imports/controls/fusion/ButtonPanel.qml b/src/imports/controls/fusion/ButtonPanel.qml
index 3250044b..125aa2f3 100644
--- a/src/imports/controls/fusion/ButtonPanel.qml
+++ b/src/imports/controls/fusion/ButtonPanel.qml
@@ -55,11 +55,11 @@ Rectangle {
id: buttonGradient
GradientStop {
position: 0
- color: Fusion.gradientStart(Fusion.buttonColor(control.palette, panel.highlighted, control.down, control.hovered))
+ color: Fusion.gradientStart(Fusion.buttonColor(panel.control.palette, panel.highlighted, panel.control.down, panel.control.hovered))
}
GradientStop {
position: 1
- color: Fusion.gradientStop(Fusion.buttonColor(control.palette, panel.highlighted, control.down, control.hovered))
+ color: Fusion.gradientStop(Fusion.buttonColor(panel.control.palette, panel.highlighted, panel.control.down, panel.control.hovered))
}
}
diff --git a/src/imports/controls/fusion/CheckBox.qml b/src/imports/controls/fusion/CheckBox.qml
index f90c80fb..edb4c77f 100644
--- a/src/imports/controls/fusion/CheckBox.qml
+++ b/src/imports/controls/fusion/CheckBox.qml
@@ -54,7 +54,7 @@ T.CheckBox {
spacing: 6
indicator: CheckIndicator {
- x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ 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
}
diff --git a/src/imports/controls/fusion/CheckIndicator.qml b/src/imports/controls/fusion/CheckIndicator.qml
index 314a6798..7dcfee30 100644
--- a/src/imports/controls/fusion/CheckIndicator.qml
+++ b/src/imports/controls/fusion/CheckIndicator.qml
@@ -59,7 +59,7 @@ Rectangle {
width: parent.width - 2
height: 1
color: Fusion.topShadow
- visible: control.enabled && !control.down
+ visible: indicator.control.enabled && !indicator.control.down
}
ColorImage {
@@ -67,7 +67,7 @@ Rectangle {
y: (parent.height - height) / 2
color: Color.transparent(indicator.checkMarkColor, 210 / 255)
source: "qrc:/qt-project.org/imports/QtQuick/Controls.2/Fusion/images/checkmark.png"
- visible: control.checkState === Qt.Checked || (control.checked && control.checkState === undefined)
+ visible: indicator.control.checkState === Qt.Checked || (indicator.control.checked && indicator.control.checkState === undefined)
}
Rectangle {
@@ -75,7 +75,7 @@ Rectangle {
width: parent.width - 6
height: parent.width - 6
- visible: control.checkState === Qt.PartiallyChecked
+ visible: indicator.control.checkState === Qt.PartiallyChecked
gradient: Gradient {
GradientStop {
diff --git a/src/imports/controls/fusion/ComboBox.qml b/src/imports/controls/fusion/ComboBox.qml
index 3ecb0cf2..e9b836ef 100644
--- a/src/imports/controls/fusion/ComboBox.qml
+++ b/src/imports/controls/fusion/ComboBox.qml
@@ -34,13 +34,13 @@
**
****************************************************************************/
-import QtQuick 2.12
-import QtQuick.Window 2.12
-import QtQuick.Templates 2.12 as T
-import QtQuick.Controls 2.12
-import QtQuick.Controls.impl 2.12
-import QtQuick.Controls.Fusion 2.12
-import QtQuick.Controls.Fusion.impl 2.12
+import QtQuick 2.14
+import QtQuick.Window 2.14
+import QtQuick.Templates 2.14 as T
+import QtQuick.Controls 2.14
+import QtQuick.Controls.impl 2.14
+import QtQuick.Controls.Fusion 2.14
+import QtQuick.Controls.Fusion.impl 2.14
T.ComboBox {
id: control
@@ -159,7 +159,7 @@ T.ComboBox {
}
background: Rectangle {
- color: popup.palette.window
+ color: control.popup.palette.window
border.color: Fusion.outline(control.palette)
Rectangle {
diff --git a/src/imports/controls/fusion/Dial.qml b/src/imports/controls/fusion/Dial.qml
index 423087c9..a1337242 100644
--- a/src/imports/controls/fusion/Dial.qml
+++ b/src/imports/controls/fusion/Dial.qml
@@ -57,19 +57,19 @@ T.Dial {
}
handle: KnobImpl {
- x: background.x + background.width / 2 - handle.width / 2
- y: background.y + background.height / 2 - handle.height / 2
+ x: control.background.x + control.background.width / 2 - control.handle.width / 2
+ y: control.background.y + control.background.height / 2 - control.handle.height / 2
width: control.width / 7
height: control.height / 7
palette: control.palette
transform: [
Translate {
- y: -Math.min(background.width, background.height) * 0.42 + handle.height
+ y: -Math.min(control.background.width, control.background.height) * 0.42 + control.handle.height
},
Rotation {
angle: control.angle
- origin.x: handle.width / 2
- origin.y: handle.height / 2
+ origin.x: control.handle.width / 2
+ origin.y: control.handle.height / 2
}
]
}
diff --git a/src/imports/controls/fusion/Page.qml b/src/imports/controls/fusion/Page.qml
index 796dff1c..ce4b1d54 100644
--- a/src/imports/controls/fusion/Page.qml
+++ b/src/imports/controls/fusion/Page.qml
@@ -54,6 +54,6 @@ T.Page {
+ (implicitFooterHeight > 0 ? implicitFooterHeight + spacing : 0))
background: Rectangle {
- color: palette.window
+ color: control.palette.window
}
}
diff --git a/src/imports/controls/fusion/Pane.qml b/src/imports/controls/fusion/Pane.qml
index 69fbdca0..28be3b47 100644
--- a/src/imports/controls/fusion/Pane.qml
+++ b/src/imports/controls/fusion/Pane.qml
@@ -52,6 +52,6 @@ T.Pane {
padding: 9
background: Rectangle {
- color: palette.window
+ color: control.palette.window
}
}
diff --git a/src/imports/controls/fusion/RadioButton.qml b/src/imports/controls/fusion/RadioButton.qml
index fed6fa7c..a940aff3 100644
--- a/src/imports/controls/fusion/RadioButton.qml
+++ b/src/imports/controls/fusion/RadioButton.qml
@@ -54,7 +54,7 @@ T.RadioButton {
spacing: 6
indicator: RadioIndicator {
- x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ 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
}
diff --git a/src/imports/controls/fusion/RadioIndicator.qml b/src/imports/controls/fusion/RadioIndicator.qml
index 4b67d24e..c73cd49f 100644
--- a/src/imports/controls/fusion/RadioIndicator.qml
+++ b/src/imports/controls/fusion/RadioIndicator.qml
@@ -62,7 +62,7 @@ Rectangle {
radius: width / 2
color: "transparent"
border.color: Fusion.topShadow
- visible: control.enabled && !control.down
+ visible: indicator.control.enabled && !indicator.control.down
}
Rectangle {
@@ -73,6 +73,6 @@ Rectangle {
radius: width / 2
color: Color.transparent(indicator.checkMarkColor, 180 / 255)
border.color: Color.transparent(indicator.checkMarkColor, 200 / 255)
- visible: control.checked
+ visible: indicator.control.checked
}
}
diff --git a/src/imports/controls/fusion/ScrollBar.qml b/src/imports/controls/fusion/ScrollBar.qml
index e4fb7949..93b58f0e 100644
--- a/src/imports/controls/fusion/ScrollBar.qml
+++ b/src/imports/controls/fusion/ScrollBar.qml
@@ -51,6 +51,7 @@ T.ScrollBar {
padding: 2
visible: control.policy !== T.ScrollBar.AlwaysOff
+ minimumSize: orientation == Qt.Horizontal ? height / width : width / height
contentItem: Rectangle {
implicitWidth: control.interactive ? 6 : 2
diff --git a/src/imports/controls/fusion/SliderGroove.qml b/src/imports/controls/fusion/SliderGroove.qml
index c34217a8..381a02b5 100644
--- a/src/imports/controls/fusion/SliderGroove.qml
+++ b/src/imports/controls/fusion/SliderGroove.qml
@@ -63,31 +63,31 @@ Rectangle {
gradient: Gradient {
GradientStop {
position: 0
- color: Qt.darker(Fusion.grooveColor(control.palette), 1.1)
+ color: Qt.darker(Fusion.grooveColor(groove.control.palette), 1.1)
}
GradientStop {
position: 1
- color: Qt.lighter(Fusion.grooveColor(control.palette), 1.1)
+ color: Qt.lighter(Fusion.grooveColor(groove.control.palette), 1.1)
}
}
Rectangle {
- x: control.horizontal ? groove.offset * parent.width : 0
- y: control.horizontal ? 0 : groove.visualProgress * parent.height
- width: control.horizontal ? groove.progress * parent.width - groove.offset * parent.width : 5
- height: control.horizontal ? 5 : groove.progress * parent.height - groove.offset * parent.height
+ x: groove.control.horizontal ? groove.offset * parent.width : 0
+ y: groove.control.horizontal ? 0 : groove.visualProgress * parent.height
+ width: groove.control.horizontal ? groove.progress * parent.width - groove.offset * parent.width : 5
+ height: groove.control.horizontal ? 5 : groove.progress * parent.height - groove.offset * parent.height
radius: 2
- border.color: Qt.darker(Fusion.highlightedOutline(control.palette), 1.1)
+ border.color: Qt.darker(Fusion.highlightedOutline(groove.control.palette), 1.1)
gradient: Gradient {
GradientStop {
position: 0
- color: Fusion.highlight(control.palette)
+ color: Fusion.highlight(groove.control.palette)
}
GradientStop {
position: 1
- color: Qt.lighter(Fusion.highlight(control.palette), 1.2)
+ color: Qt.lighter(Fusion.highlight(groove.control.palette), 1.2)
}
}
}
diff --git a/src/imports/controls/fusion/SpinBox.qml b/src/imports/controls/fusion/SpinBox.qml
index fd77f9f3..41754f63 100644
--- a/src/imports/controls/fusion/SpinBox.qml
+++ b/src/imports/controls/fusion/SpinBox.qml
@@ -145,8 +145,8 @@ T.SpinBox {
Rectangle {
x: control.mirrored ? 1 : parent.width - width - 1
y: 1
- width: Math.max(up.indicator ? up.indicator.width : 0,
- down.indicator ? down.indicator.width : 0) + 1
+ width: Math.max(control.up.indicator ? control.up.indicator.width : 0,
+ control.down.indicator ? control.down.indicator.width : 0) + 1
height: parent.height - 2
radius: 2
diff --git a/src/imports/controls/fusion/Switch.qml b/src/imports/controls/fusion/Switch.qml
index edcb3650..bf18003a 100644
--- a/src/imports/controls/fusion/Switch.qml
+++ b/src/imports/controls/fusion/Switch.qml
@@ -54,7 +54,7 @@ T.Switch {
spacing: 6
indicator: SwitchIndicator {
- x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ 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
}
diff --git a/src/imports/controls/fusion/SwitchDelegate.qml b/src/imports/controls/fusion/SwitchDelegate.qml
index 0db13b41..67c41924 100644
--- a/src/imports/controls/fusion/SwitchDelegate.qml
+++ b/src/imports/controls/fusion/SwitchDelegate.qml
@@ -57,7 +57,7 @@ T.SwitchDelegate {
icon.height: 16
indicator: SwitchIndicator {
- x: text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ 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
}
diff --git a/src/imports/controls/fusion/SwitchIndicator.qml b/src/imports/controls/fusion/SwitchIndicator.qml
index f89388c7..ae7c89a0 100644
--- a/src/imports/controls/fusion/SwitchIndicator.qml
+++ b/src/imports/controls/fusion/SwitchIndicator.qml
@@ -56,44 +56,44 @@ Rectangle {
gradient: Gradient {
GradientStop {
position: 0
- color: Qt.darker(Fusion.grooveColor(control.palette), 1.1)
+ color: Qt.darker(Fusion.grooveColor(indicator.control.palette), 1.1)
}
GradientStop {
position: 1
- color: Qt.lighter(Fusion.grooveColor(control.palette), 1.1)
+ color: Qt.lighter(Fusion.grooveColor(indicator.control.palette), 1.1)
}
}
Rectangle {
- x: control.mirrored ? handle.x : 0
- width: control.mirrored ? parent.width - handle.x : handle.x + handle.width
+ x: indicator.control.mirrored ? handle.x : 0
+ width: indicator.control.mirrored ? parent.width - handle.x : handle.x + handle.width
height: parent.height
- opacity: control.checked ? 1 : 0
+ opacity: indicator.control.checked ? 1 : 0
Behavior on opacity {
- enabled: !control.down
+ enabled: !indicator.control.down
NumberAnimation { duration: 80 }
}
radius: 2
- border.color: Qt.darker(Fusion.highlightedOutline(control.palette), 1.1)
- border.width: control.enabled ? 1 : 0
+ border.color: Qt.darker(Fusion.highlightedOutline(indicator.control.palette), 1.1)
+ border.width: indicator.control.enabled ? 1 : 0
gradient: Gradient {
GradientStop {
position: 0
- color: Fusion.highlight(control.palette)
+ color: Fusion.highlight(indicator.control.palette)
}
GradientStop {
position: 1
- color: Qt.lighter(Fusion.highlight(control.palette), 1.2)
+ color: Qt.lighter(Fusion.highlight(indicator.control.palette), 1.2)
}
}
}
Rectangle {
id: handle
- x: Math.max(0, Math.min(parent.width - width, control.visualPosition * parent.width - (width / 2)))
+ x: Math.max(0, Math.min(parent.width - width, indicator.control.visualPosition * parent.width - (width / 2)))
y: (parent.height - height) / 2
width: 20
height: 16
@@ -102,11 +102,11 @@ Rectangle {
gradient: Gradient {
GradientStop {
position: 0
- color: Fusion.gradientStart(Fusion.buttonColor(control.palette, control.visualFocus, control.pressed, control.hovered))
+ color: Fusion.gradientStart(Fusion.buttonColor(indicator.control.palette, indicator.control.visualFocus, indicator.control.pressed, indicator.control.hovered))
}
GradientStop {
position: 1
- color: Fusion.gradientStop(Fusion.buttonColor(control.palette, control.visualFocus, control.pressed, control.hovered))
+ color: Fusion.gradientStop(Fusion.buttonColor(indicator.control.palette, indicator.control.visualFocus, indicator.control.pressed, indicator.control.hovered))
}
}
border.width: 1
@@ -115,7 +115,7 @@ Rectangle {
Rectangle {
width: parent.width
height: parent.height
- border.color: control.visualFocus ? Fusion.highlightedOutline(control.palette) : Fusion.outline(control.palette)
+ border.color: indicator.control.visualFocus ? Fusion.highlightedOutline(indicator.control.palette) : Fusion.outline(indicator.control.palette)
color: "transparent"
radius: 2
@@ -130,7 +130,7 @@ Rectangle {
}
Behavior on x {
- enabled: !control.down
+ enabled: !indicator.control.down
SmoothedAnimation { velocity: 200 }
}
}
diff --git a/src/imports/controls/fusion/Tumbler.qml b/src/imports/controls/fusion/Tumbler.qml
index 6abf7b5a..0129f06c 100644
--- a/src/imports/controls/fusion/Tumbler.qml
+++ b/src/imports/controls/fusion/Tumbler.qml
@@ -64,11 +64,11 @@ T.Tumbler {
model: control.model
delegate: control.delegate
path: Path {
- startX: contentItem.width / 2
- startY: -contentItem.delegateHeight / 2
+ startX: control.contentItem.width / 2
+ startY: -control.contentItem.delegateHeight / 2
PathLine {
- x: contentItem.width / 2
- y: (control.visibleItemCount + 1) * contentItem.delegateHeight - contentItem.delegateHeight / 2
+ x: control.contentItem.width / 2
+ y: (control.visibleItemCount + 1) * control.contentItem.delegateHeight - control.contentItem.delegateHeight / 2
}
}
diff --git a/src/imports/controls/fusion/qquickfusionstyle.cpp b/src/imports/controls/fusion/qquickfusionstyle.cpp
index 7797463a..364f8a75 100644
--- a/src/imports/controls/fusion/qquickfusionstyle.cpp
+++ b/src/imports/controls/fusion/qquickfusionstyle.cpp
@@ -80,8 +80,6 @@ QColor QQuickFusionStyle::highlightedText(const QPalette &palette)
QColor QQuickFusionStyle::outline(const QPalette &palette)
{
- if (palette.window().style() == Qt::TexturePattern)
- return QColor(0, 0, 0, 160);
return palette.window().color().darker(140);
}
@@ -95,8 +93,6 @@ QColor QQuickFusionStyle::highlightedOutline(const QPalette &palette)
QColor QQuickFusionStyle::tabFrameColor(const QPalette &palette)
{
- if (palette.window().style() == Qt::TexturePattern)
- return QColor(255, 255, 255, 8);
return buttonColor(palette).lighter(104);
}
diff --git a/src/imports/controls/imagine/ComboBox.qml b/src/imports/controls/imagine/ComboBox.qml
index 3a3ae682..2d582e98 100644
--- a/src/imports/controls/imagine/ComboBox.qml
+++ b/src/imports/controls/imagine/ComboBox.qml
@@ -34,12 +34,12 @@
**
****************************************************************************/
-import QtQuick 2.12
-import QtQuick.Window 2.12
-import QtQuick.Templates 2.12 as T
-import QtQuick.Controls 2.12
-import QtQuick.Controls.Imagine 2.12
-import QtQuick.Controls.Imagine.impl 2.12
+import QtQuick 2.14
+import QtQuick.Window 2.14
+import QtQuick.Templates 2.14 as T
+import QtQuick.Controls 2.14
+import QtQuick.Controls.Imagine 2.14
+import QtQuick.Controls.Imagine.impl 2.14
T.ComboBox {
id: control
diff --git a/src/imports/controls/imagine/RadioButton.qml b/src/imports/controls/imagine/RadioButton.qml
index d431695f..a50bc127 100644
--- a/src/imports/controls/imagine/RadioButton.qml
+++ b/src/imports/controls/imagine/RadioButton.qml
@@ -61,7 +61,7 @@ T.RadioButton {
bottomInset: background ? -background.bottomInset || 0 : 0
indicator: Image {
- x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ 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
source: Imagine.url + "radiobutton-indicator"
diff --git a/src/imports/controls/imagine/ScrollBar.qml b/src/imports/controls/imagine/ScrollBar.qml
index 787ea663..68772e12 100644
--- a/src/imports/controls/imagine/ScrollBar.qml
+++ b/src/imports/controls/imagine/ScrollBar.qml
@@ -48,6 +48,7 @@ T.ScrollBar {
implicitContentHeight + topPadding + bottomPadding)
visible: control.policy !== T.ScrollBar.AlwaysOff
+ minimumSize: orientation == Qt.Horizontal ? height / width : width / height
topPadding: background ? background.topPadding : 0
leftPadding: background ? background.leftPadding : 0
@@ -104,14 +105,14 @@ T.ScrollBar {
transitions: [
Transition {
to: "active"
- NumberAnimation { targets: [contentItem, background]; property: "opacity"; to: 1.0 }
+ NumberAnimation { targets: [control.contentItem, control.background]; property: "opacity"; to: 1.0 }
},
Transition {
from: "active"
SequentialAnimation {
- PropertyAction{ targets: [contentItem, background]; property: "opacity"; value: 1.0 }
+ PropertyAction{ targets: [control.contentItem, control.background]; property: "opacity"; value: 1.0 }
PauseAnimation { duration: 3000 }
- NumberAnimation { targets: [contentItem, background]; property: "opacity"; to: 0.0 }
+ NumberAnimation { targets: [control.contentItem, control.background]; property: "opacity"; to: 0.0 }
}
}
]
diff --git a/src/imports/controls/imagine/ScrollIndicator.qml b/src/imports/controls/imagine/ScrollIndicator.qml
index 2fd578ef..896cd876 100644
--- a/src/imports/controls/imagine/ScrollIndicator.qml
+++ b/src/imports/controls/imagine/ScrollIndicator.qml
@@ -98,13 +98,13 @@ T.ScrollIndicator {
transitions: [
Transition {
to: "active"
- NumberAnimation { targets: [contentItem, background]; property: "opacity"; to: 1.0 }
+ NumberAnimation { targets: [contentItem, control.background]; property: "opacity"; to: 1.0 }
},
Transition {
from: "active"
SequentialAnimation {
PauseAnimation { duration: 5000 }
- NumberAnimation { targets: [contentItem, background]; property: "opacity"; to: 0.0 }
+ NumberAnimation { targets: [contentItem, control.background]; property: "opacity"; to: 0.0 }
}
}
]
diff --git a/src/imports/controls/imagine/Switch.qml b/src/imports/controls/imagine/Switch.qml
index 7d1f3a2a..50b407ac 100644
--- a/src/imports/controls/imagine/Switch.qml
+++ b/src/imports/controls/imagine/Switch.qml
@@ -61,7 +61,7 @@ T.Switch {
bottomInset: background ? -background.bottomInset || 0 : 0
indicator: NinePatchImage {
- x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ 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
width: Math.max(implicitWidth, handle.leftPadding && handle.rightPadding ? handle.implicitWidth : 2 * handle.implicitWidth)
height: Math.max(implicitHeight, handle.implicitHeight)
diff --git a/src/imports/controls/imagine/SwitchDelegate.qml b/src/imports/controls/imagine/SwitchDelegate.qml
index e95023fb..73e5aac0 100644
--- a/src/imports/controls/imagine/SwitchDelegate.qml
+++ b/src/imports/controls/imagine/SwitchDelegate.qml
@@ -67,7 +67,7 @@ T.SwitchDelegate {
icon.color: control.palette.text
indicator: NinePatchImage {
- x: text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ 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
width: Math.max(implicitWidth, handle.leftPadding && handle.rightPadding ? handle.implicitWidth : 2 * handle.implicitWidth)
height: Math.max(implicitHeight, handle.implicitHeight)
diff --git a/src/imports/controls/imagine/Tumbler.qml b/src/imports/controls/imagine/Tumbler.qml
index d49966b0..12025cc5 100644
--- a/src/imports/controls/imagine/Tumbler.qml
+++ b/src/imports/controls/imagine/Tumbler.qml
@@ -69,11 +69,11 @@ T.Tumbler {
model: control.model
delegate: control.delegate
path: Path {
- startX: contentItem.width / 2
- startY: -contentItem.delegateHeight / 2
+ startX: control.contentItem.width / 2
+ startY: -control.contentItem.delegateHeight / 2
PathLine {
- x: contentItem.width / 2
- y: (control.visibleItemCount + 1) * contentItem.delegateHeight - contentItem.delegateHeight / 2
+ x: control.contentItem.width / 2
+ y: (control.visibleItemCount + 1) * control.contentItem.delegateHeight - control.contentItem.delegateHeight / 2
}
}
diff --git a/src/imports/controls/material/CheckBox.qml b/src/imports/controls/material/CheckBox.qml
index cad5ae97..159e2f12 100644
--- a/src/imports/controls/material/CheckBox.qml
+++ b/src/imports/controls/material/CheckBox.qml
@@ -53,7 +53,7 @@ T.CheckBox {
verticalPadding: padding + 7
indicator: CheckIndicator {
- x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ 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
diff --git a/src/imports/controls/material/CheckDelegate.qml b/src/imports/controls/material/CheckDelegate.qml
index 34495e2d..c7d7575e 100644
--- a/src/imports/controls/material/CheckDelegate.qml
+++ b/src/imports/controls/material/CheckDelegate.qml
@@ -59,7 +59,7 @@ T.CheckDelegate {
icon.color: enabled ? Material.foreground : Material.hintTextColor
indicator: CheckIndicator {
- x: text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ 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
}
diff --git a/src/imports/controls/material/CheckIndicator.qml b/src/imports/controls/material/CheckIndicator.qml
index 673d6f48..7caf8553 100644
--- a/src/imports/controls/material/CheckIndicator.qml
+++ b/src/imports/controls/material/CheckIndicator.qml
@@ -75,7 +75,7 @@ Rectangle {
source: "qrc:/qt-project.org/imports/QtQuick/Controls.2/Material/images/check.png"
fillMode: Image.PreserveAspectFit
- scale: checkState === Qt.Checked ? 1 : 0
+ scale: indicatorItem.checkState === Qt.Checked ? 1 : 0
Behavior on scale { NumberAnimation { duration: 100 } }
}
@@ -85,18 +85,18 @@ Rectangle {
width: 12
height: 3
- scale: checkState === Qt.PartiallyChecked ? 1 : 0
+ scale: indicatorItem.checkState === Qt.PartiallyChecked ? 1 : 0
Behavior on scale { NumberAnimation { duration: 100 } }
}
states: [
State {
name: "checked"
- when: checkState === Qt.Checked
+ when: indicatorItem.checkState === Qt.Checked
},
State {
name: "partiallychecked"
- when: checkState === Qt.PartiallyChecked
+ when: indicatorItem.checkState === Qt.PartiallyChecked
}
]
diff --git a/src/imports/controls/material/ComboBox.qml b/src/imports/controls/material/ComboBox.qml
index 223f8fca..7d635902 100644
--- a/src/imports/controls/material/ComboBox.qml
+++ b/src/imports/controls/material/ComboBox.qml
@@ -34,13 +34,13 @@
**
****************************************************************************/
-import QtQuick 2.12
-import QtQuick.Window 2.12
-import QtQuick.Controls 2.12
-import QtQuick.Controls.impl 2.12
-import QtQuick.Templates 2.12 as T
-import QtQuick.Controls.Material 2.12
-import QtQuick.Controls.Material.impl 2.12
+import QtQuick 2.14
+import QtQuick.Window 2.14
+import QtQuick.Controls 2.14
+import QtQuick.Controls.impl 2.14
+import QtQuick.Templates 2.14 as T
+import QtQuick.Controls.Material 2.14
+import QtQuick.Controls.Material.impl 2.14
T.ComboBox {
id: control
diff --git a/src/imports/controls/material/Dial.qml b/src/imports/controls/material/Dial.qml
index 1148dd25..1f80a7fe 100644
--- a/src/imports/controls/material/Dial.qml
+++ b/src/imports/controls/material/Dial.qml
@@ -62,16 +62,16 @@ T.Dial {
}
handle: SliderHandle {
- x: background.x + background.width / 2 - handle.width / 2
- y: background.y + background.height / 2 - handle.height / 2
+ x: control.background.x + control.background.width / 2 - control.handle.width / 2
+ y: control.background.y + control.background.height / 2 - control.handle.height / 2
transform: [
Translate {
- y: -background.height * 0.4 + handle.height / 2
+ y: -control.background.height * 0.4 + control.handle.height / 2
},
Rotation {
angle: control.angle
- origin.x: handle.width / 2
- origin.y: handle.height / 2
+ origin.x: control.handle.width / 2
+ origin.y: control.handle.height / 2
}
]
implicitWidth: 10
diff --git a/src/imports/controls/material/ElevationEffect.qml b/src/imports/controls/material/ElevationEffect.qml
index 06b654a8..73a2a238 100644
--- a/src/imports/controls/material/ElevationEffect.qml
+++ b/src/imports/controls/material/ElevationEffect.qml
@@ -235,9 +235,9 @@ Item {
// the size of the parent, so we don't need to worry about the extra padding
// in the parent Item
BoxShadow {
- offsetY: _shadow[0].offset
- blurRadius: _shadow[0].blur
- spreadRadius: _shadow[0].spread
+ 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
@@ -246,9 +246,9 @@ Item {
}
BoxShadow {
- offsetY: _shadow[1].offset
- blurRadius: _shadow[1].blur
- spreadRadius: _shadow[1].spread
+ 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
@@ -257,9 +257,9 @@ Item {
}
BoxShadow {
- offsetY: _shadow[2].offset
- blurRadius: _shadow[2].blur
- spreadRadius: _shadow[2].spread
+ 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
@@ -272,8 +272,8 @@ Item {
x: (parent.width - width)/2
y: (parent.height - height)/2
- width: sourceItem.width
- height: sourceItem.height
+ width: effect.sourceItem.width
+ height: effect.sourceItem.height
}
}
}
diff --git a/src/imports/controls/material/MenuItem.qml b/src/imports/controls/material/MenuItem.qml
index 069ad216..a5d2f8a1 100644
--- a/src/imports/controls/material/MenuItem.qml
+++ b/src/imports/controls/material/MenuItem.qml
@@ -59,7 +59,7 @@ T.MenuItem {
icon.color: enabled ? Material.foreground : Material.hintTextColor
indicator: CheckIndicator {
- x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ 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
diff --git a/src/imports/controls/material/RadioButton.qml b/src/imports/controls/material/RadioButton.qml
index 47bbbd80..dadcc84f 100644
--- a/src/imports/controls/material/RadioButton.qml
+++ b/src/imports/controls/material/RadioButton.qml
@@ -53,7 +53,7 @@ T.RadioButton {
verticalPadding: padding + 6
indicator: RadioIndicator {
- x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ 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
diff --git a/src/imports/controls/material/RadioDelegate.qml b/src/imports/controls/material/RadioDelegate.qml
index edc93c2c..c977d332 100644
--- a/src/imports/controls/material/RadioDelegate.qml
+++ b/src/imports/controls/material/RadioDelegate.qml
@@ -59,7 +59,7 @@ T.RadioDelegate {
icon.color: enabled ? Material.foreground : Material.hintTextColor
indicator: RadioIndicator {
- x: text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ 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
}
diff --git a/src/imports/controls/material/RadioIndicator.qml b/src/imports/controls/material/RadioIndicator.qml
index 4be816ad..e2c55184 100644
--- a/src/imports/controls/material/RadioIndicator.qml
+++ b/src/imports/controls/material/RadioIndicator.qml
@@ -39,6 +39,7 @@ import QtQuick.Controls.Material 2.12
import QtQuick.Controls.Material.impl 2.12
Rectangle {
+ id: indicator
implicitWidth: 20
implicitHeight: 20
radius: width / 2
@@ -56,6 +57,6 @@ Rectangle {
height: 10
radius: width / 2
color: parent.border.color
- visible: control.checked || control.down
+ visible: indicator.control.checked || indicator.control.down
}
}
diff --git a/src/imports/controls/material/RectangularGlow.qml b/src/imports/controls/material/RectangularGlow.qml
index 58e11b9f..c01e536d 100644
--- a/src/imports/controls/material/RectangularGlow.qml
+++ b/src/imports/controls/material/RectangularGlow.qml
@@ -224,7 +224,7 @@ Item {
height: parent.height + rootItem.glowRadius * 2 + cornerRadius * 2
function clampedCornerRadius() {
- var maxCornerRadius = Math.min(rootItem.width, rootItem.height) / 2 + glowRadius;
+ var maxCornerRadius = Math.min(rootItem.width, rootItem.height) / 2 + rootItem.glowRadius;
return Math.max(0, Math.min(rootItem.cornerRadius, maxCornerRadius))
}
diff --git a/src/imports/controls/material/ScrollBar.qml b/src/imports/controls/material/ScrollBar.qml
index a376742d..fda64346 100644
--- a/src/imports/controls/material/ScrollBar.qml
+++ b/src/imports/controls/material/ScrollBar.qml
@@ -48,6 +48,7 @@ T.ScrollBar {
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
@@ -74,14 +75,14 @@ T.ScrollBar {
transitions: [
Transition {
to: "active"
- NumberAnimation { targets: [contentItem, background]; property: "opacity"; to: 1.0 }
+ NumberAnimation { targets: [control.contentItem, control.background]; property: "opacity"; to: 1.0 }
},
Transition {
from: "active"
SequentialAnimation {
- PropertyAction{ targets: [contentItem, background]; property: "opacity"; value: 1.0 }
+ PropertyAction{ targets: [control.contentItem, control.background]; property: "opacity"; value: 1.0 }
PauseAnimation { duration: 2450 }
- NumberAnimation { targets: [contentItem, background]; property: "opacity"; to: 0.0 }
+ NumberAnimation { targets: [control.contentItem, control.background]; property: "opacity"; to: 0.0 }
}
}
]
diff --git a/src/imports/controls/material/SliderHandle.qml b/src/imports/controls/material/SliderHandle.qml
index b3bdb802..2e3120e4 100644
--- a/src/imports/controls/material/SliderHandle.qml
+++ b/src/imports/controls/material/SliderHandle.qml
@@ -71,6 +71,6 @@ Item {
width: 22; height: 22
pressed: root.handlePressed
active: root.handlePressed || root.handleHasFocus || root.handleHovered
- color: control.Material.rippleColor
+ color: root.control.Material.rippleColor
}
}
diff --git a/src/imports/controls/material/SwitchDelegate.qml b/src/imports/controls/material/SwitchDelegate.qml
index bae5171b..834a3dfa 100644
--- a/src/imports/controls/material/SwitchDelegate.qml
+++ b/src/imports/controls/material/SwitchDelegate.qml
@@ -59,7 +59,7 @@ T.SwitchDelegate {
icon.color: enabled ? Material.foreground : Material.hintTextColor
indicator: SwitchIndicator {
- x: text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ 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
}
diff --git a/src/imports/controls/material/SwitchIndicator.qml b/src/imports/controls/material/SwitchIndicator.qml
index 7fef407c..3034e771 100644
--- a/src/imports/controls/material/SwitchIndicator.qml
+++ b/src/imports/controls/material/SwitchIndicator.qml
@@ -53,22 +53,22 @@ Item {
height: 14
radius: height / 2
y: parent.height / 2 - height / 2
- color: control.enabled ? (control.checked ? control.Material.switchCheckedTrackColor : control.Material.switchUncheckedTrackColor)
- : control.Material.switchDisabledTrackColor
+ 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, control.visualPosition * parent.width - (width / 2)))
+ 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: control.enabled ? (control.checked ? control.Material.switchCheckedHandleColor : control.Material.switchUncheckedHandleColor)
- : control.Material.switchDisabledHandleColor
+ color: indicator.control.enabled ? (indicator.control.checked ? indicator.control.Material.switchCheckedHandleColor : indicator.control.Material.switchUncheckedHandleColor)
+ : indicator.control.Material.switchDisabledHandleColor
Behavior on x {
- enabled: !control.pressed
+ enabled: !indicator.control.pressed
SmoothedAnimation {
duration: 300
}
diff --git a/src/imports/controls/material/Tumbler.qml b/src/imports/controls/material/Tumbler.qml
index 92e24430..30d66c58 100644
--- a/src/imports/controls/material/Tumbler.qml
+++ b/src/imports/controls/material/Tumbler.qml
@@ -63,11 +63,11 @@ T.Tumbler {
model: control.model
delegate: control.delegate
path: Path {
- startX: contentItem.width / 2
- startY: -contentItem.delegateHeight / 2
+ startX: control.contentItem.width / 2
+ startY: -control.contentItem.delegateHeight / 2
PathLine {
- x: contentItem.width / 2
- y: (control.visibleItemCount + 1) * contentItem.delegateHeight - contentItem.delegateHeight / 2
+ x: control.contentItem.width / 2
+ y: (control.visibleItemCount + 1) * control.contentItem.delegateHeight - control.contentItem.delegateHeight / 2
}
}
diff --git a/src/imports/controls/material/qquickmaterialbusyindicator.cpp b/src/imports/controls/material/qquickmaterialbusyindicator.cpp
index c18a4005..58c1fd8c 100644
--- a/src/imports/controls/material/qquickmaterialbusyindicator.cpp
+++ b/src/imports/controls/material/qquickmaterialbusyindicator.cpp
@@ -184,7 +184,7 @@ QColor QQuickMaterialBusyIndicator::color() const
return m_color;
}
-void QQuickMaterialBusyIndicator::setColor(QColor color)
+void QQuickMaterialBusyIndicator::setColor(const QColor &color)
{
if (m_color == color)
return;
diff --git a/src/imports/controls/material/qquickmaterialbusyindicator_p.h b/src/imports/controls/material/qquickmaterialbusyindicator_p.h
index d29427c1..ad7bc002 100644
--- a/src/imports/controls/material/qquickmaterialbusyindicator_p.h
+++ b/src/imports/controls/material/qquickmaterialbusyindicator_p.h
@@ -63,7 +63,7 @@ public:
explicit QQuickMaterialBusyIndicator(QQuickItem *parent = nullptr);
QColor color() const;
- void setColor(QColor color);
+ void setColor(const QColor &color);
bool isRunning() const;
void setRunning(bool running);
diff --git a/src/imports/controls/material/qtquickcontrols2materialstyleplugin.qrc b/src/imports/controls/material/qtquickcontrols2materialstyleplugin.qrc
index 6e29aea4..71f9563b 100644
--- a/src/imports/controls/material/qtquickcontrols2materialstyleplugin.qrc
+++ b/src/imports/controls/material/qtquickcontrols2materialstyleplugin.qrc
@@ -15,5 +15,6 @@
<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/imports/controls/material/shaders/+qsb/RectangularGlow.frag b/src/imports/controls/material/shaders/+qsb/RectangularGlow.frag
new file mode 100644
index 00000000..a805b134
--- /dev/null
+++ b/src/imports/controls/material/shaders/+qsb/RectangularGlow.frag
Binary files differ
diff --git a/src/imports/controls/material/shaders/RectangularGlow_rhi.frag b/src/imports/controls/material/shaders/RectangularGlow_rhi.frag
new file mode 100644
index 00000000..3e7d2dfe
--- /dev/null
+++ b/src/imports/controls/material/shaders/RectangularGlow_rhi.frag
@@ -0,0 +1,28 @@
+#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/imports/controls/universal/CheckBox.qml b/src/imports/controls/universal/CheckBox.qml
index b726339a..9494f4d2 100644
--- a/src/imports/controls/universal/CheckBox.qml
+++ b/src/imports/controls/universal/CheckBox.qml
@@ -54,7 +54,7 @@ T.CheckBox {
property bool useSystemFocusVisuals: true
indicator: CheckIndicator {
- x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ 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
}
diff --git a/src/imports/controls/universal/CheckDelegate.qml b/src/imports/controls/universal/CheckDelegate.qml
index 7847f459..b544c42e 100644
--- a/src/imports/controls/universal/CheckDelegate.qml
+++ b/src/imports/controls/universal/CheckDelegate.qml
@@ -61,7 +61,7 @@ T.CheckDelegate {
icon.color: Color.transparent(Universal.foreground, enabled ? 1.0 : 0.2)
indicator: CheckIndicator {
- x: text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ 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
}
diff --git a/src/imports/controls/universal/CheckIndicator.qml b/src/imports/controls/universal/CheckIndicator.qml
index 0f535ea6..8f41617a 100644
--- a/src/imports/controls/universal/CheckIndicator.qml
+++ b/src/imports/controls/universal/CheckIndicator.qml
@@ -41,6 +41,7 @@ import QtQuick.Controls.impl 2.12
import QtQuick.Controls.Universal 2.12
Rectangle {
+ id: indicator
implicitWidth: 20
implicitHeight: 20
@@ -59,23 +60,23 @@ Rectangle {
x: (parent.width - width) / 2
y: (parent.height - height) / 2
- visible: control.checkState === Qt.Checked
- color: !control.enabled ? control.Universal.baseLowColor : control.Universal.chromeWhiteColor
+ visible: indicator.control.checkState === Qt.Checked
+ color: !indicator.control.enabled ? indicator.control.Universal.baseLowColor : indicator.control.Universal.chromeWhiteColor
source: "qrc:/qt-project.org/imports/QtQuick/Controls.2/Universal/images/checkmark.png"
}
Rectangle {
x: (parent.width - width) / 2
y: (parent.height - height) / 2
- width: partiallyChecked ? parent.width / 2 : parent.width
- height: partiallyChecked ? parent.height / 2 : parent.height
+ width: indicator.partiallyChecked ? parent.width / 2 : parent.width
+ height: indicator.partiallyChecked ? parent.height / 2 : parent.height
- visible: !control.pressed && control.hovered || partiallyChecked
- color: !partiallyChecked ? "transparent" :
- !control.enabled ? control.Universal.baseLowColor :
- control.down ? control.Universal.baseMediumColor :
- control.hovered ? control.Universal.baseHighColor : control.Universal.baseMediumHighColor
- border.width: partiallyChecked ? 0 : 2 // CheckBoxBorderThemeThickness
- border.color: control.Universal.baseMediumLowColor
+ visible: !indicator.control.pressed && indicator.control.hovered || indicator.partiallyChecked
+ color: !indicator.partiallyChecked ? "transparent" :
+ !indicator.control.enabled ? indicator.control.Universal.baseLowColor :
+ indicator.control.down ? indicator.control.Universal.baseMediumColor :
+ indicator.control.hovered ? indicator.control.Universal.baseHighColor : indicator.control.Universal.baseMediumHighColor
+ border.width: indicator.partiallyChecked ? 0 : 2 // CheckBoxBorderThemeThickness
+ border.color: indicator.control.Universal.baseMediumLowColor
}
}
diff --git a/src/imports/controls/universal/ComboBox.qml b/src/imports/controls/universal/ComboBox.qml
index 3ec7e98b..9a4e119b 100644
--- a/src/imports/controls/universal/ComboBox.qml
+++ b/src/imports/controls/universal/ComboBox.qml
@@ -34,12 +34,12 @@
**
****************************************************************************/
-import QtQuick 2.12
-import QtQuick.Window 2.12
-import QtQuick.Controls 2.12
-import QtQuick.Controls.impl 2.12
-import QtQuick.Templates 2.12 as T
-import QtQuick.Controls.Universal 2.12
+import QtQuick 2.14
+import QtQuick.Window 2.14
+import QtQuick.Controls 2.14
+import QtQuick.Controls.impl 2.14
+import QtQuick.Templates 2.14 as T
+import QtQuick.Controls.Universal 2.14
T.ComboBox {
id: control
diff --git a/src/imports/controls/universal/Dial.qml b/src/imports/controls/universal/Dial.qml
index 276c87d6..f45d912e 100644
--- a/src/imports/controls/universal/Dial.qml
+++ b/src/imports/controls/universal/Dial.qml
@@ -64,8 +64,8 @@ T.Dial {
implicitWidth: 14
implicitHeight: 14
- x: background.x + background.width / 2 - handle.width / 2
- y: background.y + background.height / 2 - handle.height / 2
+ x: control.background.x + control.background.width / 2 - control.handle.width / 2
+ y: control.background.y + control.background.height / 2 - control.handle.height / 2
radius: width / 2
color: !control.enabled ? control.Universal.baseLowColor :
@@ -74,12 +74,12 @@ T.Dial {
transform: [
Translate {
- y: -background.height * 0.4 + handle.height / 2
+ y: -control.background.height * 0.4 + control.handle.height / 2
},
Rotation {
angle: control.angle
- origin.x: handle.width / 2
- origin.y: handle.height / 2
+ origin.x: control.handle.width / 2
+ origin.y: control.handle.height / 2
}
]
}
diff --git a/src/imports/controls/universal/RadioButton.qml b/src/imports/controls/universal/RadioButton.qml
index 5a61c3f7..a50cdf9b 100644
--- a/src/imports/controls/universal/RadioButton.qml
+++ b/src/imports/controls/universal/RadioButton.qml
@@ -54,7 +54,7 @@ T.RadioButton {
property bool useSystemFocusVisuals: true
indicator: RadioIndicator {
- x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ 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
}
diff --git a/src/imports/controls/universal/RadioDelegate.qml b/src/imports/controls/universal/RadioDelegate.qml
index d56cef33..9fc910f3 100644
--- a/src/imports/controls/universal/RadioDelegate.qml
+++ b/src/imports/controls/universal/RadioDelegate.qml
@@ -61,7 +61,7 @@ T.RadioDelegate {
icon.color: Color.transparent(Universal.foreground, enabled ? 1.0 : 0.2)
indicator: RadioIndicator {
- x: text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ 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
}
diff --git a/src/imports/controls/universal/RadioIndicator.qml b/src/imports/controls/universal/RadioIndicator.qml
index 68d53d45..1a32decb 100644
--- a/src/imports/controls/universal/RadioIndicator.qml
+++ b/src/imports/controls/universal/RadioIndicator.qml
@@ -38,6 +38,7 @@ import QtQuick 2.12
import QtQuick.Controls.Universal 2.12
Rectangle {
+ id: indicator
implicitWidth: 20
implicitHeight: 20
radius: width / 2
@@ -56,11 +57,11 @@ Rectangle {
height: parent.height
radius: width / 2
- opacity: control.checked ? 1 : 0
+ opacity: indicator.control.checked ? 1 : 0
color: "transparent"
border.width: 2 // RadioButtonBorderThemeThickness
- border.color: !control.enabled ? control.Universal.baseLowColor :
- control.down ? control.Universal.baseMediumColor : control.Universal.accent
+ border.color: !indicator.control.enabled ? indicator.control.Universal.baseLowColor :
+ indicator.control.down ? indicator.control.Universal.baseMediumColor : indicator.control.Universal.accent
}
Rectangle {
@@ -71,9 +72,9 @@ Rectangle {
height: parent.height / 2
radius: width / 2
- opacity: control.checked ? 1 : 0
- color: !control.enabled ? control.Universal.baseLowColor :
- control.down ? control.Universal.baseMediumColor :
- control.hovered ? control.Universal.baseHighColor : control.Universal.baseMediumHighColor
+ opacity: indicator.control.checked ? 1 : 0
+ color: !indicator.control.enabled ? indicator.control.Universal.baseLowColor :
+ indicator.control.down ? indicator.control.Universal.baseMediumColor :
+ indicator.control.hovered ? indicator.control.Universal.baseHighColor : indicator.control.Universal.baseMediumHighColor
}
}
diff --git a/src/imports/controls/universal/ScrollBar.qml b/src/imports/controls/universal/ScrollBar.qml
index d6a525f7..8b8e325d 100644
--- a/src/imports/controls/universal/ScrollBar.qml
+++ b/src/imports/controls/universal/ScrollBar.qml
@@ -47,6 +47,7 @@ T.ScrollBar {
implicitContentHeight + topPadding + bottomPadding)
visible: control.policy !== T.ScrollBar.AlwaysOff
+ minimumSize: orientation == Qt.Horizontal ? height / width : width / height
// TODO: arrows
@@ -78,14 +79,14 @@ T.ScrollBar {
transitions: [
Transition {
to: "active"
- NumberAnimation { targets: [contentItem, background]; property: "opacity"; to: 1.0 }
+ NumberAnimation { targets: [control.contentItem, control.background]; property: "opacity"; to: 1.0 }
},
Transition {
from: "active"
SequentialAnimation {
- PropertyAction{ targets: [contentItem, background]; property: "opacity"; value: 1.0 }
+ PropertyAction{ targets: [control.contentItem, control.background]; property: "opacity"; value: 1.0 }
PauseAnimation { duration: 3000 }
- NumberAnimation { targets: [contentItem, background]; property: "opacity"; to: 0.0 }
+ NumberAnimation { targets: [control.contentItem, control.background]; property: "opacity"; to: 0.0 }
}
}
]
diff --git a/src/imports/controls/universal/Switch.qml b/src/imports/controls/universal/Switch.qml
index 962d5157..284b1229 100644
--- a/src/imports/controls/universal/Switch.qml
+++ b/src/imports/controls/universal/Switch.qml
@@ -54,7 +54,7 @@ T.Switch {
property bool useSystemFocusVisuals: true
indicator: SwitchIndicator {
- x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ 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
}
diff --git a/src/imports/controls/universal/SwitchDelegate.qml b/src/imports/controls/universal/SwitchDelegate.qml
index bf6069f5..56ba8494 100644
--- a/src/imports/controls/universal/SwitchDelegate.qml
+++ b/src/imports/controls/universal/SwitchDelegate.qml
@@ -61,7 +61,7 @@ T.SwitchDelegate {
icon.color: Color.transparent(Universal.foreground, enabled ? 1.0 : 0.2)
indicator: SwitchIndicator {
- x: text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ 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
}
diff --git a/src/imports/controls/universal/SwitchIndicator.qml b/src/imports/controls/universal/SwitchIndicator.qml
index ad9a23e9..10f39515 100644
--- a/src/imports/controls/universal/SwitchIndicator.qml
+++ b/src/imports/controls/universal/SwitchIndicator.qml
@@ -39,6 +39,7 @@ import QtQuick.Templates 2.12 as T
import QtQuick.Controls.Universal 2.12
Item {
+ id: indicator
implicitWidth: 44
implicitHeight: 20
@@ -47,13 +48,13 @@ Item {
height: parent.height
radius: 10
- color: !control.enabled ? "transparent" :
- control.pressed ? control.Universal.baseMediumColor :
- control.checked ? control.Universal.accent : "transparent"
- border.color: !control.enabled ? control.Universal.baseLowColor :
- control.checked && !control.pressed ? control.Universal.accent :
- control.hovered && !control.checked && !control.pressed ? control.Universal.baseHighColor : control.Universal.baseMediumColor
- opacity: control.hovered && control.checked && !control.pressed ? (control.Universal.theme === Universal.Light ? 0.7 : 0.9) : 1.0
+ color: !indicator.control.enabled ? "transparent" :
+ indicator.control.pressed ? indicator.control.Universal.baseMediumColor :
+ indicator.control.checked ? indicator.control.Universal.accent : "transparent"
+ border.color: !indicator.control.enabled ? indicator.control.Universal.baseLowColor :
+ indicator.control.checked && !indicator.control.pressed ? indicator.control.Universal.accent :
+ indicator.control.hovered && !indicator.control.checked && !indicator.control.pressed ? indicator.control.Universal.baseHighColor : indicator.control.Universal.baseMediumColor
+ opacity: indicator.control.hovered && indicator.control.checked && !indicator.control.pressed ? (indicator.control.Universal.theme === Universal.Light ? 0.7 : 0.9) : 1.0
border.width: 2
}
@@ -64,16 +65,16 @@ Item {
height: 10
radius: 5
- color: !control.enabled ? control.Universal.baseLowColor :
- control.pressed || control.checked ? control.Universal.chromeWhiteColor :
- control.hovered && !control.checked ? control.Universal.baseHighColor : control.Universal.baseMediumHighColor
+ color: !indicator.control.enabled ? indicator.control.Universal.baseLowColor :
+ indicator.control.pressed || indicator.control.checked ? indicator.control.Universal.chromeWhiteColor :
+ indicator.control.hovered && !indicator.control.checked ? indicator.control.Universal.baseHighColor : indicator.control.Universal.baseMediumHighColor
x: Math.max(5, Math.min(parent.width - width - 5,
- control.visualPosition * parent.width - (width / 2)))
+ indicator.control.visualPosition * parent.width - (width / 2)))
y: (parent.height - height) / 2
Behavior on x {
- enabled: !control.pressed
+ enabled: !indicator.control.pressed
SmoothedAnimation { velocity: 200 }
}
}
diff --git a/src/imports/controls/universal/Tumbler.qml b/src/imports/controls/universal/Tumbler.qml
index f7338c2b..d0e7b12f 100644
--- a/src/imports/controls/universal/Tumbler.qml
+++ b/src/imports/controls/universal/Tumbler.qml
@@ -63,11 +63,11 @@ T.Tumbler {
model: control.model
delegate: control.delegate
path: Path {
- startX: contentItem.width / 2
- startY: -contentItem.delegateHeight / 2
+ startX: control.contentItem.width / 2
+ startY: -control.contentItem.delegateHeight / 2
PathLine {
- x: contentItem.width / 2
- y: (control.visibleItemCount + 1) * contentItem.delegateHeight - contentItem.delegateHeight / 2
+ x: control.contentItem.width / 2
+ y: (control.visibleItemCount + 1) * control.contentItem.delegateHeight - control.contentItem.delegateHeight / 2
}
}
diff --git a/src/imports/platform/qtlabsplatformplugin.cpp b/src/imports/platform/qtlabsplatformplugin.cpp
index b92c1ea0..98d5dcc4 100644
--- a/src/imports/platform/qtlabsplatformplugin.cpp
+++ b/src/imports/platform/qtlabsplatformplugin.cpp
@@ -83,7 +83,7 @@ void QtLabsPlatformPlugin::registerTypes(const char *uri)
qmlRegisterUncreatableType<QQuickPlatformDialog>(uri, 1, 0, "Dialog", QQuickPlatformDialog::tr("Dialog is an abstract base class"));
qmlRegisterType<QQuickPlatformColorDialog>(uri, 1, 0, "ColorDialog");
qmlRegisterType<QQuickPlatformFileDialog>(uri, 1, 0, "FileDialog");
- qmlRegisterType<QQuickPlatformFileNameFilter>();
+ qmlRegisterAnonymousType<QQuickPlatformFileNameFilter>(uri, 1);
qmlRegisterType<QQuickPlatformFolderDialog>(uri, 1, 0, "FolderDialog");
qmlRegisterType<QQuickPlatformFontDialog>(uri, 1, 0, "FontDialog");
qmlRegisterType<QQuickPlatformMessageDialog>(uri, 1, 0, "MessageDialog");
@@ -107,7 +107,7 @@ void QtLabsPlatformPlugin::registerTypes(const char *uri)
qRegisterMetaType<QPlatformSystemTrayIcon::MessageIcon>();
#endif
- qmlRegisterType<QQuickPlatformIcon>();
+ qmlRegisterAnonymousType<QQuickPlatformIcon>(uri, 1);
qRegisterMetaType<QQuickPlatformIcon>();
}
diff --git a/src/imports/templates/qtquicktemplates2plugin.cpp b/src/imports/templates/qtquicktemplates2plugin.cpp
index 10f9b8dd..e84db606 100644
--- a/src/imports/templates/qtquicktemplates2plugin.cpp
+++ b/src/imports/templates/qtquicktemplates2plugin.cpp
@@ -173,11 +173,11 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri)
// QtQuick.Templates 2.0 (originally introduced in Qt 5.7)
qmlRegisterType<QQuickAbstractButton>(uri, 2, 0, "AbstractButton");
qmlRegisterType<QQuickApplicationWindow>(uri, 2, 0, "ApplicationWindow");
- qmlRegisterType<QQuickApplicationWindowAttached>();
+ qmlRegisterAnonymousType<QQuickApplicationWindowAttached>(uri, 2);
qmlRegisterType<QQuickBusyIndicator>(uri, 2, 0, "BusyIndicator");
qmlRegisterType<QQuickButton>(uri, 2, 0, "Button");
qmlRegisterType<QQuickButtonGroup>(uri, 2, 0, "ButtonGroup");
- qmlRegisterType<QQuickButtonGroupAttached>();
+ qmlRegisterAnonymousType<QQuickButtonGroupAttached>(uri, 2);
qmlRegisterType<QQuickCheckBox>(uri, 2, 0, "CheckBox");
qmlRegisterType<QQuickCheckDelegate>(uri, 2, 0, "CheckDelegate");
qmlRegisterType<QQuickComboBox>(uri, 2, 0, "ComboBox");
@@ -191,7 +191,7 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri)
qmlRegisterType<QQuickLabel>(uri, 2, 0, "Label");
qmlRegisterType<QQuickMenu>(uri, 2, 0, "Menu");
qmlRegisterType<QQuickMenuItem>(uri, 2, 0, "MenuItem");
- qmlRegisterType<QQuickOverlay>();
+ qmlRegisterAnonymousType<QQuickOverlay>(uri, 2);
qmlRegisterType<QQuickPage>(uri, 2, 0, "Page");
qmlRegisterType<QQuickPageIndicator>(uri, 2, 0, "PageIndicator");
qmlRegisterType<QQuickPane>(uri, 2, 0, "Pane");
@@ -200,33 +200,33 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri)
qmlRegisterType<QQuickRadioButton>(uri, 2, 0, "RadioButton");
qmlRegisterType<QQuickRadioDelegate>(uri, 2, 0, "RadioDelegate");
qmlRegisterType<QQuickRangeSlider>(uri, 2, 0, "RangeSlider");
- qmlRegisterType<QQuickRangeSliderNode>();
+ qmlRegisterAnonymousType<QQuickRangeSliderNode>(uri, 2);
qmlRegisterType<QQuickScrollBar>(uri, 2, 0, "ScrollBar");
- qmlRegisterType<QQuickScrollBarAttached>();
+ qmlRegisterAnonymousType<QQuickScrollBarAttached>(uri, 2);
qmlRegisterType<QQuickScrollIndicator>(uri, 2, 0, "ScrollIndicator");
- qmlRegisterType<QQuickScrollIndicatorAttached>();
+ qmlRegisterAnonymousType<QQuickScrollIndicatorAttached>(uri, 2);
qmlRegisterType<QQuickSlider>(uri, 2, 0, "Slider");
qmlRegisterType<QQuickSpinBox>(uri, 2, 0, "SpinBox");
- qmlRegisterType<QQuickSpinButton>();
+ qmlRegisterAnonymousType<QQuickSpinButton>(uri, 2);
qmlRegisterType<QQuickStackView>(uri, 2, 0, "StackView");
- qmlRegisterType<QQuickStackViewAttached>();
- qmlRegisterType<QQuickSwipe>();
+ qmlRegisterAnonymousType<QQuickStackViewAttached>(uri, 2);
+ qmlRegisterAnonymousType<QQuickSwipe>(uri, 2);
qmlRegisterType<QQuickSwipeDelegate>(uri, 2, 0, "SwipeDelegate");
qmlRegisterType<QQuickSwipeView>(uri, 2, 0, "SwipeView");
- qmlRegisterType<QQuickSwipeViewAttached>();
+ qmlRegisterAnonymousType<QQuickSwipeViewAttached>(uri, 2);
qmlRegisterType<QQuickSwitch>(uri, 2, 0, "Switch");
qmlRegisterType<QQuickSwitchDelegate>(uri, 2, 0, "SwitchDelegate");
qmlRegisterType<QQuickTabBar>(uri, 2, 0, "TabBar");
qmlRegisterType<QQuickTabButton>(uri, 2, 0, "TabButton");
qmlRegisterType<QQuickTextArea>(uri, 2, 0, "TextArea");
- qmlRegisterType<QQuickTextAreaAttached>();
+ qmlRegisterAnonymousType<QQuickTextAreaAttached>(uri, 2);
qmlRegisterType<QQuickTextField>(uri, 2, 0, "TextField");
qmlRegisterType<QQuickToolBar>(uri, 2, 0, "ToolBar");
qmlRegisterType<QQuickToolButton>(uri, 2, 0, "ToolButton");
qmlRegisterType<QQuickToolTip>(uri, 2, 0, "ToolTip");
- qmlRegisterType<QQuickToolTipAttached>();
+ qmlRegisterAnonymousType<QQuickToolTipAttached>(uri, 2);
#if QT_CONFIG(quick_listview) && QT_CONFIG(quick_pathview)
- qmlRegisterType<QQuickTumblerAttached>();
+ qmlRegisterAnonymousType<QQuickTumblerAttached>(uri, 2);
qmlRegisterType<QQuickTumbler>(uri, 2, 0, "Tumbler");
#endif
@@ -245,7 +245,7 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri)
qmlRegisterType<QQuickContainer, 1>(uri, 2, 1, "Container");
qmlRegisterType<QQuickDialog>(uri, 2, 1, "Dialog");
qmlRegisterType<QQuickDialogButtonBox>(uri, 2, 1, "DialogButtonBox");
- qmlRegisterType<QQuickDialogButtonBoxAttached>();
+ qmlRegisterAnonymousType<QQuickDialogButtonBoxAttached>(uri, 2);
qmlRegisterType<QQuickMenuSeparator>(uri, 2, 1, "MenuSeparator");
qmlRegisterType<QQuickPage, 1>(uri, 2, 1, "Page");
qmlRegisterType<QQuickPopup, 1>(uri, 2, 1, "Popup");
@@ -285,7 +285,7 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri)
// make revisioned properties available to their subclasses (synced with Qt 5.9)
qmlRegisterRevision<QQuickText, 9>(uri, 2, 2);
qmlRegisterRevision<QQuickTextInput, 9>(uri, 2, 2);
- qmlRegisterRevision<QQuickWindowQmlImpl, 2>(uri, 2, 2);
+ qmlRegisterRevision<QQuickWindowQmlImpl, 3>(uri, 2, 2);
// QtQuick.Templates 2.3 (new types and revisions in Qt 5.10)
qmlRegisterType<QQuickAbstractButton, 3>(uri, 2, 3, "AbstractButton");
@@ -297,7 +297,7 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri)
qmlRegisterType<QQuickContainer, 3>(uri, 2, 3, "Container");
qmlRegisterType<QQuickDialog, 3>(uri, 2, 3, "Dialog");
qmlRegisterType<QQuickDialogButtonBox, 3>(uri, 2, 3, "DialogButtonBox");
- qmlRegisterType<QQuickIcon>();
+ qmlRegisterAnonymousType<QQuickIcon>(uri, 2);
qRegisterMetaType<QQuickIcon>();
qmlRegisterType<QQuickLabel, 3>(uri, 2, 3, "Label");
qmlRegisterType<QQuickMenu, 3>(uri, 2, 3, "Menu");
@@ -305,7 +305,7 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri)
qmlRegisterType<QQuickMenuBarItem>(uri, 2, 3, "MenuBarItem");
qmlRegisterType<QQuickMenuItem, 3>(uri, 2, 3, "MenuItem");
qmlRegisterUncreatableType<QQuickOverlay>(uri, 2, 3, "Overlay", QStringLiteral("Overlay is only available as an attached property."));
- qmlRegisterType<QQuickOverlayAttached>();
+ qmlRegisterAnonymousType<QQuickOverlayAttached>(uri, 2);
qmlRegisterType<QQuickPopup, 3>(uri, 2, 3, "Popup");
qmlRegisterType<QQuickRangeSlider, 3>(uri, 2, 3, "RangeSlider");
qmlRegisterType<QQuickScrollBar, 3>(uri, 2, 3, "ScrollBar");
@@ -341,7 +341,7 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri)
qmlRegisterType<QQuickLabel, 5>(uri, 2, 5, "Label");
qmlRegisterType<QQuickPage, 5>(uri, 2, 5, "Page");
qmlRegisterType<QQuickPopup, 5>(uri, 2, 5, "Popup");
- qmlRegisterType<QQuickPopupAnchors>();
+ qmlRegisterAnonymousType<QQuickPopupAnchors>(uri, 2);
qmlRegisterType<QQuickRangeSlider, 5>(uri, 2, 5, "RangeSlider");
qmlRegisterType<QQuickSlider, 5>(uri, 2, 5, "Slider");
qmlRegisterType<QQuickSpinBox, 5>(uri, 2, 5, "SpinBox");
@@ -351,10 +351,13 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri)
// QtQuick.Templates 2.13 (new types and revisions in Qt 5.13)
qmlRegisterType<QQuickSplitView>(uri, 2, 13, "SplitView");
- qmlRegisterType<QQuickSplitViewAttached>();
+ qmlRegisterAnonymousType<QQuickSplitViewAttached>(uri, 2);
qmlRegisterUncreatableType<QQuickSplitHandleAttached>(uri, 2, 13, "SplitHandle",
QStringLiteral("SplitHandle is only available as an attached property."));
- qmlRegisterType<QQuickSplitHandleAttached>();
+ qmlRegisterAnonymousType<QQuickSplitHandleAttached>(uri, 2);
+
+ // QtQuick.Templates 2.14 (new types and revisions in Qt 5.14)
+ qmlRegisterType<QQuickComboBox, 14>(uri, 2, 14, "ComboBox");
}
QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquickattachedobject.cpp b/src/quickcontrols2/qquickattachedobject.cpp
index 8b75e42a..722f22f9 100644
--- a/src/quickcontrols2/qquickattachedobject.cpp
+++ b/src/quickcontrols2/qquickattachedobject.cpp
@@ -48,8 +48,8 @@ static QQuickAttachedObject *attachedObject(const QMetaObject *type, QObject *ob
{
if (!object)
return nullptr;
- int idx = -1;
- return qobject_cast<QQuickAttachedObject *>(qmlAttachedPropertiesObject(&idx, object, type, create));
+ auto func = qmlAttachedPropertiesFunction(object, type);
+ return qobject_cast<QQuickAttachedObject *>(qmlAttachedPropertiesObject(object, func, create));
}
static QQuickAttachedObject *findAttachedParent(const QMetaObject *type, QObject *object)
@@ -119,7 +119,7 @@ static QList<QQuickAttachedObject *> findAttachedChildren(const QMetaObject *typ
if (window) {
item = window->contentItem();
- const auto windowChildren = window->children();
+ const auto &windowChildren = window->children();
for (QObject *child : windowChildren) {
QQuickWindow *childWindow = qobject_cast<QQuickWindow *>(child);
if (childWindow) {
diff --git a/src/quickcontrols2/qquickiconlabel.cpp b/src/quickcontrols2/qquickiconlabel.cpp
index b246621b..536b3c1b 100644
--- a/src/quickcontrols2/qquickiconlabel.cpp
+++ b/src/quickcontrols2/qquickiconlabel.cpp
@@ -408,7 +408,7 @@ QString QQuickIconLabel::text() const
return d->text;
}
-void QQuickIconLabel::setText(const QString text)
+void QQuickIconLabel::setText(const QString &text)
{
Q_D(QQuickIconLabel);
if (d->text == text)
diff --git a/src/quickcontrols2/qquickiconlabel_p.h b/src/quickcontrols2/qquickiconlabel_p.h
index df79dbf2..75b77064 100644
--- a/src/quickcontrols2/qquickiconlabel_p.h
+++ b/src/quickcontrols2/qquickiconlabel_p.h
@@ -88,7 +88,7 @@ public:
void setIcon(const QQuickIcon &icon);
QString text() const;
- void setText(const QString text);
+ void setText(const QString &text);
QFont font() const;
void setFont(const QFont &font);
diff --git a/src/quickcontrols2/qquickmnemoniclabel.cpp b/src/quickcontrols2/qquickmnemoniclabel.cpp
index a006f076..193365b5 100644
--- a/src/quickcontrols2/qquickmnemoniclabel.cpp
+++ b/src/quickcontrols2/qquickmnemoniclabel.cpp
@@ -88,7 +88,7 @@ static QTextLayout::FormatRange underlineRange(int start, int length = 1)
// based on QPlatformTheme::removeMnemonics()
void QQuickMnemonicLabel::updateMnemonic()
{
- QString text(m_fullText.size(), 0);
+ QString text(m_fullText.size(), QChar::Null);
int idx = 0;
int pos = 0;
int len = m_fullText.length();
diff --git a/src/quickcontrols2/qquickstyle.cpp b/src/quickcontrols2/qquickstyle.cpp
index e2b6678b..408a0de3 100644
--- a/src/quickcontrols2/qquickstyle.cpp
+++ b/src/quickcontrols2/qquickstyle.cpp
@@ -495,7 +495,7 @@ static bool qt_is_dark_system_theme()
{
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
if (const QPalette *systemPalette = theme->palette(QPlatformTheme::SystemPalette)) {
- const QColor textColor = systemPalette->color(QPalette::WindowText);
+ const QColor &textColor = systemPalette->color(QPalette::WindowText);
return textColor.red() > 128 && textColor.blue() > 128 && textColor.green() > 128;
}
}
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
index 8dc70934..21eecfe1 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -43,13 +43,14 @@
#include <QtCore/qregularexpression.h>
#include <QtCore/qabstractitemmodel.h>
+#include <QtCore/qglobal.h>
#include <QtGui/qinputmethod.h>
#include <QtGui/qguiapplication.h>
#include <QtGui/qpa/qplatformtheme.h>
#include <QtQml/qjsvalue.h>
#include <QtQml/qqmlcontext.h>
#include <QtQml/private/qlazilyallocated_p.h>
-#include <QtQml/private/qqmldelegatemodel_p.h>
+#include <private/qqmldelegatemodel_p.h>
#include <QtQuick/private/qquickevents_p_p.h>
#include <QtQuick/private/qquicktextinput_p.h>
#include <QtQuick/private/qquickitemview_p.h>
@@ -103,18 +104,14 @@ QT_BEGIN_NAMESPACE
When using models that have multiple named roles, ComboBox must be configured
to use a specific \l {textRole}{text role} for its \l {displayText}{display text}
- and \l delegate instances.
+ and \l delegate instances. If you want to use a role of the model item
+ that corresponds to the text role, set \l valueRole. The \l currentValue
+ property and \l indexOfValue() method can then be used to get information
+ about those values.
- \code
- ComboBox {
- textRole: "key"
- model: ListModel {
- ListElement { key: "First"; value: 123 }
- ListElement { key: "Second"; value: 456 }
- ListElement { key: "Third"; value: 789 }
- }
- }
- \endcode
+ For example:
+
+ \snippet qtquickcontrols2-combobox-valuerole.qml file
\note If ComboBox is assigned a data model that has multiple named roles, but
\l textRole is not defined, ComboBox is unable to visualize it and throws a
@@ -183,7 +180,7 @@ class QQuickComboBoxDelegateModel : public QQmlDelegateModel
{
public:
explicit QQuickComboBoxDelegateModel(QQuickComboBox *combo);
- QString stringValue(int index, const QString &role) override;
+ QVariant variantValue(int index, const QString &role) override;
private:
QQuickComboBox *combo = nullptr;
@@ -195,23 +192,23 @@ QQuickComboBoxDelegateModel::QQuickComboBoxDelegateModel(QQuickComboBox *combo)
{
}
-QString QQuickComboBoxDelegateModel::stringValue(int index, const QString &role)
+QVariant QQuickComboBoxDelegateModel::variantValue(int index, const QString &role)
{
- QVariant model = combo->model();
+ const QVariant model = combo->model();
if (model.userType() == QMetaType::QVariantList) {
QVariant object = model.toList().value(index);
if (object.userType() == QMetaType::QVariantMap) {
const QVariantMap data = object.toMap();
if (data.count() == 1 && role == QLatin1String("modelData"))
- return data.first().toString();
- return data.value(role).toString();
+ return data.first();
+ return data.value(role);
} else if (object.userType() == QMetaType::QObjectStar) {
const QObject *data = object.value<QObject *>();
if (data && role != QLatin1String("modelData"))
- return data->property(role.toUtf8()).toString();
+ return data->property(role.toUtf8());
}
}
- return QQmlDelegateModel::stringValue(index, role);
+ return QQmlDelegateModel::variantValue(index, role);
}
class QQuickComboBoxPrivate : public QQuickControlPrivate
@@ -234,6 +231,14 @@ public:
void updateEditText();
void updateCurrentText();
+ void updateCurrentValue();
+ void updateCurrentText(bool hasDelegateModelObject);
+ void updateCurrentValue(bool hasDelegateModelObject);
+ void updateCurrentTextAndValue();
+
+ bool isValidIndex(int index) const;
+ QString fastTextAt(int index) const;
+ QVariant fastValueAt(int index) const;
void acceptInput();
QString tryComplete(const QString &inputText);
@@ -277,6 +282,8 @@ public:
QString textRole;
QString currentText;
QString displayText;
+ QString valueRole;
+ QVariant currentValue;
QQuickItem *pressedItem = nullptr;
QQmlInstanceModel *delegateModel = nullptr;
QQmlComponent *delegate = nullptr;
@@ -434,10 +441,34 @@ void QQuickComboBoxPrivate::updateEditText()
q->setEditText(text);
}
+// We have these two rather than just using default arguments
+// because QObjectPrivate::connect() doesn't accept lambdas.
void QQuickComboBoxPrivate::updateCurrentText()
{
+ updateCurrentText(false);
+}
+
+void QQuickComboBoxPrivate::updateCurrentValue()
+{
+ updateCurrentValue(false);
+}
+
+void QQuickComboBoxPrivate::updateCurrentText(bool hasDelegateModelObject)
+{
Q_Q(QQuickComboBox);
- QString text = q->textAt(currentIndex);
+ QString text;
+ // If a delegate model object was passed in, it means the calling code
+ // has decided to reuse it for several function calls to speed things up.
+ // So, use the faster (private) version in that case.
+ // For other cases, we use the version that creates the delegate model object
+ // itself in order to have neater, more convenient calling code.
+ if (isValidIndex(currentIndex)) {
+ if (hasDelegateModelObject)
+ text = fastTextAt(currentIndex);
+ else
+ text = q->textAt(currentIndex);
+ }
+
if (currentText != text) {
currentText = text;
if (!hasDisplayText)
@@ -452,6 +483,58 @@ void QQuickComboBoxPrivate::updateCurrentText()
q->setEditText(currentText);
}
+void QQuickComboBoxPrivate::updateCurrentValue(bool hasDelegateModelObject)
+{
+ Q_Q(QQuickComboBox);
+ QVariant value;
+ // If a delegate model object was passed in, it means the calling code
+ // has decided to reuse it for several function calls to speed things up.
+ // So, use the faster (private) version in that case.
+ if (isValidIndex(currentIndex)) {
+ if (hasDelegateModelObject)
+ value = fastValueAt(currentIndex);
+ else
+ value = q->valueAt(currentIndex);
+ }
+ if (currentValue == value)
+ return;
+
+ currentValue = value;
+ emit q->currentValueChanged();
+}
+
+void QQuickComboBoxPrivate::updateCurrentTextAndValue()
+{
+ QObject *object = nullptr;
+ // For performance reasons, we reuse the same delegate model object: QTBUG-76029.
+ if (isValidIndex(currentIndex))
+ object = delegateModel->object(currentIndex);
+ const bool hasDelegateModelObject = object != nullptr;
+ updateCurrentText(hasDelegateModelObject);
+ updateCurrentValue(hasDelegateModelObject);
+ if (object)
+ delegateModel->release(object);
+}
+
+bool QQuickComboBoxPrivate::isValidIndex(int index) const
+{
+ return delegateModel && index >= 0 && index < delegateModel->count();
+}
+
+// For performance reasons (QTBUG-76029), both this and valueAt assume that
+// the index is valid and delegateModel->object(index) has been called.
+QString QQuickComboBoxPrivate::fastTextAt(int index) const
+{
+ const QString effectiveTextRole = textRole.isEmpty() ? QStringLiteral("modelData") : textRole;
+ return delegateModel->stringValue(index, effectiveTextRole);
+}
+
+QVariant QQuickComboBoxPrivate::fastValueAt(int index) const
+{
+ const QString effectiveValueRole = valueRole.isEmpty() ? QStringLiteral("modelData") : valueRole;
+ return delegateModel->variantValue(index, effectiveValueRole);
+}
+
void QQuickComboBoxPrivate::acceptInput()
{
Q_Q(QQuickComboBox);
@@ -499,7 +582,7 @@ void QQuickComboBoxPrivate::setCurrentIndex(int index, Activation activate)
emit q->currentIndexChanged();
if (componentComplete)
- updateCurrentText();
+ updateCurrentTextAndValue();
if (activate)
emit q->activated(index);
@@ -820,10 +903,14 @@ void QQuickComboBox::setModel(const QVariant& m)
if (d->model == model)
return;
- if (QAbstractItemModel* aim = qvariant_cast<QAbstractItemModel *>(d->model))
- QObjectPrivate::disconnect(aim, &QAbstractItemModel::dataChanged, d, &QQuickComboBoxPrivate::updateCurrentText);
- if (QAbstractItemModel* aim = qvariant_cast<QAbstractItemModel *>(model))
- QObjectPrivate::connect(aim, &QAbstractItemModel::dataChanged, d, &QQuickComboBoxPrivate::updateCurrentText);
+ if (QAbstractItemModel* aim = qvariant_cast<QAbstractItemModel *>(d->model)) {
+ QObjectPrivate::disconnect(aim, &QAbstractItemModel::dataChanged,
+ d, QOverload<>::of(&QQuickComboBoxPrivate::updateCurrentText));
+ }
+ if (QAbstractItemModel* aim = qvariant_cast<QAbstractItemModel *>(model)) {
+ QObjectPrivate::connect(aim, &QAbstractItemModel::dataChanged,
+ d, QOverload<>::of(&QQuickComboBoxPrivate::updateCurrentText));
+ }
d->model = model;
d->createDelegateModel();
@@ -1008,6 +1095,35 @@ void QQuickComboBox::setTextRole(const QString &role)
}
/*!
+ \since QtQuick.Controls 2.14 (Qt 5.14)
+ \qmlproperty string QtQuick.Controls::ComboBox::valueRole
+
+ This property holds the model role used for storing the value associated
+ with each item in the model.
+
+ For an example of how to use this property, see \l {ComboBox Model Roles}.
+
+ \sa model, currentValue
+*/
+QString QQuickComboBox::valueRole() const
+{
+ Q_D(const QQuickComboBox);
+ return d->valueRole;
+}
+
+void QQuickComboBox::setValueRole(const QString &role)
+{
+ Q_D(QQuickComboBox);
+ if (d->valueRole == role)
+ return;
+
+ d->valueRole = role;
+ if (isComponentComplete())
+ d->updateCurrentValue();
+ emit valueRoleChanged();
+}
+
+/*!
\qmlproperty Component QtQuick.Controls::ComboBox::delegate
This property holds a delegate that presents an item in the combo box popup.
@@ -1445,6 +1561,58 @@ qreal QQuickComboBox::implicitIndicatorHeight() const
}
/*!
+ \readonly
+ \since QtQuick.Controls 2.14 (Qt 5.14)
+ \qmlproperty string QtQuick.Controls::ComboBox::currentValue
+
+ This property holds the value of the current item in the combo box.
+
+ For an example of how to use this property, see \l {ComboBox Model Roles}.
+
+ \sa currentIndex, currentText, valueRole
+*/
+QVariant QQuickComboBox::currentValue() const
+{
+ Q_D(const QQuickComboBox);
+ return d->currentValue;
+}
+
+QVariant QQuickComboBox::valueAt(int index) const
+{
+ Q_D(const QQuickComboBox);
+ if (!d->isValidIndex(index))
+ return QVariant();
+
+ QObject *object = d->delegateModel->object(index);
+ QVariant value;
+ if (object) {
+ value = d->fastValueAt(index);
+ d->delegateModel->release(object);
+ }
+ return value;
+}
+
+/*!
+ \since QtQuick.Controls 2.14 (Qt 5.14)
+ \qmlmethod int QtQuick.Controls::ComboBox::indexOfValue(object value)
+
+ Returns the index of the specified \a value, or \c -1 if no match is found.
+
+ For an example of how to use this method, see \l {ComboBox Model Roles}.
+
+ \sa find(), currentValue, currentIndex, valueRole
+*/
+int QQuickComboBox::indexOfValue(const QVariant &value) const
+{
+ for (int i = 0; i < count(); ++i) {
+ const QVariant ourValue = valueAt(i);
+ if (value == ourValue)
+ return i;
+ }
+ return -1;
+}
+
+/*!
\qmlmethod string QtQuick.Controls::ComboBox::textAt(int index)
Returns the text for the specified \a index, or an empty string
@@ -1455,13 +1623,13 @@ qreal QQuickComboBox::implicitIndicatorHeight() const
QString QQuickComboBox::textAt(int index) const
{
Q_D(const QQuickComboBox);
- if (!d->delegateModel || index < 0 || index >= d->delegateModel->count())
+ if (!d->isValidIndex(index))
return QString();
- QString text;
QObject *object = d->delegateModel->object(index);
+ QString text;
if (object) {
- text = d->delegateModel->stringValue(index, d->textRole.isEmpty() ? QStringLiteral("modelData") : d->textRole);
+ text = d->fastTextAt(index);
d->delegateModel->release(object);
}
return text;
@@ -1731,7 +1899,7 @@ void QQuickComboBox::componentComplete()
if (!d->hasCurrentIndex && d->currentIndex == -1)
setCurrentIndex(0);
else
- d->updateCurrentText();
+ d->updateCurrentTextAndValue();
}
}
diff --git a/src/quicktemplates2/qquickcombobox_p.h b/src/quicktemplates2/qquickcombobox_p.h
index 75e535a9..c9063d6a 100644
--- a/src/quicktemplates2/qquickcombobox_p.h
+++ b/src/quicktemplates2/qquickcombobox_p.h
@@ -86,6 +86,9 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickComboBox : public QQuickControl
Q_PROPERTY(qreal implicitIndicatorWidth READ implicitIndicatorWidth NOTIFY implicitIndicatorWidthChanged FINAL REVISION 5)
Q_PROPERTY(qreal implicitIndicatorHeight READ implicitIndicatorHeight NOTIFY implicitIndicatorHeightChanged FINAL REVISION 5)
Q_CLASSINFO("DeferredPropertyNames", "background,contentItem,indicator,popup")
+ // 2.14 (Qt 5.14)
+ Q_PROPERTY(QVariant currentValue READ currentValue NOTIFY currentValueChanged FINAL REVISION 14)
+ Q_PROPERTY(QString valueRole READ valueRole WRITE setValueRole NOTIFY valueRoleChanged FINAL REVISION 14)
public:
explicit QQuickComboBox(QQuickItem *parent = nullptr);
@@ -114,6 +117,9 @@ public:
QString textRole() const;
void setTextRole(const QString &role);
+ QString valueRole() const;
+ void setValueRole(const QString &role);
+
QQmlComponent *delegate() const;
void setDelegate(QQmlComponent *delegate);
@@ -155,6 +161,11 @@ public:
qreal implicitIndicatorWidth() const;
qreal implicitIndicatorHeight() const;
+ // 2.14 (Qt 5.14)
+ QVariant currentValue() const;
+ Q_REVISION(14) Q_INVOKABLE QVariant valueAt(int index) const;
+ Q_REVISION(14) Q_INVOKABLE int indexOfValue(const QVariant &value) const;
+
public Q_SLOTS:
void incrementCurrentIndex();
void decrementCurrentIndex();
@@ -189,6 +200,9 @@ Q_SIGNALS:
// 2.5 (Qt 5.12)
Q_REVISION(5) void implicitIndicatorWidthChanged();
Q_REVISION(5) void implicitIndicatorHeightChanged();
+ // 2.14 (Qt 5.14)
+ Q_REVISION(14) void valueRoleChanged();
+ Q_REVISION(14) void currentValueChanged();
protected:
bool eventFilter(QObject *object, QEvent *event) override;
diff --git a/src/quicktemplates2/qquickcontainer_p_p.h b/src/quicktemplates2/qquickcontainer_p_p.h
index 16e9c9f6..1a251b50 100644
--- a/src/quicktemplates2/qquickcontainer_p_p.h
+++ b/src/quicktemplates2/qquickcontainer_p_p.h
@@ -50,7 +50,7 @@
#include <QtQuickTemplates2/private/qquickcontainer_p.h>
#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>
-#include <QtQml/private/qqmlobjectmodel_p.h>
+#include <private/qqmlobjectmodel_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/quicktemplates2/qquickmenu.cpp b/src/quicktemplates2/qquickmenu.cpp
index 67e2d806..91372777 100644
--- a/src/quicktemplates2/qquickmenu.cpp
+++ b/src/quicktemplates2/qquickmenu.cpp
@@ -53,7 +53,7 @@
#include <QtQml/private/qv4scopedvalue_p.h>
#include <QtQml/private/qv4variantobject_p.h>
#include <QtQml/private/qv4qobjectwrapper_p.h>
-#include <QtQml/private/qqmlobjectmodel_p.h>
+#include <private/qqmlobjectmodel_p.h>
#include <QtQuick/private/qquickitem_p.h>
#include <QtQuick/private/qquickitemchangelistener_p.h>
#include <QtQuick/private/qquickitemview_p.h>
diff --git a/src/quicktemplates2/qquickpresshandler.cpp b/src/quicktemplates2/qquickpresshandler.cpp
index 8df25a82..b9018573 100644
--- a/src/quicktemplates2/qquickpresshandler.cpp
+++ b/src/quicktemplates2/qquickpresshandler.cpp
@@ -41,6 +41,8 @@
#include <QtGui/qstylehints.h>
#include <QtQuick/qquickitem.h>
#include <QtQuick/private/qquickevents_p_p.h>
+#include <QtQuickTemplates2/private/qquicktextarea_p.h>
+#include <QtQuickTemplates2/private/qquicktextfield_p.h>
QT_BEGIN_NAMESPACE
@@ -55,11 +57,7 @@ void QQuickPressHandler::mousePressEvent(QMouseEvent *event)
timer.stop();
}
- if (pressedSignalIndex == -1)
- pressedSignalIndex = control->metaObject()->indexOfSignal("pressed(QQuickMouseEvent*)");
- Q_ASSERT(pressedSignalIndex != -1);
-
- if (QObjectPrivate::get(control)->isSignalConnected(pressedSignalIndex)) {
+ if (isSignalConnected(control, "pressed(QQuickMouseEvent*)", pressedSignalIndex)) {
QQuickMouseEvent mev;
mev.reset(pressPos.x(), pressPos.y(), event->button(), event->buttons(),
QGuiApplication::keyboardModifiers(), false/*isClick*/, false/*wasHeld*/);
@@ -82,11 +80,7 @@ void QQuickPressHandler::mouseReleaseEvent(QMouseEvent *event)
if (!longPress) {
timer.stop();
- if (releasedSignalIndex == -1)
- releasedSignalIndex = control->metaObject()->indexOfSignal("released(QQuickMouseEvent*)");
- Q_ASSERT(releasedSignalIndex != -1);
-
- if (QObjectPrivate::get(control)->isSignalConnected(releasedSignalIndex)) {
+ if (isSignalConnected(control, "released(QQuickMouseEvent*)", releasedSignalIndex)) {
QQuickMouseEvent mev;
mev.reset(pressPos.x(), pressPos.y(), event->button(), event->buttons(),
QGuiApplication::keyboardModifiers(), false/*isClick*/, false/*wasHeld*/);
@@ -104,11 +98,7 @@ void QQuickPressHandler::timerEvent(QTimerEvent *)
timer.stop();
clearDelayedMouseEvent();
- if (pressAndHoldSignalIndex == -1)
- pressAndHoldSignalIndex = control->metaObject()->indexOfSignal("pressAndHold(QQuickMouseEvent*)");
- Q_ASSERT(pressAndHoldSignalIndex != -1);
-
- longPress = QObjectPrivate::get(control)->isSignalConnected(pressAndHoldSignalIndex);
+ longPress = isSignalConnected(control, "pressAndHold(QQuickMouseEvent*)", pressAndHoldSignalIndex);
if (longPress) {
QQuickMouseEvent mev;
mev.reset(pressPos.x(), pressPos.y(), Qt::LeftButton, Qt::LeftButton,
@@ -136,4 +126,19 @@ bool QQuickPressHandler::isActive()
return !(timer.isActive() || longPress);
}
+bool QQuickPressHandler::isSignalConnected(QQuickItem *item, const char *signalName, int &signalIndex)
+{
+ if (signalIndex == -1)
+ signalIndex = item->metaObject()->indexOfSignal(signalName);
+ Q_ASSERT(signalIndex != -1);
+ const auto signalMetaMethod = item->metaObject()->method(signalIndex);
+ if (QQuickTextArea *textArea = qobject_cast<QQuickTextArea*>(item)) {
+ return textArea->isSignalConnected(signalMetaMethod);
+ } else if (QQuickTextField *textField = qobject_cast<QQuickTextField*>(item)) {
+ return textField->isSignalConnected(signalMetaMethod);
+ }
+ qFatal("Unhandled control type for signal name: %s", signalName);
+ return false;
+}
+
QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickpresshandler_p_p.h b/src/quicktemplates2/qquickpresshandler_p_p.h
index 99ef94bd..19312cdd 100644
--- a/src/quicktemplates2/qquickpresshandler_p_p.h
+++ b/src/quicktemplates2/qquickpresshandler_p_p.h
@@ -67,6 +67,8 @@ struct QQuickPressHandler
void clearDelayedMouseEvent();
bool isActive();
+ static bool isSignalConnected(QQuickItem *item, const char *signalName, int &signalIndex);
+
QQuickItem *control = nullptr;
QBasicTimer timer;
QPointF pressPos;
diff --git a/src/quicktemplates2/qquickstackview_p_p.h b/src/quicktemplates2/qquickstackview_p_p.h
index 74ea3e7a..c20ce776 100644
--- a/src/quicktemplates2/qquickstackview_p_p.h
+++ b/src/quicktemplates2/qquickstackview_p_p.h
@@ -54,6 +54,7 @@
#include <QtQuick/private/qquickitemchangelistener_p.h>
#include <QtQml/private/qv4value_p.h>
#include <QtCore/qset.h>
+#include <QtCore/qstack.h>
QT_BEGIN_NAMESPACE
diff --git a/src/quicktemplates2/qquicktextarea_p.h b/src/quicktemplates2/qquicktextarea_p.h
index 3c38dabf..15182a84 100644
--- a/src/quicktemplates2/qquicktextarea_p.h
+++ b/src/quicktemplates2/qquicktextarea_p.h
@@ -164,6 +164,8 @@ Q_SIGNALS:
Q_REVISION(5) void bottomInsetChanged();
protected:
+ friend struct QQuickPressHandler;
+
void classBegin() override;
void componentComplete() override;
diff --git a/src/quicktemplates2/qquicktextfield_p.h b/src/quicktemplates2/qquicktextfield_p.h
index d0d25d70..ae2681d1 100644
--- a/src/quicktemplates2/qquicktextfield_p.h
+++ b/src/quicktemplates2/qquicktextfield_p.h
@@ -159,6 +159,8 @@ Q_SIGNALS:
Q_REVISION(5) void bottomInsetChanged();
protected:
+ friend struct QQuickPressHandler;
+
void classBegin() override;
void componentComplete() override;
diff --git a/src/quicktemplates2/quicktemplates2.pro b/src/quicktemplates2/quicktemplates2.pro
index 13b4f0e8..8ed0151a 100644
--- a/src/quicktemplates2/quicktemplates2.pro
+++ b/src/quicktemplates2/quicktemplates2.pro
@@ -3,6 +3,7 @@ MODULE = quicktemplates2
QT += quick
QT_PRIVATE += core-private gui-private qml-private quick-private
+qtHaveModule(qmlmodels): QT += qmlmodels-private
DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
diff --git a/tests/auto/accessibility/tst_accessibility.cpp b/tests/auto/accessibility/tst_accessibility.cpp
index 868b4413..0c2f2e74 100644
--- a/tests/auto/accessibility/tst_accessibility.cpp
+++ b/tests/auto/accessibility/tst_accessibility.cpp
@@ -132,10 +132,10 @@ void tst_accessibility::a11y()
QString fn = name;
#if !QT_CONFIG(accessibility)
- if (name == QLatin1Literal("dayofweekrow")
- || name == QLatin1Literal("monthgrid")
- || name == QLatin1Literal("weeknumbercolumn"))
- fn += QLatin1Literal("-2");
+ if (name == QLatin1String("dayofweekrow")
+ || name == QLatin1String("monthgrid")
+ || name == QLatin1String("weeknumbercolumn"))
+ fn += QLatin1String("-2");
#endif
QQmlComponent component(&engine);
@@ -154,9 +154,9 @@ void tst_accessibility::a11y()
#if QT_CONFIG(accessibility)
QQuickAccessibleAttached *acc = QQuickAccessibleAttached::attachedProperties(item);
- if (name != QLatin1Literal("dayofweekrow")
- && name != QLatin1Literal("monthgrid")
- && name != QLatin1Literal("weeknumbercolumn")) {
+ if (name != QLatin1String("dayofweekrow")
+ && name != QLatin1String("monthgrid")
+ && name != QLatin1String("weeknumbercolumn")) {
if (QAccessible::isActive()) {
QVERIFY(acc);
} else {
diff --git a/tests/auto/calendar/data/tst_monthgrid.qml b/tests/auto/calendar/data/tst_monthgrid.qml
index 25c8378b..6d125712 100644
--- a/tests/auto/calendar/data/tst_monthgrid.qml
+++ b/tests/auto/calendar/data/tst_monthgrid.qml
@@ -148,28 +148,29 @@ TestCase {
control.month = 0
compare(control.month, 0)
- ignoreWarning(Qt.resolvedUrl("tst_monthgrid.qml") + ":65:9: QML AbstractMonthGrid: month -1 is out of range [0...11]")
+
+ ignoreWarning(/tst_monthgrid.qml:65:9: QML (Abstract)?MonthGrid: month -1 is out of range \[0...11\]$/)
control.month = -1
compare(control.month, 0)
control.month = 11
compare(control.month, 11)
- ignoreWarning(Qt.resolvedUrl("tst_monthgrid.qml") + ":65:9: QML AbstractMonthGrid: month 12 is out of range [0...11]")
+ ignoreWarning(/tst_monthgrid.qml:65:9: QML (Abstract)?MonthGrid: month 12 is out of range \[0...11\]$/)
control.month = 12
compare(control.month, 11)
control.year = -271820
compare(control.year, -271820)
- ignoreWarning(Qt.resolvedUrl("tst_monthgrid.qml") + ":65:9: QML AbstractMonthGrid: year -271821 is out of range [-271820...275759]")
+ ignoreWarning(/tst_monthgrid.qml:65:9: QML (Abstract)?MonthGrid: year -271821 is out of range \[-271820...275759\]$/)
control.year = -271821
compare(control.year, -271820)
control.year = 275759
compare(control.year, 275759)
- ignoreWarning(Qt.resolvedUrl("tst_monthgrid.qml") + ":65:9: QML AbstractMonthGrid: year 275760 is out of range [-271820...275759]")
+ ignoreWarning(/tst_monthgrid.qml:65:9: QML (Abstract)?MonthGrid: year 275760 is out of range \[-271820...275759\]$/)
control.year = 275760
compare(control.year, 275759)
diff --git a/tests/auto/calendar/data/tst_weeknumbercolumn.qml b/tests/auto/calendar/data/tst_weeknumbercolumn.qml
index f94fed43..d1b50339 100644
--- a/tests/auto/calendar/data/tst_weeknumbercolumn.qml
+++ b/tests/auto/calendar/data/tst_weeknumbercolumn.qml
@@ -93,28 +93,28 @@ TestCase {
control.month = 0
compare(control.month, 0)
- ignoreWarning(Qt.resolvedUrl("tst_weeknumbercolumn.qml") + ":65:9: QML AbstractWeekNumberColumn: month -1 is out of range [0...11]")
+ ignoreWarning(/tst_weeknumbercolumn.qml:65:9: QML (Abstract)?WeekNumberColumn: month -1 is out of range \[0...11\]$/)
control.month = -1
compare(control.month, 0)
control.month = 11
compare(control.month, 11)
- ignoreWarning(Qt.resolvedUrl("tst_weeknumbercolumn.qml") + ":65:9: QML AbstractWeekNumberColumn: month 12 is out of range [0...11]")
+ ignoreWarning(/tst_weeknumbercolumn.qml:65:9: QML (Abstract)?WeekNumberColumn: month 12 is out of range \[0...11\]$/)
control.month = 12
compare(control.month, 11)
control.year = -271820
compare(control.year, -271820)
- ignoreWarning(Qt.resolvedUrl("tst_weeknumbercolumn.qml") + ":65:9: QML AbstractWeekNumberColumn: year -271821 is out of range [-271820...275759]")
+ ignoreWarning(/tst_weeknumbercolumn.qml:65:9: QML (Abstract)?WeekNumberColumn: year -271821 is out of range \[-271820...275759\]$/)
control.year = -271821
compare(control.year, -271820)
control.year = 275759
compare(control.year, 275759)
- ignoreWarning(Qt.resolvedUrl("tst_weeknumbercolumn.qml") + ":65:9: QML AbstractWeekNumberColumn: year 275760 is out of range [-271820...275759]")
+ ignoreWarning(/tst_weeknumbercolumn.qml:65:9: QML (Abstract)?WeekNumberColumn: year 275760 is out of range \[-271820...275759\]$/)
control.year = 275760
compare(control.year, 275759)
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml
index f8f06679..2cf71f73 100644
--- a/tests/auto/controls/data/tst_combobox.qml
+++ b/tests/auto/controls/data/tst_combobox.qml
@@ -384,9 +384,73 @@ TestCase {
compare(control.find(data.term, data.flags), data.index)
}
+ function test_valueRole_data() {
+ return [
+ { tag: "ListModel", model: fruitmodel },
+ { tag: "ObjectArray", model: fruitarray }
+ ]
+ }
+
+ function test_valueRole(data) {
+ var control = createTemporaryObject(emptyBox, testCase,
+ { model: data.model, valueRole: "color" })
+ verify(control)
+ compare(control.count, 3)
+ compare(control.currentIndex, 0)
+ compare(control.currentValue, "red")
+
+ control.valueRole = "name"
+ compare(control.currentValue, "Apple")
+
+ control.currentIndex = 1
+ compare(control.currentIndex, 1)
+ compare(control.currentValue, "Orange")
+
+ control.valueRole = "color"
+ compare(control.currentValue, "orange")
+
+ control.model = null
+ compare(control.currentIndex, -1)
+ // An invalid QVariant is represented as undefined.
+ compare(control.currentValue, undefined)
+
+ control.valueRole = ""
+ compare(control.currentValue, undefined)
+ }
+
+ function test_valueAt() {
+ var control = createTemporaryObject(comboBox, testCase,
+ { model: fruitmodel, textRole: "name", valueRole: "color" })
+ verify(control)
+
+ compare(control.valueAt(0), "red")
+ compare(control.valueAt(1), "orange")
+ compare(control.valueAt(2), "yellow")
+ compare(control.valueAt(-1), undefined)
+ compare(control.valueAt(5), undefined)
+ }
+
+ function test_indexOfValue_data() {
+ return [
+ { tag: "red", expectedIndex: 0 },
+ { tag: "orange", expectedIndex: 1 },
+ { tag: "yellow", expectedIndex: 2 },
+ { tag: "brown", expectedIndex: -1 },
+ ]
+ }
+
+ function test_indexOfValue(data) {
+ var control = createTemporaryObject(comboBox, testCase,
+ { model: fruitmodel, textRole: "name", valueRole: "color" })
+ verify(control)
+
+ compare(control.indexOfValue(data.tag), data.expectedIndex)
+ }
+
function test_arrowKeys() {
- var control = createTemporaryObject(comboBox, testCase, {model: 3})
+ var control = createTemporaryObject(comboBox, testCase,
+ { model: fruitmodel, textRole: "name", valueRole: "color" })
verify(control)
var activatedSpy = signalSpy.createObject(control, {target: control, signalName: "activated"})
diff --git a/tests/auto/controls/data/tst_scrollbar.qml b/tests/auto/controls/data/tst_scrollbar.qml
index 0051b785..9d21fa8b 100644
--- a/tests/auto/controls/data/tst_scrollbar.qml
+++ b/tests/auto/controls/data/tst_scrollbar.qml
@@ -67,7 +67,10 @@ TestCase {
Component {
id: scrollBar
- ScrollBar { padding: 0 }
+ ScrollBar {
+ padding: 0
+ minimumSize: 0
+ }
}
Component {
diff --git a/tests/auto/controls/default/BLACKLIST b/tests/auto/controls/default/BLACKLIST
deleted file mode 100644
index 1e63fcb0..00000000
--- a/tests/auto/controls/default/BLACKLIST
+++ /dev/null
@@ -1,3 +0,0 @@
-[Popup::test_shortcut]
-opensuse ci
-opensuse-leap ci
diff --git a/tests/auto/sanity/tst_sanity.cpp b/tests/auto/sanity/tst_sanity.cpp
index 62a1f574..bfa1ecf1 100644
--- a/tests/auto/sanity/tst_sanity.cpp
+++ b/tests/auto/sanity/tst_sanity.cpp
@@ -122,7 +122,11 @@ public:
if (!parser.parse()) {
const auto diagnosticMessages = parser.diagnosticMessages();
for (const QQmlJS::DiagnosticMessage &msg : diagnosticMessages)
+#if Q_QML_PRIVATE_API_VERSION < 5
m_errors += QString("%s:%d : %s").arg(m_fileName).arg(msg.loc.startLine).arg(msg.message);
+#else
+ m_errors += QString("%s:%d : %s").arg(m_fileName).arg(msg.line).arg(msg.message);
+#endif
return false;
}