aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-03-17 09:54:04 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-03-17 09:54:04 +0100
commitf52b95a96cc8f36f766635f9ddb6c95fa6b3c934 (patch)
tree0a74d23575ae74e93a7b2dedb7a03827c42e8266 /src/imports/controls
parent2bd4f5cd587e258227c69b3124757d7b8e019c9f (diff)
parent7da5842647f75fd990f69f400f75d9b090e39306 (diff)
Merge remote-tracking branch 'origin/dev' into wip/cmake
Diffstat (limited to 'src/imports/controls')
-rw-r--r--src/imports/controls/ComboBox.qml11
-rw-r--r--src/imports/controls/HorizontalHeaderView.qml66
-rw-r--r--src/imports/controls/VerticalHeaderView.qml66
-rw-r--r--src/imports/controls/controls.pri4
-rw-r--r--src/imports/controls/controls.pro2
-rw-r--r--src/imports/controls/designer/qtquickcontrols2.metainfo4
-rw-r--r--src/imports/controls/doc/qtquickcontrols.qdocconf2
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-headerview-simple.qml119
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-custom.qml8
-rw-r--r--src/imports/controls/doc/src/includes/customize-button-background.qdocinc25
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc125
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-imagine.qdoc2
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc14
-rw-r--r--src/imports/controls/fusion/ComboBox.qml15
-rw-r--r--src/imports/controls/fusion/HorizontalHeaderView.qml76
-rw-r--r--src/imports/controls/fusion/VerticalHeaderView.qml76
-rw-r--r--src/imports/controls/fusion/fusion.pri4
-rw-r--r--src/imports/controls/fusion/qquickfusiondial.cpp2
-rw-r--r--src/imports/controls/imagine/ComboBox.qml13
-rw-r--r--src/imports/controls/imagine/Dial.qml3
-rw-r--r--src/imports/controls/imagine/HorizontalHeaderView.qml66
-rw-r--r--src/imports/controls/imagine/VerticalHeaderView.qml66
-rw-r--r--src/imports/controls/imagine/imagine.pri4
-rw-r--r--src/imports/controls/imagine/qquickimaginestyle.cpp2
-rw-r--r--src/imports/controls/material/ComboBox.qml15
-rw-r--r--src/imports/controls/material/HorizontalHeaderView.qml67
-rw-r--r--src/imports/controls/material/VerticalHeaderView.qml67
-rw-r--r--src/imports/controls/material/material.pri4
-rw-r--r--src/imports/controls/material/shaders/+qsb/RectangularGlow.fragbin2321 -> 2007 bytes
-rw-r--r--src/imports/controls/material/shaders/compile.bat40
-rw-r--r--src/imports/controls/qquickdefaultbusyindicator.cpp2
-rw-r--r--src/imports/controls/qquickdefaultprogressbar.cpp2
-rw-r--r--src/imports/controls/qtquickcontrols2plugin.cpp14
-rw-r--r--src/imports/controls/universal/ComboBox.qml13
-rw-r--r--src/imports/controls/universal/HorizontalHeaderView.qml68
-rw-r--r--src/imports/controls/universal/VerticalHeaderView.qml68
-rw-r--r--src/imports/controls/universal/universal.pri4
37 files changed, 1057 insertions, 82 deletions
diff --git a/src/imports/controls/ComboBox.qml b/src/imports/controls/ComboBox.qml
index 8eefc686..b30293f5 100644
--- a/src/imports/controls/ComboBox.qml
+++ b/src/imports/controls/ComboBox.qml
@@ -34,11 +34,11 @@
**
****************************************************************************/
-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 2.15
+import QtQuick.Window 2.15
+import QtQuick.Controls 2.15
+import QtQuick.Controls.impl 2.15
+import QtQuick.Templates 2.15 as T
T.ComboBox {
id: control
@@ -84,6 +84,7 @@ T.ComboBox {
readOnly: control.down
inputMethodHints: control.inputMethodHints
validator: control.validator
+ selectByMouse: control.selectTextByMouse
font: control.font
color: control.editable ? control.palette.text : control.palette.buttonText
diff --git a/src/imports/controls/HorizontalHeaderView.qml b/src/imports/controls/HorizontalHeaderView.qml
new file mode 100644
index 00000000..7f0454da
--- /dev/null
+++ b/src/imports/controls/HorizontalHeaderView.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.15
+import QtQuick.Controls 2.15
+import QtQuick.Templates 2.15 as T
+
+T.HorizontalHeaderView {
+ id: control
+
+ implicitWidth: syncView ? syncView.width : 0
+ implicitHeight: contentHeight
+
+ delegate: Rectangle {
+ // Qt6: add cellPadding (and font etc) as public API in headerview
+ readonly property real cellPadding: 8
+
+ implicitWidth: text.implicitWidth + (cellPadding * 2)
+ implicitHeight: Math.max(control.height, text.implicitHeight + (cellPadding * 2))
+ color: "#f6f6f6"
+ border.color: "#e4e4e4"
+
+ Text {
+ id: text
+ text: model[control.textRole]
+ width: parent.width
+ height: parent.height
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ color: "#ff26282a"
+ }
+ }
+}
diff --git a/src/imports/controls/VerticalHeaderView.qml b/src/imports/controls/VerticalHeaderView.qml
new file mode 100644
index 00000000..5fbfaedf
--- /dev/null
+++ b/src/imports/controls/VerticalHeaderView.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.15
+import QtQuick.Controls 2.15
+import QtQuick.Templates 2.15 as T
+
+T.VerticalHeaderView {
+ id: control
+
+ implicitWidth: contentWidth
+ implicitHeight: syncView ? syncView.height : 0
+
+ delegate: Rectangle {
+ // Qt6: add cellPadding (and font etc) as public API in headerview
+ readonly property real cellPadding: 8
+
+ implicitWidth: Math.max(control.width, text.implicitWidth + (cellPadding * 2))
+ implicitHeight: text.implicitHeight + (cellPadding * 2)
+ color: "#f6f6f6"
+ border.color: "#e4e4e4"
+
+ Text {
+ id: text
+ text: model[control.textRole]
+ width: parent.width
+ height: parent.height
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ color: "#ff26282a"
+ }
+ }
+}
diff --git a/src/imports/controls/controls.pri b/src/imports/controls/controls.pri
index fbf5d075..03fc0f4b 100644
--- a/src/imports/controls/controls.pri
+++ b/src/imports/controls/controls.pri
@@ -32,6 +32,7 @@ QML_FILES += \
$$PWD/Drawer.qml \
$$PWD/Frame.qml \
$$PWD/GroupBox.qml \
+ $$PWD/HorizontalHeaderView.qml \
$$PWD/ItemDelegate.qml \
$$PWD/Label.qml \
$$PWD/Menu.qml \
@@ -67,4 +68,5 @@ QML_FILES += \
$$PWD/ToolButton.qml \
$$PWD/ToolSeparator.qml \
$$PWD/ToolTip.qml \
- $$PWD/Tumbler.qml
+ $$PWD/Tumbler.qml \
+ $$PWD/VerticalHeaderView.qml
diff --git a/src/imports/controls/controls.pro b/src/imports/controls/controls.pro
index 2aeaf9ab..66373d55 100644
--- a/src/imports/controls/controls.pro
+++ b/src/imports/controls/controls.pro
@@ -19,7 +19,7 @@ SOURCES += \
RESOURCES += \
$$PWD/qtquickcontrols2plugin.qrc
-!static: qtConfig(quick-designer): include(designer/designer.pri)
+qtConfig(quick-designer): include(designer/designer.pri)
include(doc/doc.pri)
CONFIG += no_cxx_module install_qml_files builtin_resources qtquickcompiler
diff --git a/src/imports/controls/designer/qtquickcontrols2.metainfo b/src/imports/controls/designer/qtquickcontrols2.metainfo
index 9e6030b1..d27f1b90 100644
--- a/src/imports/controls/designer/qtquickcontrols2.metainfo
+++ b/src/imports/controls/designer/qtquickcontrols2.metainfo
@@ -443,7 +443,7 @@ MetaInfo {
version: "2.0"
requiredImport: "QtQuick.Controls"
- Property { name: "text"; type: "binding"; value: "qsTr(\"Text Area\")" }
+ Property { name: "placeholderText"; type: "binding"; value: "qsTr(\"Text Area\")" }
}
}
@@ -458,7 +458,7 @@ MetaInfo {
version: "2.0"
requiredImport: "QtQuick.Controls"
- Property { name: "text"; type: "binding"; value: "qsTr(\"Text Field\")" }
+ Property { name: "placeholderText"; type: "binding"; value: "qsTr(\"Text Field\")" }
}
}
diff --git a/src/imports/controls/doc/qtquickcontrols.qdocconf b/src/imports/controls/doc/qtquickcontrols.qdocconf
index f6798f1f..d52aceb8 100644
--- a/src/imports/controls/doc/qtquickcontrols.qdocconf
+++ b/src/imports/controls/doc/qtquickcontrols.qdocconf
@@ -33,7 +33,7 @@ qhp.QtQuickControls.subprojects.examples.title = Examples
qhp.QtQuickControls.subprojects.examples.indexTitle = Qt Quick Controls Examples
qhp.QtQuickControls.subprojects.examples.selectors = fake:example
-depends = qtcore qtgui qtdoc qtqml qtquick qtquickdialogs qtquickcontrols1 qtquickextras qmake qtsql qtwidgets qtlabscalendar qtlabsplatform qtgraphicaleffects
+depends = qtcore qtgui qtdoc qtqml qtqmlmodels qtquick qtquickdialogs qtquickcontrols1 qtquickextras qmake qtsql qtwidgets qtlabscalendar qtlabsplatform qtgraphicaleffects
# Specify the install path under QT_INSTALL_EXAMPLES
# Note: paths passed to \example command must contain the parent directory, e.g.
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-headerview-simple.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-headerview-simple.qml
new file mode 100644
index 00000000..07ec84d8
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-headerview-simple.qml
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![file]
+import QtQuick 2.15
+import QtQuick.Controls 2.15
+import Qt.labs.qmlmodels 1.0
+
+ApplicationWindow {
+ visible: true
+ width: 640
+ height: 480
+
+ //! [horizontal]
+ HorizontalHeaderView {
+ id: horizontalHeader
+ syncView: tableView
+ anchors.left: tableView.left
+ }
+ //! [horizontal]
+
+ //! [vertical]
+ VerticalHeaderView {
+ id: verticalHeader
+ syncView: tableView
+ anchors.top: tableView.top
+ }
+ //! [vertical]
+
+ TableView {
+ id: tableView
+ anchors.fill: parent
+ anchors.topMargin: horizontalHeader.height
+ anchors.leftMargin: verticalHeader.width
+ columnSpacing: 1
+ rowSpacing: 1
+ clip: true
+
+ model: TableModel {
+ TableModelColumn { display: "name" }
+ TableModelColumn { display: "color" }
+
+ rows: [
+ {
+ "name": "cat",
+ "color": "black"
+ },
+ {
+ "name": "dog",
+ "color": "brown"
+ },
+ {
+ "name": "bird",
+ "color": "white"
+ }
+ ]
+ }
+
+ delegate: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 50
+ border.width: 1
+
+ Text {
+ text: display
+ anchors.centerIn: parent
+ }
+ }
+ }
+}
+
+//![file]
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-custom.qml
index 1c5db214..b8510ddd 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-custom.qml
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-custom.qml
@@ -54,22 +54,22 @@ RangeSlider {
}
first.handle: Rectangle {
- x: control.leftPadding + first.visualPosition * (control.availableWidth - width)
+ x: control.leftPadding + control.first.visualPosition * (control.availableWidth - width)
y: control.topPadding + control.availableHeight / 2 - height / 2
implicitWidth: 26
implicitHeight: 26
radius: 13
- color: first.pressed ? "#f0f0f0" : "#f6f6f6"
+ color: control.first.pressed ? "#f0f0f0" : "#f6f6f6"
border.color: "#bdbebf"
}
second.handle: Rectangle {
- x: control.leftPadding + second.visualPosition * (control.availableWidth - width)
+ x: control.leftPadding + control.second.visualPosition * (control.availableWidth - width)
y: control.topPadding + control.availableHeight / 2 - height / 2
implicitWidth: 26
implicitHeight: 26
radius: 13
- color: second.pressed ? "#f0f0f0" : "#f6f6f6"
+ color: control.second.pressed ? "#f0f0f0" : "#f6f6f6"
border.color: "#bdbebf"
}
}
diff --git a/src/imports/controls/doc/src/includes/customize-button-background.qdocinc b/src/imports/controls/doc/src/includes/customize-button-background.qdocinc
new file mode 100644
index 00000000..59df7d8e
--- /dev/null
+++ b/src/imports/controls/doc/src/includes/customize-button-background.qdocinc
@@ -0,0 +1,25 @@
+//! [file]
+\qml \QtMinorVersion
+import QtQuick 2.\1
+import QtQuick.Controls 2.\1
+
+ApplicationWindow {
+ width: 400
+ height: 400
+ visible: true
+
+ Button {
+ id: button
+ text: "A Special Button"
+ background: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 40
+ color: button.down ? "#d6d6d6" : "#f6f6f6"
+ border.color: "#26282a"
+ border.width: 1
+ radius: 4
+ }
+ }
+}
+\endqml
+//! [file]
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
index cd06a456..5901663a 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
@@ -48,29 +48,7 @@
can override the \l {Control::}{background} item and set the radius
property of Rectangle:
- \qml \QtMinorVersion
- import QtQuick 2.\1
- import QtQuick.Controls 2.\1
-
- ApplicationWindow {
- width: 400
- height: 400
- visible: true
-
- Button {
- id: button
- text: "A Special Button"
- background: Rectangle {
- implicitWidth: 100
- implicitHeight: 40
- color: button.down ? "#d6d6d6" : "#f6f6f6"
- border.color: "#26282a"
- border.width: 1
- radius: 4
- }
- }
- }
- \endqml
+ \include customize-button-background.qdocinc file
The second way to create the button is good if you plan to use your rounded
button in several places. It involves moving the code into its own QML file
@@ -166,7 +144,8 @@
By default, the styling system uses the Default style as a fallback for
controls that aren't implemented. To customize or extend any other built-in
- style, it is possible to specify a different fallback style using \l QQuickStyle.
+ style, it is possible to specify a different fallback style using
+ \l[QtQuickControls2]{QQuickStyle}.
What this means is that you can implement as many controls as you like for
your custom style, and place them almost anywhere. It also allows users to
@@ -175,7 +154,7 @@
\section3 Previewing Custom Styles in Qt Quick Designer
Using the approach above, it is possible to preview a custom style
- in \l {Using Qt Quick Designer}{Qt Quick Designer}. In order to do so,
+ in Qt Quick Designer. In order to do so,
ensure that the project has a
\l {Qt Quick Controls Configuration File}{qtquickcontrols2.conf} file,
and that the following entry exists:
@@ -213,6 +192,102 @@
files.
\endlist
+ \section3 Considerations for custom styles
+
+ When implementing your own style and customizing controls, there are some
+ points to keep in mind to ensure that your application is as performant as
+ possible.
+
+ \section4 Avoid assigning an id to styles' implementations of item delegates
+
+ As explained in \l {Definition of a Style}, when you implement your
+ own style for a control, you start off with the relevant template for
+ that control. For example, a style's \c Button.qml will be structured
+ similarly to this:
+
+ \qml
+ T.Button {
+ // ...
+
+ background: Rectangle {
+ // ...
+ }
+
+ contentItem: Text {
+ // ...
+ }
+
+ // ...
+ }
+ \endqml
+
+ When you use a Button in your application, the \c background and
+ \c contentItem items will be created and parented to the root \c Button
+ item:
+
+ \qml
+ // Creates the Button root item, the Rectangle background,
+ // and the Text contentItem.
+ Button {
+ text: qsTr("Confirm")
+ }
+ \endqml
+
+ Suppose you then needed to do a one-off customization of the Button (as
+ explained in \l {Customizing a Control}):
+
+ \include customize-button-background.qdocinc file
+
+ In QML, this would normally result in both the default \c background
+ implementation and the one-off, custom \c background items being created.
+ Qt Quick Controls uses a technique that avoids creating both items, and
+ instead only creates the custom \c background, greatly improving the
+ creation performance of controls.
+
+ This technique relies on the absence of an \l {The id Attribute}{id} in the
+ style's implementation of that item. If an id is assigned, the technique
+ cannot work, and both items will be created. For example, it can be
+ tempting to assign an id to the \c background or \c contentItem so that
+ other objects within the file can refer to those items:
+
+ \qml
+ T.Button {
+ // ...
+
+ background: Rectangle {
+ id: backgroundRect
+ // ...
+ }
+
+ contentItem: Text {
+ // Use backgroundRect in some way...
+ }
+
+ // ...
+ }
+ \endqml
+
+ With this code, every time a Button instance with a customized background
+ is created, both backgrounds will be created, resulting in sub-optimal
+ creation performance.
+
+ Prior to Qt 5.15, the old, unused background would be deleted to release
+ the resources associated with it. However, as the control does not own the
+ items, it should not delete them. As of Qt 5.15, old items are no longer
+ deleted, and so the \c backgroundRect item will live longer than it needs
+ to—typically until the application exits. Although the old item will be
+ hidden, visually unparented from the control, and removed from the
+ accessibility tree, it is important to keep the creation time and memory
+ usage of these unused items in mind when assigning an id in this context.
+
+ \section4 Avoid imperative assignments of custom items
+
+ The technique mentioned in the section above only works when an item is
+ \l {Prefer Declarative Bindings Over Imperative Assignments}{declaratively}
+ assigned for the first time, and so imperative assignments will result in
+ orphaned items. Always use declarative bindings to assign custom items
+ when possible.
+
\section3 Attached properties
It is common for a style to have certain properties or attributes that
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-imagine.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-imagine.qdoc
index 6e15762d..ac2e9cc1 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-imagine.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-imagine.qdoc
@@ -2478,7 +2478,7 @@
The Imagine style supports palette customization via the \l {Control::}{palette}
property and the \l {Palette Configuration}{qtquickcontrols2.conf} file.
- As with other styles, the exact \l {palette QML Basic Type}{palette roles}
+ As with other styles, the exact \l[QML]{palette}{palette roles}
that the Imagine style uses are style-dependent. However, as most of the visual
appearance of controls (for example: backgrounds) are managed through image assets,
only the roles that are typically used for text will have an effect.
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc
index 75e59f42..ddf41771 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc
@@ -70,15 +70,15 @@
\section1 Using Styles in Qt Quick Controls
In order to run an application with a specific style, either configure the
- style using \l QQuickStyle in C++, pass a command line argument, or set an
+ style using \l[CPP]{QQuickStyle} in C++, pass a command line argument, or set an
environment variable. Alternatively, the preferred style and style-specific
attributes can be specified in a configuration file.
The priority of these approaches follows the order they are listed below,
- from highest to lowest. That is, using QQuickStyle to set the style will
+ from highest to lowest. That is, using \c QQuickStyle to set the style will
always take priority over using the command line argument, for example.
- \warning When resolving a given style name to an absolute path, QQuickStyle
+ \warning When resolving a given style name to an absolute path, \c QQuickStyle
may search the root resource directory (\c {:}). Consequently, make sure
that your resource directories are named differently than the names of the
styles that your application supports. Otherwise, the styles may not load.
@@ -87,14 +87,16 @@
\section2 Using QQuickStyle in C++
- \l QQuickStyle provides C++ API for configuring a specific style. The following
- example runs a Qt Quick Controls application with the Material style:
+ \l[CPP]{QQuickStyle} provides C++ API for configuring a specific
+ style. The following example runs a Qt Quick Controls application
+ with the Material style:
\code
QQuickStyle::setStyle("Material");
\endcode
- See the detailed description of \l QQuickStyle for more details.
+ See the detailed description of \l[CPP]{QQuickStyle} for more
+ details.
\section2 Command line argument
diff --git a/src/imports/controls/fusion/ComboBox.qml b/src/imports/controls/fusion/ComboBox.qml
index e9b836ef..d8ef1888 100644
--- a/src/imports/controls/fusion/ComboBox.qml
+++ b/src/imports/controls/fusion/ComboBox.qml
@@ -34,13 +34,13 @@
**
****************************************************************************/
-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
+import QtQuick 2.15
+import QtQuick.Window 2.15
+import QtQuick.Templates 2.15 as T
+import QtQuick.Controls 2.15
+import QtQuick.Controls.impl 2.15
+import QtQuick.Controls.Fusion 2.15
+import QtQuick.Controls.Fusion.impl 2.15
T.ComboBox {
id: control
@@ -84,6 +84,7 @@ T.ComboBox {
readOnly: control.down
inputMethodHints: control.inputMethodHints
validator: control.validator
+ selectByMouse: control.selectTextByMouse
font: control.font
color: control.editable ? control.palette.text : control.palette.buttonText
diff --git a/src/imports/controls/fusion/HorizontalHeaderView.qml b/src/imports/controls/fusion/HorizontalHeaderView.qml
new file mode 100644
index 00000000..3d0f247b
--- /dev/null
+++ b/src/imports/controls/fusion/HorizontalHeaderView.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.15
+import QtQuick.Controls 2.15
+import QtQuick.Templates 2.15 as T
+
+T.HorizontalHeaderView {
+ id: control
+
+ implicitWidth: syncView ? syncView.width : 0
+ implicitHeight: contentHeight
+
+ delegate: Rectangle {
+ // Qt6: add cellPadding (and font etc) as public API in headerview
+ readonly property real cellPadding: 8
+
+ implicitWidth: text.implicitWidth + (cellPadding * 2)
+ implicitHeight: Math.max(control.height, text.implicitHeight + (cellPadding * 2))
+ border.color: "#cacaca"
+
+ gradient: Gradient {
+ GradientStop {
+ position: 0
+ color: "#fbfbfb"
+ }
+ GradientStop {
+ position: 1
+ color: "#e0dfe0"
+ }
+ }
+
+ Text {
+ id: text
+ text: model[control.textRole]
+ width: parent.width
+ height: parent.height
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ color: "#ff26282a"
+ }
+ }
+}
diff --git a/src/imports/controls/fusion/VerticalHeaderView.qml b/src/imports/controls/fusion/VerticalHeaderView.qml
new file mode 100644
index 00000000..5ad0db8f
--- /dev/null
+++ b/src/imports/controls/fusion/VerticalHeaderView.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.15
+import QtQuick.Controls 2.15
+import QtQuick.Templates 2.15 as T
+
+T.VerticalHeaderView {
+ id: control
+
+ implicitWidth: contentWidth
+ implicitHeight: syncView ? syncView.height : 0
+
+ delegate: Rectangle {
+ // Qt6: add cellPadding (and font etc) as public API in headerview
+ readonly property real cellPadding: 8
+
+ implicitWidth: Math.max(control.width, text.implicitWidth + (cellPadding * 2))
+ implicitHeight: text.implicitHeight + (cellPadding * 2)
+ border.color: "#cacaca"
+
+ gradient: Gradient {
+ GradientStop {
+ position: 0
+ color: "#fbfbfb"
+ }
+ GradientStop {
+ position: 1
+ color: "#e0dfe0"
+ }
+ }
+
+ Text {
+ id: text
+ text: model[control.textRole]
+ width: parent.width
+ height: parent.height
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ color: "#ff26282a"
+ }
+ }
+}
diff --git a/src/imports/controls/fusion/fusion.pri b/src/imports/controls/fusion/fusion.pri
index 72978db5..bdc413fd 100644
--- a/src/imports/controls/fusion/fusion.pri
+++ b/src/imports/controls/fusion/fusion.pri
@@ -28,6 +28,7 @@ QML_FILES += \
$$PWD/Drawer.qml \
$$PWD/Frame.qml \
$$PWD/GroupBox.qml \
+ $$PWD/HorizontalHeaderView.qml \
$$PWD/ItemDelegate.qml \
$$PWD/Label.qml \
$$PWD/Menu.qml \
@@ -64,4 +65,5 @@ QML_FILES += \
$$PWD/ToolButton.qml \
$$PWD/ToolSeparator.qml \
$$PWD/ToolTip.qml \
- $$PWD/Tumbler.qml
+ $$PWD/Tumbler.qml \
+ $$PWD/VerticalHeaderView.qml
diff --git a/src/imports/controls/fusion/qquickfusiondial.cpp b/src/imports/controls/fusion/qquickfusiondial.cpp
index 182f5c0f..50436634 100644
--- a/src/imports/controls/fusion/qquickfusiondial.cpp
+++ b/src/imports/controls/fusion/qquickfusiondial.cpp
@@ -84,7 +84,7 @@ void QQuickFusionDial::paint(QPainter *painter)
QColor buttonColor = m_palette.button().color();
const bool enabled = isEnabled();
- qreal r = qMin(width, height) / 2;
+ qreal r = qMin(width, height) / 2.0;
r -= r/50;
const qreal penSize = r/20.0;
diff --git a/src/imports/controls/imagine/ComboBox.qml b/src/imports/controls/imagine/ComboBox.qml
index 2d582e98..92937826 100644
--- a/src/imports/controls/imagine/ComboBox.qml
+++ b/src/imports/controls/imagine/ComboBox.qml
@@ -34,12 +34,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
+import QtQuick 2.15
+import QtQuick.Window 2.15
+import QtQuick.Templates 2.15 as T
+import QtQuick.Controls 2.15
+import QtQuick.Controls.Imagine 2.15
+import QtQuick.Controls.Imagine.impl 2.15
T.ComboBox {
id: control
@@ -98,6 +98,7 @@ T.ComboBox {
readOnly: control.down
inputMethodHints: control.inputMethodHints
validator: control.validator
+ selectByMouse: control.selectTextByMouse
font: control.font
color: control.flat ? control.palette.windowText : control.editable ? control.palette.text : control.palette.buttonText
diff --git a/src/imports/controls/imagine/Dial.qml b/src/imports/controls/imagine/Dial.qml
index f10634e6..f8c394f3 100644
--- a/src/imports/controls/imagine/Dial.qml
+++ b/src/imports/controls/imagine/Dial.qml
@@ -74,7 +74,7 @@ T.Dial {
transform: [
Translate {
- y: -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
@@ -89,6 +89,7 @@ T.Dial {
y: control.height / 2 - height / 2
width: Math.max(64, Math.min(control.width, control.height))
height: width
+ fillMode: Image.PreserveAspectFit
source: Imagine.url + "dial-background"
NinePatchImageSelector on source {
diff --git a/src/imports/controls/imagine/HorizontalHeaderView.qml b/src/imports/controls/imagine/HorizontalHeaderView.qml
new file mode 100644
index 00000000..7f0454da
--- /dev/null
+++ b/src/imports/controls/imagine/HorizontalHeaderView.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.15
+import QtQuick.Controls 2.15
+import QtQuick.Templates 2.15 as T
+
+T.HorizontalHeaderView {
+ id: control
+
+ implicitWidth: syncView ? syncView.width : 0
+ implicitHeight: contentHeight
+
+ delegate: Rectangle {
+ // Qt6: add cellPadding (and font etc) as public API in headerview
+ readonly property real cellPadding: 8
+
+ implicitWidth: text.implicitWidth + (cellPadding * 2)
+ implicitHeight: Math.max(control.height, text.implicitHeight + (cellPadding * 2))
+ color: "#f6f6f6"
+ border.color: "#e4e4e4"
+
+ Text {
+ id: text
+ text: model[control.textRole]
+ width: parent.width
+ height: parent.height
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ color: "#ff26282a"
+ }
+ }
+}
diff --git a/src/imports/controls/imagine/VerticalHeaderView.qml b/src/imports/controls/imagine/VerticalHeaderView.qml
new file mode 100644
index 00000000..5fbfaedf
--- /dev/null
+++ b/src/imports/controls/imagine/VerticalHeaderView.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.15
+import QtQuick.Controls 2.15
+import QtQuick.Templates 2.15 as T
+
+T.VerticalHeaderView {
+ id: control
+
+ implicitWidth: contentWidth
+ implicitHeight: syncView ? syncView.height : 0
+
+ delegate: Rectangle {
+ // Qt6: add cellPadding (and font etc) as public API in headerview
+ readonly property real cellPadding: 8
+
+ implicitWidth: Math.max(control.width, text.implicitWidth + (cellPadding * 2))
+ implicitHeight: text.implicitHeight + (cellPadding * 2)
+ color: "#f6f6f6"
+ border.color: "#e4e4e4"
+
+ Text {
+ id: text
+ text: model[control.textRole]
+ width: parent.width
+ height: parent.height
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ color: "#ff26282a"
+ }
+ }
+}
diff --git a/src/imports/controls/imagine/imagine.pri b/src/imports/controls/imagine/imagine.pri
index 081a509e..4c6bcf1b 100644
--- a/src/imports/controls/imagine/imagine.pri
+++ b/src/imports/controls/imagine/imagine.pri
@@ -12,6 +12,7 @@ QML_FILES += \
$$PWD/Drawer.qml \
$$PWD/Frame.qml \
$$PWD/GroupBox.qml \
+ $$PWD/HorizontalHeaderView.qml \
$$PWD/ItemDelegate.qml \
$$PWD/Label.qml \
$$PWD/Menu.qml \
@@ -44,7 +45,8 @@ QML_FILES += \
$$PWD/ToolButton.qml \
$$PWD/ToolSeparator.qml \
$$PWD/ToolTip.qml \
- $$PWD/Tumbler.qml
+ $$PWD/Tumbler.qml \
+ $$PWD/VerticalHeaderView.qml
HEADERS += \
$$PWD/qquickimageselector_p.h \
diff --git a/src/imports/controls/imagine/qquickimaginestyle.cpp b/src/imports/controls/imagine/qquickimaginestyle.cpp
index 9e1431de..745bef10 100644
--- a/src/imports/controls/imagine/qquickimaginestyle.cpp
+++ b/src/imports/controls/imagine/qquickimaginestyle.cpp
@@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC_WITH_ARGS(QString, GlobalPath, (QLatin1String("qrc:/qt-project.org/imports/QtQuick/Controls.2/Imagine/images/")))
-static const QString ensureSlash(const QString &path)
+static QString ensureSlash(const QString &path)
{
const QChar slash = QLatin1Char('/');
return path.endsWith(slash) ? path : path + slash;
diff --git a/src/imports/controls/material/ComboBox.qml b/src/imports/controls/material/ComboBox.qml
index 7d635902..e4ee332b 100644
--- a/src/imports/controls/material/ComboBox.qml
+++ b/src/imports/controls/material/ComboBox.qml
@@ -34,13 +34,13 @@
**
****************************************************************************/
-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
+import QtQuick 2.15
+import QtQuick.Window 2.15
+import QtQuick.Controls 2.15
+import QtQuick.Controls.impl 2.15
+import QtQuick.Templates 2.15 as T
+import QtQuick.Controls.Material 2.15
+import QtQuick.Controls.Material.impl 2.15
T.ComboBox {
id: control
@@ -89,6 +89,7 @@ T.ComboBox {
readOnly: control.down
inputMethodHints: control.inputMethodHints
validator: control.validator
+ selectByMouse: control.selectTextByMouse
font: control.font
color: control.enabled ? control.Material.foreground : control.Material.hintTextColor
diff --git a/src/imports/controls/material/HorizontalHeaderView.qml b/src/imports/controls/material/HorizontalHeaderView.qml
new file mode 100644
index 00000000..504579cc
--- /dev/null
+++ b/src/imports/controls/material/HorizontalHeaderView.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.15
+import QtQuick.Controls 2.15
+import QtQuick.Templates 2.15 as T
+import QtQuick.Controls.Material 2.15
+import QtQuick.Controls.Material.impl 2.15
+
+T.HorizontalHeaderView {
+ id: control
+
+ implicitWidth: syncView ? syncView.width : 0
+ implicitHeight: contentHeight
+
+ delegate: Rectangle {
+ // Qt6: add cellPadding (and font etc) as public API in headerview
+ readonly property real cellPadding: 8
+
+ implicitWidth: text.implicitWidth + (cellPadding * 2)
+ implicitHeight: Math.max(control.height, text.implicitHeight + (cellPadding * 2))
+ color: control.Material.backgroundColor
+
+ Text {
+ id: text
+ text: model[control.textRole]
+ width: parent.width
+ height: parent.height
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ color: enabled ? control.Material.foreground : control.Material.hintTextColor
+ }
+ }
+}
diff --git a/src/imports/controls/material/VerticalHeaderView.qml b/src/imports/controls/material/VerticalHeaderView.qml
new file mode 100644
index 00000000..7f8ecc92
--- /dev/null
+++ b/src/imports/controls/material/VerticalHeaderView.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.15
+import QtQuick.Controls 2.15
+import QtQuick.Templates 2.15 as T
+import QtQuick.Controls.Material 2.15
+import QtQuick.Controls.Material.impl 2.15
+
+T.VerticalHeaderView {
+ id: control
+
+ implicitWidth: contentWidth
+ implicitHeight: syncView ? syncView.height : 0
+
+ delegate: Rectangle {
+ // Qt6: add cellPadding (and font etc) as public API in headerview
+ readonly property real cellPadding: 8
+
+ implicitWidth: Math.max(control.width, text.implicitWidth + (cellPadding * 2))
+ implicitHeight: text.implicitHeight + (cellPadding * 2)
+ color: control.Material.backgroundColor
+
+ Text {
+ id: text
+ text: model[control.textRole]
+ width: parent.width
+ height: parent.height
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ color: enabled ? control.Material.foreground : control.Material.hintTextColor
+ }
+ }
+}
diff --git a/src/imports/controls/material/material.pri b/src/imports/controls/material/material.pri
index bda1fb21..457a8df1 100644
--- a/src/imports/controls/material/material.pri
+++ b/src/imports/controls/material/material.pri
@@ -30,6 +30,7 @@ QML_FILES += \
$$PWD/ElevationEffect.qml \
$$PWD/Frame.qml \
$$PWD/GroupBox.qml \
+ $$PWD/HorizontalHeaderView.qml \
$$PWD/ItemDelegate.qml \
$$PWD/Label.qml \
$$PWD/Menu.qml \
@@ -68,4 +69,5 @@ QML_FILES += \
$$PWD/ToolButton.qml \
$$PWD/ToolSeparator.qml \
$$PWD/ToolTip.qml \
- $$PWD/Tumbler.qml
+ $$PWD/Tumbler.qml \
+ $$PWD/VerticalHeaderView.qml
diff --git a/src/imports/controls/material/shaders/+qsb/RectangularGlow.frag b/src/imports/controls/material/shaders/+qsb/RectangularGlow.frag
index a805b134..5cfa2db6 100644
--- a/src/imports/controls/material/shaders/+qsb/RectangularGlow.frag
+++ b/src/imports/controls/material/shaders/+qsb/RectangularGlow.frag
Binary files differ
diff --git a/src/imports/controls/material/shaders/compile.bat b/src/imports/controls/material/shaders/compile.bat
new file mode 100644
index 00000000..e87efa7a
--- /dev/null
+++ b/src/imports/controls/material/shaders/compile.bat
@@ -0,0 +1,40 @@
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::
+:: Copyright (C) 2019 The Qt Company Ltd.
+:: Contact: https://www.qt.io/licensing/
+::
+:: This file is part of the QtQuick module of the Qt Toolkit.
+::
+:: $QT_BEGIN_LICENSE:LGPL$
+:: Commercial License Usage
+:: Licensees holding valid commercial Qt licenses may use this file in
+:: accordance with the commercial license agreement provided with the
+:: Software or, alternatively, in accordance with the terms contained in
+:: a written agreement between you and The Qt Company. For licensing terms
+:: and conditions see https://www.qt.io/terms-conditions. For further
+:: information use the contact form at https://www.qt.io/contact-us.
+::
+:: GNU Lesser General Public License Usage
+:: Alternatively, this file may be used under the terms of the GNU Lesser
+:: General Public License version 3 as published by the Free Software
+:: Foundation and appearing in the file LICENSE.LGPL3 included in the
+:: packaging of this file. Please review the following information to
+:: ensure the GNU Lesser General Public License version 3 requirements
+:: will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+::
+:: GNU General Public License Usage
+:: Alternatively, this file may be used under the terms of the GNU
+:: General Public License version 2.0 or (at your option) the GNU General
+:: Public license version 3 or any later version approved by the KDE Free
+:: Qt Foundation. The licenses are as published by the Free Software
+:: Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+:: included in the packaging of this file. Please review the following
+:: information to ensure the GNU General Public License requirements will
+:: be met: https://www.gnu.org/licenses/gpl-2.0.html and
+:: https://www.gnu.org/licenses/gpl-3.0.html.
+::
+:: $QT_END_LICENSE$
+::
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/RectangularGlow.frag RectangularGlow_rhi.frag
diff --git a/src/imports/controls/qquickdefaultbusyindicator.cpp b/src/imports/controls/qquickdefaultbusyindicator.cpp
index 98a3cae3..aca795d9 100644
--- a/src/imports/controls/qquickdefaultbusyindicator.cpp
+++ b/src/imports/controls/qquickdefaultbusyindicator.cpp
@@ -124,7 +124,7 @@ void QQuickDefaultBusyIndicatorNode::sync(QQuickItem *item)
Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType);
QPointF pos = QPointF(sz / 2 - circleRadius, sz / 2 - circleRadius);
- pos = moveCircle(pos, 360 / CircleCount * i, sz / 2 - circleRadius);
+ pos = moveCircle(pos, 360.0 / CircleCount * i, sz / 2 - circleRadius);
QMatrix4x4 m;
m.translate(dx + pos.x(), dy + pos.y());
diff --git a/src/imports/controls/qquickdefaultprogressbar.cpp b/src/imports/controls/qquickdefaultprogressbar.cpp
index e8657255..f44065e4 100644
--- a/src/imports/controls/qquickdefaultprogressbar.cpp
+++ b/src/imports/controls/qquickdefaultprogressbar.cpp
@@ -59,7 +59,7 @@ static inline qreal blockStartX(int blockIndex)
static inline qreal blockRestX(int blockIndex, qreal availableWidth)
{
- const qreal spanRightEdgePos = availableWidth / 2 + BlockSpan / 2;
+ const qreal spanRightEdgePos = availableWidth / 2 + BlockSpan / 2.0;
return spanRightEdgePos - (blockIndex + 1) * BlockWidth - (blockIndex * BlockRestingSpacing);
}
diff --git a/src/imports/controls/qtquickcontrols2plugin.cpp b/src/imports/controls/qtquickcontrols2plugin.cpp
index 5d59d8ca..6730848f 100644
--- a/src/imports/controls/qtquickcontrols2plugin.cpp
+++ b/src/imports/controls/qtquickcontrols2plugin.cpp
@@ -79,6 +79,7 @@ public:
~QtQuickControls2Plugin();
void registerTypes(const char *uri) override;
+ void unregisterTypes() override;
QString name() const override;
void initializeTheme(QQuickTheme *theme) override;
@@ -94,7 +95,8 @@ QtQuickControls2Plugin::QtQuickControls2Plugin(QObject *parent) : QQuickStylePlu
QtQuickControls2Plugin::~QtQuickControls2Plugin()
{
- QQuickStylePrivate::reset();
+ // Intentionally empty: we use register/unregisterTypes() to do
+ // initialization and cleanup, as plugins are not unloaded on macOS.
}
static bool isDefaultStyle(const QString &style)
@@ -194,6 +196,10 @@ void QtQuickControls2Plugin::registerTypes(const char *uri)
qmlRegisterUncreatableType<QQuickSplitHandleAttached>(uri, 2, 13, "SplitHandle",
QStringLiteral("SplitHandle is only available as an attached property."));
+ // QtQuick.Controls 2.15 (new types in Qt 5.15)
+ qmlRegisterType(resolvedUrl(QStringLiteral("HorizontalHeaderView.qml")), uri, 2, 15, "HorizontalHeaderView");
+ qmlRegisterType(resolvedUrl(QStringLiteral("VerticalHeaderView.qml")), uri, 2, 15, "VerticalHeaderView");
+
// The minor version used to be the current Qt 5 minor. For compatibility it is the last
// Qt 5 release.
const QByteArray import = QByteArray(uri) + ".impl";
@@ -234,6 +240,12 @@ void QtQuickControls2Plugin::registerTypes(const char *uri)
qmlRegisterRevision<QQuickText, 6>(import, 2, 3);
}
+void QtQuickControls2Plugin::unregisterTypes()
+{
+ QQuickStylePlugin::unregisterTypes();
+ QQuickStylePrivate::reset();
+}
+
QString QtQuickControls2Plugin::name() const
{
return QStringLiteral("Default");
diff --git a/src/imports/controls/universal/ComboBox.qml b/src/imports/controls/universal/ComboBox.qml
index 9a4e119b..fd2d8935 100644
--- a/src/imports/controls/universal/ComboBox.qml
+++ b/src/imports/controls/universal/ComboBox.qml
@@ -34,12 +34,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
+import QtQuick 2.15
+import QtQuick.Window 2.15
+import QtQuick.Controls 2.15
+import QtQuick.Controls.impl 2.15
+import QtQuick.Templates 2.15 as T
+import QtQuick.Controls.Universal 2.15
T.ComboBox {
id: control
@@ -94,6 +94,7 @@ T.ComboBox {
readOnly: control.down
inputMethodHints: control.inputMethodHints
validator: control.validator
+ selectByMouse: control.selectTextByMouse
font: control.font
color: !control.enabled ? control.Universal.chromeDisabledLowColor :
diff --git a/src/imports/controls/universal/HorizontalHeaderView.qml b/src/imports/controls/universal/HorizontalHeaderView.qml
new file mode 100644
index 00000000..8cdfda35
--- /dev/null
+++ b/src/imports/controls/universal/HorizontalHeaderView.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.15
+import QtQuick.Controls 2.15
+import QtQuick.Controls.impl 2.15
+import QtQuick.Templates 2.15 as T
+import QtQuick.Controls.Universal 2.15
+import QtQuick.Controls.Universal.impl 2.15
+
+T.HorizontalHeaderView {
+ id: control
+
+ implicitWidth: syncView ? syncView.width : 0
+ implicitHeight: contentHeight
+
+ delegate: Rectangle {
+ // Qt6: add cellPadding (and font etc) as public API in headerview
+ readonly property real cellPadding: 8
+
+ implicitWidth: text.implicitWidth + (cellPadding * 2)
+ implicitHeight: Math.max(control.height, text.implicitHeight + (cellPadding * 2))
+ color: control.Universal.background
+
+ Text {
+ id: text
+ text: model[control.textRole]
+ width: parent.width
+ height: parent.height
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ color: Color.transparent(control.Universal.foreground, enabled ? 1.0 : 0.2)
+ }
+ }
+}
diff --git a/src/imports/controls/universal/VerticalHeaderView.qml b/src/imports/controls/universal/VerticalHeaderView.qml
new file mode 100644
index 00000000..7c7544af
--- /dev/null
+++ b/src/imports/controls/universal/VerticalHeaderView.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.15
+import QtQuick.Controls 2.15
+import QtQuick.Controls.impl 2.15
+import QtQuick.Templates 2.15 as T
+import QtQuick.Controls.Universal 2.15
+import QtQuick.Controls.Universal.impl 2.15
+
+T.VerticalHeaderView {
+ id: control
+
+ implicitWidth: contentWidth
+ implicitHeight: syncView ? syncView.height : 0
+
+ delegate: Rectangle {
+ // Qt6: add cellPadding (and font etc) as public API in headerview
+ readonly property real cellPadding: 8
+
+ implicitWidth: Math.max(control.width, text.implicitWidth + (cellPadding * 2))
+ implicitHeight: text.implicitHeight + (cellPadding * 2)
+ color: control.Universal.background
+
+ Text {
+ id: text
+ text: model[control.textRole]
+ width: parent.width
+ height: parent.height
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ color: Color.transparent(control.Universal.foreground, enabled ? 1.0 : 0.2)
+ }
+ }
+}
diff --git a/src/imports/controls/universal/universal.pri b/src/imports/controls/universal/universal.pri
index 4440acbf..8f1b905c 100644
--- a/src/imports/controls/universal/universal.pri
+++ b/src/imports/controls/universal/universal.pri
@@ -13,6 +13,7 @@ QML_FILES += \
$$PWD/Drawer.qml \
$$PWD/Frame.qml \
$$PWD/GroupBox.qml \
+ $$PWD/HorizontalHeaderView.qml \
$$PWD/ItemDelegate.qml \
$$PWD/Label.qml \
$$PWD/Menu.qml \
@@ -48,7 +49,8 @@ QML_FILES += \
$$PWD/ToolButton.qml \
$$PWD/ToolSeparator.qml \
$$PWD/ToolTip.qml \
- $$PWD/Tumbler.qml
+ $$PWD/Tumbler.qml \
+ $$PWD/VerticalHeaderView.qml
HEADERS += \
$$PWD/qquickuniversalbusyindicator_p.h \