aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/imports/calendar/qquickcalendar.cpp2
-rw-r--r--src/imports/calendar/qquickcalendarmodel.cpp2
-rw-r--r--src/imports/calendar/qquickdayofweekrow.cpp2
-rw-r--r--src/imports/calendar/qquickmonthgrid.cpp2
-rw-r--r--src/imports/calendar/qquickweeknumbercolumn.cpp2
-rw-r--r--src/imports/calendar/qquickweeknumbermodel.cpp2
-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
-rw-r--r--src/imports/platform/qquickplatformcolordialog.cpp2
-rw-r--r--src/imports/platform/qquickplatformdialog.cpp6
-rw-r--r--src/imports/platform/qquickplatformfiledialog.cpp6
-rw-r--r--src/imports/platform/qquickplatformfolderdialog.cpp4
-rw-r--r--src/imports/platform/qquickplatformfontdialog.cpp2
-rw-r--r--src/imports/platform/qquickplatformmenu.cpp6
-rw-r--r--src/imports/platform/qquickplatformmenubar.cpp4
-rw-r--r--src/imports/platform/qquickplatformmenuitem.cpp4
-rw-r--r--src/imports/platform/qquickplatformmenuitemgroup.cpp4
-rw-r--r--src/imports/platform/qquickplatformmenuseparator.cpp2
-rw-r--r--src/imports/platform/qquickplatformmessagedialog.cpp2
-rw-r--r--src/imports/platform/qquickplatformstandardpaths.cpp20
-rw-r--r--src/imports/platform/qquickplatformsystemtrayicon.cpp4
-rw-r--r--src/imports/templates/qtquicktemplates2plugin.cpp36
-rw-r--r--src/quickcontrols2/qquickstyle.cpp47
-rw-r--r--src/quickcontrols2/qquickstyleplugin.cpp10
-rw-r--r--src/quickcontrols2/qquickstyleplugin_p.h1
-rw-r--r--src/quickcontrols2/qquickstyleselector.cpp12
-rw-r--r--src/quickcontrols2/qquicktumblerview.cpp2
-rw-r--r--src/quicktemplates2/qquickabstractbutton.cpp17
-rw-r--r--src/quicktemplates2/qquickabstractbutton_p_p.h1
-rw-r--r--src/quicktemplates2/qquickaction.cpp6
-rw-r--r--src/quicktemplates2/qquickactiongroup.cpp2
-rw-r--r--src/quicktemplates2/qquickapplicationwindow.cpp4
-rw-r--r--src/quicktemplates2/qquickbusyindicator.cpp2
-rw-r--r--src/quicktemplates2/qquickbutton.cpp2
-rw-r--r--src/quicktemplates2/qquickbuttongroup.cpp2
-rw-r--r--src/quicktemplates2/qquickcheckbox.cpp2
-rw-r--r--src/quicktemplates2/qquickcheckdelegate.cpp2
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp75
-rw-r--r--src/quicktemplates2/qquickcombobox_p.h12
-rw-r--r--src/quicktemplates2/qquickcontainer.cpp8
-rw-r--r--src/quicktemplates2/qquickcontrol.cpp50
-rw-r--r--src/quicktemplates2/qquickcontrol_p.h2
-rw-r--r--src/quicktemplates2/qquickcontrol_p_p.h8
-rw-r--r--src/quicktemplates2/qquickdelaybutton.cpp4
-rw-r--r--src/quicktemplates2/qquickdial.cpp4
-rw-r--r--src/quicktemplates2/qquickdialog.cpp5
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox.cpp11
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox_p_p.h2
-rw-r--r--src/quicktemplates2/qquickdrawer.cpp2
-rw-r--r--src/quicktemplates2/qquickframe.cpp2
-rw-r--r--src/quicktemplates2/qquickgroupbox.cpp8
-rw-r--r--src/quicktemplates2/qquickheaderview.cpp500
-rw-r--r--src/quicktemplates2/qquickheaderview_p.h125
-rw-r--r--src/quicktemplates2/qquickheaderview_p_p.h136
-rw-r--r--src/quicktemplates2/qquickitemdelegate.cpp2
-rw-r--r--src/quicktemplates2/qquicklabel.cpp21
-rw-r--r--src/quicktemplates2/qquicklabel_p_p.h1
-rw-r--r--src/quicktemplates2/qquickmenu.cpp7
-rw-r--r--src/quicktemplates2/qquickmenubar.cpp2
-rw-r--r--src/quicktemplates2/qquickmenubaritem.cpp4
-rw-r--r--src/quicktemplates2/qquickmenuitem.cpp6
-rw-r--r--src/quicktemplates2/qquickmenuseparator.cpp2
-rw-r--r--src/quicktemplates2/qquickoverlay.cpp10
-rw-r--r--src/quicktemplates2/qquickpage.cpp6
-rw-r--r--src/quicktemplates2/qquickpageindicator.cpp2
-rw-r--r--src/quicktemplates2/qquickpane.cpp6
-rw-r--r--src/quicktemplates2/qquickpopup.cpp29
-rw-r--r--src/quicktemplates2/qquickpopup_p.h2
-rw-r--r--src/quicktemplates2/qquickpopupanchors.cpp2
-rw-r--r--src/quicktemplates2/qquickpopupitem.cpp25
-rw-r--r--src/quicktemplates2/qquickprogressbar.cpp2
-rw-r--r--src/quicktemplates2/qquickradiobutton.cpp2
-rw-r--r--src/quicktemplates2/qquickradiodelegate.cpp2
-rw-r--r--src/quicktemplates2/qquickrangeslider.cpp12
-rw-r--r--src/quicktemplates2/qquickroundbutton.cpp2
-rw-r--r--src/quicktemplates2/qquickscrollbar.cpp4
-rw-r--r--src/quicktemplates2/qquickscrollindicator.cpp2
-rw-r--r--src/quicktemplates2/qquickscrollview.cpp2
-rw-r--r--src/quicktemplates2/qquickslider.cpp4
-rw-r--r--src/quicktemplates2/qquickspinbox.cpp6
-rw-r--r--src/quicktemplates2/qquicksplitview.cpp63
-rw-r--r--src/quicktemplates2/qquicksplitview_p.h1
-rw-r--r--src/quicktemplates2/qquickstackview.cpp34
-rw-r--r--src/quicktemplates2/qquickstackview_p.cpp22
-rw-r--r--src/quicktemplates2/qquickstackview_p_p.h1
-rw-r--r--src/quicktemplates2/qquickswipedelegate.cpp5
-rw-r--r--src/quicktemplates2/qquickswipeview.cpp4
-rw-r--r--src/quicktemplates2/qquickswitch.cpp2
-rw-r--r--src/quicktemplates2/qquickswitchdelegate.cpp2
-rw-r--r--src/quicktemplates2/qquicktabbar.cpp2
-rw-r--r--src/quicktemplates2/qquicktabbutton.cpp2
-rw-r--r--src/quicktemplates2/qquicktextarea.cpp17
-rw-r--r--src/quicktemplates2/qquicktextfield.cpp18
-rw-r--r--src/quicktemplates2/qquicktheme.cpp1
-rw-r--r--src/quicktemplates2/qquicktheme_p_p.h3
-rw-r--r--src/quicktemplates2/qquicktoolbar.cpp2
-rw-r--r--src/quicktemplates2/qquicktoolbutton.cpp2
-rw-r--r--src/quicktemplates2/qquicktoolseparator.cpp2
-rw-r--r--src/quicktemplates2/qquicktooltip.cpp31
-rw-r--r--src/quicktemplates2/qquicktumbler.cpp2
-rw-r--r--src/quicktemplates2/quicktemplates2.pri3
136 files changed, 2392 insertions, 311 deletions
diff --git a/src/imports/calendar/qquickcalendar.cpp b/src/imports/calendar/qquickcalendar.cpp
index 2ad449f1..3b16d7f9 100644
--- a/src/imports/calendar/qquickcalendar.cpp
+++ b/src/imports/calendar/qquickcalendar.cpp
@@ -41,7 +41,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Calendar
\inherits QObject
- \instantiates QQuickCalendar
+//! \instantiates QQuickCalendar
\inqmlmodule Qt.labs.calendar
\brief A calendar namespace.
diff --git a/src/imports/calendar/qquickcalendarmodel.cpp b/src/imports/calendar/qquickcalendarmodel.cpp
index 053a4a5f..ee5e0bd3 100644
--- a/src/imports/calendar/qquickcalendarmodel.cpp
+++ b/src/imports/calendar/qquickcalendarmodel.cpp
@@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype CalendarModel
\inherits QAbstractListModel
- \instantiates QQuickCalendarModel
+//! \instantiates QQuickCalendarModel
\inqmlmodule Qt.labs.calendar
\brief A calendar model.
diff --git a/src/imports/calendar/qquickdayofweekrow.cpp b/src/imports/calendar/qquickdayofweekrow.cpp
index da3264f9..d5432f8e 100644
--- a/src/imports/calendar/qquickdayofweekrow.cpp
+++ b/src/imports/calendar/qquickdayofweekrow.cpp
@@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype DayOfWeekRow
\inherits Control
- \instantiates QQuickDayOfWeekRow
+//! \instantiates QQuickDayOfWeekRow
\inqmlmodule Qt.labs.calendar
\brief A row of names for the days in a week.
diff --git a/src/imports/calendar/qquickmonthgrid.cpp b/src/imports/calendar/qquickmonthgrid.cpp
index 46b18db6..966b0c60 100644
--- a/src/imports/calendar/qquickmonthgrid.cpp
+++ b/src/imports/calendar/qquickmonthgrid.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype MonthGrid
\inherits Control
- \instantiates QQuickMonthGrid
+//! \instantiates QQuickMonthGrid
\inqmlmodule Qt.labs.calendar
\brief A grid of days for a calendar month.
diff --git a/src/imports/calendar/qquickweeknumbercolumn.cpp b/src/imports/calendar/qquickweeknumbercolumn.cpp
index c1179879..6c661274 100644
--- a/src/imports/calendar/qquickweeknumbercolumn.cpp
+++ b/src/imports/calendar/qquickweeknumbercolumn.cpp
@@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype WeekNumberColumn
\inherits Control
- \instantiates QQuickWeekNumberColumn
+//! \instantiates QQuickWeekNumberColumn
\inqmlmodule Qt.labs.calendar
\brief A column of week numbers.
diff --git a/src/imports/calendar/qquickweeknumbermodel.cpp b/src/imports/calendar/qquickweeknumbermodel.cpp
index c45d8938..8144fb12 100644
--- a/src/imports/calendar/qquickweeknumbermodel.cpp
+++ b/src/imports/calendar/qquickweeknumbermodel.cpp
@@ -46,7 +46,7 @@ class QQuickWeekNumberModelPrivate : public QAbstractItemModelPrivate
Q_DECLARE_PUBLIC(QQuickWeekNumberModel)
public:
- QQuickWeekNumberModelPrivate() : month(-1), year(-1)
+ QQuickWeekNumberModelPrivate() : month(-1), year(-1), weekNumbers{}
{
QDate date = QDate::currentDate();
init(date.month(), date.year(), locale);
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 \
diff --git a/src/imports/platform/qquickplatformcolordialog.cpp b/src/imports/platform/qquickplatformcolordialog.cpp
index 0b8cfd97..04a5e079 100644
--- a/src/imports/platform/qquickplatformcolordialog.cpp
+++ b/src/imports/platform/qquickplatformcolordialog.cpp
@@ -41,7 +41,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype ColorDialog
\inherits Dialog
- \instantiates QQuickPlatformColorDialog
+//! \instantiates QQuickPlatformColorDialog
\inqmlmodule Qt.labs.platform
\since 5.8
\brief A native color dialog.
diff --git a/src/imports/platform/qquickplatformdialog.cpp b/src/imports/platform/qquickplatformdialog.cpp
index 41fc1316..983c2766 100644
--- a/src/imports/platform/qquickplatformdialog.cpp
+++ b/src/imports/platform/qquickplatformdialog.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Dialog
\inherits QtObject
- \instantiates QQuickPlatformDialog
+//! \instantiates QQuickPlatformDialog
\inqmlmodule Qt.labs.platform
\since 5.8
\brief The base class of native dialogs.
@@ -119,7 +119,7 @@ QPlatformDialogHelper *QQuickPlatformDialog::handle() const
*/
QQmlListProperty<QObject> QQuickPlatformDialog::data()
{
- return QQmlListProperty<QObject>(this, m_data);
+ return QQmlListProperty<QObject>(this, &m_data);
}
/*!
@@ -407,3 +407,5 @@ QWindow *QQuickPlatformDialog::findParentWindow() const
}
QT_END_NAMESPACE
+
+#include "moc_qquickplatformdialog_p.cpp"
diff --git a/src/imports/platform/qquickplatformfiledialog.cpp b/src/imports/platform/qquickplatformfiledialog.cpp
index 9c1eb684..2ef08ef6 100644
--- a/src/imports/platform/qquickplatformfiledialog.cpp
+++ b/src/imports/platform/qquickplatformfiledialog.cpp
@@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype FileDialog
\inherits Dialog
- \instantiates QQuickPlatformFileDialog
+//! \instantiates QQuickPlatformFileDialog
\inqmlmodule Qt.labs.platform
\since 5.8
\brief A native file dialog.
@@ -303,7 +303,7 @@ void QQuickPlatformFileDialog::setOptions(QFileDialogOptions::FileDialogOptions
void QQuickPlatformFileDialog::resetOptions()
{
- setOptions(0);
+ setOptions({});
}
/*!
@@ -623,7 +623,7 @@ static QStringList extractExtensions(const QString &filter)
const int to = filter.lastIndexOf(QLatin1Char(')')) - 1;
if (from >= 0 && from < to) {
const QStringRef ref = filter.midRef(from + 1, to - from);
- const QVector<QStringRef> exts = ref.split(QLatin1Char(' '), QString::SkipEmptyParts);
+ const QVector<QStringRef> exts = ref.split(QLatin1Char(' '), Qt::SkipEmptyParts);
for (const QStringRef &ref : exts)
extensions += extractExtension(ref.toString());
}
diff --git a/src/imports/platform/qquickplatformfolderdialog.cpp b/src/imports/platform/qquickplatformfolderdialog.cpp
index 512dce52..4ae6341e 100644
--- a/src/imports/platform/qquickplatformfolderdialog.cpp
+++ b/src/imports/platform/qquickplatformfolderdialog.cpp
@@ -41,7 +41,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype FolderDialog
\inherits Dialog
- \instantiates QQuickPlatformFolderDialog
+//! \instantiates QQuickPlatformFolderDialog
\inqmlmodule Qt.labs.platform
\since 5.8
\brief A native folder dialog.
@@ -186,7 +186,7 @@ void QQuickPlatformFolderDialog::setOptions(QFileDialogOptions::FileDialogOption
void QQuickPlatformFolderDialog::resetOptions()
{
- setOptions(0);
+ setOptions({});
}
/*!
diff --git a/src/imports/platform/qquickplatformfontdialog.cpp b/src/imports/platform/qquickplatformfontdialog.cpp
index ecd6ba4a..f3eca2c3 100644
--- a/src/imports/platform/qquickplatformfontdialog.cpp
+++ b/src/imports/platform/qquickplatformfontdialog.cpp
@@ -41,7 +41,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype FontDialog
\inherits Dialog
- \instantiates QQuickPlatformFontDialog
+//! \instantiates QQuickPlatformFontDialog
\inqmlmodule Qt.labs.platform
\since 5.8
\brief A native font dialog.
diff --git a/src/imports/platform/qquickplatformmenu.cpp b/src/imports/platform/qquickplatformmenu.cpp
index 844fbbd9..8954d439 100644
--- a/src/imports/platform/qquickplatformmenu.cpp
+++ b/src/imports/platform/qquickplatformmenu.cpp
@@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Menu
\inherits QtObject
- \instantiates QQuickPlatformMenu
+//! \instantiates QQuickPlatformMenu
\inqmlmodule Qt.labs.platform
\since 5.8
\brief A native menu.
@@ -127,7 +127,7 @@ QT_BEGIN_NAMESPACE
\section2 Dynamically Generating Menu Items
It is possible to dynamically generate menu items. One of the easiest ways
- to do so is with \l Instantiator. For example, to implement a
+ to do so is with \l[QtQml]{Instantiator}. For example, to implement a
"Recent Files" submenu, where the items are based on a list of files stored
in settings, the following code could be used:
@@ -938,3 +938,5 @@ void QQuickPlatformMenu::updateIcon()
}
QT_END_NAMESPACE
+
+#include "moc_qquickplatformmenu_p.cpp"
diff --git a/src/imports/platform/qquickplatformmenubar.cpp b/src/imports/platform/qquickplatformmenubar.cpp
index 4487b9a7..592a6bfe 100644
--- a/src/imports/platform/qquickplatformmenubar.cpp
+++ b/src/imports/platform/qquickplatformmenubar.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype MenuBar
\inherits QtObject
- \instantiates QQuickPlatformMenuBar
+//! \instantiates QQuickPlatformMenuBar
\inqmlmodule Qt.labs.platform
\since 5.8
\brief A native menubar.
@@ -328,3 +328,5 @@ void QQuickPlatformMenuBar::menus_clear(QQmlListProperty<QQuickPlatformMenu> *pr
}
QT_END_NAMESPACE
+
+#include "moc_qquickplatformmenubar_p.cpp"
diff --git a/src/imports/platform/qquickplatformmenuitem.cpp b/src/imports/platform/qquickplatformmenuitem.cpp
index d657fd12..e5741b6b 100644
--- a/src/imports/platform/qquickplatformmenuitem.cpp
+++ b/src/imports/platform/qquickplatformmenuitem.cpp
@@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype MenuItem
\inherits QtObject
- \instantiates QQuickPlatformMenuItem
+//! \instantiates QQuickPlatformMenuItem
\inqmlmodule Qt.labs.platform
\since 5.8
\brief A native menu item.
@@ -623,3 +623,5 @@ void QQuickPlatformMenuItem::updateIcon()
}
QT_END_NAMESPACE
+
+#include "moc_qquickplatformmenuitem_p.cpp"
diff --git a/src/imports/platform/qquickplatformmenuitemgroup.cpp b/src/imports/platform/qquickplatformmenuitemgroup.cpp
index f07d0a1b..e0773bb1 100644
--- a/src/imports/platform/qquickplatformmenuitemgroup.cpp
+++ b/src/imports/platform/qquickplatformmenuitemgroup.cpp
@@ -42,7 +42,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype MenuItemGroup
\inherits QtObject
- \instantiates QQuickPlatformMenuItemGroup
+//! \instantiates QQuickPlatformMenuItemGroup
\inqmlmodule Qt.labs.platform
\since 5.8
\brief A group for managing native menu items.
@@ -388,3 +388,5 @@ void QQuickPlatformMenuItemGroup::items_clear(QQmlListProperty<QQuickPlatformMen
}
QT_END_NAMESPACE
+
+#include "moc_qquickplatformmenuitemgroup_p.cpp"
diff --git a/src/imports/platform/qquickplatformmenuseparator.cpp b/src/imports/platform/qquickplatformmenuseparator.cpp
index 34767ff6..f29d5b9e 100644
--- a/src/imports/platform/qquickplatformmenuseparator.cpp
+++ b/src/imports/platform/qquickplatformmenuseparator.cpp
@@ -41,7 +41,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype MenuSeparator
\inherits MenuItem
- \instantiates QQuickPlatformMenuSeparator
+//! \instantiates QQuickPlatformMenuSeparator
\inqmlmodule Qt.labs.platform
\since 5.8
\brief A native menu separator.
diff --git a/src/imports/platform/qquickplatformmessagedialog.cpp b/src/imports/platform/qquickplatformmessagedialog.cpp
index ffc4b296..075b4d62 100644
--- a/src/imports/platform/qquickplatformmessagedialog.cpp
+++ b/src/imports/platform/qquickplatformmessagedialog.cpp
@@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype MessageDialog
\inherits Dialog
- \instantiates QQuickPlatformMessageDialog
+//! \instantiates QQuickPlatformMessageDialog
\inqmlmodule Qt.labs.platform
\since 5.8
\brief A native message dialog.
diff --git a/src/imports/platform/qquickplatformstandardpaths.cpp b/src/imports/platform/qquickplatformstandardpaths.cpp
index 4687ba69..a6fff1c0 100644
--- a/src/imports/platform/qquickplatformstandardpaths.cpp
+++ b/src/imports/platform/qquickplatformstandardpaths.cpp
@@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype StandardPaths
\inherits QtObject
- \instantiates QQuickPlatformStandardPaths
+//! \instantiates QQuickPlatformStandardPaths
\inqmlmodule Qt.labs.platform
\since 5.8
\brief Provides access to the standard system paths.
@@ -89,6 +89,8 @@ QObject *QQuickPlatformStandardPaths::create(QQmlEngine *engine, QJSEngine *scri
/*!
\qmlmethod string Qt.labs.platform::StandardPaths::displayName(StandardLocation type)
+ \include standardpath/functiondocs.qdocinc displayName
+
\sa QStandardPaths::displayName()
*/
QString QQuickPlatformStandardPaths::displayName(QStandardPaths::StandardLocation type)
@@ -99,6 +101,8 @@ QString QQuickPlatformStandardPaths::displayName(QStandardPaths::StandardLocatio
/*!
\qmlmethod url Qt.labs.platform::StandardPaths::findExecutable(string executableName, list<string> paths)
+ \include standardpath/functiondocs.qdocinc findExecutable
+
\sa QStandardPaths::findExecutable()
*/
QUrl QQuickPlatformStandardPaths::findExecutable(const QString &executableName, const QStringList &paths)
@@ -107,7 +111,9 @@ QUrl QQuickPlatformStandardPaths::findExecutable(const QString &executableName,
}
/*!
- \qmlmethod url Qt.labs.platform::StandardPaths::locate(StandardLocation type, string fileName, LocateOptions options = LocateFile)
+ \qmlmethod url Qt.labs.platform::StandardPaths::locate(StandardLocation type, string fileName, LocateOptions options)
+
+ \include standardpath/functiondocs.qdocinc locate
\sa QStandardPaths::locate()
*/
@@ -117,7 +123,9 @@ QUrl QQuickPlatformStandardPaths::locate(QStandardPaths::StandardLocation type,
}
/*!
- \qmlmethod list<url> Qt.labs.platform::StandardPaths::locateAll(StandardLocation type, string fileName, LocateOptions options = LocateFile)
+ \qmlmethod list<url> Qt.labs.platform::StandardPaths::locateAll(StandardLocation type, string fileName, LocateOptions options)
+
+ \include standardpath/functiondocs.qdocinc locateAll
\sa QStandardPaths::locateAll()
*/
@@ -129,6 +137,8 @@ QList<QUrl> QQuickPlatformStandardPaths::locateAll(QStandardPaths::StandardLocat
/*!
\qmlmethod void Qt.labs.platform::StandardPaths::setTestModeEnabled(bool testMode)
+ \include standardpath/functiondocs.qdocinc setTestModeEnabled
+
\sa QStandardPaths::setTestModeEnabled()
*/
void QQuickPlatformStandardPaths::setTestModeEnabled(bool testMode)
@@ -139,6 +149,8 @@ void QQuickPlatformStandardPaths::setTestModeEnabled(bool testMode)
/*!
\qmlmethod list<url> Qt.labs.platform::StandardPaths::standardLocations(StandardLocation type)
+ \include standardpath/functiondocs.qdocinc standardLocations
+
\sa QStandardPaths::standardLocations()
*/
QList<QUrl> QQuickPlatformStandardPaths::standardLocations(QStandardPaths::StandardLocation type)
@@ -149,6 +161,8 @@ QList<QUrl> QQuickPlatformStandardPaths::standardLocations(QStandardPaths::Stand
/*!
\qmlmethod url Qt.labs.platform::StandardPaths::writableLocation(StandardLocation type)
+ \include standardpath/functiondocs.qdocinc writableLocation
+
\sa QStandardPaths::writableLocation()
*/
QUrl QQuickPlatformStandardPaths::writableLocation(QStandardPaths::StandardLocation type)
diff --git a/src/imports/platform/qquickplatformsystemtrayicon.cpp b/src/imports/platform/qquickplatformsystemtrayicon.cpp
index 202bc3bf..4a96b38f 100644
--- a/src/imports/platform/qquickplatformsystemtrayicon.cpp
+++ b/src/imports/platform/qquickplatformsystemtrayicon.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype SystemTrayIcon
\inherits QtObject
- \instantiates QQuickPlatformSystemTrayIcon
+//! \instantiates QQuickPlatformSystemTrayIcon
\inqmlmodule Qt.labs.platform
\since 5.8
\brief A system tray icon.
@@ -482,3 +482,5 @@ void QQuickPlatformSystemTrayIcon::updateIcon()
}
QT_END_NAMESPACE
+
+#include "moc_qquickplatformsystemtrayicon_p.cpp"
diff --git a/src/imports/templates/qtquicktemplates2plugin.cpp b/src/imports/templates/qtquicktemplates2plugin.cpp
index 470e86e0..9c57b471 100644
--- a/src/imports/templates/qtquicktemplates2plugin.cpp
+++ b/src/imports/templates/qtquicktemplates2plugin.cpp
@@ -56,6 +56,7 @@
#include <QtQuickTemplates2/private/qquickdrawer_p.h>
#include <QtQuickTemplates2/private/qquickframe_p.h>
#include <QtQuickTemplates2/private/qquickgroupbox_p.h>
+#include <QtQuickTemplates2/private/qquickheaderview_p.h>
#include <QtQuickTemplates2/private/qquickicon_p.h>
#include <QtQuickTemplates2/private/qquickitemdelegate_p.h>
#include <QtQuickTemplates2/private/qquicklabel_p.h>
@@ -130,6 +131,7 @@ public:
~QtQuickTemplates2Plugin();
void registerTypes(const char *uri) override;
+ void unregisterTypes() override;
private:
bool registered;
@@ -141,24 +143,21 @@ private:
QtQuickTemplates2Plugin::QtQuickTemplates2Plugin(QObject *parent)
: QQmlExtensionPlugin(parent), registered(false)
{
-#if QT_CONFIG(shortcut)
- originalContextMatcher = qt_quick_shortcut_context_matcher();
- qt_quick_set_shortcut_context_matcher(QQuickShortcutContext::matcher);
-#endif
}
QtQuickTemplates2Plugin::~QtQuickTemplates2Plugin()
{
- if (registered)
- cleanupProviders();
-
-#if QT_CONFIG(shortcut)
- qt_quick_set_shortcut_context_matcher(originalContextMatcher);
-#endif
+ // Intentionally empty: we use register/unregisterTypes() to do
+ // initialization and cleanup, as plugins are not unloaded on macOS.
}
void QtQuickTemplates2Plugin::registerTypes(const char *uri)
{
+#if QT_CONFIG(shortcut)
+ originalContextMatcher = qt_quick_shortcut_context_matcher();
+ qt_quick_set_shortcut_context_matcher(QQuickShortcutContext::matcher);
+#endif
+
registered = true;
initProviders();
@@ -354,6 +353,23 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri)
// QtQuick.Templates 2.14 (new types and revisions in Qt 5.14)
qmlRegisterType<QQuickComboBox, 14>(uri, 2, 14, "ComboBox");
+
+ // QtQuick.Templates 2.15 (new types and revisions in Qt 5.15)
+ qmlRegisterType<QQuickComboBox, 15>(uri, 2, 15, "ComboBox");
+ // Register QQuickTableView here to expose headerView's base, with a irregular type name to 'hide' it.
+ qmlRegisterType<QQuickTableView, 15>(uri, 2, 15, "__TableView__");
+ qmlRegisterType<QQuickHorizontalHeaderView>(uri, 2, 15, "HorizontalHeaderView");
+ qmlRegisterType<QQuickVerticalHeaderView>(uri, 2, 15, "VerticalHeaderView");
+}
+
+void QtQuickTemplates2Plugin::unregisterTypes()
+{
+ if (registered)
+ cleanupProviders();
+
+#if QT_CONFIG(shortcut)
+ qt_quick_set_shortcut_context_matcher(originalContextMatcher);
+#endif
}
QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquickstyle.cpp b/src/quickcontrols2/qquickstyle.cpp
index 408a0de3..e1cf4bfe 100644
--- a/src/quickcontrols2/qquickstyle.cpp
+++ b/src/quickcontrols2/qquickstyle.cpp
@@ -43,6 +43,7 @@
#include <QtCore/qsettings.h>
#include <QtCore/qfileselector.h>
#include <QtCore/qlibraryinfo.h>
+#include <QtCore/qloggingcategory.h>
#include <QtCore/qmetaobject.h>
#include <QtGui/qcolor.h>
#include <QtGui/qfont.h>
@@ -57,6 +58,8 @@
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(lcQtQuickControlsStyle, "qt.quick.controls.style")
+
/*!
\class QQuickStyle
\brief The QQuickStyle class allows configuring the application style.
@@ -110,7 +113,7 @@ static QStringList envPathList(const QByteArray &var)
QStringList paths;
if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty(var))) {
const QByteArray value = qgetenv(var);
- paths += QString::fromLocal8Bit(value).split(QDir::listSeparator(), QString::SkipEmptyParts);
+ paths += QString::fromLocal8Bit(value).split(QDir::listSeparator(), Qt::SkipEmptyParts);
}
return paths;
}
@@ -119,8 +122,14 @@ static QStringList defaultImportPathList()
{
QStringList importPaths;
importPaths.reserve(3);
-#ifndef QT_STATIC
+#ifdef Q_OS_ANDROID
+ // androiddeployqt puts the QML files inside a resource file and they are not
+ // showing up in the Qml2ImportsPath as a result
+ importPaths += QStringLiteral(":/android_rcc_bundle/qml");
+#else
+# ifndef QT_STATIC
importPaths += QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
+# endif
#endif
importPaths += envPathList("QML2_IMPORT_PATH");
importPaths += QStringLiteral(":/qt-project.org/imports");
@@ -182,6 +191,8 @@ struct QQuickStyleSpec
void resolve(const QUrl &baseUrl = QUrl())
{
+ qCDebug(lcQtQuickControlsStyle) << "resolving style with baseUrl" << baseUrl;
+
if (style.isEmpty())
style = QGuiApplicationPrivate::styleOverride;
if (style.isEmpty())
@@ -234,6 +245,15 @@ struct QQuickStyleSpec
}
resolved = true;
}
+
+ qCDebug(lcQtQuickControlsStyle).nospace() << "done resolving:"
+ << "\n custom=" << custom
+ << "\n resolved=" << resolved
+ << "\n style=" << style
+ << "\n fallbackStyle=" << fallbackStyle
+ << "\n fallbackMethod=" << fallbackMethod
+ << "\n configFilePath=" << configFilePath
+ << "\n customStylePaths=" << customStylePaths;
}
void reset()
@@ -260,12 +280,19 @@ struct QQuickStyleSpec
return configFilePath;
}
+ // Is this a custom style defined by the user and not "built-in" style?
bool custom;
+ // Did we manage to find a valid style path?
bool resolved;
+ // The full path to the style.
QString style;
+ // The built-in style to use if the requested style cannot be found.
QString fallbackStyle;
+ // A description of the way in which fallbackStyle was set, used in e.g. warning messages shown to the user.
QByteArray fallbackMethod;
+ // The path to the qtquickcontrols2.conf file.
QString configFilePath;
+ // An extra list of directories where we search for available styles before any other directories.
QStringList customStylePaths;
};
@@ -341,7 +368,7 @@ QStringList QQuickStylePrivate::stylePaths(bool resolve)
} else {
// Fast/simpler path for systems where something other than : is used as
// the list separator (such as ';').
- const QStringList customPaths = value.split(listSeparator, QString::SkipEmptyParts);
+ const QStringList customPaths = value.split(listSeparator, Qt::SkipEmptyParts);
paths += customPaths;
}
}
@@ -379,7 +406,13 @@ void QQuickStylePrivate::init(const QUrl &baseUrl)
spec->resolve(baseUrl);
if (!spec->fallbackStyle.isEmpty()) {
- QString fallbackStyle = spec->findStyle(QQmlFile::urlToLocalFileOrQrc(baseUrl), spec->fallbackStyle);
+ QString fallbackStyle;
+ const QStringList stylePaths = QQuickStylePrivate::stylePaths();
+ for (const QString &path : stylePaths) {
+ fallbackStyle = spec->findStyle(path, spec->fallbackStyle);
+ if (!fallbackStyle.isEmpty())
+ break;
+ }
if (fallbackStyle.isEmpty()) {
if (spec->fallbackStyle.compare(QStringLiteral("Default")) != 0) {
qWarning() << "ERROR: unable to locate fallback style" << spec->fallbackStyle;
@@ -543,7 +576,9 @@ QString QQuickStyle::path()
*/
void QQuickStyle::setStyle(const QString &style)
{
- if (QQmlMetaType::isModule(QStringLiteral("QtQuick.Controls"), 2, 0)) {
+ qCDebug(lcQtQuickControlsStyle) << "setStyle called with" << style;
+
+ if (QQmlMetaType::isModule(QStringLiteral("QtQuick.Controls"), QTypeRevision::fromVersion(2, 0))) {
qWarning() << "ERROR: QQuickStyle::setStyle() must be called before loading QML that imports Qt Quick Controls 2.";
return;
}
@@ -567,7 +602,7 @@ void QQuickStyle::setStyle(const QString &style)
*/
void QQuickStyle::setFallbackStyle(const QString &style)
{
- if (QQmlMetaType::isModule(QStringLiteral("QtQuick.Controls"), 2, 0)) {
+ if (QQmlMetaType::isModule(QStringLiteral("QtQuick.Controls"), QTypeRevision::fromVersion(2, 0))) {
qWarning() << "ERROR: QQuickStyle::setFallbackStyle() must be called before loading QML that imports Qt Quick Controls 2.";
return;
}
diff --git a/src/quickcontrols2/qquickstyleplugin.cpp b/src/quickcontrols2/qquickstyleplugin.cpp
index 553a6cad..c35c8735 100644
--- a/src/quickcontrols2/qquickstyleplugin.cpp
+++ b/src/quickcontrols2/qquickstyleplugin.cpp
@@ -63,7 +63,15 @@ QString QQuickStylePlugin::name() const
void QQuickStylePlugin::initializeTheme(QQuickTheme *theme)
{
- Q_UNUSED(theme);
+ Q_UNUSED(theme)
+}
+
+void QQuickStylePlugin::unregisterTypes()
+{
+ Q_D(QQuickStylePlugin);
+ // Destroy the selector so that it is recreated in resolvedUrl() and
+ // any new style that has been set at runtime will be accounted for when selecting QML files.
+ d->selector.reset();
}
QUrl QQuickStylePlugin::resolvedUrl(const QString &fileName) const
diff --git a/src/quickcontrols2/qquickstyleplugin_p.h b/src/quickcontrols2/qquickstyleplugin_p.h
index 6b89926c..67103e12 100644
--- a/src/quickcontrols2/qquickstyleplugin_p.h
+++ b/src/quickcontrols2/qquickstyleplugin_p.h
@@ -66,6 +66,7 @@ public:
virtual QString name() const;
virtual void initializeTheme(QQuickTheme *theme);
+ virtual void unregisterTypes() override;
QUrl resolvedUrl(const QString &fileName) const;
diff --git a/src/quickcontrols2/qquickstyleselector.cpp b/src/quickcontrols2/qquickstyleselector.cpp
index d11a95bd..72e7af66 100644
--- a/src/quickcontrols2/qquickstyleselector.cpp
+++ b/src/quickcontrols2/qquickstyleselector.cpp
@@ -48,7 +48,9 @@
QT_BEGIN_NAMESPACE
-Q_LOGGING_CATEGORY(lcQtQuickControlsStyle, "qt.quick.controls.style")
+Q_LOGGING_CATEGORY(lcStyleSelectorSelect, "qt.quick.controls.styleSelector.select")
+Q_LOGGING_CATEGORY(lcStyleSelectorSetPaths, "qt.quick.controls.styleSelector.setPaths")
+Q_LOGGING_CATEGORY(lcStyleSelectorAddSelector, "qt.quick.controls.styleSelector.addSelector")
static QString ensureSlash(const QString &path)
{
@@ -112,6 +114,9 @@ void QQuickStyleSelector::addSelector(const QString &selector)
return;
d->selectors += selector;
+
+ qCDebug(lcStyleSelectorSetPaths).nospace() << "added selector " << selector
+ << "; full list is now: " << d->selectors;
}
QStringList QQuickStyleSelector::paths() const
@@ -123,6 +128,7 @@ QStringList QQuickStyleSelector::paths() const
void QQuickStyleSelector::setPaths(const QStringList &paths)
{
Q_D(QQuickStyleSelector);
+ qCDebug(lcStyleSelectorSetPaths) << "setting paths to" << paths;
d->paths = paths;
}
@@ -133,7 +139,7 @@ QUrl QQuickStyleSelector::select(const QString &fileName) const
// 1) requested style (e.g. "MyStyle", included in d->selectors)
// 2) fallback style (e.g. "Material", included in d->selectors)
// 3) default style (empty selector, not in d->selectors)
- qCDebug(lcQtQuickControlsStyle) << "selecting" << fileName << "from" << d->paths << "with selectors" << d->selectors;
+ qCDebug(lcStyleSelectorSelect) << "selecting" << fileName << "from" << d->paths << "with selectors" << d->selectors;
int to = d->selectors.count() - 1;
if (d->selectors.isEmpty() || !d->selectors.first().isEmpty())
@@ -145,7 +151,7 @@ QUrl QQuickStyleSelector::select(const QString &fileName) const
for (const QString &path : d->paths) {
const QUrl selectedUrl = d->select(ensureSlash(path) + selector + QLatin1Char('/') + fileName);
if (selectedUrl.isValid()) {
- qCDebug(lcQtQuickControlsStyle) << "==>" << selectedUrl << "from" << path << "with selector" << selector;
+ qCDebug(lcStyleSelectorSelect) << "==>" << selectedUrl << "from" << path << "with selector" << selector;
return selectedUrl;
}
}
diff --git a/src/quickcontrols2/qquicktumblerview.cpp b/src/quickcontrols2/qquicktumblerview.cpp
index 4a64ad7f..eaa58032 100644
--- a/src/quickcontrols2/qquicktumblerview.cpp
+++ b/src/quickcontrols2/qquicktumblerview.cpp
@@ -316,3 +316,5 @@ QQuickItem *QQuickTumblerView::view()
}
QT_END_NAMESPACE
+
+#include "moc_qquicktumblerview_p.cpp"
diff --git a/src/quicktemplates2/qquickabstractbutton.cpp b/src/quicktemplates2/qquickabstractbutton.cpp
index bb07d13e..f5dec6c2 100644
--- a/src/quicktemplates2/qquickabstractbutton.cpp
+++ b/src/quicktemplates2/qquickabstractbutton.cpp
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype AbstractButton
\inherits Control
- \instantiates QQuickAbstractButton
+//! \instantiates QQuickAbstractButton
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-buttons
@@ -178,7 +178,7 @@ void QQuickAbstractButtonPrivate::handleRelease(const QPointF &point)
if (wasPressed) {
emit q->released();
- if (!wasHeld)
+ if (!wasHeld && !wasDoubleClick)
trigger();
} else {
emit q->canceled();
@@ -188,6 +188,8 @@ void QQuickAbstractButtonPrivate::handleRelease(const QPointF &point)
stopPressRepeat();
else
stopPressAndHold();
+
+ wasDoubleClick = false;
}
void QQuickAbstractButtonPrivate::handleUngrab()
@@ -201,6 +203,7 @@ void QQuickAbstractButtonPrivate::handleUngrab()
q->setPressed(false);
stopPressRepeat();
stopPressAndHold();
+ wasDoubleClick = false;
emit q->canceled();
}
@@ -712,7 +715,7 @@ void QQuickAbstractButton::setIndicator(QQuickItem *indicator)
const qreal oldImplicitIndicatorHeight = implicitIndicatorHeight();
d->removeImplicitSizeListener(d->indicator);
- delete d->indicator;
+ QQuickControlPrivate::hideOldItem(d->indicator);
d->indicator = indicator;
if (indicator) {
@@ -1080,8 +1083,10 @@ void QQuickAbstractButton::mousePressEvent(QMouseEvent *event)
void QQuickAbstractButton::mouseDoubleClickEvent(QMouseEvent *event)
{
+ Q_D(QQuickAbstractButton);
QQuickControl::mouseDoubleClickEvent(event);
emit doubleClicked();
+ d->wasDoubleClick = true;
}
void QQuickAbstractButton::timerEvent(QTimerEvent *event)
@@ -1128,7 +1133,7 @@ void QQuickAbstractButton::buttonChange(ButtonChange change)
break;
case ButtonTextChange: {
const QString txt = text();
- setAccessibleName(txt);
+ maybeSetAccessibleName(txt);
#if QT_CONFIG(shortcut)
setShortcut(QKeySequence::mnemonic(txt));
#endif
@@ -1154,7 +1159,7 @@ void QQuickAbstractButton::accessibilityActiveChanged(bool active)
Q_D(QQuickAbstractButton);
if (active) {
- setAccessibleName(text());
+ maybeSetAccessibleName(text());
setAccessibleProperty("pressed", d->pressed);
setAccessibleProperty("checked", d->checked);
setAccessibleProperty("checkable", d->checkable);
@@ -1172,3 +1177,5 @@ QAccessible::Role QQuickAbstractButton::accessibleRole() const
#endif
QT_END_NAMESPACE
+
+#include "moc_qquickabstractbutton_p.cpp"
diff --git a/src/quicktemplates2/qquickabstractbutton_p_p.h b/src/quicktemplates2/qquickabstractbutton_p_p.h
index 8ad479e2..9291c1a8 100644
--- a/src/quicktemplates2/qquickabstractbutton_p_p.h
+++ b/src/quicktemplates2/qquickabstractbutton_p_p.h
@@ -124,6 +124,7 @@ public:
bool autoExclusive = false;
bool autoRepeat = false;
bool wasHeld = false;
+ bool wasDoubleClick = false;
int holdTimer = 0;
int delayTimer = 0;
int repeatTimer = 0;
diff --git a/src/quicktemplates2/qquickaction.cpp b/src/quicktemplates2/qquickaction.cpp
index 559c5fc3..0b083339 100644
--- a/src/quicktemplates2/qquickaction.cpp
+++ b/src/quicktemplates2/qquickaction.cpp
@@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Action
\inherits QtObject
- \instantiates QQuickAction
+//! \instantiates QQuickAction
\inqmlmodule QtQuick.Controls
\since 5.10
\ingroup utilities
@@ -512,7 +512,7 @@ void QQuickAction::setShortcut(const QKeySequence &shortcut)
#endif // QT_CONFIG(shortcut)
/*!
- \qmlmethod void QtQuick.Controls::Action::toggle(QtObject source = null)
+ \qmlmethod void QtQuick.Controls::Action::toggle(QtObject source)
Toggles the action and emits \l toggled() if enabled, with an optional \a source object defined.
*/
@@ -529,7 +529,7 @@ void QQuickAction::toggle(QObject *source)
}
/*!
- \qmlmethod void QtQuick.Controls::Action::trigger(QtObject source = null)
+ \qmlmethod void QtQuick.Controls::Action::trigger(QtObject source)
Triggers the action and emits \l triggered() if enabled, with an optional \a source object defined.
*/
diff --git a/src/quicktemplates2/qquickactiongroup.cpp b/src/quicktemplates2/qquickactiongroup.cpp
index f831660b..a78489e2 100644
--- a/src/quicktemplates2/qquickactiongroup.cpp
+++ b/src/quicktemplates2/qquickactiongroup.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype ActionGroup
\inherits QtObject
- \instantiates QQuickActionGroup
+//! \instantiates QQuickActionGroup
\inqmlmodule QtQuick.Controls
\since 5.10
\ingroup utilities
diff --git a/src/quicktemplates2/qquickapplicationwindow.cpp b/src/quicktemplates2/qquickapplicationwindow.cpp
index 19f6f82b..903de676 100644
--- a/src/quicktemplates2/qquickapplicationwindow.cpp
+++ b/src/quicktemplates2/qquickapplicationwindow.cpp
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype ApplicationWindow
\inherits Window
- \instantiates QQuickApplicationWindow
+//! \instantiates QQuickApplicationWindow
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-containers
@@ -407,7 +407,7 @@ void QQuickApplicationWindow::setBackground(QQuickItem *background)
if (!d->background.isExecuting())
d->cancelBackground();
- delete d->background;
+ QQuickControlPrivate::hideOldItem(d->background);
d->background = background;
if (background) {
background->setParentItem(QQuickWindow::contentItem());
diff --git a/src/quicktemplates2/qquickbusyindicator.cpp b/src/quicktemplates2/qquickbusyindicator.cpp
index eea8eadb..cfc24b93 100644
--- a/src/quicktemplates2/qquickbusyindicator.cpp
+++ b/src/quicktemplates2/qquickbusyindicator.cpp
@@ -42,7 +42,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype BusyIndicator
\inherits Control
- \instantiates QQuickBusyIndicator
+//! \instantiates QQuickBusyIndicator
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-indicators
diff --git a/src/quicktemplates2/qquickbutton.cpp b/src/quicktemplates2/qquickbutton.cpp
index b4188a95..780492bf 100644
--- a/src/quicktemplates2/qquickbutton.cpp
+++ b/src/quicktemplates2/qquickbutton.cpp
@@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Button
\inherits AbstractButton
- \instantiates QQuickButton
+//! \instantiates QQuickButton
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-buttons
diff --git a/src/quicktemplates2/qquickbuttongroup.cpp b/src/quicktemplates2/qquickbuttongroup.cpp
index cddfb199..3886dce9 100644
--- a/src/quicktemplates2/qquickbuttongroup.cpp
+++ b/src/quicktemplates2/qquickbuttongroup.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype ButtonGroup
\inherits QtObject
- \instantiates QQuickButtonGroup
+//! \instantiates QQuickButtonGroup
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup utilities
diff --git a/src/quicktemplates2/qquickcheckbox.cpp b/src/quicktemplates2/qquickcheckbox.cpp
index 0227e95d..f5b12e62 100644
--- a/src/quicktemplates2/qquickcheckbox.cpp
+++ b/src/quicktemplates2/qquickcheckbox.cpp
@@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype CheckBox
\inherits AbstractButton
- \instantiates QQuickCheckBox
+//! \instantiates QQuickCheckBox
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-buttons
diff --git a/src/quicktemplates2/qquickcheckdelegate.cpp b/src/quicktemplates2/qquickcheckdelegate.cpp
index 17f1f0b2..d8d008ce 100644
--- a/src/quicktemplates2/qquickcheckdelegate.cpp
+++ b/src/quicktemplates2/qquickcheckdelegate.cpp
@@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype CheckDelegate
\inherits ItemDelegate
- \instantiates QQuickCheckDelegate
+//! \instantiates QQuickCheckDelegate
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-delegates
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
index 6b03bbf2..f8b91b4e 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -51,6 +51,7 @@
#include <QtQml/qqmlcontext.h>
#include <QtQml/private/qlazilyallocated_p.h>
#include <private/qqmldelegatemodel_p.h>
+#include <QtQuick/private/qquickaccessibleattached_p.h>
#include <QtQuick/private/qquickevents_p_p.h>
#include <QtQuick/private/qquicktextinput_p.h>
#include <QtQuick/private/qquickitemview_p.h>
@@ -60,7 +61,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype ComboBox
\inherits Control
- \instantiates QQuickComboBox
+//! \instantiates QQuickComboBox
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-input
@@ -264,6 +265,8 @@ public:
void itemImplicitWidthChanged(QQuickItem *item) override;
void itemImplicitHeightChanged(QQuickItem *item) override;
+ static void hideOldPopup(QQuickPopup *popup);
+
bool flat = false;
bool down = false;
bool hasDown = false;
@@ -290,6 +293,7 @@ public:
bool editable = false;
bool accepting = false;
bool allowComplete = false;
+ bool selectTextByMouse = false;
Qt::InputMethodHints inputMethodHints = Qt::ImhNone;
QString editText;
QValidator *validator = nullptr;
@@ -444,7 +448,7 @@ void QQuickComboBoxPrivate::updateCurrentText()
if (currentText != text) {
currentText = text;
if (!hasDisplayText)
- q->setAccessibleName(text);
+ q->maybeSetAccessibleName(text);
emit q->currentTextChanged();
}
if (!hasDisplayText && displayText != text) {
@@ -774,6 +778,21 @@ void QQuickComboBoxPrivate::itemImplicitHeightChanged(QQuickItem *item)
emit q->implicitIndicatorHeightChanged();
}
+void QQuickComboBoxPrivate::hideOldPopup(QQuickPopup *popup)
+{
+ if (!popup)
+ return;
+
+ qCDebug(lcItemManagement) << "hiding old popup" << popup;
+
+ popup->setVisible(false);
+ popup->setParentItem(nullptr);
+ // Remove the item from the accessibility tree.
+ QQuickAccessibleAttached *accessible = accessibleAttached(popup);
+ if (accessible)
+ accessible->setIgnored(true);
+}
+
QQuickComboBox::QQuickComboBox(QQuickItem *parent)
: QQuickControl(*(new QQuickComboBoxPrivate), parent)
{
@@ -794,7 +813,7 @@ QQuickComboBox::~QQuickComboBox()
// Disconnect visibleChanged() to avoid a spurious highlightedIndexChanged() signal
// emission during the destruction of the (visible) popup. (QTBUG-57650)
QObjectPrivate::disconnect(d->popup.data(), &QQuickPopup::visibleChanged, d, &QQuickComboBoxPrivate::popupVisibleChanged);
- delete d->popup;
+ QQuickComboBoxPrivate::hideOldPopup(d->popup);
d->popup = nullptr;
}
}
@@ -993,7 +1012,7 @@ void QQuickComboBox::setDisplayText(const QString &text)
return;
d->displayText = text;
- setAccessibleName(text);
+ maybeSetAccessibleName(text);
emit displayTextChanged();
}
@@ -1136,7 +1155,7 @@ void QQuickComboBox::setIndicator(QQuickItem *indicator)
const qreal oldImplicitIndicatorHeight = implicitIndicatorHeight();
d->removeImplicitSizeListener(d->indicator);
- delete d->indicator;
+ QQuickControlPrivate::hideOldItem(d->indicator);
d->indicator = indicator;
if (indicator) {
if (!indicator->parentItem())
@@ -1184,7 +1203,7 @@ void QQuickComboBox::setPopup(QQuickPopup *popup)
if (d->popup) {
QObjectPrivate::disconnect(d->popup.data(), &QQuickPopup::visibleChanged, d, &QQuickComboBoxPrivate::popupVisibleChanged);
- delete d->popup;
+ QQuickComboBoxPrivate::hideOldPopup(d->popup);
}
if (popup) {
QQuickPopupPrivate::get(popup)->allowVerticalFlip = true;
@@ -1550,6 +1569,30 @@ int QQuickComboBox::indexOfValue(const QVariant &value) const
}
/*!
+ \since QtQuick.Controls 2.15 (Qt 5.15)
+ \qmlproperty bool QtQuick.Controls::ComboBox::selectTextByMouse
+
+ This property holds whether the text field for an editable ComboBox
+ can be selected with the mouse.
+
+ The default value is \c false.
+*/
+bool QQuickComboBox::selectTextByMouse() const
+{
+ Q_D(const QQuickComboBox);
+ return d->extra.isAllocated() ? d->extra->selectTextByMouse : false;
+}
+
+void QQuickComboBox::setSelectTextByMouse(bool canSelect)
+{
+ Q_D(QQuickComboBox);
+ if (canSelect == selectTextByMouse())
+ return;
+
+ d->extra.value().selectTextByMouse = canSelect;
+ emit selectTextByMouseChanged();
+}
+/*!
\qmlmethod string QtQuick.Controls::ComboBox::textAt(int index)
Returns the text for the specified \a index, or an empty string
@@ -1568,7 +1611,7 @@ QString QQuickComboBox::textAt(int index) const
}
/*!
- \qmlmethod int QtQuick.Controls::ComboBox::find(string text, flags = Qt.MatchExactly)
+ \qmlmethod int QtQuick.Controls::ComboBox::find(string text, enumeration flags)
Returns the index of the specified \a text, or \c -1 if no match is found.
@@ -1662,6 +1705,12 @@ bool QQuickComboBox::eventFilter(QObject *object, QEvent *event)
// the user clicked on the popup button to open it, not close it).
d->hidePopup(false);
setPressed(false);
+
+ // The focus left the text field, so if the edit text matches an item in the model,
+ // change our currentIndex to that. This matches widgets' behavior.
+ const int indexForEditText = find(d->extra.value().editText, Qt::MatchFixedString);
+ if (indexForEditText > -1)
+ setCurrentIndex(indexForEditText);
}
break;
#if QT_CONFIG(im)
@@ -1816,6 +1865,14 @@ void QQuickComboBox::wheelEvent(QWheelEvent *event)
}
#endif
+bool QQuickComboBox::event(QEvent *e)
+{
+ Q_D(QQuickComboBox);
+ if (e->type() == QEvent::LanguageChange)
+ d->updateCurrentText();
+ return QQuickControl::event(e);
+}
+
void QQuickComboBox::componentComplete()
{
Q_D(QQuickComboBox);
@@ -1902,10 +1959,12 @@ void QQuickComboBox::accessibilityActiveChanged(bool active)
QQuickControl::accessibilityActiveChanged(active);
if (active) {
- setAccessibleName(d->hasDisplayText ? d->displayText : d->currentText);
+ maybeSetAccessibleName(d->hasDisplayText ? d->displayText : d->currentText);
setAccessibleProperty("editable", isEditable());
}
}
#endif //
QT_END_NAMESPACE
+
+#include "moc_qquickcombobox_p.cpp"
diff --git a/src/quicktemplates2/qquickcombobox_p.h b/src/quicktemplates2/qquickcombobox_p.h
index c9063d6a..282f3d23 100644
--- a/src/quicktemplates2/qquickcombobox_p.h
+++ b/src/quicktemplates2/qquickcombobox_p.h
@@ -48,10 +48,13 @@
// We mean it.
//
+#include <QtCore/qloggingcategory.h>
#include <QtQuickTemplates2/private/qquickcontrol_p.h>
QT_BEGIN_NAMESPACE
+Q_DECLARE_LOGGING_CATEGORY(lcItemManagement)
+
class QValidator;
class QQuickPopup;
class QQmlInstanceModel;
@@ -89,6 +92,8 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickComboBox : public QQuickControl
// 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)
+ // 2.15 (Qt 5.15)
+ Q_PROPERTY(bool selectTextByMouse READ selectTextByMouse WRITE setSelectTextByMouse NOTIFY selectTextByMouseChanged FINAL REVISION 15)
public:
explicit QQuickComboBox(QQuickItem *parent = nullptr);
@@ -166,6 +171,10 @@ public:
Q_REVISION(14) Q_INVOKABLE QVariant valueAt(int index) const;
Q_REVISION(14) Q_INVOKABLE int indexOfValue(const QVariant &value) const;
+ // 2.15 (Qt 5.15)
+ bool selectTextByMouse() const;
+ void setSelectTextByMouse(bool canSelect);
+
public Q_SLOTS:
void incrementCurrentIndex();
void decrementCurrentIndex();
@@ -203,6 +212,8 @@ Q_SIGNALS:
// 2.14 (Qt 5.14)
Q_REVISION(14) void valueRoleChanged();
Q_REVISION(14) void currentValueChanged();
+ // 2.15 (Qt 5.15)
+ Q_REVISION(15) void selectTextByMouseChanged();
protected:
bool eventFilter(QObject *object, QEvent *event) override;
@@ -216,6 +227,7 @@ protected:
#if QT_CONFIG(wheelevent)
void wheelEvent(QWheelEvent *event) override;
#endif
+ bool event(QEvent *e) override;
void componentComplete() override;
void itemChange(ItemChange change, const ItemChangeData &value) override;
diff --git a/src/quicktemplates2/qquickcontainer.cpp b/src/quicktemplates2/qquickcontainer.cpp
index 5f38c5b9..f38c2b09 100644
--- a/src/quicktemplates2/qquickcontainer.cpp
+++ b/src/quicktemplates2/qquickcontainer.cpp
@@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Container
\inherits Control
- \instantiates QQuickContainer
+//! \instantiates QQuickContainer
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-containers
@@ -110,7 +110,7 @@ QT_BEGIN_NAMESPACE
\list
\li \l incrementCurrentIndex()
\li \l decrementCurrentIndex()
- \li \l setCurrentIndex(int index)
+ \li \l setCurrentIndex()
\endlist
\code
@@ -219,7 +219,7 @@ void QQuickContainerPrivate::cleanup()
QQuickWindowPrivate::get(window)->clearFocusInScope(contentItem, focusItem, Qt::OtherFocusReason);
q->contentItemChange(nullptr, contentItem);
- delete contentItem;
+ QQuickControlPrivate::hideOldItem(contentItem);
}
QObject::disconnect(contentModel, &QQmlObjectModel::countChanged, q, &QQuickContainer::countChanged);
@@ -700,7 +700,7 @@ int QQuickContainer::currentIndex() const
/*!
\qmlmethod void QtQuick.Controls::Container::setCurrentIndex(int index)
- Sets the current index of the container.
+ Sets the current \a index of the container.
This method can be called to set a specific current index without breaking
existing \c currentIndex bindings.
diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp
index 0ebaf9a3..4eb411c2 100644
--- a/src/quicktemplates2/qquickcontrol.cpp
+++ b/src/quicktemplates2/qquickcontrol.cpp
@@ -56,10 +56,12 @@
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(lcItemManagement, "qt.quick.controls.control.itemmanagement")
+
/*!
\qmltype Control
\inherits Item
- \instantiates QQuickControl
+//! \instantiates QQuickControl
\inqmlmodule QtQuick.Controls
\since 5.7
\brief Abstract base type providing functionality common to all controls.
@@ -178,6 +180,12 @@ bool QQuickControlPrivate::acceptTouch(const QTouchEvent::TouchPoint &point)
return true;
}
+ // If the control is on a Flickable that has a pressDelay, then the press is never
+ // sent as a touch event, therefore we need to check for this case.
+ if (touchId == -1 && pressWasTouch && point.state() == Qt::TouchPointReleased &&
+ point.pos() == previousPressPos) {
+ return true;
+ }
return false;
}
#endif
@@ -213,6 +221,8 @@ void QQuickControlPrivate::handleRelease(const QPointF &)
if ((focusPolicy & Qt::ClickFocus) == Qt::ClickFocus && QGuiApplication::styleHints()->setFocusOnTouchRelease())
setActiveFocus(q, Qt::MouseFocusReason);
touchId = -1;
+ pressWasTouch = false;
+ previousPressPos = QPointF();
}
void QQuickControlPrivate::handleUngrab()
@@ -420,7 +430,7 @@ void QQuickControlPrivate::setContentItem_helper(QQuickItem *item, bool notify)
contentItem = item;
q->contentItemChange(item, oldContentItem);
- delete oldContentItem;
+ QQuickControlPrivate::hideOldItem(oldContentItem);
if (item) {
connect(contentItem.data(), &QQuickItem::baselineOffsetChanged, this, &QQuickControlPrivate::updateBaselineOffset);
@@ -838,6 +848,22 @@ void QQuickControlPrivate::executeBackground(bool complete)
quickCompleteDeferred(q, backgroundName(), background);
}
+void QQuickControlPrivate::hideOldItem(QQuickItem *item)
+{
+ if (!item)
+ return;
+
+ qCDebug(lcItemManagement) << "hiding old item" << item;
+
+ item->setVisible(false);
+ item->setParentItem(nullptr);
+
+ // Remove the item from the accessibility tree.
+ QQuickAccessibleAttached *accessible = accessibleAttached(item);
+ if (accessible)
+ accessible->setIgnored(true);
+}
+
void QQuickControlPrivate::updateBaselineOffset()
{
Q_Q(QQuickControl);
@@ -1590,7 +1616,7 @@ void QQuickControl::setBackground(QQuickItem *background)
}
d->removeImplicitSizeListener(d->background, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);
- delete d->background;
+ QQuickControlPrivate::hideOldItem(d->background);
d->background = background;
if (background) {
@@ -1633,8 +1659,10 @@ void QQuickControl::setBackground(QQuickItem *background)
\endcode
\note The content item is automatically positioned and resized to fit
- within the \l padding of the control. Bindings to the \l x, \l y, \l width,
- and \l height properties of the contentItem are not respected.
+ within the \l padding of the control. Bindings to the
+ \l[QtQuick]{Item::}{x}, \l[QtQuick]{Item::}{y},
+ \l[QtQuick]{Item::}{width}, and \l[QtQuick]{Item::}{height}
+ properties of the contentItem are not respected.
\note Most controls use the implicit size of the content item to calculate
the implicit size of the control itself. If you replace the content item
@@ -2101,6 +2129,10 @@ void QQuickControl::mousePressEvent(QMouseEvent *event)
{
Q_D(QQuickControl);
d->handlePress(event->localPos());
+ if (event->source() == Qt::MouseEventSynthesizedByQt) {
+ d->pressWasTouch = true;
+ d->previousPressPos = event->localPos();
+ }
event->accept();
}
@@ -2280,11 +2312,13 @@ QString QQuickControl::accessibleName() const
return QString();
}
-void QQuickControl::setAccessibleName(const QString &name)
+void QQuickControl::maybeSetAccessibleName(const QString &name)
{
#if QT_CONFIG(accessibility)
- if (QQuickAccessibleAttached *accessibleAttached = QQuickControlPrivate::accessibleAttached(this))
- accessibleAttached->setName(name);
+ if (QQuickAccessibleAttached *accessibleAttached = QQuickControlPrivate::accessibleAttached(this)) {
+ if (!accessibleAttached->wasNameExplicitlySet())
+ accessibleAttached->setNameImplicitly(name);
+ }
#else
Q_UNUSED(name)
#endif
diff --git a/src/quicktemplates2/qquickcontrol_p.h b/src/quicktemplates2/qquickcontrol_p.h
index 3fe20f3b..d35630a7 100644
--- a/src/quicktemplates2/qquickcontrol_p.h
+++ b/src/quicktemplates2/qquickcontrol_p.h
@@ -287,7 +287,7 @@ protected:
// helper functions which avoid to check QT_CONFIG(accessibility)
QString accessibleName() const;
- void setAccessibleName(const QString &name);
+ void maybeSetAccessibleName(const QString &name);
QVariant accessibleProperty(const char *propertyName);
bool setAccessibleProperty(const char *propertyName, const QVariant &value);
diff --git a/src/quicktemplates2/qquickcontrol_p_p.h b/src/quicktemplates2/qquickcontrol_p_p.h
index a657307b..fa06c97f 100644
--- a/src/quicktemplates2/qquickcontrol_p_p.h
+++ b/src/quicktemplates2/qquickcontrol_p_p.h
@@ -60,8 +60,12 @@
#include <QtGui/qaccessible.h>
#endif
+#include <QtCore/qloggingcategory.h>
+
QT_BEGIN_NAMESPACE
+Q_DECLARE_LOGGING_CATEGORY(lcItemManagement)
+
class QQuickAccessibleAttached;
class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickControlPrivate : public QQuickItemPrivate, public QQuickItemChangeListener
@@ -168,6 +172,8 @@ public:
virtual void cancelBackground();
virtual void executeBackground(bool complete = false);
+ static void hideOldItem(QQuickItem *item);
+
void updateBaselineOffset();
static const ChangeTypes ImplicitSizeChanges;
@@ -224,7 +230,9 @@ public:
bool explicitHoverEnabled = false;
#endif
bool resizingBackground = false;
+ bool pressWasTouch = false;
int touchId = -1;
+ QPointF previousPressPos;
qreal padding = 0;
qreal horizontalPadding = 0;
qreal verticalPadding = 0;
diff --git a/src/quicktemplates2/qquickdelaybutton.cpp b/src/quicktemplates2/qquickdelaybutton.cpp
index ba5953a0..abc1488d 100644
--- a/src/quicktemplates2/qquickdelaybutton.cpp
+++ b/src/quicktemplates2/qquickdelaybutton.cpp
@@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype DelayButton
\inherits AbstractButton
- \instantiates QQuickDelayButton
+//! \instantiates QQuickDelayButton
\inqmlmodule QtQuick.Controls
\since 5.9
\ingroup qtquickcontrols2-buttons
@@ -265,3 +265,5 @@ QPalette QQuickDelayButton::defaultPalette() const
}
QT_END_NAMESPACE
+
+#include "moc_qquickdelaybutton_p.cpp"
diff --git a/src/quicktemplates2/qquickdial.cpp b/src/quicktemplates2/qquickdial.cpp
index 431b25a8..99bd0e98 100644
--- a/src/quicktemplates2/qquickdial.cpp
+++ b/src/quicktemplates2/qquickdial.cpp
@@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Dial
\inherits Control
- \instantiates QQuickDial
+//! \instantiates QQuickDial
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-input
@@ -620,7 +620,7 @@ void QQuickDial::setHandle(QQuickItem *handle)
if (!d->handle.isExecuting())
d->cancelHandle();
- delete d->handle;
+ QQuickControlPrivate::hideOldItem(d->handle);
d->handle = handle;
if (d->handle && !d->handle->parentItem())
d->handle->setParentItem(this);
diff --git a/src/quicktemplates2/qquickdialog.cpp b/src/quicktemplates2/qquickdialog.cpp
index 7d3152e2..a13b42ee 100644
--- a/src/quicktemplates2/qquickdialog.cpp
+++ b/src/quicktemplates2/qquickdialog.cpp
@@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Dialog
\inherits Popup
- \instantiates QQuickDialog
+//! \instantiates QQuickDialog
\inqmlmodule QtQuick.Controls
\ingroup qtquickcontrols2-dialogs
\ingroup qtquickcontrols2-popups
@@ -219,7 +219,6 @@ void QQuickDialog::setTitle(const QString &title)
{
Q_D(QQuickDialog);
d->popupItem->setTitle(title);
- setAccessibleName(title);
}
/*!
@@ -536,7 +535,7 @@ void QQuickDialog::accessibilityActiveChanged(bool active)
QQuickPopup::accessibilityActiveChanged(active);
if (active)
- setAccessibleName(d->popupItem->title());
+ maybeSetAccessibleName(d->popupItem->title());
}
#endif
diff --git a/src/quicktemplates2/qquickdialogbuttonbox.cpp b/src/quicktemplates2/qquickdialogbuttonbox.cpp
index 10d80778..f3dd2da1 100644
--- a/src/quicktemplates2/qquickdialogbuttonbox.cpp
+++ b/src/quicktemplates2/qquickdialogbuttonbox.cpp
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype DialogButtonBox
\inherits Container
- \instantiates QQuickDialogButtonBox
+//! \instantiates QQuickDialogButtonBox
\inqmlmodule QtQuick.Controls
\ingroup qtquickcontrols2-dialogs
\brief A button box used in dialogs.
@@ -455,8 +455,11 @@ void QQuickDialogButtonBoxPrivate::updateLanguage()
qmlAttachedPropertiesObject<QQuickDialogButtonBox>(button, true));
const auto boxAttachedPrivate = QQuickDialogButtonBoxAttachedPrivate::get(attached);
const QPlatformDialogHelper::StandardButton standardButton = boxAttachedPrivate->standardButton;
- const QString buttonText = QGuiApplicationPrivate::platformTheme()->standardButtonText(standardButton);
- button->setText(QPlatformTheme::removeMnemonics(buttonText));
+ // The button might be a custom one with explicitly specified text, so we shouldn't change it in that case.
+ if (standardButton != QPlatformDialogHelper::NoButton) {
+ const QString buttonText = QGuiApplicationPrivate::platformTheme()->standardButtonText(standardButton);
+ button->setText(QPlatformTheme::removeMnemonics(buttonText));
+ }
}
--i;
}
@@ -542,7 +545,7 @@ void QQuickDialogButtonBox::setAlignment(Qt::Alignment alignment)
void QQuickDialogButtonBox::resetAlignment()
{
- setAlignment(0);
+ setAlignment({});
}
/*!
diff --git a/src/quicktemplates2/qquickdialogbuttonbox_p_p.h b/src/quicktemplates2/qquickdialogbuttonbox_p_p.h
index 6f9c9033..22da9e6d 100644
--- a/src/quicktemplates2/qquickdialogbuttonbox_p_p.h
+++ b/src/quicktemplates2/qquickdialogbuttonbox_p_p.h
@@ -80,7 +80,7 @@ public:
void updateLanguage();
- Qt::Alignment alignment = 0;
+ Qt::Alignment alignment;
QQuickDialogButtonBox::Position position = QQuickDialogButtonBox::Footer;
QPlatformDialogHelper::StandardButtons standardButtons = QPlatformDialogHelper::NoButton;
QPlatformDialogHelper::ButtonLayout buttonLayout = QPlatformDialogHelper::UnknownLayout;
diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp
index 9cc38791..cf2f7558 100644
--- a/src/quicktemplates2/qquickdrawer.cpp
+++ b/src/quicktemplates2/qquickdrawer.cpp
@@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Drawer
\inherits Popup
- \instantiates QQuickDrawer
+//! \instantiates QQuickDrawer
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-navigation
diff --git a/src/quicktemplates2/qquickframe.cpp b/src/quicktemplates2/qquickframe.cpp
index f880d917..e82258a9 100644
--- a/src/quicktemplates2/qquickframe.cpp
+++ b/src/quicktemplates2/qquickframe.cpp
@@ -42,7 +42,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Frame
\inherits Pane
- \instantiates QQuickFrame
+//! \instantiates QQuickFrame
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-containers
diff --git a/src/quicktemplates2/qquickgroupbox.cpp b/src/quicktemplates2/qquickgroupbox.cpp
index 7f3c7a2d..70ec30dc 100644
--- a/src/quicktemplates2/qquickgroupbox.cpp
+++ b/src/quicktemplates2/qquickgroupbox.cpp
@@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype GroupBox
\inherits Frame
- \instantiates QQuickGroupBox
+//! \instantiates QQuickGroupBox
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-containers
@@ -167,7 +167,7 @@ void QQuickGroupBox::setTitle(const QString &title)
return;
d->title = title;
- setAccessibleName(title);
+ maybeSetAccessibleName(title);
emit titleChanged();
}
@@ -199,7 +199,7 @@ void QQuickGroupBox::setLabel(QQuickItem *label)
const qreal oldImplicitLabelHeight = implicitLabelHeight();
d->removeImplicitSizeListener(d->label);
- delete d->label;
+ QQuickControlPrivate::hideOldItem(d->label);
d->label = label;
if (label) {
@@ -283,7 +283,7 @@ void QQuickGroupBox::accessibilityActiveChanged(bool active)
QQuickFrame::accessibilityActiveChanged(active);
if (active)
- setAccessibleName(d->title);
+ maybeSetAccessibleName(d->title);
}
#endif
diff --git a/src/quicktemplates2/qquickheaderview.cpp b/src/quicktemplates2/qquickheaderview.cpp
new file mode 100644
index 00000000..49463944
--- /dev/null
+++ b/src/quicktemplates2/qquickheaderview.cpp
@@ -0,0 +1,500 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 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$
+**
+****************************************************************************/
+
+#include <QtQuickTemplates2/private/qquickheaderview_p_p.h>
+#include <algorithm>
+
+/*!
+ \qmltype HorizontalHeaderView
+ \inqmlmodule QtQuick.Controls
+ \ingroup qtquickcontrols2-containers
+ \inherits TableView
+ \brief Provides a horizontal header view to accompany a \l TableView.
+
+ A HorizontalHeaderView provides labeling of the columns of a \l TableView.
+ To add a horizontal header to a TableView, bind the
+ \l {HorizontalHeaderView::syncView} {syncView} property to the TableView:
+
+ \snippet qtquickcontrols2-headerview-simple.qml horizontal
+
+ The header displays data from the {syncView}'s model by default, but can
+ also have its own model. If the model is a QAbstractTableModel, then
+ the header will display the model's horizontal headerData(); otherwise,
+ the model's data().
+*/
+
+/*!
+ \qmltype VerticalHeaderView
+ \inqmlmodule QtQuick.Controls
+ \ingroup qtquickcontrols2-containers
+ \inherits TableView
+ \brief Provides a vertical header view to accompany a \l TableView.
+
+ A VerticalHeaderView provides labeling of the rows of a \l TableView.
+ To add a vertical header to a TableView, bind the
+ \l {VerticalHeaderView::syncView} {syncView} property to the TableView:
+
+ \snippet qtquickcontrols2-headerview-simple.qml vertical
+
+ The header displays data from the {syncView}'s model by default, but can
+ also have its own model. If the model is a QAbstractTableModel, then
+ the header will display the model's vertical headerData(); otherwise,
+ the model's data().
+*/
+
+/*!
+ \qmlproperty TableView QtQuick::HorizontalHeaderView::syncView
+
+ This property holds the TableView to synchronize with.
+
+ Once this property is bound to another TableView, both header and table
+ will synchronize with regard to column widths, column spacing, and flicking
+ horizontally.
+
+ If the \l model is not explicitly set, then the header will use the syncView's
+ model to label the columns.
+
+ \sa model TableView
+*/
+
+/*!
+ \qmlproperty TableView QtQuick::VerticalHeaderView::syncView
+
+ This property holds the TableView to synchronize with.
+
+ Once this property is bound to another TableView, both header and table
+ will synchronize with regard to row heights, row spacing, and flicking
+ vertically.
+
+ If the \l model is not explicitly set, then the header will use the syncView's
+ model to label the rows.
+
+ \sa model TableView
+*/
+
+/*!
+ \qmlproperty QVariant QtQuick::HorizontalHeaderView::model
+
+ This property holds the model providing data for the horizontal header view.
+
+ When model is not explicitly set, the header will use the syncView's
+ model once syncView is set.
+
+ If model is a QAbstractTableModel, its horizontal headerData() will
+ be accessed.
+
+ If model is a QAbstractItemModel other than QAbstractTableModel, model's data()
+ will be accessed.
+
+ Otherwise, the behavior is same as setting TableView::model.
+
+ \sa TableView {TableView::model} {model} QAbstractTableModel
+*/
+
+/*!
+ \qmlproperty QVariant QtQuick::VerticalHeaderView::model
+
+ This property holds the model providing data for the vertical header view.
+
+ When model is not explicitly set, it will be synchronized with syncView's model
+ once syncView is set.
+
+ If model is a QAbstractTableModel, its vertical headerData() will
+ be accessed.
+
+ If model is a QAbstractItemModel other than QAbstractTableModel, model's data()
+ will be accessed.
+
+ Otherwise, the behavior is same as setting TableView::model.
+
+ \sa TableView {TableView::model} {model} QAbstractTableModel
+*/
+
+/*!
+ \qmlproperty QString QtQuick::HorizontalHeaderView::textRole
+
+ This property holds the model role used to display text in each header cell.
+
+ The default value is the \c "display" role.
+
+ \sa QAbstractItemModel::roleNames()
+*/
+
+/*!
+ \qmlproperty QString QtQuick::VerticalHeaderView::textRole
+
+ This property holds the model role used to display text in each header cell.
+
+ The default value is the \c "display" role.
+
+ \sa QAbstractItemModel::roleNames()
+*/
+
+QT_BEGIN_NAMESPACE
+
+QQuickHeaderViewBasePrivate::QQuickHeaderViewBasePrivate()
+ : QQuickTableViewPrivate()
+{
+}
+
+QQuickHeaderViewBasePrivate::~QQuickHeaderViewBasePrivate()
+{
+}
+
+const QPointer<QQuickItem> QQuickHeaderViewBasePrivate::delegateItemAt(int row, int col) const
+{
+ return loadedTableItem(QPoint(col, row))->item;
+}
+
+QVariant QQuickHeaderViewBasePrivate::modelImpl() const
+{
+ if (auto model = m_headerDataProxyModel.sourceModel())
+ return QVariant::fromValue(model.data());
+ if (auto model = m_transposeProxyModel.sourceModel())
+ return QVariant::fromValue(model);
+ return QQuickTableViewPrivate::modelImpl();
+}
+
+template <typename P, typename M>
+inline bool proxyModelSetter(QQuickHeaderViewBase *const q, P &proxyModel, M *model)
+{
+ if (model) {
+ if (model == proxyModel.sourceModel())
+ return true;
+ proxyModel.setSourceModel(model);
+ const auto &modelVariant = QVariant::fromValue(std::addressof(proxyModel));
+ bool isProxyModelChanged = (modelVariant != QQuickTableViewPrivate::get(q)->QQuickTableViewPrivate::modelImpl());
+ QQuickTableViewPrivate::get(q)->QQuickTableViewPrivate::setModelImpl(modelVariant);
+ //Necessary, since TableView's assigned model not changed, but proxy's source changed
+ if (!isProxyModelChanged)
+ emit q->modelChanged();
+ return true;
+ }
+ proxyModel.setSourceModel(nullptr);
+ return false;
+}
+
+void QQuickHeaderViewBasePrivate::setModelImpl(const QVariant &newModel)
+{
+ Q_Q(QQuickHeaderViewBase);
+ m_modelExplicitlySetByUser = true;
+ // Case 1: newModel is QAbstractTableModel
+ if (proxyModelSetter(q, m_headerDataProxyModel, newModel.value<QAbstractTableModel *>()))
+ return;
+ // Case 2: newModel is QAbstractItemModel but not QAbstractTableModel
+ if (orientation() == Qt::Horizontal
+ && proxyModelSetter(q, m_transposeProxyModel, newModel.value<QAbstractItemModel *>()))
+ return;
+
+ QQuickTableViewPrivate::setModelImpl(newModel);
+}
+
+void QQuickHeaderViewBasePrivate::syncModel()
+{
+ Q_Q(QQuickHeaderViewBase);
+ if (assignedSyncView && !m_modelExplicitlySetByUser) {
+ auto newModel = assignedSyncView->model();
+ if (auto m = newModel.value<QAbstractTableModel *>()) {
+ proxyModelSetter(q, m_headerDataProxyModel, m);
+ } else if (orientation() == Qt::Horizontal) {
+ if (auto m = newModel.value<QAbstractItemModel *>())
+ proxyModelSetter(q, m_transposeProxyModel, m);
+ } else {
+ QQuickTableViewPrivate::setModelImpl(newModel);
+ }
+ }
+
+ QQuickTableViewPrivate::syncModel();
+}
+
+void QQuickHeaderViewBasePrivate::syncSyncView()
+{
+ Q_Q(QQuickHeaderViewBase);
+ if (assignedSyncDirection != orientation()) {
+ qmlWarning(q_func()) << "Setting syncDirection other than Qt::"
+ << QVariant::fromValue(orientation()).toString()
+ << " is invalid.";
+ assignedSyncDirection = orientation();
+ }
+ if (assignedSyncView) {
+ QBoolBlocker fixupGuard(inUpdateContentSize, true);
+ if (orientation() == Qt::Horizontal) {
+ q->setLeftMargin(assignedSyncView->leftMargin());
+ q->setRightMargin(assignedSyncView->rightMargin());
+ } else {
+ q->setTopMargin(assignedSyncView->topMargin());
+ q->setBottomMargin(assignedSyncView->bottomMargin());
+ }
+ }
+ QQuickTableViewPrivate::syncSyncView();
+}
+
+QQuickHeaderViewBase::QQuickHeaderViewBase(Qt::Orientation orient, QQuickItem *parent)
+ : QQuickTableView(*(new QQuickHeaderViewBasePrivate), parent)
+{
+ d_func()->setOrientation(orient);
+ setSyncDirection(orient);
+}
+
+QQuickHeaderViewBase::QQuickHeaderViewBase(QQuickHeaderViewBasePrivate &dd, QQuickItem *parent)
+ : QQuickTableView(dd, parent)
+{
+}
+
+QQuickHeaderViewBase::~QQuickHeaderViewBase()
+{
+}
+
+QString QQuickHeaderViewBase::textRole() const
+{
+ Q_D(const QQuickHeaderViewBase);
+ return d->m_textRole;
+}
+
+void QQuickHeaderViewBase::setTextRole(const QString &role)
+{
+ Q_D(QQuickHeaderViewBase);
+ if (d->m_textRole == role)
+ return;
+
+ d->m_textRole = role;
+ emit textRoleChanged();
+}
+
+Qt::Orientation QQuickHeaderViewBasePrivate::orientation() const
+{
+ return m_headerDataProxyModel.orientation();
+}
+
+void QQuickHeaderViewBasePrivate::setOrientation(Qt::Orientation orientation)
+{
+ if (QQuickHeaderViewBasePrivate::orientation() == orientation)
+ return;
+ m_headerDataProxyModel.setOrientation(orientation);
+}
+
+QQuickVerticalHeaderView::QQuickVerticalHeaderView(QQuickVerticalHeaderViewPrivate &dd, QQuickItem *parent)
+ : QQuickHeaderViewBase(dd, parent)
+{
+}
+
+/*! \internal
+ \class QHeaderDataProxyModel
+ \brief
+ QHeaderDataProxyModel is a proxy AbstractItemModel type that maps
+ source model's headerData() to correspondent data()
+ */
+QHeaderDataProxyModel::QHeaderDataProxyModel(QObject *parent)
+ : QAbstractItemModel(parent)
+{
+}
+
+QHeaderDataProxyModel::~QHeaderDataProxyModel() = default;
+
+void QHeaderDataProxyModel::setSourceModel(QAbstractItemModel *newSourceModel)
+{
+ if (m_model == newSourceModel)
+ return;
+ beginResetModel();
+ disconnectFromModel();
+ m_model = newSourceModel;
+ connectToModel();
+ endResetModel();
+}
+
+QModelIndex QHeaderDataProxyModel::index(int row, int column, const QModelIndex &parent) const
+{
+ return hasIndex(row, column, parent) ? createIndex(row, column) : QModelIndex();
+}
+
+QModelIndex QHeaderDataProxyModel::parent(const QModelIndex &child) const
+{
+ Q_UNUSED(child)
+ return QModelIndex();
+}
+
+QModelIndex QHeaderDataProxyModel::sibling(int row, int column, const QModelIndex &idx) const
+{
+ return index(row, column, idx);
+}
+
+int QHeaderDataProxyModel::rowCount(const QModelIndex &parent) const
+{
+ return m_model.isNull() ? -1 : (m_orientation == Qt::Horizontal ? 1 : m_model->rowCount(parent));
+}
+
+int QHeaderDataProxyModel::columnCount(const QModelIndex &parent) const
+{
+ return m_model.isNull() ? -1 : (m_orientation == Qt::Vertical ? 1 : m_model->columnCount(parent));
+}
+
+QVariant QHeaderDataProxyModel::data(const QModelIndex &index, int role) const
+{
+ if (m_model.isNull())
+ return QVariant();
+ if (!hasIndex(index.row(), index.column()))
+ return QModelIndex();
+ auto section = m_orientation == Qt::Vertical ? index.row() : index.column();
+ return m_model->headerData(section, m_orientation, role);
+}
+
+bool QHeaderDataProxyModel::setData(const QModelIndex &index, const QVariant &value, int role)
+{
+ if (!hasIndex(index.row(), index.column()))
+ return false;
+ auto section = m_orientation == Qt::Vertical ? index.row() : index.column();
+ auto ret = m_model->setHeaderData(section, m_orientation, value, role);
+ emit dataChanged(index, index, { role });
+ return ret;
+}
+
+bool QHeaderDataProxyModel::hasChildren(const QModelIndex &parent) const
+{
+ Q_UNUSED(parent)
+ return false;
+}
+
+QVariant QHeaderDataProxyModel::variantValue() const
+{
+ return QVariant::fromValue(static_cast<QObject *>(const_cast<QHeaderDataProxyModel *>(this)));
+}
+
+void QHeaderDataProxyModel::setOrientation(Qt::Orientation o)
+{
+ if (o == m_orientation)
+ return;
+ beginResetModel();
+ m_orientation = o;
+ endResetModel();
+}
+
+Qt::Orientation QHeaderDataProxyModel::orientation() const
+{
+ return m_orientation;
+}
+
+QPointer<QAbstractItemModel> QHeaderDataProxyModel::sourceModel() const
+{
+ return m_model;
+}
+
+void QHeaderDataProxyModel::connectToModel()
+{
+ if (m_model.isNull())
+ return;
+ connect(m_model, &QAbstractItemModel::headerDataChanged,
+ [this](Qt::Orientation orient, int first, int last) {
+ if (orient != orientation())
+ return;
+ if (orient == Qt::Horizontal) {
+ emit dataChanged(createIndex(0, first), createIndex(0, last));
+ } else {
+ emit dataChanged(createIndex(first, 0), createIndex(last, 0));
+ }
+ });
+ connect(m_model, &QAbstractItemModel::modelAboutToBeReset,
+ this, &QHeaderDataProxyModel::modelAboutToBeReset, Qt::UniqueConnection);
+ connect(m_model, &QAbstractItemModel::modelReset,
+ this, &QHeaderDataProxyModel::modelReset, Qt::UniqueConnection);
+ connect(m_model, &QAbstractItemModel::rowsAboutToBeMoved,
+ this, &QHeaderDataProxyModel::rowsAboutToBeMoved, Qt::UniqueConnection);
+ connect(m_model, &QAbstractItemModel::rowsMoved,
+ this, &QHeaderDataProxyModel::rowsMoved, Qt::UniqueConnection);
+ connect(m_model, &QAbstractItemModel::rowsAboutToBeInserted,
+ this, &QHeaderDataProxyModel::rowsAboutToBeInserted, Qt::UniqueConnection);
+ connect(m_model, &QAbstractItemModel::rowsInserted,
+ this, &QHeaderDataProxyModel::rowsInserted, Qt::UniqueConnection);
+ connect(m_model, &QAbstractItemModel::rowsAboutToBeRemoved,
+ this, &QHeaderDataProxyModel::rowsAboutToBeRemoved, Qt::UniqueConnection);
+ connect(m_model, &QAbstractItemModel::rowsRemoved,
+ this, &QHeaderDataProxyModel::rowsRemoved, Qt::UniqueConnection);
+ connect(m_model, &QAbstractItemModel::columnsAboutToBeMoved,
+ this, &QHeaderDataProxyModel::columnsAboutToBeMoved, Qt::UniqueConnection);
+ connect(m_model, &QAbstractItemModel::columnsMoved,
+ this, &QHeaderDataProxyModel::columnsMoved, Qt::UniqueConnection);
+ connect(m_model, &QAbstractItemModel::columnsAboutToBeInserted,
+ this, &QHeaderDataProxyModel::columnsAboutToBeInserted, Qt::UniqueConnection);
+ connect(m_model, &QAbstractItemModel::columnsInserted,
+ this, &QHeaderDataProxyModel::columnsInserted, Qt::UniqueConnection);
+ connect(m_model, &QAbstractItemModel::columnsAboutToBeRemoved,
+ this, &QHeaderDataProxyModel::columnsAboutToBeRemoved, Qt::UniqueConnection);
+ connect(m_model, &QAbstractItemModel::columnsRemoved,
+ this, &QHeaderDataProxyModel::columnsRemoved, Qt::UniqueConnection);
+ connect(m_model, &QAbstractItemModel::layoutAboutToBeChanged,
+ this, &QHeaderDataProxyModel::layoutAboutToBeChanged, Qt::UniqueConnection);
+ connect(m_model, &QAbstractItemModel::layoutChanged,
+ this, &QHeaderDataProxyModel::layoutChanged, Qt::UniqueConnection);
+}
+
+void QHeaderDataProxyModel::disconnectFromModel()
+{
+ if (m_model.isNull())
+ return;
+ m_model->disconnect(this);
+}
+
+QQuickHorizontalHeaderView::QQuickHorizontalHeaderView(QQuickItem *parent)
+ : QQuickHeaderViewBase(Qt::Horizontal, parent)
+{
+ setFlickableDirection(FlickableDirection::HorizontalFlick);
+}
+
+QQuickHorizontalHeaderView::~QQuickHorizontalHeaderView()
+{
+}
+
+QQuickVerticalHeaderView::QQuickVerticalHeaderView(QQuickItem *parent)
+ : QQuickHeaderViewBase(Qt::Vertical, parent)
+{
+ setFlickableDirection(FlickableDirection::VerticalFlick);
+}
+
+QQuickVerticalHeaderView::~QQuickVerticalHeaderView()
+{
+}
+
+QQuickHorizontalHeaderViewPrivate::QQuickHorizontalHeaderViewPrivate() = default;
+
+QQuickHorizontalHeaderViewPrivate::~QQuickHorizontalHeaderViewPrivate() = default;
+
+QQuickVerticalHeaderViewPrivate::QQuickVerticalHeaderViewPrivate() = default;
+
+QQuickVerticalHeaderViewPrivate::~QQuickVerticalHeaderViewPrivate() = default;
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickheaderview_p.h b/src/quicktemplates2/qquickheaderview_p.h
new file mode 100644
index 00000000..10c55c6e
--- /dev/null
+++ b/src/quicktemplates2/qquickheaderview_p.h
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 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$
+**
+****************************************************************************/
+
+#ifndef QQUICKHEADERVIEW_P_H
+#define QQUICKHEADERVIEW_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qquicktableview_p.h>
+#include <private/qtquicktemplates2global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickHeaderViewBase;
+class QQuickHeaderViewBasePrivate;
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickHeaderViewBase : public QQuickTableView
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QQuickHeaderViewBase)
+ Q_PROPERTY(QString textRole READ textRole WRITE setTextRole NOTIFY textRoleChanged FINAL)
+
+public:
+ explicit QQuickHeaderViewBase(Qt::Orientation orient, QQuickItem *parent = nullptr);
+ ~QQuickHeaderViewBase();
+
+ QString textRole() const;
+ void setTextRole(const QString &role);
+
+protected:
+ QQuickHeaderViewBase(QQuickHeaderViewBasePrivate &dd, QQuickItem *parent);
+
+Q_SIGNALS:
+ void textRoleChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickHeaderViewBase)
+ friend class QQuickHorizontalHeaderView;
+ friend class QQuickVerticalHeaderView;
+};
+
+class QQuickHorizontalHeaderViewPrivate;
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickHorizontalHeaderView : public QQuickHeaderViewBase
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QQuickHorizontalHeaderView)
+
+public:
+ QQuickHorizontalHeaderView(QQuickItem *parent = nullptr);
+ ~QQuickHorizontalHeaderView() override;
+
+protected:
+ QQuickHorizontalHeaderView(QQuickHorizontalHeaderViewPrivate &dd, QQuickItem *parent);
+
+private:
+ Q_DISABLE_COPY(QQuickHorizontalHeaderView)
+};
+
+class QQuickVerticalHeaderViewPrivate;
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickVerticalHeaderView : public QQuickHeaderViewBase
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QQuickVerticalHeaderView)
+
+public:
+ QQuickVerticalHeaderView(QQuickItem *parent = nullptr);
+ ~QQuickVerticalHeaderView() override;
+
+protected:
+ QQuickVerticalHeaderView(QQuickVerticalHeaderViewPrivate &dd, QQuickItem *parent);
+
+private:
+ Q_DISABLE_COPY(QQuickVerticalHeaderView)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickHorizontalHeaderView)
+QML_DECLARE_TYPE(QQuickVerticalHeaderView)
+
+#endif // QQUICKHEADERVIEW_P_H
diff --git a/src/quicktemplates2/qquickheaderview_p_p.h b/src/quicktemplates2/qquickheaderview_p_p.h
new file mode 100644
index 00000000..961c554b
--- /dev/null
+++ b/src/quicktemplates2/qquickheaderview_p_p.h
@@ -0,0 +1,136 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKHEADERVIEW_P_P_H
+#define QQUICKHEADERVIEW_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/QAbstractItemModel>
+#include <QtCore/QPointer>
+#include <QtCore/QTransposeProxyModel>
+#include <QtQuick/private/qquicktableview_p_p.h>
+#include <private/qquickheaderview_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QHeaderDataProxyModel : public QAbstractItemModel
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(QHeaderDataProxyModel)
+ Q_PROPERTY(QAbstractItemModel *sourceModel READ sourceModel)
+public:
+ explicit QHeaderDataProxyModel(QObject *parent = nullptr);
+ ~QHeaderDataProxyModel();
+
+ void setSourceModel(QAbstractItemModel *newSourceModel);
+ QPointer<QAbstractItemModel> sourceModel() const;
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
+ QModelIndex parent(const QModelIndex &child) const override;
+ QModelIndex sibling(int row, int column, const QModelIndex &idx) const override;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
+ bool hasChildren(const QModelIndex &parent = QModelIndex()) const override;
+
+ inline QVariant variantValue() const;
+ inline Qt::Orientation orientation() const;
+ inline void setOrientation(Qt::Orientation o);
+
+private:
+ inline void connectToModel();
+ inline void disconnectFromModel();
+ QPointer<QAbstractItemModel> m_model = nullptr;
+ Qt::Orientation m_orientation = Qt::Horizontal;
+};
+
+class QQuickHeaderViewBasePrivate : public QQuickTableViewPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickHeaderViewBase)
+public:
+ QQuickHeaderViewBasePrivate();
+ ~QQuickHeaderViewBasePrivate();
+
+ Qt::Orientation orientation() const;
+ void setOrientation(Qt::Orientation orientation);
+ const QPointer<QQuickItem> delegateItemAt(int row, int col) const;
+ QVariant modelImpl() const override;
+ void setModelImpl(const QVariant &newModel) override;
+ void syncModel() override;
+ void syncSyncView() override;
+
+protected:
+ QHeaderDataProxyModel m_headerDataProxyModel;
+ QTransposeProxyModel m_transposeProxyModel;
+ struct SectionSize
+ {
+ int section;
+ qreal previousSize;
+ };
+ QStack<SectionSize> m_hiddenSectionSizes;
+ bool m_modelExplicitlySetByUser = false;
+ QString m_textRole = QStringLiteral("display");
+};
+
+class QQuickHorizontalHeaderViewPrivate : public QQuickHeaderViewBasePrivate
+{
+ Q_DECLARE_PUBLIC(QQuickHorizontalHeaderView)
+public:
+ QQuickHorizontalHeaderViewPrivate();
+ ~QQuickHorizontalHeaderViewPrivate();
+};
+
+class QQuickVerticalHeaderViewPrivate : public QQuickHeaderViewBasePrivate
+{
+ Q_DECLARE_PUBLIC(QQuickVerticalHeaderView)
+public:
+ QQuickVerticalHeaderViewPrivate();
+ ~QQuickVerticalHeaderViewPrivate();
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKHEADERVIEW_P_P_H
diff --git a/src/quicktemplates2/qquickitemdelegate.cpp b/src/quicktemplates2/qquickitemdelegate.cpp
index 8156ab65..85e14a38 100644
--- a/src/quicktemplates2/qquickitemdelegate.cpp
+++ b/src/quicktemplates2/qquickitemdelegate.cpp
@@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype ItemDelegate
\inherits AbstractButton
- \instantiates QQuickItemDelegate
+//! \instantiates QQuickItemDelegate
\inqmlmodule QtQuick.Controls
\since 5.7
\brief Basic item delegate that can be used in various views and controls.
diff --git a/src/quicktemplates2/qquicklabel.cpp b/src/quicktemplates2/qquicklabel.cpp
index f3e0d512..71b60a2b 100644
--- a/src/quicktemplates2/qquicklabel.cpp
+++ b/src/quicktemplates2/qquicklabel.cpp
@@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Label
\inherits Text
- \instantiates QQuickLabel
+//! \instantiates QQuickLabel
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup text
@@ -248,9 +248,7 @@ void QQuickLabelPrivate::updatePalette(const QPalette &palette)
void QQuickLabelPrivate::textChanged(const QString &text)
{
#if QT_CONFIG(accessibility)
- Q_Q(QQuickLabel);
- if (QQuickAccessibleAttached *accessibleAttached = QQuickControlPrivate::accessibleAttached(q))
- accessibleAttached->setName(text);
+ maybeSetAccessibleName(text);
#else
Q_UNUSED(text)
#endif
@@ -266,13 +264,24 @@ void QQuickLabelPrivate::accessibilityActiveChanged(bool active)
QQuickAccessibleAttached *accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(q, true));
Q_ASSERT(accessibleAttached);
accessibleAttached->setRole(accessibleRole());
- accessibleAttached->setName(text);
+ maybeSetAccessibleName(text);
}
QAccessible::Role QQuickLabelPrivate::accessibleRole() const
{
return QAccessible::StaticText;
}
+
+void QQuickLabelPrivate::maybeSetAccessibleName(const QString &name)
+{
+ Q_Q(QQuickLabel);
+ auto accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(
+ qmlAttachedPropertiesObject<QQuickAccessibleAttached>(q, true));
+ if (accessibleAttached) {
+ if (!accessibleAttached->wasNameExplicitlySet())
+ accessibleAttached->setNameImplicitly(name);
+ }
+}
#endif
static inline QString backgroundName() { return QStringLiteral("background"); }
@@ -396,7 +405,7 @@ void QQuickLabel::setBackground(QQuickItem *background)
}
QQuickControlPrivate::removeImplicitSizeListener(d->background, d, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);
- delete d->background;
+ QQuickControlPrivate::hideOldItem(d->background);
d->background = background;
if (background) {
diff --git a/src/quicktemplates2/qquicklabel_p_p.h b/src/quicktemplates2/qquicklabel_p_p.h
index e1010698..ce70c168 100644
--- a/src/quicktemplates2/qquicklabel_p_p.h
+++ b/src/quicktemplates2/qquicklabel_p_p.h
@@ -111,6 +111,7 @@ public:
#if QT_CONFIG(accessibility)
void accessibilityActiveChanged(bool active) override;
QAccessible::Role accessibleRole() const override;
+ void maybeSetAccessibleName(const QString &name);
#endif
void cancelBackground();
diff --git a/src/quicktemplates2/qquickmenu.cpp b/src/quicktemplates2/qquickmenu.cpp
index 91372777..c3d80aa0 100644
--- a/src/quicktemplates2/qquickmenu.cpp
+++ b/src/quicktemplates2/qquickmenu.cpp
@@ -68,7 +68,7 @@ static const int SUBMENU_DELAY = 225;
/*!
\qmltype Menu
\inherits Popup
- \instantiates QQuickMenu
+//! \instantiates QQuickMenu
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-menus
@@ -178,8 +178,9 @@ static const int SUBMENU_DELAY = 225;
This property holds whether the popup wants focus.
- When the popup actually receives focus, \l activeFocus will be \c true.
- For more information, see \l {Keyboard Focus in Qt Quick}.
+ When the popup actually receives focus, \l{Popup::}{activeFocus}
+ will be \c true. For more information, see
+ \l {Keyboard Focus in Qt Quick}.
The default value is \c false.
diff --git a/src/quicktemplates2/qquickmenubar.cpp b/src/quicktemplates2/qquickmenubar.cpp
index f909193f..4cf77e3d 100644
--- a/src/quicktemplates2/qquickmenubar.cpp
+++ b/src/quicktemplates2/qquickmenubar.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype MenuBar
\inherits Container
- \instantiates QQuickMenuBar
+//! \instantiates QQuickMenuBar
\inqmlmodule QtQuick.Controls
\since 5.10
\ingroup qtquickcontrols2-menus
diff --git a/src/quicktemplates2/qquickmenubaritem.cpp b/src/quicktemplates2/qquickmenubaritem.cpp
index f32baff5..bfb23a06 100644
--- a/src/quicktemplates2/qquickmenubaritem.cpp
+++ b/src/quicktemplates2/qquickmenubaritem.cpp
@@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype MenuBarItem
\inherits AbstractButton
- \instantiates QQuickMenuBarItem
+//! \instantiates QQuickMenuBarItem
\inqmlmodule QtQuick.Controls
\since 5.10
\ingroup qtquickcontrols2-menus
@@ -183,3 +183,5 @@ QAccessible::Role QQuickMenuBarItem::accessibleRole() const
#endif
QT_END_NAMESPACE
+
+#include "moc_qquickmenubaritem_p.cpp"
diff --git a/src/quicktemplates2/qquickmenuitem.cpp b/src/quicktemplates2/qquickmenuitem.cpp
index a7fc63e8..f0cb2045 100644
--- a/src/quicktemplates2/qquickmenuitem.cpp
+++ b/src/quicktemplates2/qquickmenuitem.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype MenuItem
\inherits AbstractButton
- \instantiates QQuickMenuItem
+//! \instantiates QQuickMenuItem
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-menus
@@ -216,7 +216,7 @@ void QQuickMenuItem::setArrow(QQuickItem *arrow)
if (!d->arrow.isExecuting())
d->cancelArrow();
- delete d->arrow;
+ QQuickControlPrivate::hideOldItem(d->arrow);
d->arrow = arrow;
if (arrow && !arrow->parentItem())
arrow->setParentItem(this);
@@ -277,3 +277,5 @@ QAccessible::Role QQuickMenuItem::accessibleRole() const
#endif
QT_END_NAMESPACE
+
+#include "moc_qquickmenuitem_p.cpp"
diff --git a/src/quicktemplates2/qquickmenuseparator.cpp b/src/quicktemplates2/qquickmenuseparator.cpp
index f6b8c4b2..076ada57 100644
--- a/src/quicktemplates2/qquickmenuseparator.cpp
+++ b/src/quicktemplates2/qquickmenuseparator.cpp
@@ -42,7 +42,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype MenuSeparator
\inherits Control
- \instantiates QQuickMenuSeparator
+//! \instantiates QQuickMenuSeparator
\inqmlmodule QtQuick.Controls
\since 5.8
\ingroup qtquickcontrols2-separators
diff --git a/src/quicktemplates2/qquickoverlay.cpp b/src/quicktemplates2/qquickoverlay.cpp
index 3f358706..e9f8801d 100644
--- a/src/quicktemplates2/qquickoverlay.cpp
+++ b/src/quicktemplates2/qquickoverlay.cpp
@@ -34,10 +34,12 @@
**
****************************************************************************/
+#include "qquickcontrol_p_p.h"
#include "qquickoverlay_p.h"
#include "qquickoverlay_p_p.h"
#include "qquickpopupitem_p_p.h"
#include "qquickpopup_p_p.h"
+#include "qquickdrawer_p.h"
#include "qquickdrawer_p_p.h"
#include "qquickapplicationwindow_p.h"
#include <QtQml/qqmlinfo.h>
@@ -50,7 +52,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Overlay
\inherits Item
- \instantiates QQuickOverlay
+//! \instantiates QQuickOverlay
\inqmlmodule QtQuick.Controls
\since 5.10
\brief A window overlay for popups.
@@ -255,7 +257,7 @@ void QQuickOverlayPrivate::removePopup(QQuickPopup *popup)
{
Q_Q(QQuickOverlay);
allPopups.removeOne(popup);
- if (allDrawers.removeOne(static_cast<QQuickDrawer *>(popup)))
+ if (allDrawers.removeOne(qobject_cast<QQuickDrawer *>(popup)))
q->setVisible(!allDrawers.isEmpty() || !q->childItems().isEmpty());
}
@@ -341,7 +343,6 @@ void QQuickOverlay::setModal(QQmlComponent *modal)
if (d->modal == modal)
return;
- delete d->modal;
d->modal = modal;
emit modalChanged();
}
@@ -358,7 +359,6 @@ void QQuickOverlay::setModeless(QQmlComponent *modeless)
if (d->modeless == modeless)
return;
- delete d->modeless;
d->modeless = modeless;
emit modelessChanged();
}
@@ -670,7 +670,6 @@ void QQuickOverlayAttached::setModal(QQmlComponent *modal)
if (d->modal == modal)
return;
- delete d->modal;
d->modal = modal;
emit modalChanged();
}
@@ -703,7 +702,6 @@ void QQuickOverlayAttached::setModeless(QQmlComponent *modeless)
if (d->modeless == modeless)
return;
- delete d->modeless;
d->modeless = modeless;
emit modelessChanged();
}
diff --git a/src/quicktemplates2/qquickpage.cpp b/src/quicktemplates2/qquickpage.cpp
index 78bae921..0a72bad7 100644
--- a/src/quicktemplates2/qquickpage.cpp
+++ b/src/quicktemplates2/qquickpage.cpp
@@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Page
\inherits Pane
- \instantiates QQuickPage
+//! \instantiates QQuickPage
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-containers
@@ -285,7 +285,7 @@ void QQuickPage::setTitle(const QString &title)
return;
d->title = title;
- setAccessibleName(title);
+ maybeSetAccessibleName(title);
emit titleChanged();
}
@@ -473,7 +473,7 @@ void QQuickPage::accessibilityActiveChanged(bool active)
QQuickPane::accessibilityActiveChanged(active);
if (active)
- setAccessibleName(d->title);
+ maybeSetAccessibleName(d->title);
}
#endif
diff --git a/src/quicktemplates2/qquickpageindicator.cpp b/src/quicktemplates2/qquickpageindicator.cpp
index d29158a8..a06884cb 100644
--- a/src/quicktemplates2/qquickpageindicator.cpp
+++ b/src/quicktemplates2/qquickpageindicator.cpp
@@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype PageIndicator
\inherits Control
- \instantiates QQuickPageIndicator
+//! \instantiates QQuickPageIndicator
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-indicators
diff --git a/src/quicktemplates2/qquickpane.cpp b/src/quicktemplates2/qquickpane.cpp
index 18c8bd51..bf902b6b 100644
--- a/src/quicktemplates2/qquickpane.cpp
+++ b/src/quicktemplates2/qquickpane.cpp
@@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Pane
\inherits Control
- \instantiates QQuickPane
+//! \instantiates QQuickPane
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-containers
@@ -56,8 +56,8 @@ QT_BEGIN_NAMESPACE
\l ColumnLayout.
Items declared as children of a Pane are automatically parented to the
- Pane's \l {Control::}{contentItem}. Items created dynamically need to be
- explicitly parented to the contentItem.
+ Pane's \l[QtQuickControls2]{Control::}{contentItem}. Items created
+ dynamically need to be explicitly parented to the contentItem.
\section1 Content Sizing
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index d83bb8aa..7a7e00b1 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Popup
\inherits QtObject
- \instantiates QQuickPopup
+//! \instantiates QQuickPopup
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-popups
@@ -485,11 +485,18 @@ void QQuickPopupPrivate::finalizeExitTransition()
if (hadActiveFocusBeforeExitTransition && window) {
// restore focus to the next popup in chain, or to the window content if there are no other popups open
- QQuickPopup *popup = nullptr;
- if (QQuickOverlay *overlay = QQuickOverlay::overlay(window))
- popup = QQuickOverlayPrivate::get(overlay)->stackingOrderPopups().value(0);
- if (popup && popup->hasFocus()) {
- popup->forceActiveFocus();
+ QQuickPopup *nextFocusPopup = nullptr;
+ if (QQuickOverlay *overlay = QQuickOverlay::overlay(window)) {
+ const auto stackingOrderPopups = QQuickOverlayPrivate::get(overlay)->stackingOrderPopups();
+ for (auto popup : stackingOrderPopups) {
+ if (QQuickPopupPrivate::get(popup)->transitionState != ExitTransition) {
+ nextFocusPopup = popup;
+ break;
+ }
+ }
+ }
+ if (nextFocusPopup && nextFocusPopup->hasFocus()) {
+ nextFocusPopup->forceActiveFocus();
} else {
QQuickApplicationWindow *applicationWindow = qobject_cast<QQuickApplicationWindow*>(window);
if (applicationWindow)
@@ -573,7 +580,7 @@ void QQuickPopupPrivate::setBottomMargin(qreal value, bool reset)
relationship with other items.
A common use case is to center a popup within its parent. One way to do
- this is with the \l {Item::}{x} and \l {Item::}{y} properties. Anchors offer
+ this is with the \l[QtQuick]{Item::}{x} and \l[QtQuick]{Item::}{y} properties. Anchors offer
a more convenient approach:
\qml
@@ -595,7 +602,7 @@ void QQuickPopupPrivate::setBottomMargin(qreal value, bool reset)
\note Popups can only be centered within their immediate parent or
the window overlay; trying to center in other items will produce a warning.
- \sa {Popup Positioning}, {Item::anchors}
+ \sa {Popup Positioning}, {QtQuick::Item::anchors}{anchors}
*/
QQuickPopupAnchors *QQuickPopupPrivate::getAnchors()
{
@@ -2375,7 +2382,7 @@ void QQuickPopup::setFiltersChildMouseEvents(bool filter)
}
/*!
- \qmlmethod QtQuick.Controls::Popup::forceActiveFocus(reason = Qt.OtherFocusReason)
+ \qmlmethod QtQuick.Controls::Popup::forceActiveFocus(enumeration reason = Qt.OtherFocusReason)
Forces active focus on the popup with the given \a reason.
@@ -2692,10 +2699,10 @@ QString QQuickPopup::accessibleName() const
return d->popupItem->accessibleName();
}
-void QQuickPopup::setAccessibleName(const QString &name)
+void QQuickPopup::maybeSetAccessibleName(const QString &name)
{
Q_D(QQuickPopup);
- d->popupItem->setAccessibleName(name);
+ d->popupItem->maybeSetAccessibleName(name);
}
QVariant QQuickPopup::accessibleProperty(const char *propertyName)
diff --git a/src/quicktemplates2/qquickpopup_p.h b/src/quicktemplates2/qquickpopup_p.h
index 12dbd247..dc3ebf6f 100644
--- a/src/quicktemplates2/qquickpopup_p.h
+++ b/src/quicktemplates2/qquickpopup_p.h
@@ -459,7 +459,7 @@ protected:
#endif
QString accessibleName() const;
- void setAccessibleName(const QString &name);
+ void maybeSetAccessibleName(const QString &name);
QVariant accessibleProperty(const char *propertyName);
bool setAccessibleProperty(const char *propertyName, const QVariant &value);
diff --git a/src/quicktemplates2/qquickpopupanchors.cpp b/src/quicktemplates2/qquickpopupanchors.cpp
index 5acc2934..c48ca5ff 100644
--- a/src/quicktemplates2/qquickpopupanchors.cpp
+++ b/src/quicktemplates2/qquickpopupanchors.cpp
@@ -70,3 +70,5 @@ void QQuickPopupAnchors::resetCenterIn()
}
QT_END_NAMESPACE
+
+#include "moc_qquickpopupanchors_p.cpp"
diff --git a/src/quicktemplates2/qquickpopupitem.cpp b/src/quicktemplates2/qquickpopupitem.cpp
index 28ddde66..8e169b0b 100644
--- a/src/quicktemplates2/qquickpopupitem.cpp
+++ b/src/quicktemplates2/qquickpopupitem.cpp
@@ -47,6 +47,10 @@
#endif
#include <QtGui/private/qguiapplication_p.h>
+#if QT_CONFIG(accessibility)
+#include <QtQuick/private/qquickaccessibleattached_p.h>
+#endif
+
QT_BEGIN_NAMESPACE
class QQuickPopupItemPrivate : public QQuickPagePrivate
@@ -403,7 +407,28 @@ QAccessible::Role QQuickPopupItem::accessibleRole() const
void QQuickPopupItem::accessibilityActiveChanged(bool active)
{
Q_D(const QQuickPopupItem);
+ // Can't just use d->popup->accessibleName() here, because that refers to the accessible
+ // name of us, the popup item, which is not what we want.
+ const QQuickAccessibleAttached *popupAccessibleAttached = QQuickControlPrivate::accessibleAttached(d->popup);
+ const QString oldPopupName = popupAccessibleAttached ? popupAccessibleAttached->name() : QString();
+ const bool wasNameExplicitlySetOnPopup = popupAccessibleAttached && popupAccessibleAttached->wasNameExplicitlySet();
+
QQuickPage::accessibilityActiveChanged(active);
+
+ QQuickAccessibleAttached *accessibleAttached = QQuickControlPrivate::accessibleAttached(this);
+ const QString ourName = accessibleAttached ? accessibleAttached->name() : QString();
+ if (wasNameExplicitlySetOnPopup && accessibleAttached && ourName != oldPopupName) {
+ // The user set Accessible.name on the Popup. Since the Popup and its popup item
+ // have different accessible attached properties, the popup item doesn't know that
+ // a name was set on the Popup by the user, and that it should use that, rather than
+ // whatever QQuickPage sets. That's why we need to do it here.
+ // To avoid it being overridden by the call to accessibilityActiveChanged() below,
+ // we set it explicitly. It's safe to do this as the popup item is an internal implementation detail.
+ accessibleAttached->setName(oldPopupName);
+ }
+
+ // This allows the different popup types to set a name on their popup item accordingly.
+ // For example: Dialog uses its title and ToolTip uses its text.
d->popup->accessibilityActiveChanged(active);
}
#endif
diff --git a/src/quicktemplates2/qquickprogressbar.cpp b/src/quicktemplates2/qquickprogressbar.cpp
index 041d4d88..34d3cd1b 100644
--- a/src/quicktemplates2/qquickprogressbar.cpp
+++ b/src/quicktemplates2/qquickprogressbar.cpp
@@ -42,7 +42,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype ProgressBar
\inherits Control
- \instantiates QQuickProgressBar
+//! \instantiates QQuickProgressBar
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-indicators
diff --git a/src/quicktemplates2/qquickradiobutton.cpp b/src/quicktemplates2/qquickradiobutton.cpp
index bf0c414c..f22a152f 100644
--- a/src/quicktemplates2/qquickradiobutton.cpp
+++ b/src/quicktemplates2/qquickradiobutton.cpp
@@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype RadioButton
\inherits AbstractButton
- \instantiates QQuickRadioButton
+//! \instantiates QQuickRadioButton
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-buttons
diff --git a/src/quicktemplates2/qquickradiodelegate.cpp b/src/quicktemplates2/qquickradiodelegate.cpp
index 12a1ffb7..6b353fe3 100644
--- a/src/quicktemplates2/qquickradiodelegate.cpp
+++ b/src/quicktemplates2/qquickradiodelegate.cpp
@@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype RadioDelegate
\inherits ItemDelegate
- \instantiates QQuickRadioDelegate
+//! \instantiates QQuickRadioDelegate
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-delegates
diff --git a/src/quicktemplates2/qquickrangeslider.cpp b/src/quicktemplates2/qquickrangeslider.cpp
index 378ece50..9ad12102 100644
--- a/src/quicktemplates2/qquickrangeslider.cpp
+++ b/src/quicktemplates2/qquickrangeslider.cpp
@@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype RangeSlider
\inherits Control
- \instantiates QQuickRangeSlider
+//! \instantiates QQuickRangeSlider
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-input
@@ -267,7 +267,7 @@ void QQuickRangeSliderNode::setHandle(QQuickItem *handle)
const qreal oldImplicitHandleHeight = implicitHandleHeight();
QQuickControlPrivate::get(d->slider)->removeImplicitSizeListener(d->handle);
- delete d->handle;
+ QQuickControlPrivate::hideOldItem(d->handle);
d->handle = handle;
if (handle) {
@@ -978,11 +978,11 @@ void QQuickRangeSlider::setOrientation(Qt::Orientation orientation)
Sets \l first.value and \l second.value with the given arguments.
- If \a to is larger than \a from and \a firstValue is larger than
- \a secondValue, \a firstValue will be clamped to \a secondValue.
+ If \l to is larger than \l from and \a firstValue is larger than
+ \a secondValue, firstValue will be clamped to secondValue.
- If \a from is larger than \a to and \a secondValue is larger than
- \a firstValue, \a secondValue will be clamped to \a firstValue.
+ If \l from is larger than \l to and secondValue is larger than
+ firstValue, secondValue will be clamped to firstValue.
This function may be necessary to set the first and second values
after the control has been completed, as there is a circular
diff --git a/src/quicktemplates2/qquickroundbutton.cpp b/src/quicktemplates2/qquickroundbutton.cpp
index d930edbe..10ebbcc1 100644
--- a/src/quicktemplates2/qquickroundbutton.cpp
+++ b/src/quicktemplates2/qquickroundbutton.cpp
@@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype RoundButton
\inherits Button
- \instantiates QQuickRoundButton
+//! \instantiates QQuickRoundButton
\inqmlmodule QtQuick.Controls
\since 5.8
\ingroup qtquickcontrols2-buttons
diff --git a/src/quicktemplates2/qquickscrollbar.cpp b/src/quicktemplates2/qquickscrollbar.cpp
index 535151d6..678b7942 100644
--- a/src/quicktemplates2/qquickscrollbar.cpp
+++ b/src/quicktemplates2/qquickscrollbar.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype ScrollBar
\inherits Control
- \instantiates QQuickScrollBar
+//! \instantiates QQuickScrollBar
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-indicators
@@ -144,7 +144,7 @@ QT_BEGIN_NAMESPACE
\list
\li Layout the scroll bar (with the \l {Item::}{x} and \l {Item::}{y} or
- \l {Item::anchors}{anchor} properties, for example).
+ \l [QtQuick]{Item::}{anchors} property, for example).
\li Set the \l size and \l position properties to determine the size and position
of the scroll bar in relation to the scrolled item.
\li Set the \l active property to determine when the scroll bar will be
diff --git a/src/quicktemplates2/qquickscrollindicator.cpp b/src/quicktemplates2/qquickscrollindicator.cpp
index 1e411bce..8c001c01 100644
--- a/src/quicktemplates2/qquickscrollindicator.cpp
+++ b/src/quicktemplates2/qquickscrollindicator.cpp
@@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype ScrollIndicator
\inherits Control
- \instantiates QQuickScrollIndicator
+//! \instantiates QQuickScrollIndicator
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-indicators
diff --git a/src/quicktemplates2/qquickscrollview.cpp b/src/quicktemplates2/qquickscrollview.cpp
index 70390351..f9f4c9f8 100644
--- a/src/quicktemplates2/qquickscrollview.cpp
+++ b/src/quicktemplates2/qquickscrollview.cpp
@@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype ScrollView
\inherits Pane
- \instantiates QQuickScrollView
+//! \instantiates QQuickScrollView
\inqmlmodule QtQuick.Controls
\since 5.9
\ingroup qtquickcontrols2-containers
diff --git a/src/quicktemplates2/qquickslider.cpp b/src/quicktemplates2/qquickslider.cpp
index 054ea502..f4a459fa 100644
--- a/src/quicktemplates2/qquickslider.cpp
+++ b/src/quicktemplates2/qquickslider.cpp
@@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Slider
\inherits Control
- \instantiates QQuickSlider
+//! \instantiates QQuickSlider
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-input
@@ -579,7 +579,7 @@ void QQuickSlider::setHandle(QQuickItem *handle)
const qreal oldImplicitHandleHeight = implicitHandleHeight();
d->removeImplicitSizeListener(d->handle);
- delete d->handle;
+ QQuickControlPrivate::hideOldItem(d->handle);
d->handle = handle;
if (handle) {
diff --git a/src/quicktemplates2/qquickspinbox.cpp b/src/quicktemplates2/qquickspinbox.cpp
index 389e5c54..a3441c51 100644
--- a/src/quicktemplates2/qquickspinbox.cpp
+++ b/src/quicktemplates2/qquickspinbox.cpp
@@ -55,7 +55,7 @@ static const int AUTO_REPEAT_INTERVAL = 100;
/*!
\qmltype SpinBox
\inherits Control
- \instantiates QQuickSpinBox
+//! \instantiates QQuickSpinBox
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup input
@@ -1126,7 +1126,7 @@ void QQuickSpinButton::setIndicator(QQuickItem *indicator)
QQuickSpinBox *spinBox = static_cast<QQuickSpinBox *>(parent());
QQuickSpinBoxPrivate::get(spinBox)->removeImplicitSizeListener(d->indicator);
- delete d->indicator;
+ QQuickControlPrivate::hideOldItem(d->indicator);
d->indicator = indicator;
if (indicator) {
@@ -1176,3 +1176,5 @@ qreal QQuickSpinButton::implicitIndicatorHeight() const
}
QT_END_NAMESPACE
+
+#include "moc_qquickspinbox_p.cpp"
diff --git a/src/quicktemplates2/qquicksplitview.cpp b/src/quicktemplates2/qquicksplitview.cpp
index ba7644a1..219a6b08 100644
--- a/src/quicktemplates2/qquicksplitview.cpp
+++ b/src/quicktemplates2/qquicksplitview.cpp
@@ -50,12 +50,12 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype SplitView
\inherits Control
- \instantiates QQuickSplitView
+//! \instantiates QQuickSplitView
\inqmlmodule QtQuick.Controls
\since 5.13
\ingroup qtquickcontrols2-containers
\ingroup qtquickcontrols2-focusscopes
- \brief Lays out items with a draggable splitter between each item
+ \brief Lays out items with a draggable splitter between each item.
SplitView is a control that lays out items horizontally or vertically with
a draggable splitter between each item.
@@ -63,25 +63,28 @@ QT_BEGIN_NAMESPACE
SplitView supports the following attached properties on items it manages:
\list
- \li \l SplitView.minimumWidth
- \li \l SplitView.minimumHeight
- \li \l SplitView.preferredWidth
- \li \l SplitView.preferredHeight
- \li \l SplitView.maximumWidth
- \li \l SplitView.maximumHeight
- \li \l SplitView.fillWidth (true for only one child)
- \li \l SplitView.fillHeight (true for only one child)
+ \li \l{minimumWidth}{SplitView.minimumWidth}
+ \li \l{minimumHeight}{SplitView.minimumHeight}
+ \li \l{preferredWidth}{SplitView.preferredWidth}
+ \li \l{preferredHeight}{SplitView.preferredHeight}
+ \li \l{maximumWidth}{SplitView.maximumWidth}
+ \li \l{maximumHeight}{SplitView.maximumHeight}
+ \li \l{fillWidth}{SplitView.fillWidth} (true for only one child)
+ \li \l{fillHeight}{SplitView.fillHeight} (true for only one child)
\endlist
In addition, each handle has the following read-only attached properties:
\list
- \li \l SplitHandle.hovered
- \li \l SplitHandle.pressed
+ \li \l{SplitHandle::hovered}{SplitHandle.hovered}
+ \li \l{SplitHandle::pressed}{SplitHandle.pressed}
\endlist
+ \note Handles should be purely visual and not handle events, as it can
+ interfere with their hovered and pressed states.
+
The preferred size of items in a SplitView can be specified via
- \l {Item::}{implicitWidth} and \l {Item::}{implicitHeight} or
+ \l{Item::}{implicitWidth} and \l{Item::}{implicitHeight} or
\c SplitView.preferredWidth and \c SplitView.preferredHeight:
\code
@@ -1091,6 +1094,7 @@ QQuickSplitView::QQuickSplitView(QQuickItem *parent)
d->changeTypes |= QQuickItemPrivate::Visibility;
setAcceptedMouseButtons(Qt::LeftButton);
+ setFiltersChildMouseEvents(true);
}
QQuickSplitView::QQuickSplitView(QQuickSplitViewPrivate &dd, QQuickItem *parent)
@@ -1100,6 +1104,7 @@ QQuickSplitView::QQuickSplitView(QQuickSplitViewPrivate &dd, QQuickItem *parent)
d->changeTypes |= QQuickItemPrivate::Visibility;
setAcceptedMouseButtons(Qt::LeftButton);
+ setFiltersChildMouseEvents(true);
}
QQuickSplitView::~QQuickSplitView()
@@ -1159,7 +1164,7 @@ bool QQuickSplitView::isResizing() const
This property holds the handle component.
An instance of this component will be instantiated \c {count - 1}
- times, as long as \l count is greater than than \c {1}.
+ times, as long as \c count is greater than than \c {1}.
The following table explains how each handle will be resized
depending on the orientation of the split view:
@@ -1172,10 +1177,10 @@ bool QQuickSplitView::isResizing() const
\row
\li \c Qt.Horizontal
\li \c implicitWidth
- \li The \l height of the SplitView.
+ \li The \c height of the SplitView.
\row
\li \c Qt.Vertical
- \li The \l width of the SplitView.
+ \li The \c width of the SplitView.
\li \c implicitHeight
\endtable
@@ -1364,6 +1369,20 @@ void QQuickSplitView::hoverMoveEvent(QHoverEvent *event)
d->updateHoveredHandle(hoveredItem);
}
+bool QQuickSplitView::childMouseEventFilter(QQuickItem *item, QEvent *event)
+{
+ Q_D(QQuickSplitView);
+ qCDebug(qlcQQuickSplitViewMouse) << "childMouseEventFilter called with" << item << event;
+ if (event->type() != QEvent::HoverEnter)
+ return false;
+
+ // If a child item received a hover enter event, then it means our handle is no longer hovered.
+ // Handles should be purely visual and not accept hover events,
+ // so we should never get hover events for them here.
+ d->updateHoveredHandle(nullptr);
+ return false;
+}
+
void QQuickSplitView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
Q_D(QQuickSplitView);
@@ -1615,7 +1634,7 @@ void QQuickSplitViewAttached::resetMinimumHeight()
\l {Item::}{implicitWidth} will be used instead. To reset this property to
its default value, set it to \c undefined.
- \note Do not set the \l width property of a split item, as it will be
+ \note Do not set the \l{Item::}{width} property of a split item, as it will be
overwritten upon each layout of the SplitView.
\sa minimumWidth, maximumWidth, fillWidth, preferredHeight
@@ -1675,16 +1694,16 @@ void QQuickSplitViewAttached::resetPreferredWidth()
This attached property controls the preferred height of the split item. The
preferred height will be used as the size of the item, and will be bound
within the \l minimumHeight and \l maximumHeight. If the preferred height
- is not set, the item's \l {Item::}{implicitHeight} will be used.
+ is not set, the item's \l{Item::}{implicitHeight} will be used.
When a split item is resized, the preferredHeight will be set in order
to keep track of the new size.
By default, this property is not set, and therefore
- \l {Item::}{implicitHeight} will be used instead. To reset this property to
+ \l{Item::}{implicitHeight} will be used instead. To reset this property to
its default value, set it to \c undefined.
- \note Do not set the \l height property of a split item, as it will be
+ \note Do not set the \l{Item:}{height} property of a split item, as it will be
overwritten upon each layout of the SplitView.
\sa minimumHeight, maximumHeight, fillHeight, preferredWidth
@@ -1993,10 +2012,10 @@ QQuickSplitHandleAttached::QQuickSplitHandleAttached(QObject *parent)
/*!
\qmltype SplitHandle
\inherits QtObject
- \instantiates QQuickSplitHandleAttached
+//! \instantiates QQuickSplitHandleAttached
\inqmlmodule QtQuick.Controls
\since 5.13
- \brief Provides attached properties for SplitView handles
+ \brief Provides attached properties for SplitView handles.
SplitHandle provides attached properties for \l SplitView handles.
diff --git a/src/quicktemplates2/qquicksplitview_p.h b/src/quicktemplates2/qquicksplitview_p.h
index 99001615..2fa15588 100644
--- a/src/quicktemplates2/qquicksplitview_p.h
+++ b/src/quicktemplates2/qquicksplitview_p.h
@@ -99,6 +99,7 @@ protected:
void componentComplete() override;
void hoverMoveEvent(QHoverEvent *event) override;
+ bool childMouseEventFilter(QQuickItem *item, QEvent *event) override;
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
void itemAdded(int index, QQuickItem *item) override;
diff --git a/src/quicktemplates2/qquickstackview.cpp b/src/quicktemplates2/qquickstackview.cpp
index b2a95731..1d7bb91f 100644
--- a/src/quicktemplates2/qquickstackview.cpp
+++ b/src/quicktemplates2/qquickstackview.cpp
@@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype StackView
\inherits Control
- \instantiates QQuickStackView
+//! \instantiates QQuickStackView
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-navigation
@@ -365,8 +365,10 @@ QT_BEGIN_NAMESPACE
situation:
\list
- \li Set \l implicitWidth and \l implicitHeight on the StackView itself.
- \li Set \l implicitWidth and \l implicitHeight on the \l Rectangle.
+ \li Set \l[QtQuick]{Item::}{implicitWidth} and
+ \l[QtQuick]{Item::}{implicitHeight} on the StackView itself.
+ \li Set \l[QtQuick]{Item::}{implicitWidth} and
+ \l[QtQuick]{Item::}{implicitHeight} on the \l Rectangle.
\li Set \l {Popup::}{contentWidth} and \l {Popup::}{contentHeight} on
the Dialog.
\li Give the Dialog a size.
@@ -438,7 +440,7 @@ QQuickItem *QQuickStackView::currentItem() const
Returns the item at position \a index in the stack, or \c null if the index
is out of bounds.
- Supported behavior values:
+ Supported \a behavior values:
\value StackView.DontLoad The item is not forced to load (and \c null is returned if not yet loaded).
\value StackView.ForceLoad The item is forced to load.
*/
@@ -467,7 +469,7 @@ QQuickItem *QQuickStackView::get(int index, LoadBehavior behavior)
})
\endcode
- Supported behavior values:
+ Supported \a behavior values:
\value StackView.DontLoad Unloaded items are skipped (the callback function is not called for them).
\value StackView.ForceLoad Unloaded items are forced to load.
*/
@@ -649,6 +651,13 @@ void QQuickStackView::push(QQmlV4Function *args)
void QQuickStackView::pop(QQmlV4Function *args)
{
Q_D(QQuickStackView);
+ if (d->removingElements) {
+ d->warn(QStringLiteral("cannot pop while already in the process of removing elements"));
+ args->setReturnValue(QV4::Encode::null());
+ return;
+ }
+
+ QScopedValueRollback<bool> removingElements(d->removingElements, true);
QScopedValueRollback<QString> rollback(d->operation, QStringLiteral("pop"));
int argc = args->length();
if (d->elements.count() <= 1 || argc > 2) {
@@ -804,6 +813,13 @@ void QQuickStackView::pop(QQmlV4Function *args)
void QQuickStackView::replace(QQmlV4Function *args)
{
Q_D(QQuickStackView);
+ if (d->removingElements) {
+ d->warn(QStringLiteral("cannot replace while already in the process of removing elements"));
+ args->setReturnValue(QV4::Encode::null());
+ return;
+ }
+
+ QScopedValueRollback<bool> removingElements(d->removingElements, true);
QScopedValueRollback<QString> rollback(d->operation, QStringLiteral("replace"));
if (args->length() <= 0) {
d->warn(QStringLiteral("missing arguments"));
@@ -900,6 +916,12 @@ void QQuickStackView::clear(Operation operation)
if (d->elements.isEmpty())
return;
+ if (d->removingElements) {
+ d->warn(QStringLiteral("cannot clear while already in the process of removing elements"));
+ return;
+ }
+
+ QScopedValueRollback<bool> removingElements(d->removingElements, true);
if (operation != Immediate) {
QQuickStackElement *exit = d->elements.pop();
exit->removal = true;
@@ -1361,3 +1383,5 @@ void QQuickStackViewAttached::resetVisible()
*/
QT_END_NAMESPACE
+
+#include "moc_qquickstackview_p.cpp"
diff --git a/src/quicktemplates2/qquickstackview_p.cpp b/src/quicktemplates2/qquickstackview_p.cpp
index 7cb943a3..a280e31d 100644
--- a/src/quicktemplates2/qquickstackview_p.cpp
+++ b/src/quicktemplates2/qquickstackview_p.cpp
@@ -267,7 +267,11 @@ void QQuickStackViewPrivate::viewItemTransitionFinished(QQuickItemViewTransition
element->setStatus(QQuickStackView::Active);
} else if (element->status == QQuickStackView::Deactivating) {
element->setStatus(QQuickStackView::Inactive);
- element->setVisible(false);
+ QQuickStackElement *existingElement = element->item ? findElement(element->item) : nullptr;
+ // If a different element with the same item is found,
+ // do not call setVisible(false) since it needs to be visible.
+ if (!existingElement || element == existingElement)
+ element->setVisible(false);
if (element->removal || element->isPendingRemoval())
removed += element;
}
@@ -275,11 +279,21 @@ void QQuickStackViewPrivate::viewItemTransitionFinished(QQuickItemViewTransition
if (transitioner && transitioner->runningJobs.isEmpty()) {
// ~QQuickStackElement() emits QQuickStackViewAttached::removed(), which may be used
// to modify the stack. Set the status first and make a copy of the destroyable stack
- // elements to exclude any modifications that may happen during the loop. (QTBUG-62153)
+ // elements to exclude any modifications that may happen during qDeleteAll(). (QTBUG-62153)
setBusy(false);
- QList<QQuickStackElement*> elements = removed;
+ QList<QQuickStackElement*> removedElements = removed;
removed.clear();
- qDeleteAll(elements);
+
+ for (QQuickStackElement *removedElement : qAsConst(removedElements)) {
+ // If an element with the same item is found in the active stack list,
+ // forget about the item so that we don't hide it.
+ if (removedElement->item && findElement(removedElement->item)) {
+ QQuickItemPrivate::get(removedElement->item)->removeItemChangeListener(removedElement, QQuickItemPrivate::Destroyed);
+ removedElement->item = nullptr;
+ }
+ }
+
+ qDeleteAll(removedElements);
}
removing.remove(element);
diff --git a/src/quicktemplates2/qquickstackview_p_p.h b/src/quicktemplates2/qquickstackview_p_p.h
index c20ce776..b8c4b817 100644
--- a/src/quicktemplates2/qquickstackview_p_p.h
+++ b/src/quicktemplates2/qquickstackview_p_p.h
@@ -94,6 +94,7 @@ public:
void depthChange(int newDepth, int oldDepth);
bool busy = false;
+ bool removingElements = false;
QString operation;
QJSValue initialItem;
QQuickItem *currentItem = nullptr;
diff --git a/src/quicktemplates2/qquickswipedelegate.cpp b/src/quicktemplates2/qquickswipedelegate.cpp
index 97c17a6b..4a66ecef 100644
--- a/src/quicktemplates2/qquickswipedelegate.cpp
+++ b/src/quicktemplates2/qquickswipedelegate.cpp
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype SwipeDelegate
\inherits ItemDelegate
- \instantiates QQuickSwipeDelegate
+//! \instantiates QQuickSwipeDelegate
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-delegates
@@ -1383,3 +1383,6 @@ void QQuickSwipeDelegateAttached::setPressed(bool pressed)
}
QT_END_NAMESPACE
+
+#include "moc_qquickswipe_p.cpp"
+#include "moc_qquickswipedelegate_p.cpp"
diff --git a/src/quicktemplates2/qquickswipeview.cpp b/src/quicktemplates2/qquickswipeview.cpp
index 3ba4f4d3..f8b6ea77 100644
--- a/src/quicktemplates2/qquickswipeview.cpp
+++ b/src/quicktemplates2/qquickswipeview.cpp
@@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype SwipeView
\inherits Container
- \instantiates QQuickSwipeView
+//! \instantiates QQuickSwipeView
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-navigation
@@ -474,3 +474,5 @@ bool QQuickSwipeViewAttached::isPreviousItem() const
}
QT_END_NAMESPACE
+
+#include "moc_qquickswipeview_p.cpp"
diff --git a/src/quicktemplates2/qquickswitch.cpp b/src/quicktemplates2/qquickswitch.cpp
index 675cb6ae..c5cdf7b5 100644
--- a/src/quicktemplates2/qquickswitch.cpp
+++ b/src/quicktemplates2/qquickswitch.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Switch
\inherits AbstractButton
- \instantiates QQuickSwitch
+//! \instantiates QQuickSwitch
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-buttons
diff --git a/src/quicktemplates2/qquickswitchdelegate.cpp b/src/quicktemplates2/qquickswitchdelegate.cpp
index 3a849be0..86ce690b 100644
--- a/src/quicktemplates2/qquickswitchdelegate.cpp
+++ b/src/quicktemplates2/qquickswitchdelegate.cpp
@@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype SwitchDelegate
\inherits ItemDelegate
- \instantiates QQuickSwitchDelegate
+//! \instantiates QQuickSwitchDelegate
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-delegates
diff --git a/src/quicktemplates2/qquicktabbar.cpp b/src/quicktemplates2/qquicktabbar.cpp
index 5a439b4b..3bf21f25 100644
--- a/src/quicktemplates2/qquicktabbar.cpp
+++ b/src/quicktemplates2/qquicktabbar.cpp
@@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype TabBar
\inherits Container
- \instantiates QQuickTabBar
+//! \instantiates QQuickTabBar
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-navigation
diff --git a/src/quicktemplates2/qquicktabbutton.cpp b/src/quicktemplates2/qquicktabbutton.cpp
index 6e20b0da..0af81278 100644
--- a/src/quicktemplates2/qquicktabbutton.cpp
+++ b/src/quicktemplates2/qquicktabbutton.cpp
@@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype TabButton
\inherits AbstractButton
- \instantiates QQuickTabButton
+//! \instantiates QQuickTabButton
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-navigation
diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp
index ef59bd93..56dc946d 100644
--- a/src/quicktemplates2/qquicktextarea.cpp
+++ b/src/quicktemplates2/qquicktextarea.cpp
@@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype TextArea
\inherits TextEdit
- \instantiates QQuickTextArea
+//! \instantiates QQuickTextArea
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-input
@@ -121,8 +121,8 @@ QT_BEGIN_NAMESPACE
\qmlsignal QtQuick.Controls::TextArea::pressAndHold(MouseEvent event)
This signal is emitted when there is a long press (the delay depends on the platform plugin).
- The \l {MouseEvent}{event} parameter provides information about the press, including the x and y
- position of the press, and which button is pressed.
+ The \a event parameter provides information about the press, including the x and y
+ coordinates of the press, and which button is pressed.
\sa pressed, released
*/
@@ -132,8 +132,8 @@ QT_BEGIN_NAMESPACE
\since QtQuick.Controls 2.1 (Qt 5.8)
This signal is emitted when the text area is pressed by the user.
- The \l {MouseEvent}{event} parameter provides information about the press,
- including the x and y position of the press, and which button is pressed.
+ The \a event parameter provides information about the press,
+ including the x and y coordinates of the press, and which button is pressed.
\sa released, pressAndHold
*/
@@ -143,8 +143,9 @@ QT_BEGIN_NAMESPACE
\since QtQuick.Controls 2.1 (Qt 5.8)
This signal is emitted when the text area is released by the user.
- The \l {MouseEvent}{event} parameter provides information about the release,
- including the x and y position of the press, and which button is pressed.
+ The \a event parameter provides information about the release,
+ including the x and y coordinates of the press, and which button
+ is pressed.
\sa pressed, pressAndHold
*/
@@ -633,7 +634,7 @@ void QQuickTextArea::setBackground(QQuickItem *background)
}
QQuickControlPrivate::removeImplicitSizeListener(d->background, d, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);
- delete d->background;
+ QQuickControlPrivate::hideOldItem(d->background);
d->background = background;
if (background) {
diff --git a/src/quicktemplates2/qquicktextfield.cpp b/src/quicktemplates2/qquicktextfield.cpp
index 740edff0..8fa04bd3 100644
--- a/src/quicktemplates2/qquicktextfield.cpp
+++ b/src/quicktemplates2/qquicktextfield.cpp
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype TextField
\inherits TextInput
- \instantiates QQuickTextField
+//! \instantiates QQuickTextField
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-input
@@ -84,8 +84,8 @@ QT_BEGIN_NAMESPACE
\qmlsignal QtQuick.Controls::TextField::pressAndHold(MouseEvent event)
This signal is emitted when there is a long press (the delay depends on the platform plugin).
- The \l {MouseEvent}{event} parameter provides information about the press, including the x and y
- position of the press, and which button is pressed.
+ The \a event parameter provides information about the press, including the x and y
+ coordinates of the press, and which button is pressed.
\sa pressed, released
*/
@@ -95,8 +95,9 @@ QT_BEGIN_NAMESPACE
\since QtQuick.Controls 2.1 (Qt 5.8)
This signal is emitted when the text field is pressed by the user.
- The \l {MouseEvent}{event} parameter provides information about the press,
- including the x and y position of the press, and which button is pressed.
+ The \a event parameter provides information about the press,
+ including the x and y coordinates of the press, and which button
+ is pressed.
\sa released, pressAndHold
*/
@@ -106,8 +107,9 @@ QT_BEGIN_NAMESPACE
\since QtQuick.Controls 2.1 (Qt 5.8)
This signal is emitted when the text field is released by the user.
- The \l {MouseEvent}{event} parameter provides information about the release,
- including the x and y position of the press, and which button is pressed.
+ The \a event parameter provides information about the release,
+ including the x and y coordinates of the press, and which button
+ is pressed.
\sa pressed, pressAndHold
*/
@@ -501,7 +503,7 @@ void QQuickTextField::setBackground(QQuickItem *background)
}
QQuickControlPrivate::removeImplicitSizeListener(d->background, d, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);
- delete d->background;
+ QQuickControlPrivate::hideOldItem(d->background);
d->background = background;
if (background) {
diff --git a/src/quicktemplates2/qquicktheme.cpp b/src/quicktemplates2/qquicktheme.cpp
index 1228714b..f8c4a251 100644
--- a/src/quicktemplates2/qquicktheme.cpp
+++ b/src/quicktemplates2/qquicktheme.cpp
@@ -109,7 +109,6 @@ static QPlatformTheme::Palette platformPalette(QQuickTheme::Scope scope)
QQuickTheme::QQuickTheme()
: d_ptr(new QQuickThemePrivate)
{
- d_ptr->q_ptr = this;
}
QQuickTheme::~QQuickTheme()
diff --git a/src/quicktemplates2/qquicktheme_p_p.h b/src/quicktemplates2/qquicktheme_p_p.h
index c7421677..29058bc8 100644
--- a/src/quicktemplates2/qquicktheme_p_p.h
+++ b/src/quicktemplates2/qquicktheme_p_p.h
@@ -54,8 +54,6 @@ QT_BEGIN_NAMESPACE
class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickThemePrivate
{
- Q_DECLARE_PUBLIC(QQuickTheme)
-
public:
static QQuickThemePrivate *get(QQuickTheme *theme)
{
@@ -70,7 +68,6 @@ public:
QScopedPointer<const QPalette> defaultPalette;
QSharedPointer<QFont> fonts[NScopes];
QSharedPointer<QPalette> palettes[NScopes];
- QQuickTheme *q_ptr = nullptr;
};
QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquicktoolbar.cpp b/src/quicktemplates2/qquicktoolbar.cpp
index 0abf0364..817ee8a9 100644
--- a/src/quicktemplates2/qquicktoolbar.cpp
+++ b/src/quicktemplates2/qquicktoolbar.cpp
@@ -42,7 +42,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype ToolBar
\inherits Pane
- \instantiates QQuickToolBar
+//! \instantiates QQuickToolBar
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-containers
diff --git a/src/quicktemplates2/qquicktoolbutton.cpp b/src/quicktemplates2/qquicktoolbutton.cpp
index b613e69b..01cf17f6 100644
--- a/src/quicktemplates2/qquicktoolbutton.cpp
+++ b/src/quicktemplates2/qquicktoolbutton.cpp
@@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype ToolButton
\inherits Button
- \instantiates QQuickToolButton
+//! \instantiates QQuickToolButton
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-buttons
diff --git a/src/quicktemplates2/qquicktoolseparator.cpp b/src/quicktemplates2/qquicktoolseparator.cpp
index 625e85e9..e33e9f9d 100644
--- a/src/quicktemplates2/qquicktoolseparator.cpp
+++ b/src/quicktemplates2/qquicktoolseparator.cpp
@@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype ToolSeparator
\inherits Control
- \instantiates QQuickToolSeparator
+//! \instantiates QQuickToolSeparator
\inqmlmodule QtQuick.Controls
\since 5.8
\ingroup qtquickcontrols2-separators
diff --git a/src/quicktemplates2/qquicktooltip.cpp b/src/quicktemplates2/qquicktooltip.cpp
index 0a36e0c7..8b61375e 100644
--- a/src/quicktemplates2/qquicktooltip.cpp
+++ b/src/quicktemplates2/qquicktooltip.cpp
@@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype ToolTip
\inherits Popup
- \instantiates QQuickToolTip
+//! \instantiates QQuickToolTip
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-popups
@@ -188,7 +188,7 @@ void QQuickToolTip::setText(const QString &text)
return;
d->text = text;
- setAccessibleName(text);
+ maybeSetAccessibleName(text);
emit textChanged();
}
@@ -252,9 +252,18 @@ void QQuickToolTip::setVisible(bool visible)
{
Q_D(QQuickToolTip);
if (visible) {
- if (!d->visible && d->delay > 0) {
- d->startDelay();
- return;
+ if (!d->visible) {
+ // We are being made visible, and we weren't before.
+ if (d->delay > 0) {
+ d->startDelay();
+ return;
+ }
+ } else {
+ // We are being made visible, even though we already were.
+ // We've probably been re-opened before our exit transition could finish.
+ // In that case, we need to manually start the timeout, as that is usually
+ // done in itemChange(), which won't be called in this situation.
+ d->startTimeout();
}
} else {
d->stopDelay();
@@ -273,9 +282,10 @@ QQuickToolTipAttached *QQuickToolTip::qmlAttachedProperties(QObject *object)
/*!
\since QtQuick.Controls 2.5 (Qt 5.12)
- \qmlmethod void QtQuick.Controls::ToolTip::show(string text, int timeout = -1)
+ \qmlmethod void QtQuick.Controls::ToolTip::show(string text, int timeout)
- This method shows the tooltip with \a text and \a timeout (milliseconds).
+ This method shows the \a text as a tooltip, which times out in
+ \a timeout (milliseconds).
*/
void QQuickToolTip::show(const QString &text, int ms)
{
@@ -350,7 +360,7 @@ void QQuickToolTip::accessibilityActiveChanged(bool active)
QQuickPopup::accessibilityActiveChanged(active);
if (active)
- setAccessibleName(d->text);
+ maybeSetAccessibleName(d->text);
}
#endif
@@ -556,8 +566,9 @@ void QQuickToolTipAttached::hide()
QQuickToolTip *tip = d->instance(false);
if (!tip)
return;
-
- tip->close();
+ // check the parent item to prevent unexpectedly closing tooltip by new created invisible tooltip
+ if (parent() == tip->parentItem())
+ tip->close();
}
QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquicktumbler.cpp b/src/quicktemplates2/qquicktumbler.cpp
index 85c70b1b..c1d1c00f 100644
--- a/src/quicktemplates2/qquicktumbler.cpp
+++ b/src/quicktemplates2/qquicktumbler.cpp
@@ -50,7 +50,7 @@ Q_LOGGING_CATEGORY(lcTumbler, "qt.quick.controls.tumbler")
/*!
\qmltype Tumbler
\inherits Control
- \instantiates QQuickTumbler
+//! \instantiates QQuickTumbler
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-input
diff --git a/src/quicktemplates2/quicktemplates2.pri b/src/quicktemplates2/quicktemplates2.pri
index c145c20f..fa6929f9 100644
--- a/src/quicktemplates2/quicktemplates2.pri
+++ b/src/quicktemplates2/quicktemplates2.pri
@@ -31,6 +31,8 @@ HEADERS += \
$$PWD/qquickframe_p.h \
$$PWD/qquickframe_p_p.h \
$$PWD/qquickgroupbox_p.h \
+ $$PWD/qquickheaderview_p.h \
+ $$PWD/qquickheaderview_p_p.h \
$$PWD/qquickicon_p.h \
$$PWD/qquickitemdelegate_p.h \
$$PWD/qquickitemdelegate_p_p.h \
@@ -120,6 +122,7 @@ SOURCES += \
$$PWD/qquickdrawer.cpp \
$$PWD/qquickframe.cpp \
$$PWD/qquickgroupbox.cpp \
+ $$PWD/qquickheaderview.cpp \
$$PWD/qquickicon.cpp \
$$PWD/qquickitemdelegate.cpp \
$$PWD/qquicklabel.cpp \