diff options
103 files changed, 3215 insertions, 312 deletions
diff --git a/.qmake.conf b/.qmake.conf index a5831035..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.2 +MODULE_VERSION = 5.14.0 diff --git a/src/imports/calendar/plugins.qmltypes b/src/imports/calendar/plugins.qmltypes index 76902876..e004d63d 100644 --- a/src/imports/calendar/plugins.qmltypes +++ b/src/imports/calendar/plugins.qmltypes @@ -9,6 +9,280 @@ import QtQuick.tooling 1.2 Module { dependencies: ["QtQuick 2.12"] Component { + name: "QAbstractItemModel" + prototype: "QObject" + Enum { + name: "LayoutChangeHint" + values: { + "NoLayoutChangeHint": 0, + "VerticalSortHint": 1, + "HorizontalSortHint": 2 + } + } + Enum { + name: "CheckIndexOption" + values: { + "NoOption": 0, + "IndexIsValid": 1, + "DoNotUseParent": 2, + "ParentIsInvalid": 4 + } + } + Signal { + name: "dataChanged" + Parameter { name: "topLeft"; type: "QModelIndex" } + Parameter { name: "bottomRight"; type: "QModelIndex" } + Parameter { name: "roles"; type: "QVector<int>" } + } + Signal { + name: "dataChanged" + Parameter { name: "topLeft"; type: "QModelIndex" } + Parameter { name: "bottomRight"; type: "QModelIndex" } + } + Signal { + name: "headerDataChanged" + Parameter { name: "orientation"; type: "Qt::Orientation" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "layoutChanged" + Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" } + Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" } + } + Signal { + name: "layoutChanged" + Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" } + } + Signal { name: "layoutChanged" } + Signal { + name: "layoutAboutToBeChanged" + Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" } + Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" } + } + Signal { + name: "layoutAboutToBeChanged" + Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" } + } + Signal { name: "layoutAboutToBeChanged" } + Signal { + name: "rowsAboutToBeInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "rowsInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "rowsAboutToBeRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "rowsRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsAboutToBeInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsAboutToBeRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { name: "modelAboutToBeReset" } + Signal { name: "modelReset" } + Signal { + name: "rowsAboutToBeMoved" + Parameter { name: "sourceParent"; type: "QModelIndex" } + Parameter { name: "sourceStart"; type: "int" } + Parameter { name: "sourceEnd"; type: "int" } + Parameter { name: "destinationParent"; type: "QModelIndex" } + Parameter { name: "destinationRow"; type: "int" } + } + Signal { + name: "rowsMoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + Parameter { name: "destination"; type: "QModelIndex" } + Parameter { name: "row"; type: "int" } + } + Signal { + name: "columnsAboutToBeMoved" + Parameter { name: "sourceParent"; type: "QModelIndex" } + Parameter { name: "sourceStart"; type: "int" } + Parameter { name: "sourceEnd"; type: "int" } + Parameter { name: "destinationParent"; type: "QModelIndex" } + Parameter { name: "destinationColumn"; type: "int" } + } + Signal { + name: "columnsMoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + Parameter { name: "destination"; type: "QModelIndex" } + Parameter { name: "column"; type: "int" } + } + Method { name: "submit"; type: "bool" } + Method { name: "revert" } + Method { + name: "hasIndex" + type: "bool" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { + name: "hasIndex" + type: "bool" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + } + Method { + name: "index" + type: "QModelIndex" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { + name: "index" + type: "QModelIndex" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + } + Method { + name: "parent" + type: "QModelIndex" + Parameter { name: "child"; type: "QModelIndex" } + } + Method { + name: "sibling" + type: "QModelIndex" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + Parameter { name: "idx"; type: "QModelIndex" } + } + Method { + name: "rowCount" + type: "int" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { name: "rowCount"; type: "int" } + Method { + name: "columnCount" + type: "int" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { name: "columnCount"; type: "int" } + Method { + name: "hasChildren" + type: "bool" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { name: "hasChildren"; type: "bool" } + Method { + name: "data" + type: "QVariant" + Parameter { name: "index"; type: "QModelIndex" } + Parameter { name: "role"; type: "int" } + } + Method { + name: "data" + type: "QVariant" + Parameter { name: "index"; type: "QModelIndex" } + } + Method { + name: "setData" + type: "bool" + Parameter { name: "index"; type: "QModelIndex" } + Parameter { name: "value"; type: "QVariant" } + Parameter { name: "role"; type: "int" } + } + Method { + name: "setData" + type: "bool" + Parameter { name: "index"; type: "QModelIndex" } + Parameter { name: "value"; type: "QVariant" } + } + Method { + name: "headerData" + type: "QVariant" + Parameter { name: "section"; type: "int" } + Parameter { name: "orientation"; type: "Qt::Orientation" } + Parameter { name: "role"; type: "int" } + } + Method { + name: "headerData" + type: "QVariant" + Parameter { name: "section"; type: "int" } + Parameter { name: "orientation"; type: "Qt::Orientation" } + } + Method { + name: "fetchMore" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { + name: "canFetchMore" + type: "bool" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { + name: "flags" + type: "Qt::ItemFlags" + Parameter { name: "index"; type: "QModelIndex" } + } + Method { + name: "match" + type: "QModelIndexList" + Parameter { name: "start"; type: "QModelIndex" } + Parameter { name: "role"; type: "int" } + Parameter { name: "value"; type: "QVariant" } + Parameter { name: "hits"; type: "int" } + Parameter { name: "flags"; type: "Qt::MatchFlags" } + } + Method { + name: "match" + type: "QModelIndexList" + Parameter { name: "start"; type: "QModelIndex" } + Parameter { name: "role"; type: "int" } + Parameter { name: "value"; type: "QVariant" } + Parameter { name: "hits"; type: "int" } + } + Method { + name: "match" + type: "QModelIndexList" + Parameter { name: "start"; type: "QModelIndex" } + Parameter { name: "role"; type: "int" } + Parameter { name: "value"; type: "QVariant" } + } + } + Component { name: "QAbstractListModel"; prototype: "QAbstractItemModel" } + Component { name: "QQuickCalendar" prototype: "QObject" exports: ["Qt.labs.calendar/Calendar 1.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/plugins.qmltypes b/src/imports/controls/fusion/plugins.qmltypes index a70b4901..5140d1e8 100644 --- a/src/imports/controls/fusion/plugins.qmltypes +++ b/src/imports/controls/fusion/plugins.qmltypes @@ -4,7 +4,7 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Controls.Fusion 2.13' +// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Controls.Fusion 2.14' Module { dependencies: ["QtQuick.Controls 2.0"] @@ -144,6 +144,206 @@ Module { } } Component { + name: "QQuickItem" + defaultProperty: "data" + prototype: "QObject" + Enum { + name: "Flags" + values: { + "ItemClipsChildrenToShape": 1, + "ItemAcceptsInputMethod": 2, + "ItemIsFocusScope": 4, + "ItemHasContents": 8, + "ItemAcceptsDrops": 16 + } + } + Enum { + name: "TransformOrigin" + values: { + "TopLeft": 0, + "Top": 1, + "TopRight": 2, + "Left": 3, + "Center": 4, + "Right": 5, + "BottomLeft": 6, + "Bottom": 7, + "BottomRight": 8 + } + } + Property { name: "parent"; type: "QQuickItem"; isPointer: true } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "x"; type: "double" } + Property { name: "y"; type: "double" } + Property { name: "z"; type: "double" } + Property { name: "width"; type: "double" } + Property { name: "height"; type: "double" } + Property { name: "opacity"; type: "double" } + Property { name: "enabled"; type: "bool" } + Property { name: "visible"; type: "bool" } + Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true } + Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true } + Property { name: "state"; type: "string" } + Property { name: "childrenRect"; type: "QRectF"; isReadonly: true } + Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true } + Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "baselineOffset"; type: "double" } + Property { name: "clip"; type: "bool" } + Property { name: "focus"; type: "bool" } + Property { name: "activeFocus"; type: "bool"; isReadonly: true } + Property { name: "activeFocusOnTab"; revision: 1; type: "bool" } + Property { name: "rotation"; type: "double" } + Property { name: "scale"; type: "double" } + Property { name: "transformOrigin"; type: "TransformOrigin" } + Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true } + Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true } + Property { name: "smooth"; type: "bool" } + Property { name: "antialiasing"; type: "bool" } + Property { name: "implicitWidth"; type: "double" } + Property { name: "implicitHeight"; type: "double" } + Property { name: "containmentMask"; revision: 11; type: "QObject"; isPointer: true } + Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true } + Signal { + name: "childrenRectChanged" + Parameter { type: "QRectF" } + } + Signal { + name: "baselineOffsetChanged" + Parameter { type: "double" } + } + Signal { + name: "stateChanged" + Parameter { type: "string" } + } + Signal { + name: "focusChanged" + Parameter { type: "bool" } + } + Signal { + name: "activeFocusChanged" + Parameter { type: "bool" } + } + Signal { + name: "activeFocusOnTabChanged" + revision: 1 + Parameter { type: "bool" } + } + Signal { + name: "parentChanged" + Parameter { type: "QQuickItem"; isPointer: true } + } + Signal { + name: "transformOriginChanged" + Parameter { type: "TransformOrigin" } + } + Signal { + name: "smoothChanged" + Parameter { type: "bool" } + } + Signal { + name: "antialiasingChanged" + Parameter { type: "bool" } + } + Signal { + name: "clipChanged" + Parameter { type: "bool" } + } + Signal { + name: "windowChanged" + revision: 1 + Parameter { name: "window"; type: "QQuickWindow"; isPointer: true } + } + Signal { name: "containmentMaskChanged"; revision: 11 } + Method { name: "update" } + Method { + name: "grabToImage" + revision: 4 + type: "bool" + Parameter { name: "callback"; type: "QJSValue" } + Parameter { name: "targetSize"; type: "QSize" } + } + Method { + name: "grabToImage" + revision: 4 + type: "bool" + Parameter { name: "callback"; type: "QJSValue" } + } + Method { + name: "contains" + type: "bool" + Parameter { name: "point"; type: "QPointF" } + } + Method { + name: "mapFromItem" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "mapToItem" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "mapFromGlobal" + revision: 7 + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "mapToGlobal" + revision: 7 + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { name: "forceActiveFocus" } + Method { + name: "forceActiveFocus" + Parameter { name: "reason"; type: "Qt::FocusReason" } + } + Method { + name: "nextItemInFocusChain" + revision: 1 + type: "QQuickItem*" + Parameter { name: "forward"; type: "bool" } + } + Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" } + Method { + name: "childAt" + type: "QQuickItem*" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + } + Component { + name: "QQuickPaintedItem" + defaultProperty: "data" + prototype: "QQuickItem" + Enum { + name: "RenderTarget" + values: { + "Image": 0, + "FramebufferObject": 1, + "InvertedYFramebufferObject": 2 + } + } + Enum { + name: "PerformanceHints" + values: { + "FastFBOResizing": 1 + } + } + Property { name: "contentsSize"; type: "QSize" } + Property { name: "fillColor"; type: "QColor" } + Property { name: "contentsScale"; type: "double" } + Property { name: "renderTarget"; type: "RenderTarget" } + Property { name: "textureSize"; type: "QSize" } + } + Component { prototype: "QQuickRectangle" name: "QtQuick.Controls.Fusion.impl/ButtonPanel 2.3" exports: ["QtQuick.Controls.Fusion.impl/ButtonPanel 2.3"] 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/imagine/plugins.qmltypes b/src/imports/controls/imagine/plugins.qmltypes index 014714f3..191807ae 100644 --- a/src/imports/controls/imagine/plugins.qmltypes +++ b/src/imports/controls/imagine/plugins.qmltypes @@ -4,7 +4,7 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Controls.Imagine 2.13' +// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Controls.Imagine 2.14' Module { dependencies: ["QtQuick.Controls 2.0"] @@ -16,6 +16,98 @@ Module { } Component { name: "QQuickAttachedObject"; prototype: "QObject" } Component { + name: "QQuickImage" + defaultProperty: "data" + prototype: "QQuickImageBase" + Enum { + name: "HAlignment" + values: { + "AlignLeft": 1, + "AlignRight": 2, + "AlignHCenter": 4 + } + } + Enum { + name: "VAlignment" + values: { + "AlignTop": 32, + "AlignBottom": 64, + "AlignVCenter": 128 + } + } + Enum { + name: "FillMode" + values: { + "Stretch": 0, + "PreserveAspectFit": 1, + "PreserveAspectCrop": 2, + "Tile": 3, + "TileVertically": 4, + "TileHorizontally": 5, + "Pad": 6 + } + } + Property { name: "fillMode"; type: "FillMode" } + Property { name: "paintedWidth"; type: "double"; isReadonly: true } + Property { name: "paintedHeight"; type: "double"; isReadonly: true } + Property { name: "horizontalAlignment"; type: "HAlignment" } + Property { name: "verticalAlignment"; type: "VAlignment" } + Property { name: "mipmap"; revision: 3; type: "bool" } + Property { name: "autoTransform"; revision: 5; type: "bool" } + Signal { name: "paintedGeometryChanged" } + Signal { + name: "horizontalAlignmentChanged" + Parameter { name: "alignment"; type: "HAlignment" } + } + Signal { + name: "verticalAlignmentChanged" + Parameter { name: "alignment"; type: "VAlignment" } + } + Signal { + name: "mipmapChanged" + revision: 3 + Parameter { type: "bool" } + } + Signal { name: "autoTransformChanged"; revision: 5 } + } + Component { + name: "QQuickImageBase" + defaultProperty: "data" + prototype: "QQuickImplicitSizeItem" + Enum { + name: "Status" + values: { + "Null": 0, + "Ready": 1, + "Loading": 2, + "Error": 3 + } + } + Property { name: "status"; type: "Status"; isReadonly: true } + Property { name: "source"; type: "QUrl" } + Property { name: "progress"; type: "double"; isReadonly: true } + Property { name: "asynchronous"; type: "bool" } + Property { name: "cache"; type: "bool" } + Property { name: "sourceSize"; type: "QSize" } + Property { name: "mirror"; type: "bool" } + Property { name: "currentFrame"; revision: 14; type: "int" } + Property { name: "frameCount"; revision: 14; type: "int"; isReadonly: true } + Signal { + name: "sourceChanged" + Parameter { type: "QUrl" } + } + Signal { + name: "statusChanged" + Parameter { type: "QQuickImageBase::Status" } + } + Signal { + name: "progressChanged" + Parameter { name: "progress"; type: "double" } + } + Signal { name: "currentFrameChanged"; revision: 14 } + Signal { name: "frameCountChanged"; revision: 14 } + } + Component { name: "QQuickImageSelector" prototype: "QObject" exports: ["QtQuick.Controls.Imagine.impl/ImageSelector 2.3"] @@ -37,6 +129,189 @@ Module { Property { name: "url"; type: "QUrl"; isReadonly: true } } Component { + name: "QQuickImplicitSizeItem" + defaultProperty: "data" + prototype: "QQuickItem" + Property { name: "implicitWidth"; type: "double"; isReadonly: true } + Property { name: "implicitHeight"; type: "double"; isReadonly: true } + } + Component { + name: "QQuickItem" + defaultProperty: "data" + prototype: "QObject" + Enum { + name: "Flags" + values: { + "ItemClipsChildrenToShape": 1, + "ItemAcceptsInputMethod": 2, + "ItemIsFocusScope": 4, + "ItemHasContents": 8, + "ItemAcceptsDrops": 16 + } + } + Enum { + name: "TransformOrigin" + values: { + "TopLeft": 0, + "Top": 1, + "TopRight": 2, + "Left": 3, + "Center": 4, + "Right": 5, + "BottomLeft": 6, + "Bottom": 7, + "BottomRight": 8 + } + } + Property { name: "parent"; type: "QQuickItem"; isPointer: true } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "x"; type: "double" } + Property { name: "y"; type: "double" } + Property { name: "z"; type: "double" } + Property { name: "width"; type: "double" } + Property { name: "height"; type: "double" } + Property { name: "opacity"; type: "double" } + Property { name: "enabled"; type: "bool" } + Property { name: "visible"; type: "bool" } + Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true } + Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true } + Property { name: "state"; type: "string" } + Property { name: "childrenRect"; type: "QRectF"; isReadonly: true } + Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true } + Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "baselineOffset"; type: "double" } + Property { name: "clip"; type: "bool" } + Property { name: "focus"; type: "bool" } + Property { name: "activeFocus"; type: "bool"; isReadonly: true } + Property { name: "activeFocusOnTab"; revision: 1; type: "bool" } + Property { name: "rotation"; type: "double" } + Property { name: "scale"; type: "double" } + Property { name: "transformOrigin"; type: "TransformOrigin" } + Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true } + Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true } + Property { name: "smooth"; type: "bool" } + Property { name: "antialiasing"; type: "bool" } + Property { name: "implicitWidth"; type: "double" } + Property { name: "implicitHeight"; type: "double" } + Property { name: "containmentMask"; revision: 11; type: "QObject"; isPointer: true } + Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true } + Signal { + name: "childrenRectChanged" + Parameter { type: "QRectF" } + } + Signal { + name: "baselineOffsetChanged" + Parameter { type: "double" } + } + Signal { + name: "stateChanged" + Parameter { type: "string" } + } + Signal { + name: "focusChanged" + Parameter { type: "bool" } + } + Signal { + name: "activeFocusChanged" + Parameter { type: "bool" } + } + Signal { + name: "activeFocusOnTabChanged" + revision: 1 + Parameter { type: "bool" } + } + Signal { + name: "parentChanged" + Parameter { type: "QQuickItem"; isPointer: true } + } + Signal { + name: "transformOriginChanged" + Parameter { type: "TransformOrigin" } + } + Signal { + name: "smoothChanged" + Parameter { type: "bool" } + } + Signal { + name: "antialiasingChanged" + Parameter { type: "bool" } + } + Signal { + name: "clipChanged" + Parameter { type: "bool" } + } + Signal { + name: "windowChanged" + revision: 1 + Parameter { name: "window"; type: "QQuickWindow"; isPointer: true } + } + Signal { name: "containmentMaskChanged"; revision: 11 } + Method { name: "update" } + Method { + name: "grabToImage" + revision: 4 + type: "bool" + Parameter { name: "callback"; type: "QJSValue" } + Parameter { name: "targetSize"; type: "QSize" } + } + Method { + name: "grabToImage" + revision: 4 + type: "bool" + Parameter { name: "callback"; type: "QJSValue" } + } + Method { + name: "contains" + type: "bool" + Parameter { name: "point"; type: "QPointF" } + } + Method { + name: "mapFromItem" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "mapToItem" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "mapFromGlobal" + revision: 7 + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "mapToGlobal" + revision: 7 + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { name: "forceActiveFocus" } + Method { + name: "forceActiveFocus" + Parameter { name: "reason"; type: "Qt::FocusReason" } + } + Method { + name: "nextItemInFocusChain" + revision: 1 + type: "QQuickItem*" + Parameter { name: "forward"; type: "bool" } + } + Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" } + Method { + name: "childAt" + type: "QQuickItem*" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + } + Component { name: "QQuickNinePatchImage" defaultProperty: "data" prototype: "QQuickImage" 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/plugins.qmltypes b/src/imports/controls/material/plugins.qmltypes index 3e95fa44..7546a7b0 100644 --- a/src/imports/controls/material/plugins.qmltypes +++ b/src/imports/controls/material/plugins.qmltypes @@ -4,12 +4,188 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Controls.Material 2.13' +// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Controls.Material 2.14' Module { dependencies: ["QtQuick.Controls 2.0"] Component { name: "QQuickAttachedObject"; prototype: "QObject" } Component { + name: "QQuickItem" + defaultProperty: "data" + prototype: "QObject" + Enum { + name: "Flags" + values: { + "ItemClipsChildrenToShape": 1, + "ItemAcceptsInputMethod": 2, + "ItemIsFocusScope": 4, + "ItemHasContents": 8, + "ItemAcceptsDrops": 16 + } + } + Enum { + name: "TransformOrigin" + values: { + "TopLeft": 0, + "Top": 1, + "TopRight": 2, + "Left": 3, + "Center": 4, + "Right": 5, + "BottomLeft": 6, + "Bottom": 7, + "BottomRight": 8 + } + } + Property { name: "parent"; type: "QQuickItem"; isPointer: true } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "x"; type: "double" } + Property { name: "y"; type: "double" } + Property { name: "z"; type: "double" } + Property { name: "width"; type: "double" } + Property { name: "height"; type: "double" } + Property { name: "opacity"; type: "double" } + Property { name: "enabled"; type: "bool" } + Property { name: "visible"; type: "bool" } + Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true } + Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true } + Property { name: "state"; type: "string" } + Property { name: "childrenRect"; type: "QRectF"; isReadonly: true } + Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true } + Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "baselineOffset"; type: "double" } + Property { name: "clip"; type: "bool" } + Property { name: "focus"; type: "bool" } + Property { name: "activeFocus"; type: "bool"; isReadonly: true } + Property { name: "activeFocusOnTab"; revision: 1; type: "bool" } + Property { name: "rotation"; type: "double" } + Property { name: "scale"; type: "double" } + Property { name: "transformOrigin"; type: "TransformOrigin" } + Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true } + Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true } + Property { name: "smooth"; type: "bool" } + Property { name: "antialiasing"; type: "bool" } + Property { name: "implicitWidth"; type: "double" } + Property { name: "implicitHeight"; type: "double" } + Property { name: "containmentMask"; revision: 11; type: "QObject"; isPointer: true } + Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true } + Signal { + name: "childrenRectChanged" + Parameter { type: "QRectF" } + } + Signal { + name: "baselineOffsetChanged" + Parameter { type: "double" } + } + Signal { + name: "stateChanged" + Parameter { type: "string" } + } + Signal { + name: "focusChanged" + Parameter { type: "bool" } + } + Signal { + name: "activeFocusChanged" + Parameter { type: "bool" } + } + Signal { + name: "activeFocusOnTabChanged" + revision: 1 + Parameter { type: "bool" } + } + Signal { + name: "parentChanged" + Parameter { type: "QQuickItem"; isPointer: true } + } + Signal { + name: "transformOriginChanged" + Parameter { type: "TransformOrigin" } + } + Signal { + name: "smoothChanged" + Parameter { type: "bool" } + } + Signal { + name: "antialiasingChanged" + Parameter { type: "bool" } + } + Signal { + name: "clipChanged" + Parameter { type: "bool" } + } + Signal { + name: "windowChanged" + revision: 1 + Parameter { name: "window"; type: "QQuickWindow"; isPointer: true } + } + Signal { name: "containmentMaskChanged"; revision: 11 } + Method { name: "update" } + Method { + name: "grabToImage" + revision: 4 + type: "bool" + Parameter { name: "callback"; type: "QJSValue" } + Parameter { name: "targetSize"; type: "QSize" } + } + Method { + name: "grabToImage" + revision: 4 + type: "bool" + Parameter { name: "callback"; type: "QJSValue" } + } + Method { + name: "contains" + type: "bool" + Parameter { name: "point"; type: "QPointF" } + } + Method { + name: "mapFromItem" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "mapToItem" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "mapFromGlobal" + revision: 7 + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "mapToGlobal" + revision: 7 + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { name: "forceActiveFocus" } + Method { + name: "forceActiveFocus" + Parameter { name: "reason"; type: "Qt::FocusReason" } + } + Method { + name: "nextItemInFocusChain" + revision: 1 + type: "QQuickItem*" + Parameter { name: "forward"; type: "bool" } + } + Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" } + Method { + name: "childAt" + type: "QQuickItem*" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + } + Component { name: "QQuickMaterialBusyIndicator" defaultProperty: "data" prototype: "QQuickItem" 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 Binary files differnew file mode 100644 index 00000000..a805b134 --- /dev/null +++ b/src/imports/controls/material/shaders/+qsb/RectangularGlow.frag 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/plugins.qmltypes b/src/imports/controls/plugins.qmltypes index 9b4610f0..c3e53431 100644 --- a/src/imports/controls/plugins.qmltypes +++ b/src/imports/controls/plugins.qmltypes @@ -4,7 +4,7 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Controls 2.13' +// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Controls 2.14' Module { dependencies: [ @@ -175,6 +175,13 @@ Module { Property { name: "bottomPadding"; type: "double" } } Component { + name: "QQuickImplicitSizeItem" + defaultProperty: "data" + prototype: "QQuickItem" + Property { name: "implicitWidth"; type: "double"; isReadonly: true } + Property { name: "implicitHeight"; type: "double"; isReadonly: true } + } + Component { name: "QQuickItemGroup" defaultProperty: "data" prototype: "QQuickImplicitSizeItem" @@ -191,6 +198,19 @@ Module { Property { name: "mnemonicVisible"; type: "bool" } } Component { + name: "QQuickOverlay" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick.Controls/Overlay 2.3"] + isCreatable: false + exportMetaObjectRevisions: [0] + attachedType: "QQuickOverlayAttached" + Property { name: "modal"; type: "QQmlComponent"; isPointer: true } + Property { name: "modeless"; type: "QQmlComponent"; isPointer: true } + Signal { name: "pressed" } + Signal { name: "released" } + } + Component { name: "QQuickPaddedRectangle" defaultProperty: "data" prototype: "QQuickRectangle" @@ -210,6 +230,205 @@ Module { exportMetaObjectRevisions: [0] } Component { + name: "QQuickSplitHandleAttached" + prototype: "QObject" + exports: ["QtQuick.Controls/SplitHandle 2.13"] + isCreatable: false + exportMetaObjectRevisions: [0] + Property { name: "hovered"; type: "bool"; isReadonly: true } + Property { name: "pressed"; type: "bool"; isReadonly: true } + } + Component { + name: "QQuickText" + defaultProperty: "data" + prototype: "QQuickImplicitSizeItem" + Enum { + name: "HAlignment" + values: { + "AlignLeft": 1, + "AlignRight": 2, + "AlignHCenter": 4, + "AlignJustify": 8 + } + } + Enum { + name: "VAlignment" + values: { + "AlignTop": 32, + "AlignBottom": 64, + "AlignVCenter": 128 + } + } + Enum { + name: "TextStyle" + values: { + "Normal": 0, + "Outline": 1, + "Raised": 2, + "Sunken": 3 + } + } + Enum { + name: "TextFormat" + values: { + "PlainText": 0, + "RichText": 1, + "MarkdownText": 3, + "AutoText": 2, + "StyledText": 4 + } + } + Enum { + name: "TextElideMode" + values: { + "ElideLeft": 0, + "ElideRight": 1, + "ElideMiddle": 2, + "ElideNone": 3 + } + } + Enum { + name: "WrapMode" + values: { + "NoWrap": 0, + "WordWrap": 1, + "WrapAnywhere": 3, + "WrapAtWordBoundaryOrAnywhere": 4, + "Wrap": 4 + } + } + Enum { + name: "RenderType" + values: { + "QtRendering": 0, + "NativeRendering": 1 + } + } + Enum { + name: "LineHeightMode" + values: { + "ProportionalHeight": 0, + "FixedHeight": 1 + } + } + Enum { + name: "FontSizeMode" + values: { + "FixedSize": 0, + "HorizontalFit": 1, + "VerticalFit": 2, + "Fit": 3 + } + } + Property { name: "text"; type: "string" } + Property { name: "font"; type: "QFont" } + Property { name: "color"; type: "QColor" } + Property { name: "linkColor"; type: "QColor" } + Property { name: "style"; type: "TextStyle" } + Property { name: "styleColor"; type: "QColor" } + Property { name: "horizontalAlignment"; type: "HAlignment" } + Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true } + Property { name: "verticalAlignment"; type: "VAlignment" } + Property { name: "wrapMode"; type: "WrapMode" } + Property { name: "lineCount"; type: "int"; isReadonly: true } + Property { name: "truncated"; type: "bool"; isReadonly: true } + Property { name: "maximumLineCount"; type: "int" } + Property { name: "textFormat"; type: "TextFormat" } + Property { name: "elide"; type: "TextElideMode" } + Property { name: "contentWidth"; type: "double"; isReadonly: true } + Property { name: "contentHeight"; type: "double"; isReadonly: true } + Property { name: "paintedWidth"; type: "double"; isReadonly: true } + Property { name: "paintedHeight"; type: "double"; isReadonly: true } + Property { name: "lineHeight"; type: "double" } + Property { name: "lineHeightMode"; type: "LineHeightMode" } + Property { name: "baseUrl"; type: "QUrl" } + Property { name: "minimumPixelSize"; type: "int" } + Property { name: "minimumPointSize"; type: "int" } + Property { name: "fontSizeMode"; type: "FontSizeMode" } + Property { name: "renderType"; type: "RenderType" } + Property { name: "hoveredLink"; revision: 2; type: "string"; isReadonly: true } + Property { name: "padding"; revision: 6; type: "double" } + Property { name: "topPadding"; revision: 6; type: "double" } + Property { name: "leftPadding"; revision: 6; type: "double" } + Property { name: "rightPadding"; revision: 6; type: "double" } + Property { name: "bottomPadding"; revision: 6; type: "double" } + Property { name: "fontInfo"; revision: 9; type: "QJSValue"; isReadonly: true } + Property { name: "advance"; revision: 10; type: "QSizeF"; isReadonly: true } + Signal { + name: "textChanged" + Parameter { name: "text"; type: "string" } + } + Signal { + name: "linkActivated" + Parameter { name: "link"; type: "string" } + } + Signal { + name: "linkHovered" + revision: 2 + Parameter { name: "link"; type: "string" } + } + Signal { + name: "fontChanged" + Parameter { name: "font"; type: "QFont" } + } + Signal { + name: "styleChanged" + Parameter { name: "style"; type: "QQuickText::TextStyle" } + } + Signal { + name: "horizontalAlignmentChanged" + Parameter { name: "alignment"; type: "QQuickText::HAlignment" } + } + Signal { + name: "verticalAlignmentChanged" + Parameter { name: "alignment"; type: "QQuickText::VAlignment" } + } + Signal { + name: "textFormatChanged" + Parameter { name: "textFormat"; type: "QQuickText::TextFormat" } + } + Signal { + name: "elideModeChanged" + Parameter { name: "mode"; type: "QQuickText::TextElideMode" } + } + Signal { name: "contentSizeChanged" } + Signal { + name: "contentWidthChanged" + Parameter { name: "contentWidth"; type: "double" } + } + Signal { + name: "contentHeightChanged" + Parameter { name: "contentHeight"; type: "double" } + } + Signal { + name: "lineHeightChanged" + Parameter { name: "lineHeight"; type: "double" } + } + Signal { + name: "lineHeightModeChanged" + Parameter { name: "mode"; type: "LineHeightMode" } + } + Signal { + name: "lineLaidOut" + Parameter { name: "line"; type: "QQuickTextLine"; isPointer: true } + } + Signal { name: "paddingChanged"; revision: 6 } + Signal { name: "topPaddingChanged"; revision: 6 } + Signal { name: "leftPaddingChanged"; revision: 6 } + Signal { name: "rightPaddingChanged"; revision: 6 } + Signal { name: "bottomPaddingChanged"; revision: 6 } + Signal { name: "fontInfoChanged"; revision: 9 } + Method { name: "doLayout" } + Method { name: "forceLayout"; revision: 9 } + Method { + name: "linkAt" + revision: 3 + type: "string" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + } + Component { name: "QQuickTumblerView" defaultProperty: "data" prototype: "QQuickItem" 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/controls/universal/plugins.qmltypes b/src/imports/controls/universal/plugins.qmltypes index c80ff1d4..1734c01b 100644 --- a/src/imports/controls/universal/plugins.qmltypes +++ b/src/imports/controls/universal/plugins.qmltypes @@ -4,12 +4,212 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Controls.Universal 2.13' +// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Controls.Universal 2.14' Module { dependencies: ["QtQuick.Controls 2.0"] Component { name: "QQuickAttachedObject"; prototype: "QObject" } Component { + name: "QQuickItem" + defaultProperty: "data" + prototype: "QObject" + Enum { + name: "Flags" + values: { + "ItemClipsChildrenToShape": 1, + "ItemAcceptsInputMethod": 2, + "ItemIsFocusScope": 4, + "ItemHasContents": 8, + "ItemAcceptsDrops": 16 + } + } + Enum { + name: "TransformOrigin" + values: { + "TopLeft": 0, + "Top": 1, + "TopRight": 2, + "Left": 3, + "Center": 4, + "Right": 5, + "BottomLeft": 6, + "Bottom": 7, + "BottomRight": 8 + } + } + Property { name: "parent"; type: "QQuickItem"; isPointer: true } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "x"; type: "double" } + Property { name: "y"; type: "double" } + Property { name: "z"; type: "double" } + Property { name: "width"; type: "double" } + Property { name: "height"; type: "double" } + Property { name: "opacity"; type: "double" } + Property { name: "enabled"; type: "bool" } + Property { name: "visible"; type: "bool" } + Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true } + Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true } + Property { name: "state"; type: "string" } + Property { name: "childrenRect"; type: "QRectF"; isReadonly: true } + Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true } + Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "baselineOffset"; type: "double" } + Property { name: "clip"; type: "bool" } + Property { name: "focus"; type: "bool" } + Property { name: "activeFocus"; type: "bool"; isReadonly: true } + Property { name: "activeFocusOnTab"; revision: 1; type: "bool" } + Property { name: "rotation"; type: "double" } + Property { name: "scale"; type: "double" } + Property { name: "transformOrigin"; type: "TransformOrigin" } + Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true } + Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true } + Property { name: "smooth"; type: "bool" } + Property { name: "antialiasing"; type: "bool" } + Property { name: "implicitWidth"; type: "double" } + Property { name: "implicitHeight"; type: "double" } + Property { name: "containmentMask"; revision: 11; type: "QObject"; isPointer: true } + Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true } + Signal { + name: "childrenRectChanged" + Parameter { type: "QRectF" } + } + Signal { + name: "baselineOffsetChanged" + Parameter { type: "double" } + } + Signal { + name: "stateChanged" + Parameter { type: "string" } + } + Signal { + name: "focusChanged" + Parameter { type: "bool" } + } + Signal { + name: "activeFocusChanged" + Parameter { type: "bool" } + } + Signal { + name: "activeFocusOnTabChanged" + revision: 1 + Parameter { type: "bool" } + } + Signal { + name: "parentChanged" + Parameter { type: "QQuickItem"; isPointer: true } + } + Signal { + name: "transformOriginChanged" + Parameter { type: "TransformOrigin" } + } + Signal { + name: "smoothChanged" + Parameter { type: "bool" } + } + Signal { + name: "antialiasingChanged" + Parameter { type: "bool" } + } + Signal { + name: "clipChanged" + Parameter { type: "bool" } + } + Signal { + name: "windowChanged" + revision: 1 + Parameter { name: "window"; type: "QQuickWindow"; isPointer: true } + } + Signal { name: "containmentMaskChanged"; revision: 11 } + Method { name: "update" } + Method { + name: "grabToImage" + revision: 4 + type: "bool" + Parameter { name: "callback"; type: "QJSValue" } + Parameter { name: "targetSize"; type: "QSize" } + } + Method { + name: "grabToImage" + revision: 4 + type: "bool" + Parameter { name: "callback"; type: "QJSValue" } + } + Method { + name: "contains" + type: "bool" + Parameter { name: "point"; type: "QPointF" } + } + Method { + name: "mapFromItem" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "mapToItem" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "mapFromGlobal" + revision: 7 + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "mapToGlobal" + revision: 7 + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { name: "forceActiveFocus" } + Method { + name: "forceActiveFocus" + Parameter { name: "reason"; type: "Qt::FocusReason" } + } + Method { + name: "nextItemInFocusChain" + revision: 1 + type: "QQuickItem*" + Parameter { name: "forward"; type: "bool" } + } + Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" } + Method { + name: "childAt" + type: "QQuickItem*" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + } + Component { + name: "QQuickPaintedItem" + defaultProperty: "data" + prototype: "QQuickItem" + Enum { + name: "RenderTarget" + values: { + "Image": 0, + "FramebufferObject": 1, + "InvertedYFramebufferObject": 2 + } + } + Enum { + name: "PerformanceHints" + values: { + "FastFBOResizing": 1 + } + } + Property { name: "contentsSize"; type: "QSize" } + Property { name: "fillColor"; type: "QColor" } + Property { name: "contentsScale"; type: "double" } + Property { name: "renderTarget"; type: "RenderTarget" } + Property { name: "textureSize"; type: "QSize" } + } + Component { name: "QQuickUniversalBusyIndicator" defaultProperty: "data" prototype: "QQuickItem" 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/plugins.qmltypes b/src/imports/templates/plugins.qmltypes index 48e23edd..da81e095 100644 --- a/src/imports/templates/plugins.qmltypes +++ b/src/imports/templates/plugins.qmltypes @@ -4,7 +4,7 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Templates 2.13' +// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Templates 2.14' Module { dependencies: ["QtQuick 2.9", "QtQuick.Window 2.2"] @@ -272,10 +272,11 @@ Module { exports: [ "QtQuick.Templates/ComboBox 2.0", "QtQuick.Templates/ComboBox 2.1", + "QtQuick.Templates/ComboBox 2.14", "QtQuick.Templates/ComboBox 2.2", "QtQuick.Templates/ComboBox 2.5" ] - exportMetaObjectRevisions: [0, 1, 2, 5] + exportMetaObjectRevisions: [0, 1, 14, 2, 5] Property { name: "count"; type: "int"; isReadonly: true } Property { name: "model"; type: "QVariant" } Property { name: "delegateModel"; type: "QQmlInstanceModel"; isReadonly: true; isPointer: true } @@ -298,6 +299,8 @@ Module { Property { name: "acceptableInput"; revision: 2; type: "bool"; isReadonly: true } Property { name: "implicitIndicatorWidth"; revision: 5; type: "double"; isReadonly: true } Property { name: "implicitIndicatorHeight"; revision: 5; type: "double"; isReadonly: true } + Property { name: "currentValue"; revision: 14; type: "QVariant"; isReadonly: true } + Property { name: "valueRole"; revision: 14; type: "string" } Signal { name: "activated" Parameter { name: "index"; type: "int" } @@ -317,6 +320,8 @@ Module { Signal { name: "acceptableInputChanged"; revision: 2 } Signal { name: "implicitIndicatorWidthChanged"; revision: 5 } Signal { name: "implicitIndicatorHeightChanged"; revision: 5 } + Signal { name: "valueRoleChanged"; revision: 14 } + Signal { name: "currentValueChanged"; revision: 14 } Method { name: "incrementCurrentIndex" } Method { name: "decrementCurrentIndex" } Method { name: "selectAll"; revision: 2 } @@ -336,6 +341,18 @@ Module { type: "int" Parameter { name: "text"; type: "string" } } + Method { + name: "valueAt" + revision: 14 + type: "QVariant" + Parameter { name: "index"; type: "int" } + } + Method { + name: "indexOfValue" + revision: 14 + type: "int" + Parameter { name: "value"; type: "QVariant" } + } } Component { name: "QQuickContainer" @@ -643,6 +660,189 @@ Module { Property { name: "cache"; type: "bool" } } Component { + name: "QQuickImplicitSizeItem" + defaultProperty: "data" + prototype: "QQuickItem" + Property { name: "implicitWidth"; type: "double"; isReadonly: true } + Property { name: "implicitHeight"; type: "double"; isReadonly: true } + } + Component { + name: "QQuickItem" + defaultProperty: "data" + prototype: "QObject" + Enum { + name: "Flags" + values: { + "ItemClipsChildrenToShape": 1, + "ItemAcceptsInputMethod": 2, + "ItemIsFocusScope": 4, + "ItemHasContents": 8, + "ItemAcceptsDrops": 16 + } + } + Enum { + name: "TransformOrigin" + values: { + "TopLeft": 0, + "Top": 1, + "TopRight": 2, + "Left": 3, + "Center": 4, + "Right": 5, + "BottomLeft": 6, + "Bottom": 7, + "BottomRight": 8 + } + } + Property { name: "parent"; type: "QQuickItem"; isPointer: true } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "x"; type: "double" } + Property { name: "y"; type: "double" } + Property { name: "z"; type: "double" } + Property { name: "width"; type: "double" } + Property { name: "height"; type: "double" } + Property { name: "opacity"; type: "double" } + Property { name: "enabled"; type: "bool" } + Property { name: "visible"; type: "bool" } + Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true } + Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true } + Property { name: "state"; type: "string" } + Property { name: "childrenRect"; type: "QRectF"; isReadonly: true } + Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true } + Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "baselineOffset"; type: "double" } + Property { name: "clip"; type: "bool" } + Property { name: "focus"; type: "bool" } + Property { name: "activeFocus"; type: "bool"; isReadonly: true } + Property { name: "activeFocusOnTab"; revision: 1; type: "bool" } + Property { name: "rotation"; type: "double" } + Property { name: "scale"; type: "double" } + Property { name: "transformOrigin"; type: "TransformOrigin" } + Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true } + Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true } + Property { name: "smooth"; type: "bool" } + Property { name: "antialiasing"; type: "bool" } + Property { name: "implicitWidth"; type: "double" } + Property { name: "implicitHeight"; type: "double" } + Property { name: "containmentMask"; revision: 11; type: "QObject"; isPointer: true } + Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true } + Signal { + name: "childrenRectChanged" + Parameter { type: "QRectF" } + } + Signal { + name: "baselineOffsetChanged" + Parameter { type: "double" } + } + Signal { + name: "stateChanged" + Parameter { type: "string" } + } + Signal { + name: "focusChanged" + Parameter { type: "bool" } + } + Signal { + name: "activeFocusChanged" + Parameter { type: "bool" } + } + Signal { + name: "activeFocusOnTabChanged" + revision: 1 + Parameter { type: "bool" } + } + Signal { + name: "parentChanged" + Parameter { type: "QQuickItem"; isPointer: true } + } + Signal { + name: "transformOriginChanged" + Parameter { type: "TransformOrigin" } + } + Signal { + name: "smoothChanged" + Parameter { type: "bool" } + } + Signal { + name: "antialiasingChanged" + Parameter { type: "bool" } + } + Signal { + name: "clipChanged" + Parameter { type: "bool" } + } + Signal { + name: "windowChanged" + revision: 1 + Parameter { name: "window"; type: "QQuickWindow"; isPointer: true } + } + Signal { name: "containmentMaskChanged"; revision: 11 } + Method { name: "update" } + Method { + name: "grabToImage" + revision: 4 + type: "bool" + Parameter { name: "callback"; type: "QJSValue" } + Parameter { name: "targetSize"; type: "QSize" } + } + Method { + name: "grabToImage" + revision: 4 + type: "bool" + Parameter { name: "callback"; type: "QJSValue" } + } + Method { + name: "contains" + type: "bool" + Parameter { name: "point"; type: "QPointF" } + } + Method { + name: "mapFromItem" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "mapToItem" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "mapFromGlobal" + revision: 7 + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "mapToGlobal" + revision: 7 + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { name: "forceActiveFocus" } + Method { + name: "forceActiveFocus" + Parameter { name: "reason"; type: "Qt::FocusReason" } + } + Method { + name: "nextItemInFocusChain" + revision: 1 + type: "QQuickItem*" + Parameter { name: "forward"; type: "bool" } + } + Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" } + Method { + name: "childAt" + type: "QQuickItem*" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + } + Component { name: "QQuickItemDelegate" defaultProperty: "data" prototype: "QQuickAbstractButton" @@ -1065,6 +1265,7 @@ Module { prototype: "QObject" Property { name: "centerIn"; type: "QQuickItem"; isPointer: true } } + Component { name: "QQuickPopupItem"; defaultProperty: "contentData"; prototype: "QQuickPage" } Component { name: "QQuickProgressBar" defaultProperty: "data" @@ -1154,6 +1355,19 @@ Module { Method { name: "decrease" } } Component { + name: "QQuickRootItem" + defaultProperty: "data" + prototype: "QQuickItem" + Method { + name: "setWidth" + Parameter { name: "w"; type: "int" } + } + Method { + name: "setHeight" + Parameter { name: "h"; type: "int" } + } + } + Component { name: "QQuickRoundButton" defaultProperty: "data" prototype: "QQuickButton" @@ -1638,6 +1852,196 @@ Module { exportMetaObjectRevisions: [0] } Component { + name: "QQuickText" + defaultProperty: "data" + prototype: "QQuickImplicitSizeItem" + Enum { + name: "HAlignment" + values: { + "AlignLeft": 1, + "AlignRight": 2, + "AlignHCenter": 4, + "AlignJustify": 8 + } + } + Enum { + name: "VAlignment" + values: { + "AlignTop": 32, + "AlignBottom": 64, + "AlignVCenter": 128 + } + } + Enum { + name: "TextStyle" + values: { + "Normal": 0, + "Outline": 1, + "Raised": 2, + "Sunken": 3 + } + } + Enum { + name: "TextFormat" + values: { + "PlainText": 0, + "RichText": 1, + "MarkdownText": 3, + "AutoText": 2, + "StyledText": 4 + } + } + Enum { + name: "TextElideMode" + values: { + "ElideLeft": 0, + "ElideRight": 1, + "ElideMiddle": 2, + "ElideNone": 3 + } + } + Enum { + name: "WrapMode" + values: { + "NoWrap": 0, + "WordWrap": 1, + "WrapAnywhere": 3, + "WrapAtWordBoundaryOrAnywhere": 4, + "Wrap": 4 + } + } + Enum { + name: "RenderType" + values: { + "QtRendering": 0, + "NativeRendering": 1 + } + } + Enum { + name: "LineHeightMode" + values: { + "ProportionalHeight": 0, + "FixedHeight": 1 + } + } + Enum { + name: "FontSizeMode" + values: { + "FixedSize": 0, + "HorizontalFit": 1, + "VerticalFit": 2, + "Fit": 3 + } + } + Property { name: "text"; type: "string" } + Property { name: "font"; type: "QFont" } + Property { name: "color"; type: "QColor" } + Property { name: "linkColor"; type: "QColor" } + Property { name: "style"; type: "TextStyle" } + Property { name: "styleColor"; type: "QColor" } + Property { name: "horizontalAlignment"; type: "HAlignment" } + Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true } + Property { name: "verticalAlignment"; type: "VAlignment" } + Property { name: "wrapMode"; type: "WrapMode" } + Property { name: "lineCount"; type: "int"; isReadonly: true } + Property { name: "truncated"; type: "bool"; isReadonly: true } + Property { name: "maximumLineCount"; type: "int" } + Property { name: "textFormat"; type: "TextFormat" } + Property { name: "elide"; type: "TextElideMode" } + Property { name: "contentWidth"; type: "double"; isReadonly: true } + Property { name: "contentHeight"; type: "double"; isReadonly: true } + Property { name: "paintedWidth"; type: "double"; isReadonly: true } + Property { name: "paintedHeight"; type: "double"; isReadonly: true } + Property { name: "lineHeight"; type: "double" } + Property { name: "lineHeightMode"; type: "LineHeightMode" } + Property { name: "baseUrl"; type: "QUrl" } + Property { name: "minimumPixelSize"; type: "int" } + Property { name: "minimumPointSize"; type: "int" } + Property { name: "fontSizeMode"; type: "FontSizeMode" } + Property { name: "renderType"; type: "RenderType" } + Property { name: "hoveredLink"; revision: 2; type: "string"; isReadonly: true } + Property { name: "padding"; revision: 6; type: "double" } + Property { name: "topPadding"; revision: 6; type: "double" } + Property { name: "leftPadding"; revision: 6; type: "double" } + Property { name: "rightPadding"; revision: 6; type: "double" } + Property { name: "bottomPadding"; revision: 6; type: "double" } + Property { name: "fontInfo"; revision: 9; type: "QJSValue"; isReadonly: true } + Property { name: "advance"; revision: 10; type: "QSizeF"; isReadonly: true } + Signal { + name: "textChanged" + Parameter { name: "text"; type: "string" } + } + Signal { + name: "linkActivated" + Parameter { name: "link"; type: "string" } + } + Signal { + name: "linkHovered" + revision: 2 + Parameter { name: "link"; type: "string" } + } + Signal { + name: "fontChanged" + Parameter { name: "font"; type: "QFont" } + } + Signal { + name: "styleChanged" + Parameter { name: "style"; type: "QQuickText::TextStyle" } + } + Signal { + name: "horizontalAlignmentChanged" + Parameter { name: "alignment"; type: "QQuickText::HAlignment" } + } + Signal { + name: "verticalAlignmentChanged" + Parameter { name: "alignment"; type: "QQuickText::VAlignment" } + } + Signal { + name: "textFormatChanged" + Parameter { name: "textFormat"; type: "QQuickText::TextFormat" } + } + Signal { + name: "elideModeChanged" + Parameter { name: "mode"; type: "QQuickText::TextElideMode" } + } + Signal { name: "contentSizeChanged" } + Signal { + name: "contentWidthChanged" + Parameter { name: "contentWidth"; type: "double" } + } + Signal { + name: "contentHeightChanged" + Parameter { name: "contentHeight"; type: "double" } + } + Signal { + name: "lineHeightChanged" + Parameter { name: "lineHeight"; type: "double" } + } + Signal { + name: "lineHeightModeChanged" + Parameter { name: "mode"; type: "LineHeightMode" } + } + Signal { + name: "lineLaidOut" + Parameter { name: "line"; type: "QQuickTextLine"; isPointer: true } + } + Signal { name: "paddingChanged"; revision: 6 } + Signal { name: "topPaddingChanged"; revision: 6 } + Signal { name: "leftPaddingChanged"; revision: 6 } + Signal { name: "rightPaddingChanged"; revision: 6 } + Signal { name: "bottomPaddingChanged"; revision: 6 } + Signal { name: "fontInfoChanged"; revision: 9 } + Method { name: "doLayout" } + Method { name: "forceLayout"; revision: 9 } + Method { + name: "linkAt" + revision: 3 + type: "string" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + } + Component { name: "QQuickTextArea" defaultProperty: "data" prototype: "QQuickTextEdit" @@ -1698,6 +2102,282 @@ Module { Property { name: "flickable"; type: "QQuickTextArea"; isPointer: true } } Component { + name: "QQuickTextEdit" + defaultProperty: "data" + prototype: "QQuickImplicitSizeItem" + Enum { + name: "HAlignment" + values: { + "AlignLeft": 1, + "AlignRight": 2, + "AlignHCenter": 4, + "AlignJustify": 8 + } + } + Enum { + name: "VAlignment" + values: { + "AlignTop": 32, + "AlignBottom": 64, + "AlignVCenter": 128 + } + } + Enum { + name: "TextFormat" + values: { + "PlainText": 0, + "RichText": 1, + "AutoText": 2, + "MarkdownText": 3 + } + } + Enum { + name: "WrapMode" + values: { + "NoWrap": 0, + "WordWrap": 1, + "WrapAnywhere": 3, + "WrapAtWordBoundaryOrAnywhere": 4, + "Wrap": 4 + } + } + Enum { + name: "SelectionMode" + values: { + "SelectCharacters": 0, + "SelectWords": 1 + } + } + Enum { + name: "RenderType" + values: { + "QtRendering": 0, + "NativeRendering": 1 + } + } + Property { name: "text"; type: "string" } + Property { name: "color"; type: "QColor" } + Property { name: "selectionColor"; type: "QColor" } + Property { name: "selectedTextColor"; type: "QColor" } + Property { name: "font"; type: "QFont" } + Property { name: "horizontalAlignment"; type: "HAlignment" } + Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true } + Property { name: "verticalAlignment"; type: "VAlignment" } + Property { name: "wrapMode"; type: "WrapMode" } + Property { name: "lineCount"; type: "int"; isReadonly: true } + Property { name: "length"; type: "int"; isReadonly: true } + Property { name: "contentWidth"; type: "double"; isReadonly: true } + Property { name: "contentHeight"; type: "double"; isReadonly: true } + Property { name: "paintedWidth"; type: "double"; isReadonly: true } + Property { name: "paintedHeight"; type: "double"; isReadonly: true } + Property { name: "textFormat"; type: "TextFormat" } + Property { name: "readOnly"; type: "bool" } + Property { name: "cursorVisible"; type: "bool" } + Property { name: "cursorPosition"; type: "int" } + Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true } + Property { name: "cursorDelegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "overwriteMode"; type: "bool" } + Property { name: "selectionStart"; type: "int"; isReadonly: true } + Property { name: "selectionEnd"; type: "int"; isReadonly: true } + Property { name: "selectedText"; type: "string"; isReadonly: true } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "persistentSelection"; type: "bool" } + Property { name: "textMargin"; type: "double" } + Property { name: "inputMethodHints"; type: "Qt::InputMethodHints" } + Property { name: "selectByKeyboard"; revision: 1; type: "bool" } + Property { name: "selectByMouse"; type: "bool" } + Property { name: "mouseSelectionMode"; type: "SelectionMode" } + Property { name: "canPaste"; type: "bool"; isReadonly: true } + Property { name: "canUndo"; type: "bool"; isReadonly: true } + Property { name: "canRedo"; type: "bool"; isReadonly: true } + Property { name: "inputMethodComposing"; type: "bool"; isReadonly: true } + Property { name: "baseUrl"; type: "QUrl" } + Property { name: "renderType"; type: "RenderType" } + Property { + name: "textDocument" + revision: 1 + type: "QQuickTextDocument" + isReadonly: true + isPointer: true + } + Property { name: "hoveredLink"; revision: 2; type: "string"; isReadonly: true } + Property { name: "padding"; revision: 6; type: "double" } + Property { name: "topPadding"; revision: 6; type: "double" } + Property { name: "leftPadding"; revision: 6; type: "double" } + Property { name: "rightPadding"; revision: 6; type: "double" } + Property { name: "bottomPadding"; revision: 6; type: "double" } + Property { name: "preeditText"; revision: 7; type: "string"; isReadonly: true } + Property { name: "tabStopDistance"; revision: 10; type: "double" } + Signal { name: "preeditTextChanged"; revision: 7 } + Signal { name: "contentSizeChanged" } + Signal { + name: "colorChanged" + Parameter { name: "color"; type: "QColor" } + } + Signal { + name: "selectionColorChanged" + Parameter { name: "color"; type: "QColor" } + } + Signal { + name: "selectedTextColorChanged" + Parameter { name: "color"; type: "QColor" } + } + Signal { + name: "fontChanged" + Parameter { name: "font"; type: "QFont" } + } + Signal { + name: "horizontalAlignmentChanged" + Parameter { name: "alignment"; type: "QQuickTextEdit::HAlignment" } + } + Signal { + name: "verticalAlignmentChanged" + Parameter { name: "alignment"; type: "QQuickTextEdit::VAlignment" } + } + Signal { + name: "textFormatChanged" + Parameter { name: "textFormat"; type: "QQuickTextEdit::TextFormat" } + } + Signal { + name: "readOnlyChanged" + Parameter { name: "isReadOnly"; type: "bool" } + } + Signal { + name: "cursorVisibleChanged" + Parameter { name: "isCursorVisible"; type: "bool" } + } + Signal { + name: "overwriteModeChanged" + Parameter { name: "overwriteMode"; type: "bool" } + } + Signal { + name: "activeFocusOnPressChanged" + Parameter { name: "activeFocusOnPressed"; type: "bool" } + } + Signal { + name: "persistentSelectionChanged" + Parameter { name: "isPersistentSelection"; type: "bool" } + } + Signal { + name: "textMarginChanged" + Parameter { name: "textMargin"; type: "double" } + } + Signal { + name: "selectByKeyboardChanged" + revision: 1 + Parameter { name: "selectByKeyboard"; type: "bool" } + } + Signal { + name: "selectByMouseChanged" + Parameter { name: "selectByMouse"; type: "bool" } + } + Signal { + name: "mouseSelectionModeChanged" + Parameter { name: "mode"; type: "QQuickTextEdit::SelectionMode" } + } + Signal { + name: "linkActivated" + Parameter { name: "link"; type: "string" } + } + Signal { + name: "linkHovered" + revision: 2 + Parameter { name: "link"; type: "string" } + } + Signal { name: "editingFinished"; revision: 6 } + Signal { name: "paddingChanged"; revision: 6 } + Signal { name: "topPaddingChanged"; revision: 6 } + Signal { name: "leftPaddingChanged"; revision: 6 } + Signal { name: "rightPaddingChanged"; revision: 6 } + Signal { name: "bottomPaddingChanged"; revision: 6 } + Signal { + name: "tabStopDistanceChanged" + revision: 10 + Parameter { name: "distance"; type: "double" } + } + Method { name: "selectAll" } + Method { name: "selectWord" } + Method { + name: "select" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + Method { name: "deselect" } + Method { + name: "isRightToLeft" + type: "bool" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + Method { name: "cut" } + Method { name: "copy" } + Method { name: "paste" } + Method { name: "undo" } + Method { name: "redo" } + Method { + name: "insert" + Parameter { name: "position"; type: "int" } + Parameter { name: "text"; type: "string" } + } + Method { + name: "remove" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + Method { + name: "append" + revision: 2 + Parameter { name: "text"; type: "string" } + } + Method { name: "clear"; revision: 7 } + Method { + name: "inputMethodQuery" + revision: 4 + type: "QVariant" + Parameter { name: "query"; type: "Qt::InputMethodQuery" } + Parameter { name: "argument"; type: "QVariant" } + } + Method { + name: "positionToRectangle" + type: "QRectF" + Parameter { type: "int" } + } + Method { + name: "positionAt" + type: "int" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + Method { + name: "moveCursorSelection" + Parameter { name: "pos"; type: "int" } + } + Method { + name: "moveCursorSelection" + Parameter { name: "pos"; type: "int" } + Parameter { name: "mode"; type: "SelectionMode" } + } + Method { + name: "getText" + type: "string" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + Method { + name: "getFormattedText" + type: "string" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + Method { + name: "linkAt" + revision: 3 + type: "string" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + } + Component { name: "QQuickTextField" defaultProperty: "data" prototype: "QQuickTextInput" @@ -1752,6 +2432,246 @@ Module { Signal { name: "bottomInsetChanged"; revision: 5 } } Component { + name: "QQuickTextInput" + defaultProperty: "data" + prototype: "QQuickImplicitSizeItem" + Enum { + name: "EchoMode" + values: { + "Normal": 0, + "NoEcho": 1, + "Password": 2, + "PasswordEchoOnEdit": 3 + } + } + Enum { + name: "HAlignment" + values: { + "AlignLeft": 1, + "AlignRight": 2, + "AlignHCenter": 4 + } + } + Enum { + name: "VAlignment" + values: { + "AlignTop": 32, + "AlignBottom": 64, + "AlignVCenter": 128 + } + } + Enum { + name: "WrapMode" + values: { + "NoWrap": 0, + "WordWrap": 1, + "WrapAnywhere": 3, + "WrapAtWordBoundaryOrAnywhere": 4, + "Wrap": 4 + } + } + Enum { + name: "SelectionMode" + values: { + "SelectCharacters": 0, + "SelectWords": 1 + } + } + Enum { + name: "CursorPosition" + values: { + "CursorBetweenCharacters": 0, + "CursorOnCharacter": 1 + } + } + Enum { + name: "RenderType" + values: { + "QtRendering": 0, + "NativeRendering": 1 + } + } + Property { name: "text"; type: "string" } + Property { name: "length"; type: "int"; isReadonly: true } + Property { name: "color"; type: "QColor" } + Property { name: "selectionColor"; type: "QColor" } + Property { name: "selectedTextColor"; type: "QColor" } + Property { name: "font"; type: "QFont" } + Property { name: "horizontalAlignment"; type: "HAlignment" } + Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true } + Property { name: "verticalAlignment"; type: "VAlignment" } + Property { name: "wrapMode"; type: "WrapMode" } + Property { name: "readOnly"; type: "bool" } + Property { name: "cursorVisible"; type: "bool" } + Property { name: "cursorPosition"; type: "int" } + Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true } + Property { name: "cursorDelegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "overwriteMode"; type: "bool" } + Property { name: "selectionStart"; type: "int"; isReadonly: true } + Property { name: "selectionEnd"; type: "int"; isReadonly: true } + Property { name: "selectedText"; type: "string"; isReadonly: true } + Property { name: "maximumLength"; type: "int" } + Property { name: "validator"; type: "QValidator"; isPointer: true } + Property { name: "inputMask"; type: "string" } + Property { name: "inputMethodHints"; type: "Qt::InputMethodHints" } + Property { name: "acceptableInput"; type: "bool"; isReadonly: true } + Property { name: "echoMode"; type: "EchoMode" } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "passwordCharacter"; type: "string" } + Property { name: "passwordMaskDelay"; revision: 4; type: "int" } + Property { name: "displayText"; type: "string"; isReadonly: true } + Property { name: "preeditText"; revision: 7; type: "string"; isReadonly: true } + Property { name: "autoScroll"; type: "bool" } + Property { name: "selectByMouse"; type: "bool" } + Property { name: "mouseSelectionMode"; type: "SelectionMode" } + Property { name: "persistentSelection"; type: "bool" } + Property { name: "canPaste"; type: "bool"; isReadonly: true } + Property { name: "canUndo"; type: "bool"; isReadonly: true } + Property { name: "canRedo"; type: "bool"; isReadonly: true } + Property { name: "inputMethodComposing"; type: "bool"; isReadonly: true } + Property { name: "contentWidth"; type: "double"; isReadonly: true } + Property { name: "contentHeight"; type: "double"; isReadonly: true } + Property { name: "renderType"; type: "RenderType" } + Property { name: "padding"; revision: 6; type: "double" } + Property { name: "topPadding"; revision: 6; type: "double" } + Property { name: "leftPadding"; revision: 6; type: "double" } + Property { name: "rightPadding"; revision: 6; type: "double" } + Property { name: "bottomPadding"; revision: 6; type: "double" } + Signal { name: "accepted" } + Signal { name: "editingFinished"; revision: 2 } + Signal { name: "textEdited"; revision: 9 } + Signal { + name: "fontChanged" + Parameter { name: "font"; type: "QFont" } + } + Signal { + name: "horizontalAlignmentChanged" + Parameter { name: "alignment"; type: "QQuickTextInput::HAlignment" } + } + Signal { + name: "verticalAlignmentChanged" + Parameter { name: "alignment"; type: "QQuickTextInput::VAlignment" } + } + Signal { + name: "readOnlyChanged" + Parameter { name: "isReadOnly"; type: "bool" } + } + Signal { + name: "cursorVisibleChanged" + Parameter { name: "isCursorVisible"; type: "bool" } + } + Signal { + name: "overwriteModeChanged" + Parameter { name: "overwriteMode"; type: "bool" } + } + Signal { + name: "maximumLengthChanged" + Parameter { name: "maximumLength"; type: "int" } + } + Signal { + name: "inputMaskChanged" + Parameter { name: "inputMask"; type: "string" } + } + Signal { + name: "echoModeChanged" + Parameter { name: "echoMode"; type: "QQuickTextInput::EchoMode" } + } + Signal { + name: "passwordMaskDelayChanged" + revision: 4 + Parameter { name: "delay"; type: "int" } + } + Signal { name: "preeditTextChanged"; revision: 7 } + Signal { + name: "activeFocusOnPressChanged" + Parameter { name: "activeFocusOnPress"; type: "bool" } + } + Signal { + name: "autoScrollChanged" + Parameter { name: "autoScroll"; type: "bool" } + } + Signal { + name: "selectByMouseChanged" + Parameter { name: "selectByMouse"; type: "bool" } + } + Signal { + name: "mouseSelectionModeChanged" + Parameter { name: "mode"; type: "QQuickTextInput::SelectionMode" } + } + Signal { name: "contentSizeChanged" } + Signal { name: "paddingChanged"; revision: 6 } + Signal { name: "topPaddingChanged"; revision: 6 } + Signal { name: "leftPaddingChanged"; revision: 6 } + Signal { name: "rightPaddingChanged"; revision: 6 } + Signal { name: "bottomPaddingChanged"; revision: 6 } + Method { name: "selectAll" } + Method { name: "selectWord" } + Method { + name: "select" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + Method { name: "deselect" } + Method { + name: "isRightToLeft" + type: "bool" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + Method { name: "cut" } + Method { name: "copy" } + Method { name: "paste" } + Method { name: "undo" } + Method { name: "redo" } + Method { + name: "insert" + Parameter { name: "position"; type: "int" } + Parameter { name: "text"; type: "string" } + } + Method { + name: "remove" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + Method { + name: "ensureVisible" + revision: 4 + Parameter { name: "position"; type: "int" } + } + Method { name: "clear"; revision: 7 } + Method { + name: "positionAt" + Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "positionToRectangle" + type: "QRectF" + Parameter { name: "pos"; type: "int" } + } + Method { + name: "moveCursorSelection" + Parameter { name: "pos"; type: "int" } + } + Method { + name: "moveCursorSelection" + Parameter { name: "pos"; type: "int" } + Parameter { name: "mode"; type: "SelectionMode" } + } + Method { + name: "inputMethodQuery" + revision: 4 + type: "QVariant" + Parameter { name: "query"; type: "Qt::InputMethodQuery" } + Parameter { name: "argument"; type: "QVariant" } + } + Method { + name: "getText" + type: "string" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + } + Component { name: "QQuickToolBar" defaultProperty: "contentData" prototype: "QQuickPane" @@ -1873,4 +2793,282 @@ Module { Property { name: "tumbler"; type: "QQuickTumbler"; isReadonly: true; isPointer: true } Property { name: "displacement"; type: "double"; isReadonly: true } } + Component { + name: "QQuickWindow" + defaultProperty: "data" + prototype: "QWindow" + Enum { + name: "CreateTextureOptions" + values: { + "TextureHasAlphaChannel": 1, + "TextureHasMipmaps": 2, + "TextureOwnsGLTexture": 4, + "TextureCanUseAtlas": 8, + "TextureIsOpaque": 16 + } + } + Enum { + name: "SceneGraphError" + values: { + "ContextNotAvailable": 1 + } + } + Enum { + name: "TextRenderType" + values: { + "QtTextRendering": 0, + "NativeTextRendering": 1 + } + } + Enum { + name: "NativeObjectType" + values: { + "NativeObjectTexture": 0 + } + } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "color"; type: "QColor" } + Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { + name: "activeFocusItem" + revision: 1 + type: "QQuickItem" + isReadonly: true + isPointer: true + } + Signal { name: "frameSwapped" } + Signal { + name: "openglContextCreated" + revision: 2 + Parameter { name: "context"; type: "QOpenGLContext"; isPointer: true } + } + Signal { name: "sceneGraphInitialized" } + Signal { name: "sceneGraphInvalidated" } + Signal { name: "beforeSynchronizing" } + Signal { name: "afterSynchronizing"; revision: 2 } + Signal { name: "beforeRendering" } + Signal { name: "afterRendering" } + Signal { name: "afterAnimating"; revision: 2 } + Signal { name: "sceneGraphAboutToStop"; revision: 2 } + Signal { + name: "closing" + revision: 1 + Parameter { name: "close"; type: "QQuickCloseEvent"; isPointer: true } + } + Signal { + name: "colorChanged" + Parameter { type: "QColor" } + } + Signal { name: "activeFocusItemChanged"; revision: 1 } + Signal { + name: "sceneGraphError" + revision: 2 + Parameter { name: "error"; type: "QQuickWindow::SceneGraphError" } + Parameter { name: "message"; type: "string" } + } + Signal { name: "beforeRenderPassRecording"; revision: 14 } + Signal { name: "afterRenderPassRecording"; revision: 14 } + Method { name: "update" } + Method { name: "releaseResources" } + } + Component { + name: "QQuickWindowQmlImpl" + defaultProperty: "data" + prototype: "QQuickWindow" + Property { name: "visible"; type: "bool" } + Property { name: "visibility"; type: "Visibility" } + Property { name: "screen"; revision: 3; type: "QObject"; isPointer: true } + Signal { + name: "visibleChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "visibilityChanged" + Parameter { name: "visibility"; type: "QWindow::Visibility" } + } + Signal { name: "screenChanged"; revision: 3 } + } + Component { + name: "QWindow" + prototype: "QObject" + Enum { + name: "Visibility" + values: { + "Hidden": 0, + "AutomaticVisibility": 1, + "Windowed": 2, + "Minimized": 3, + "Maximized": 4, + "FullScreen": 5 + } + } + Enum { + name: "AncestorMode" + values: { + "ExcludeTransients": 0, + "IncludeTransients": 1 + } + } + Property { name: "title"; type: "string" } + Property { name: "modality"; type: "Qt::WindowModality" } + Property { name: "flags"; type: "Qt::WindowFlags" } + Property { name: "x"; type: "int" } + Property { name: "y"; type: "int" } + Property { name: "width"; type: "int" } + Property { name: "height"; type: "int" } + Property { name: "minimumWidth"; type: "int" } + Property { name: "minimumHeight"; type: "int" } + Property { name: "maximumWidth"; type: "int" } + Property { name: "maximumHeight"; type: "int" } + Property { name: "visible"; type: "bool" } + Property { name: "active"; revision: 1; type: "bool"; isReadonly: true } + Property { name: "visibility"; revision: 1; type: "Visibility" } + Property { name: "contentOrientation"; type: "Qt::ScreenOrientation" } + Property { name: "opacity"; revision: 1; type: "double" } + Property { name: "transientParent"; revision: 13; type: "QWindow"; isPointer: true } + Signal { + name: "screenChanged" + Parameter { name: "screen"; type: "QScreen"; isPointer: true } + } + Signal { + name: "modalityChanged" + Parameter { name: "modality"; type: "Qt::WindowModality" } + } + Signal { + name: "windowStateChanged" + Parameter { name: "windowState"; type: "Qt::WindowState" } + } + Signal { + name: "windowTitleChanged" + revision: 2 + Parameter { name: "title"; type: "string" } + } + Signal { + name: "xChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "yChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "widthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "heightChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "minimumWidthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "minimumHeightChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "maximumWidthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "maximumHeightChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "visibleChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "visibilityChanged" + revision: 1 + Parameter { name: "visibility"; type: "QWindow::Visibility" } + } + Signal { name: "activeChanged"; revision: 1 } + Signal { + name: "contentOrientationChanged" + Parameter { name: "orientation"; type: "Qt::ScreenOrientation" } + } + Signal { + name: "focusObjectChanged" + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Signal { + name: "opacityChanged" + revision: 1 + Parameter { name: "opacity"; type: "double" } + } + Signal { + name: "transientParentChanged" + revision: 13 + Parameter { name: "transientParent"; type: "QWindow"; isPointer: true } + } + Method { name: "requestActivate"; revision: 1 } + Method { + name: "setVisible" + Parameter { name: "visible"; type: "bool" } + } + Method { name: "show" } + Method { name: "hide" } + Method { name: "showMinimized" } + Method { name: "showMaximized" } + Method { name: "showFullScreen" } + Method { name: "showNormal" } + Method { name: "close"; type: "bool" } + Method { name: "raise" } + Method { name: "lower" } + Method { + name: "setTitle" + Parameter { type: "string" } + } + Method { + name: "setX" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setY" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setWidth" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setHeight" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setGeometry" + Parameter { name: "posx"; type: "int" } + Parameter { name: "posy"; type: "int" } + Parameter { name: "w"; type: "int" } + Parameter { name: "h"; type: "int" } + } + Method { + name: "setGeometry" + Parameter { name: "rect"; type: "QRect" } + } + Method { + name: "setMinimumWidth" + Parameter { name: "w"; type: "int" } + } + Method { + name: "setMinimumHeight" + Parameter { name: "h"; type: "int" } + } + Method { + name: "setMaximumWidth" + Parameter { name: "w"; type: "int" } + } + Method { + name: "setMaximumHeight" + Parameter { name: "h"; type: "int" } + } + Method { + name: "alert" + revision: 1 + Parameter { name: "msec"; type: "int" } + } + Method { name: "requestUpdate"; revision: 3 } + } } diff --git a/src/imports/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/quickcontrols2/qquicktumblerview.cpp b/src/quickcontrols2/qquicktumblerview.cpp index 5f5c065d..4a64ad7f 100644 --- a/src/quickcontrols2/qquicktumblerview.cpp +++ b/src/quickcontrols2/qquicktumblerview.cpp @@ -180,7 +180,6 @@ void QQuickTumblerView::createView() QQml_setParent_noEvent(m_listView, this); m_listView->setParentItem(this); m_listView->setSnapMode(QQuickListView::SnapToItem); - m_listView->setHighlightRangeMode(QQuickListView::StrictlyEnforceRange); m_listView->setClip(true); // Give the view a size. @@ -193,6 +192,8 @@ void QQuickTumblerView::createView() // the view animates any potential currentIndex change over one second, // which we don't want when the contentItem has just been created. m_listView->setDelegate(m_delegate); + // Set this after setting the delegate to avoid unexpected currentIndex changes: QTBUG-79150 + m_listView->setHighlightRangeMode(QQuickListView::StrictlyEnforceRange); m_listView->setHighlightMoveDuration(1000); qCDebug(lcTumblerView) << "finished creating ListView"; 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; } |