summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/configure.json7
-rw-r--r--src/corelib/global/qglobal.cpp13
-rw-r--r--src/corelib/global/qglobal.h9
-rw-r--r--src/corelib/io/qdir.cpp6
-rw-r--r--src/corelib/itemmodels/itemmodels.pri8
-rw-r--r--src/corelib/itemmodels/qabstractproxymodel.cpp11
-rw-r--r--src/corelib/itemmodels/qabstractproxymodel.h3
-rw-r--r--src/corelib/itemmodels/qconcatenatetablesproxymodel.cpp750
-rw-r--r--src/corelib/itemmodels/qconcatenatetablesproxymodel.h100
-rw-r--r--src/corelib/itemmodels/qstringlistmodel.cpp86
-rw-r--r--src/corelib/itemmodels/qstringlistmodel.h7
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib.cpp5
-rw-r--r--src/corelib/kernel/qmetatype.cpp4
-rw-r--r--src/corelib/kernel/qobject.cpp3
-rw-r--r--src/corelib/plugin/qplugin.h26
-rw-r--r--src/corelib/tools/qbytearray.cpp4
-rw-r--r--src/corelib/tools/qlocale.cpp28
-rw-r--r--src/corelib/tools/qlocale.h8
-rw-r--r--src/corelib/tools/qlocale.qdoc627
-rw-r--r--src/corelib/tools/qlocale_data_p.h32
-rw-r--r--src/corelib/tools/qlocale_p.h8
-rw-r--r--src/corelib/tools/qmakearray_p.h4
-rw-r--r--src/corelib/tools/qoffsetstringarray_p.h197
-rw-r--r--src/corelib/tools/qstring.h6
-rw-r--r--src/corelib/tools/tools.pri1
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.cpp6
-rw-r--r--src/network/access/qnetworkcookiejar.cpp21
-rw-r--r--src/network/kernel/qauthenticator.cpp15
-rw-r--r--src/network/kernel/qauthenticator_p.h2
-rw-r--r--src/sql/models/qsqltablemodel.cpp10
-rw-r--r--src/sql/models/qsqltablemodel.h3
-rw-r--r--src/widgets/itemviews/qheaderview.cpp6
-rw-r--r--src/widgets/itemviews/qitemdelegate.cpp2
-rw-r--r--src/widgets/itemviews/qlistview.cpp35
-rw-r--r--src/widgets/itemviews/qlistview_p.h8
-rw-r--r--src/widgets/itemviews/qlistwidget.cpp44
-rw-r--r--src/widgets/itemviews/qlistwidget_p.h4
-rw-r--r--src/widgets/itemviews/qtableview.cpp4
-rw-r--r--src/widgets/itemviews/qtablewidget.cpp30
-rw-r--r--src/widgets/itemviews/qtablewidget_p.h3
-rw-r--r--src/widgets/itemviews/qtreewidget.cpp29
-rw-r--r--src/widgets/itemviews/qtreewidget_p.h4
-rw-r--r--src/widgets/styles/qcommonstyle.cpp2
-rw-r--r--src/widgets/styles/qstyle.h4
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp11
45 files changed, 1771 insertions, 425 deletions
diff --git a/src/corelib/configure.json b/src/corelib/configure.json
index 183eb3a13e..f09ef6c1dd 100644
--- a/src/corelib/configure.json
+++ b/src/corelib/configure.json
@@ -793,6 +793,13 @@
"condition": "features.proxymodel",
"output": [ "publicFeature", "feature" ]
},
+ "concatenatetablesproxymodel": {
+ "label": "QConcatenateTablesProxyModel",
+ "purpose": "Supports concatenating source models.",
+ "section": "ItemViews",
+ "condition": "features.proxymodel",
+ "output": [ "publicFeature", "feature" ]
+ },
"stringlistmodel": {
"label": "QStringListModel",
"purpose": "Provides a model that supplies strings to views.",
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index a369bbe490..6c608dab74 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -2142,11 +2142,20 @@ struct QUnixOSVersion
static QString unquote(const char *begin, const char *end)
{
+ // man os-release says:
+ // Variable assignment values must be enclosed in double
+ // or single quotes if they include spaces, semicolons or
+ // other special characters outside of A–Z, a–z, 0–9. Shell
+ // special characters ("$", quotes, backslash, backtick)
+ // must be escaped with backslashes, following shell style.
+ // All strings should be in UTF-8 format, and non-printable
+ // characters should not be used. It is not supported to
+ // concatenate multiple individually quoted strings.
if (*begin == '"') {
Q_ASSERT(end[-1] == '"');
- return QString::fromLatin1(begin + 1, end - begin - 2);
+ return QString::fromUtf8(begin + 1, end - begin - 2);
}
- return QString::fromLatin1(begin, end - begin);
+ return QString::fromUtf8(begin, end - begin);
}
static QByteArray getEtcFileContent(const char *filename)
{
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index b608489576..f56629faa1 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -591,11 +591,11 @@ Q_DECL_CONSTEXPR inline qint64 qRound64(float d)
{ return d >= 0.0f ? qint64(d + 0.5f) : qint64(d - float(qint64(d-1)) + 0.5f) + qint64(d-1); }
template <typename T>
-Q_DECL_CONSTEXPR inline const T &qMin(const T &a, const T &b) { return (a < b) ? a : b; }
+constexpr inline const T &qMin(const T &a, const T &b) { return (a < b) ? a : b; }
template <typename T>
-Q_DECL_CONSTEXPR inline const T &qMax(const T &a, const T &b) { return (a < b) ? b : a; }
+constexpr inline const T &qMax(const T &a, const T &b) { return (a < b) ? b : a; }
template <typename T>
-Q_DECL_CONSTEXPR inline const T &qBound(const T &min, const T &val, const T &max)
+constexpr inline const T &qBound(const T &min, const T &val, const T &max)
{ return qMax(min, qMin(max, val)); }
#ifndef Q_FORWARD_DECLARE_OBJC_CLASS
@@ -1186,9 +1186,6 @@ namespace QtPrivate {
//like std::enable_if
template <bool B, typename T = void> struct QEnableIf;
template <typename T> struct QEnableIf<true, T> { typedef T Type; };
-
-template <bool B, typename T, typename F> struct QConditional { typedef T Type; };
-template <typename T, typename F> struct QConditional<false, T, F> { typedef F Type; };
}
QT_END_NAMESPACE
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 39422c3401..fb3a2f0aea 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -1040,7 +1040,7 @@ QStringList QDir::nameFilters() const
list of filters specified by \a nameFilters.
Each name filter is a wildcard (globbing) filter that understands
- \c{*} and \c{?} wildcards. (See \l{QRegularExpression wildcard matching}.)
+ \c{*} and \c{?} wildcards. (See \l{Wildcard matching}.)
For example, the following code sets three name filters on a QDir
to ensure that only files with extensions typically used for C++
@@ -2120,7 +2120,7 @@ QString QDir::rootPath()
patterns in the list of \a filters; otherwise returns \c false. The
matching is case insensitive.
- \sa {QRegularExpression Wildcard matching}, QRegularExpression::wildcardToRegularExpression(),
+ \sa {Wildcard matching}, QRegularExpression::wildcardToRegularExpression(),
entryList(), entryInfoList()
*/
bool QDir::match(const QStringList &filters, const QString &fileName)
@@ -2143,7 +2143,7 @@ bool QDir::match(const QStringList &filters, const QString &fileName)
contain multiple patterns separated by spaces or semicolons.
The matching is case insensitive.
- \sa {QRegularExpression wildcard matching}, QRegularExpression::wildcardToRegularExpression,
+ \sa {Wildcard matching}, QRegularExpression::wildcardToRegularExpression,
entryList(), entryInfoList()
*/
bool QDir::match(const QString &filter, const QString &fileName)
diff --git a/src/corelib/itemmodels/itemmodels.pri b/src/corelib/itemmodels/itemmodels.pri
index 068a8c4b3a..5a977c6623 100644
--- a/src/corelib/itemmodels/itemmodels.pri
+++ b/src/corelib/itemmodels/itemmodels.pri
@@ -20,6 +20,14 @@ qtConfig(proxymodel) {
SOURCES += \
itemmodels/qabstractproxymodel.cpp
+ qtConfig(concatenatetablesproxymodel) {
+ HEADERS += \
+ itemmodels/qconcatenatetablesproxymodel.h
+
+ SOURCES += \
+ itemmodels/qconcatenatetablesproxymodel.cpp
+ }
+
qtConfig(identityproxymodel) {
HEADERS += \
itemmodels/qidentityproxymodel.h
diff --git a/src/corelib/itemmodels/qabstractproxymodel.cpp b/src/corelib/itemmodels/qabstractproxymodel.cpp
index b7c49a53e4..095ab6fc71 100644
--- a/src/corelib/itemmodels/qabstractproxymodel.cpp
+++ b/src/corelib/itemmodels/qabstractproxymodel.cpp
@@ -313,6 +313,17 @@ bool QAbstractProxyModel::setHeaderData(int section, Qt::Orientation orientation
return d->model->setHeaderData(sourceSection, orientation, value, role);
}
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+/*!
+ \reimp
+ */
+bool QAbstractProxyModel::clearItemData(const QModelIndex &index)
+{
+ Q_D(QAbstractProxyModel);
+ return d->model->clearItemData(mapToSource(index));
+}
+#endif
+
/*!
\reimp
*/
diff --git a/src/corelib/itemmodels/qabstractproxymodel.h b/src/corelib/itemmodels/qabstractproxymodel.h
index c4e5d67908..6d9daee75a 100644
--- a/src/corelib/itemmodels/qabstractproxymodel.h
+++ b/src/corelib/itemmodels/qabstractproxymodel.h
@@ -78,6 +78,9 @@ public:
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
bool setItemData(const QModelIndex& index, const QMap<int, QVariant> &roles) override;
bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole) override;
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ bool clearItemData(const QModelIndex &index) override;
+#endif
QModelIndex buddy(const QModelIndex &index) const override;
bool canFetchMore(const QModelIndex &parent) const override;
diff --git a/src/corelib/itemmodels/qconcatenatetablesproxymodel.cpp b/src/corelib/itemmodels/qconcatenatetablesproxymodel.cpp
new file mode 100644
index 0000000000..bbfe2dce16
--- /dev/null
+++ b/src/corelib/itemmodels/qconcatenatetablesproxymodel.cpp
@@ -0,0 +1,750 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@kdab.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtCore 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 "qconcatenatetablesproxymodel.h"
+#include <private/qabstractitemmodel_p.h>
+#include "qsize.h"
+#include "qdebug.h"
+
+QT_BEGIN_NAMESPACE
+
+class QConcatenateTablesProxyModelPrivate : public QAbstractItemModelPrivate
+{
+ Q_DECLARE_PUBLIC(QConcatenateTablesProxyModel);
+
+public:
+ QConcatenateTablesProxyModelPrivate();
+
+ int computeRowsPrior(const QAbstractItemModel *sourceModel) const;
+
+ struct SourceModelForRowResult
+ {
+ SourceModelForRowResult() : sourceModel(Q_NULLPTR), sourceRow(-1) {}
+ QAbstractItemModel *sourceModel;
+ int sourceRow;
+ };
+ SourceModelForRowResult sourceModelForRow(int row) const;
+
+ void _q_slotRowsAboutToBeInserted(const QModelIndex &, int start, int end);
+ void _q_slotRowsInserted(const QModelIndex &, int start, int end);
+ void _q_slotRowsAboutToBeRemoved(const QModelIndex &, int start, int end);
+ void _q_slotRowsRemoved(const QModelIndex &, int start, int end);
+ void _q_slotColumnsAboutToBeInserted(const QModelIndex &parent, int start, int end);
+ void _q_slotColumnsInserted(const QModelIndex &parent, int, int);
+ void _q_slotColumnsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
+ void _q_slotColumnsRemoved(const QModelIndex &parent, int, int);
+ void _q_slotDataChanged(const QModelIndex &from, const QModelIndex &to, const QVector<int> &roles);
+ void _q_slotSourceLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint);
+ void _q_slotSourceLayoutChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint);
+ void _q_slotModelAboutToBeReset();
+ void _q_slotModelReset();
+ int columnCountAfterChange(const QAbstractItemModel *model, int newCount) const;
+ int calculatedColumnCount() const;
+ void updateColumnCount();
+ bool mapDropCoordinatesToSource(int row, int column, const QModelIndex &parent,
+ int *sourceRow, int *sourceColumn, QModelIndex *sourceParent, QAbstractItemModel **sourceModel) const;
+
+ QVector<QAbstractItemModel *> m_models;
+ int m_rowCount; // have to maintain it here since we can't compute during model destruction
+ int m_columnCount;
+
+ // for columns{AboutToBe,}{Inserted,Removed}
+ int m_newColumnCount;
+
+ // for layoutAboutToBeChanged/layoutChanged
+ QVector<QPersistentModelIndex> layoutChangePersistentIndexes;
+ QVector<QModelIndex> layoutChangeProxyIndexes;
+};
+
+QConcatenateTablesProxyModelPrivate::QConcatenateTablesProxyModelPrivate()
+ : m_rowCount(0),
+ m_columnCount(0),
+ m_newColumnCount(0)
+{
+}
+
+/*!
+ \since 5.13
+ \class QConcatenateTablesProxyModel
+ \inmodule QtCore
+ \brief The QConcatenateTablesProxyModel class proxies multiple source models, concatenating their rows
+
+ \ingroup model-view
+
+ QConcatenateTablesProxyModel takes multiple source models and concatenates their rows.
+
+ In other words, the proxy will have all rows of the first source model,
+ followed by all rows of the second source model, and so on.
+
+ If the source models don't have the same number of columns, the proxy will only
+ have as many columns as the source model with the smallest number of columns.
+ Additional columns in other source models will simply be ignored.
+
+ Source models can be added and removed at runtime, and the column count is adjusted accordingly.
+
+ This proxy does not inherit from QAbstractProxyModel because it uses multiple source
+ models, rather than a single one.
+
+ Only flat models (lists and tables) are supported, tree models are not.
+
+ \sa QAbstractProxyModel, {Model/View Programming}, QIdentityProxyModel, QAbstractItemModel
+ */
+
+
+/*!
+ Constructs a concatenate-rows proxy model with the given \a parent.
+*/
+QConcatenateTablesProxyModel::QConcatenateTablesProxyModel(QObject *parent)
+ : QAbstractItemModel(*new QConcatenateTablesProxyModelPrivate, parent)
+{
+}
+
+/*!
+ Destroys this proxy model.
+*/
+QConcatenateTablesProxyModel::~QConcatenateTablesProxyModel()
+{
+}
+
+/*!
+ Returns the proxy index for a given \a sourceIndex, which can be from any of the source models.
+*/
+QModelIndex QConcatenateTablesProxyModel::mapFromSource(const QModelIndex &sourceIndex) const
+{
+ Q_D(const QConcatenateTablesProxyModel);
+ if (!sourceIndex.isValid())
+ return QModelIndex();
+ const QAbstractItemModel *sourceModel = sourceIndex.model();
+ if (!d->m_models.contains(const_cast<QAbstractItemModel *>(sourceModel))) {
+ qWarning("QConcatenateTablesProxyModel: index from wrong model passed to mapFromSource");
+ Q_ASSERT(!"QConcatenateTablesProxyModel: index from wrong model passed to mapFromSource");
+ return QModelIndex();
+ }
+ if (sourceIndex.column() >= d->m_columnCount)
+ return QModelIndex();
+ int rowsPrior = d_func()->computeRowsPrior(sourceModel);
+ return createIndex(rowsPrior + sourceIndex.row(), sourceIndex.column(), sourceIndex.internalPointer());
+}
+
+/*!
+ Returns the source index for a given proxy index.
+*/
+QModelIndex QConcatenateTablesProxyModel::mapToSource(const QModelIndex &proxyIndex) const
+{
+ Q_D(const QConcatenateTablesProxyModel);
+ Q_ASSERT(checkIndex(proxyIndex));
+ if (!proxyIndex.isValid())
+ return QModelIndex();
+ if (proxyIndex.model() != this) {
+ qWarning("QConcatenateTablesProxyModel: index from wrong model passed to mapToSource");
+ Q_ASSERT(!"QConcatenateTablesProxyModel: index from wrong model passed to mapToSource");
+ return QModelIndex();
+ }
+ const int row = proxyIndex.row();
+ const auto result = d->sourceModelForRow(row);
+ if (!result.sourceModel)
+ return QModelIndex();
+ return result.sourceModel->index(result.sourceRow, proxyIndex.column());
+}
+
+/*!
+ \reimp
+*/
+QVariant QConcatenateTablesProxyModel::data(const QModelIndex &index, int role) const
+{
+ const QModelIndex sourceIndex = mapToSource(index);
+ Q_ASSERT(checkIndex(index, CheckIndexOption::IndexIsValid));
+ if (!sourceIndex.isValid())
+ return QVariant();
+ return sourceIndex.data(role);
+}
+
+/*!
+ \reimp
+*/
+bool QConcatenateTablesProxyModel::setData(const QModelIndex &index, const QVariant &value, int role)
+{
+ Q_ASSERT(checkIndex(index, CheckIndexOption::IndexIsValid));
+ const QModelIndex sourceIndex = mapToSource(index);
+ Q_ASSERT(sourceIndex.isValid());
+ const auto sourceModel = const_cast<QAbstractItemModel *>(sourceIndex.model());
+ return sourceModel->setData(sourceIndex, value, role);
+}
+
+/*!
+ \reimp
+*/
+QMap<int, QVariant> QConcatenateTablesProxyModel::itemData(const QModelIndex &proxyIndex) const
+{
+ Q_ASSERT(checkIndex(proxyIndex));
+ const QModelIndex sourceIndex = mapToSource(proxyIndex);
+ Q_ASSERT(sourceIndex.isValid());
+ return sourceIndex.model()->itemData(sourceIndex);
+}
+
+/*!
+ \reimp
+*/
+bool QConcatenateTablesProxyModel::setItemData(const QModelIndex &proxyIndex, const QMap<int, QVariant> &roles)
+{
+ Q_ASSERT(checkIndex(proxyIndex));
+ const QModelIndex sourceIndex = mapToSource(proxyIndex);
+ Q_ASSERT(sourceIndex.isValid());
+ const auto sourceModel = const_cast<QAbstractItemModel *>(sourceIndex.model());
+ return sourceModel->setItemData(sourceIndex, roles);
+}
+
+/*!
+ Returns the flags for the given index.
+ If the index is valid, the flags come from the source model for this index.
+ If the index is invalid (as used to determine if dropping onto an empty area
+ in the view is allowed, for instance), the flags from the first model are returned.
+*/
+Qt::ItemFlags QConcatenateTablesProxyModel::flags(const QModelIndex &index) const
+{
+ Q_D(const QConcatenateTablesProxyModel);
+ if (d->m_models.isEmpty())
+ return Qt::NoItemFlags;
+ Q_ASSERT(checkIndex(index));
+ if (!index.isValid())
+ return d->m_models.at(0)->flags(index);
+ const QModelIndex sourceIndex = mapToSource(index);
+ Q_ASSERT(sourceIndex.isValid());
+ return sourceIndex.model()->flags(sourceIndex);
+}
+
+/*!
+ This method returns the horizontal header data for the first source model,
+ and the vertical header data for the source model corresponding to each row.
+ \reimp
+*/
+QVariant QConcatenateTablesProxyModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ Q_D(const QConcatenateTablesProxyModel);
+ if (d->m_models.isEmpty())
+ return QVariant();
+ switch (orientation) {
+ case Qt::Horizontal:
+ return d->m_models.at(0)->headerData(section, orientation, role);
+ case Qt::Vertical: {
+ const auto result = d->sourceModelForRow(section);
+ Q_ASSERT(result.sourceModel);
+ return result.sourceModel->headerData(result.sourceRow, orientation, role);
+ }
+ }
+ return QVariant();
+}
+
+/*!
+ This method returns the column count of the source model with the smallest number of columns.
+ \reimp
+*/
+int QConcatenateTablesProxyModel::columnCount(const QModelIndex &parent) const
+{
+ Q_D(const QConcatenateTablesProxyModel);
+ if (parent.isValid())
+ return 0; // flat model
+ return d->m_columnCount;
+}
+
+/*!
+ \reimp
+*/
+QModelIndex QConcatenateTablesProxyModel::index(int row, int column, const QModelIndex &parent) const
+{
+ Q_D(const QConcatenateTablesProxyModel);
+ Q_ASSERT(hasIndex(row, column, parent));
+ if (!hasIndex(row, column, parent))
+ return QModelIndex();
+ Q_ASSERT(checkIndex(parent, QAbstractItemModel::CheckIndexOption::ParentIsInvalid)); // flat model
+ const auto result = d->sourceModelForRow(row);
+ Q_ASSERT(result.sourceModel);
+ return mapFromSource(result.sourceModel->index(result.sourceRow, column));
+}
+
+/*!
+ \reimp
+*/
+QModelIndex QConcatenateTablesProxyModel::parent(const QModelIndex &index) const
+{
+ Q_UNUSED(index);
+ return QModelIndex(); // flat model, no hierarchy
+}
+
+/*!
+ \reimp
+*/
+int QConcatenateTablesProxyModel::rowCount(const QModelIndex &parent) const
+{
+ Q_D(const QConcatenateTablesProxyModel);
+ Q_ASSERT(checkIndex(parent, QAbstractItemModel::CheckIndexOption::ParentIsInvalid)); // flat model
+ Q_UNUSED(parent);
+ return d->m_rowCount;
+}
+
+/*!
+ This method returns the mime types for the first source model.
+ \reimp
+*/
+QStringList QConcatenateTablesProxyModel::mimeTypes() const
+{
+ Q_D(const QConcatenateTablesProxyModel);
+ if (d->m_models.isEmpty())
+ return QStringList();
+ return d->m_models.at(0)->mimeTypes();
+}
+
+/*!
+ The call is forwarded to the source model of the first index in the list of \a indexes.
+
+ Important: please note that this proxy only supports dragging a single row.
+ It will assert if called with indexes from multiple rows, because dragging rows that
+ might come from different source models cannot be implemented generically by this proxy model.
+ Each piece of data in the QMimeData needs to be merged, which is data-type-specific.
+ Reimplement this method in a subclass if you want to support dragging multiple rows.
+
+ \reimp
+*/
+QMimeData *QConcatenateTablesProxyModel::mimeData(const QModelIndexList &indexes) const
+{
+ Q_D(const QConcatenateTablesProxyModel);
+ if (indexes.isEmpty())
+ return nullptr;
+ const QModelIndex firstIndex = indexes.first();
+ Q_ASSERT(checkIndex(firstIndex, CheckIndexOption::IndexIsValid));
+ const auto result = d->sourceModelForRow(firstIndex.row());
+ QModelIndexList sourceIndexes;
+ sourceIndexes.reserve(indexes.count());
+ for (const QModelIndex &index : indexes) {
+ const QModelIndex sourceIndex = mapToSource(index);
+ Q_ASSERT(sourceIndex.model() == result.sourceModel); // see documentation above
+ sourceIndexes.append(sourceIndex);
+ }
+ return result.sourceModel->mimeData(sourceIndexes);
+}
+
+
+bool QConcatenateTablesProxyModelPrivate::mapDropCoordinatesToSource(int row, int column, const QModelIndex &parent,
+ int *sourceRow, int *sourceColumn, QModelIndex *sourceParent, QAbstractItemModel **sourceModel) const
+{
+ Q_Q(const QConcatenateTablesProxyModel);
+ *sourceColumn = column;
+ if (!parent.isValid()) {
+ // Drop after the last item
+ if (row == -1 || row == m_rowCount) {
+ *sourceRow = -1;
+ *sourceModel = m_models.constLast();
+ return true;
+ }
+ // Drop between toplevel items
+ const auto result = sourceModelForRow(row);
+ Q_ASSERT(result.sourceModel);
+ *sourceRow = result.sourceRow;
+ *sourceModel = result.sourceModel;
+ return true;
+ } else {
+ if (row > -1)
+ return false; // flat model, no dropping as new children of items
+ // Drop onto item
+ const int targetRow = parent.row();
+ const auto result = sourceModelForRow(targetRow);
+ Q_ASSERT(result.sourceModel);
+ const QModelIndex sourceIndex = q->mapToSource(parent);
+ *sourceRow = -1;
+ *sourceParent = sourceIndex;
+ *sourceModel = result.sourceModel;
+ return true;
+ }
+}
+
+/*!
+ \reimp
+*/
+bool QConcatenateTablesProxyModel::canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const
+{
+ Q_D(const QConcatenateTablesProxyModel);
+ if (d->m_models.isEmpty())
+ return false;
+
+ int sourceRow, sourceColumn;
+ QModelIndex sourceParent;
+ QAbstractItemModel *sourceModel;
+ if (!d->mapDropCoordinatesToSource(row, column, parent, &sourceRow, &sourceColumn, &sourceParent, &sourceModel))
+ return false;
+ return sourceModel->canDropMimeData(data, action, sourceRow, sourceColumn, sourceParent);
+}
+
+/*!
+ QConcatenateTablesProxyModel handles dropping onto an item, between items, and after the last item.
+ In all cases the call is forwarded to the underlying source model.
+ When dropping onto an item, the source model for this item is called.
+ When dropping between items, the source model immediately below the drop position is called.
+ When dropping after the last item, the last source model is called.
+
+ \reimp
+*/
+bool QConcatenateTablesProxyModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
+{
+ Q_D(const QConcatenateTablesProxyModel);
+ if (d->m_models.isEmpty())
+ return false;
+ int sourceRow, sourceColumn;
+ QModelIndex sourceParent;
+ QAbstractItemModel *sourceModel;
+ if (!d->mapDropCoordinatesToSource(row, column, parent, &sourceRow, &sourceColumn, &sourceParent, &sourceModel))
+ return false;
+
+ return sourceModel->dropMimeData(data, action, sourceRow, sourceColumn, sourceParent);
+}
+
+/*!
+ \reimp
+*/
+QSize QConcatenateTablesProxyModel::span(const QModelIndex &index) const
+{
+ Q_D(const QConcatenateTablesProxyModel);
+ Q_ASSERT(checkIndex(index));
+ if (d->m_models.isEmpty() || !index.isValid())
+ return QSize();
+ const QModelIndex sourceIndex = mapToSource(index);
+ Q_ASSERT(sourceIndex.isValid());
+ return sourceIndex.model()->span(sourceIndex);
+}
+
+/*!
+ Adds a source model \a sourceModel, below all previously added source models.
+
+ The ownership of \a sourceModel is not affected by this.
+
+ The same source model cannot be added more than once.
+ */
+void QConcatenateTablesProxyModel::addSourceModel(QAbstractItemModel *sourceModel)
+{
+ Q_D(QConcatenateTablesProxyModel);
+ Q_ASSERT(sourceModel);
+ Q_ASSERT(!d->m_models.contains(sourceModel));
+ connect(sourceModel, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)), this, SLOT(_q_slotDataChanged(QModelIndex,QModelIndex,QVector<int>)));
+ connect(sourceModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(_q_slotRowsInserted(QModelIndex,int,int)));
+ connect(sourceModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(_q_slotRowsRemoved(QModelIndex,int,int)));
+ connect(sourceModel, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), this, SLOT(_q_slotRowsAboutToBeInserted(QModelIndex,int,int)));
+ connect(sourceModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), this, SLOT(_q_slotRowsAboutToBeRemoved(QModelIndex,int,int)));
+
+ connect(sourceModel, SIGNAL(columnsInserted(QModelIndex,int,int)), this, SLOT(_q_slotColumnsInserted(QModelIndex,int,int)));
+ connect(sourceModel, SIGNAL(columnsRemoved(QModelIndex,int,int)), this, SLOT(_q_slotColumnsRemoved(QModelIndex,int,int)));
+ connect(sourceModel, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)), this, SLOT(_q_slotColumnsAboutToBeInserted(QModelIndex,int,int)));
+ connect(sourceModel, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)), this, SLOT(_q_slotColumnsAboutToBeRemoved(QModelIndex,int,int)));
+
+ connect(sourceModel, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>, QAbstractItemModel::LayoutChangeHint)),
+ this, SLOT(_q_slotSourceLayoutAboutToBeChanged(QList<QPersistentModelIndex>, QAbstractItemModel::LayoutChangeHint)));
+ connect(sourceModel, SIGNAL(layoutChanged(QList<QPersistentModelIndex>, QAbstractItemModel::LayoutChangeHint)),
+ this, SLOT(_q_slotSourceLayoutChanged(QList<QPersistentModelIndex>, QAbstractItemModel::LayoutChangeHint)));
+ connect(sourceModel, SIGNAL(modelAboutToBeReset()), this, SLOT(_q_slotModelAboutToBeReset()));
+ connect(sourceModel, SIGNAL(modelReset()), this, SLOT(_q_slotModelReset()));
+
+ const int newRows = sourceModel->rowCount();
+ if (newRows > 0)
+ beginInsertRows(QModelIndex(), d->m_rowCount, d->m_rowCount + newRows - 1);
+ d->m_rowCount += newRows;
+ d->m_models.append(sourceModel);
+ if (newRows > 0)
+ endInsertRows();
+
+ d->updateColumnCount();
+}
+
+/*!
+ Removes the source model \a sourceModel, which was previously added to this proxy.
+
+ The ownership of \a sourceModel is not affected by this.
+*/
+void QConcatenateTablesProxyModel::removeSourceModel(QAbstractItemModel *sourceModel)
+{
+ Q_D(QConcatenateTablesProxyModel);
+ Q_ASSERT(d->m_models.contains(sourceModel));
+ disconnect(sourceModel, 0, this, 0);
+
+ const int rowsRemoved = sourceModel->rowCount();
+ const int rowsPrior = d->computeRowsPrior(sourceModel); // location of removed section
+
+ if (rowsRemoved > 0)
+ beginRemoveRows(QModelIndex(), rowsPrior, rowsPrior + rowsRemoved - 1);
+ d->m_models.removeOne(sourceModel);
+ d->m_rowCount -= rowsRemoved;
+ if (rowsRemoved > 0)
+ endRemoveRows();
+
+ d->updateColumnCount();
+}
+
+void QConcatenateTablesProxyModelPrivate::_q_slotRowsAboutToBeInserted(const QModelIndex &parent, int start, int end)
+{
+ Q_Q(QConcatenateTablesProxyModel);
+ if (parent.isValid()) // not supported, the proxy is a flat model
+ return;
+ const QAbstractItemModel * const model = static_cast<QAbstractItemModel *>(q->sender());
+ const int rowsPrior = computeRowsPrior(model);
+ q->beginInsertRows(QModelIndex(), rowsPrior + start, rowsPrior + end);
+}
+
+void QConcatenateTablesProxyModelPrivate::_q_slotRowsInserted(const QModelIndex &parent, int start, int end)
+{
+ Q_Q(QConcatenateTablesProxyModel);
+ if (parent.isValid()) // flat model
+ return;
+ m_rowCount += end - start + 1;
+ q->endInsertRows();
+}
+
+void QConcatenateTablesProxyModelPrivate::_q_slotRowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
+{
+ Q_Q(QConcatenateTablesProxyModel);
+ if (parent.isValid()) // flat model
+ return;
+ const QAbstractItemModel * const model = static_cast<QAbstractItemModel *>(q->sender());
+ const int rowsPrior = computeRowsPrior(model);
+ q->beginRemoveRows(QModelIndex(), rowsPrior + start, rowsPrior + end);
+}
+
+void QConcatenateTablesProxyModelPrivate::_q_slotRowsRemoved(const QModelIndex &parent, int start, int end)
+{
+ Q_Q(QConcatenateTablesProxyModel);
+ if (parent.isValid()) // flat model
+ return;
+ m_rowCount -= end - start + 1;
+ q->endRemoveRows();
+}
+
+void QConcatenateTablesProxyModelPrivate::_q_slotColumnsAboutToBeInserted(const QModelIndex &parent, int start, int end)
+{
+ Q_Q(QConcatenateTablesProxyModel);
+ if (parent.isValid()) // flat model
+ return;
+ const QAbstractItemModel * const model = static_cast<QAbstractItemModel *>(q->sender());
+ const int oldColCount = model->columnCount();
+ const int newColCount = columnCountAfterChange(model, oldColCount + end - start + 1);
+ Q_ASSERT(newColCount >= oldColCount);
+ if (newColCount > oldColCount)
+ // If the underlying models have a different number of columns (example: 2 and 3), inserting 2 columns in
+ // the first model leads to inserting only one column in the proxy, since qMin(2+2,3) == 3.
+ q->beginInsertColumns(QModelIndex(), start, qMin(end, start + newColCount - oldColCount - 1));
+ m_newColumnCount = newColCount;
+}
+
+void QConcatenateTablesProxyModelPrivate::_q_slotColumnsInserted(const QModelIndex &parent, int start, int end)
+{
+ Q_UNUSED(start);
+ Q_UNUSED(end);
+ Q_Q(QConcatenateTablesProxyModel);
+ if (parent.isValid()) // flat model
+ return;
+ if (m_newColumnCount != m_columnCount) {
+ m_columnCount = m_newColumnCount;
+ q->endInsertColumns();
+ }
+}
+
+void QConcatenateTablesProxyModelPrivate::_q_slotColumnsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
+{
+ Q_Q(QConcatenateTablesProxyModel);
+ if (parent.isValid()) // flat model
+ return;
+ const QAbstractItemModel * const model = static_cast<QAbstractItemModel *>(q->sender());
+ const int oldColCount = model->columnCount();
+ const int newColCount = columnCountAfterChange(model, oldColCount - (end - start + 1));
+ Q_ASSERT(newColCount <= oldColCount);
+ if (newColCount < oldColCount)
+ q->beginRemoveColumns(QModelIndex(), start, qMax(end, start + oldColCount - newColCount - 1));
+ m_newColumnCount = newColCount;
+}
+
+void QConcatenateTablesProxyModelPrivate::_q_slotColumnsRemoved(const QModelIndex &parent, int start, int end)
+{
+ Q_Q(QConcatenateTablesProxyModel);
+ Q_UNUSED(start);
+ Q_UNUSED(end);
+ if (parent.isValid()) // flat model
+ return;
+ if (m_newColumnCount != m_columnCount) {
+ m_columnCount = m_newColumnCount;
+ q->endRemoveColumns();
+ }
+}
+
+void QConcatenateTablesProxyModelPrivate::_q_slotDataChanged(const QModelIndex &from, const QModelIndex &to, const QVector<int> &roles)
+{
+ Q_Q(QConcatenateTablesProxyModel);
+ Q_ASSERT(from.isValid());
+ Q_ASSERT(to.isValid());
+ const QModelIndex myFrom = q->mapFromSource(from);
+ Q_ASSERT(q->checkIndex(myFrom, QAbstractItemModel::CheckIndexOption::IndexIsValid));
+ const QModelIndex myTo = q->mapFromSource(to);
+ Q_ASSERT(q->checkIndex(myTo, QAbstractItemModel::CheckIndexOption::IndexIsValid));
+ emit q->dataChanged(myFrom, myTo, roles);
+}
+
+void QConcatenateTablesProxyModelPrivate::_q_slotSourceLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint)
+{
+ Q_Q(QConcatenateTablesProxyModel);
+
+ if (!sourceParents.isEmpty() && !sourceParents.contains(QModelIndex()))
+ return;
+
+ emit q->layoutAboutToBeChanged({}, hint);
+
+ const QModelIndexList persistentIndexList = q->persistentIndexList();
+ layoutChangePersistentIndexes.reserve(persistentIndexList.size());
+ layoutChangeProxyIndexes.reserve(persistentIndexList.size());
+
+ for (const QPersistentModelIndex &proxyPersistentIndex : persistentIndexList) {
+ layoutChangeProxyIndexes.append(proxyPersistentIndex);
+ Q_ASSERT(proxyPersistentIndex.isValid());
+ const QPersistentModelIndex srcPersistentIndex = q->mapToSource(proxyPersistentIndex);
+ Q_ASSERT(srcPersistentIndex.isValid());
+ layoutChangePersistentIndexes << srcPersistentIndex;
+ }
+}
+
+void QConcatenateTablesProxyModelPrivate::_q_slotSourceLayoutChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint)
+{
+ Q_Q(QConcatenateTablesProxyModel);
+ if (!sourceParents.isEmpty() && !sourceParents.contains(QModelIndex()))
+ return;
+ for (int i = 0; i < layoutChangeProxyIndexes.size(); ++i) {
+ const QModelIndex proxyIdx = layoutChangeProxyIndexes.at(i);
+ const QModelIndex newProxyIdx = q->mapFromSource(layoutChangePersistentIndexes.at(i));
+ q->changePersistentIndex(proxyIdx, newProxyIdx);
+ }
+
+ layoutChangePersistentIndexes.clear();
+ layoutChangeProxyIndexes.clear();
+
+ emit q->layoutChanged({}, hint);
+}
+
+void QConcatenateTablesProxyModelPrivate::_q_slotModelAboutToBeReset()
+{
+ Q_Q(QConcatenateTablesProxyModel);
+ Q_ASSERT(m_models.contains(const_cast<QAbstractItemModel *>(static_cast<const QAbstractItemModel *>(q->sender()))));
+ q->beginResetModel();
+ // A reset might reduce both rowCount and columnCount, and we can't notify of both at the same time,
+ // and notifying of one after the other leaves an intermediary invalid situation.
+ // So the only safe choice is to forward it as a full reset.
+}
+
+void QConcatenateTablesProxyModelPrivate::_q_slotModelReset()
+{
+ Q_Q(QConcatenateTablesProxyModel);
+ Q_ASSERT(m_models.contains(const_cast<QAbstractItemModel *>(static_cast<const QAbstractItemModel *>(q->sender()))));
+ m_columnCount = calculatedColumnCount();
+ m_rowCount = computeRowsPrior(nullptr);
+ q->endResetModel();
+}
+
+int QConcatenateTablesProxyModelPrivate::calculatedColumnCount() const
+{
+ if (m_models.isEmpty())
+ return 0;
+
+ const auto it = std::min_element(m_models.begin(), m_models.end(), [](const QAbstractItemModel* model1, const QAbstractItemModel* model2) {
+ return model1->columnCount() < model2->columnCount();
+ });
+ return (*it)->columnCount();
+}
+
+void QConcatenateTablesProxyModelPrivate::updateColumnCount()
+{
+ Q_Q(QConcatenateTablesProxyModel);
+ const int newColumnCount = calculatedColumnCount();
+ const int columnDiff = newColumnCount - m_columnCount;
+ if (columnDiff > 0) {
+ q->beginInsertColumns(QModelIndex(), m_columnCount, m_columnCount + columnDiff - 1);
+ m_columnCount = newColumnCount;
+ q->endInsertColumns();
+ } else if (columnDiff < 0) {
+ const int lastColumn = m_columnCount - 1;
+ q->beginRemoveColumns(QModelIndex(), lastColumn + columnDiff + 1, lastColumn);
+ m_columnCount = newColumnCount;
+ q->endRemoveColumns();
+ }
+}
+
+int QConcatenateTablesProxyModelPrivate::columnCountAfterChange(const QAbstractItemModel *model, int newCount) const
+{
+ int newColumnCount = 0;
+ for (int i = 0; i < m_models.count(); ++i) {
+ const QAbstractItemModel *mod = m_models.at(i);
+ const int colCount = mod == model ? newCount : mod->columnCount();
+ if (i == 0)
+ newColumnCount = colCount;
+ else
+ newColumnCount = qMin(colCount, newColumnCount);
+ }
+ return newColumnCount;
+}
+
+int QConcatenateTablesProxyModelPrivate::computeRowsPrior(const QAbstractItemModel *sourceModel) const
+{
+ int rowsPrior = 0;
+ for (const QAbstractItemModel *model : m_models) {
+ if (model == sourceModel)
+ break;
+ rowsPrior += model->rowCount();
+ }
+ return rowsPrior;
+}
+
+QConcatenateTablesProxyModelPrivate::SourceModelForRowResult QConcatenateTablesProxyModelPrivate::sourceModelForRow(int row) const
+{
+ QConcatenateTablesProxyModelPrivate::SourceModelForRowResult result;
+ int rowCount = 0;
+ for (QAbstractItemModel *model : m_models) {
+ const int subRowCount = model->rowCount();
+ if (rowCount + subRowCount > row) {
+ result.sourceModel = model;
+ break;
+ }
+ rowCount += subRowCount;
+ }
+ result.sourceRow = row - rowCount;
+ return result;
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qconcatenatetablesproxymodel.cpp"
diff --git a/src/corelib/itemmodels/qconcatenatetablesproxymodel.h b/src/corelib/itemmodels/qconcatenatetablesproxymodel.h
new file mode 100644
index 0000000000..85fc6a9c72
--- /dev/null
+++ b/src/corelib/itemmodels/qconcatenatetablesproxymodel.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@kdab.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtCore 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 QCONCATENATEROWSPROXYMODEL_H
+#define QCONCATENATEROWSPROXYMODEL_H
+
+#include <QtCore/qabstractitemmodel.h>
+
+QT_BEGIN_NAMESPACE
+
+class QConcatenateTablesProxyModelPrivate;
+
+class Q_CORE_EXPORT QConcatenateTablesProxyModel : public QAbstractItemModel
+{
+ Q_OBJECT
+
+public:
+ explicit QConcatenateTablesProxyModel(QObject *parent = nullptr);
+ ~QConcatenateTablesProxyModel();
+
+ Q_SCRIPTABLE void addSourceModel(QAbstractItemModel *sourceModel);
+ Q_SCRIPTABLE void removeSourceModel(QAbstractItemModel *sourceModel);
+
+ QModelIndex mapFromSource(const QModelIndex &sourceIndex) const;
+ QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
+
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
+ QMap<int, QVariant> itemData(const QModelIndex &proxyIndex) const override;
+ bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles) override;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
+ QModelIndex parent(const QModelIndex &index) const override;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
+ QStringList mimeTypes() const override;
+ QMimeData *mimeData(const QModelIndexList &indexes) const override;
+ bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const override;
+ bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
+ QSize span(const QModelIndex &index) const override;
+
+private:
+ Q_DECLARE_PRIVATE(QConcatenateTablesProxyModel)
+ Q_DISABLE_COPY(QConcatenateTablesProxyModel)
+
+ Q_PRIVATE_SLOT(d_func(), void _q_slotRowsAboutToBeInserted(const QModelIndex &, int start, int end))
+ Q_PRIVATE_SLOT(d_func(), void _q_slotRowsInserted(const QModelIndex &, int start, int end))
+ Q_PRIVATE_SLOT(d_func(), void _q_slotRowsAboutToBeRemoved(const QModelIndex &, int start, int end))
+ Q_PRIVATE_SLOT(d_func(), void _q_slotRowsRemoved(const QModelIndex &, int start, int end))
+ Q_PRIVATE_SLOT(d_func(), void _q_slotColumnsAboutToBeInserted(const QModelIndex &parent, int start, int end))
+ Q_PRIVATE_SLOT(d_func(), void _q_slotColumnsInserted(const QModelIndex &parent, int, int))
+ Q_PRIVATE_SLOT(d_func(), void _q_slotColumnsAboutToBeRemoved(const QModelIndex &parent, int start, int end))
+ Q_PRIVATE_SLOT(d_func(), void _q_slotColumnsRemoved(const QModelIndex &parent, int, int))
+ Q_PRIVATE_SLOT(d_func(), void _q_slotDataChanged(const QModelIndex &from, const QModelIndex &to, const QVector<int> &roles))
+ Q_PRIVATE_SLOT(d_func(), void _q_slotSourceLayoutAboutToBeChanged(QList<QPersistentModelIndex>, QAbstractItemModel::LayoutChangeHint))
+ Q_PRIVATE_SLOT(d_func(), void _q_slotSourceLayoutChanged(const QList<QPersistentModelIndex> &, QAbstractItemModel::LayoutChangeHint))
+ Q_PRIVATE_SLOT(d_func(), void _q_slotModelAboutToBeReset())
+ Q_PRIVATE_SLOT(d_func(), void _q_slotModelReset())
+};
+
+QT_END_NAMESPACE
+
+#endif // QCONCATENATEROWSPROXYMODEL_H
diff --git a/src/corelib/itemmodels/qstringlistmodel.cpp b/src/corelib/itemmodels/qstringlistmodel.cpp
index 567e6fa35e..3cc0bee8ef 100644
--- a/src/corelib/itemmodels/qstringlistmodel.cpp
+++ b/src/corelib/itemmodels/qstringlistmodel.cpp
@@ -136,6 +136,42 @@ QModelIndex QStringListModel::sibling(int row, int column, const QModelIndex &id
}
/*!
+ \reimp
+ \since 5.13
+*/
+QMap<int, QVariant> QStringListModel::itemData(const QModelIndex &index) const
+{
+ if (!checkIndex(index, CheckIndexOption::IndexIsValid | CheckIndexOption::ParentIsInvalid))
+ return QMap<int, QVariant>{};
+ const QVariant displayData = lst.at(index.row());
+ return QMap<int, QVariant>{{
+ std::make_pair<int>(Qt::DisplayRole, displayData),
+ std::make_pair<int>(Qt::EditRole, displayData)
+ }};
+}
+
+/*!
+ \reimp
+ \since 5.13
+ If \a roles contains both Qt::DisplayRole and Qt::EditRole, the latter will take precedence
+*/
+bool QStringListModel::setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles)
+{
+ if (roles.isEmpty())
+ return false;
+ if (std::any_of(roles.keyBegin(), roles.keyEnd(), [](int role) -> bool {
+ return role != Qt::DisplayRole && role != Qt::EditRole;
+ })) {
+ return false;
+ }
+ auto roleIter = roles.constFind(Qt::EditRole);
+ if (roleIter == roles.constEnd())
+ roleIter = roles.constFind(Qt::DisplayRole);
+ Q_ASSERT(roleIter != roles.constEnd());
+ return setData(index, roleIter.value(), roleIter.key());
+}
+
+/*!
Returns data for the specified \a role, from the item with the
given \a index.
@@ -185,18 +221,22 @@ bool QStringListModel::setData(const QModelIndex &index, const QVariant &value,
if (index.row() >= 0 && index.row() < lst.size()
&& (role == Qt::EditRole || role == Qt::DisplayRole)) {
lst.replace(index.row(), value.toString());
- QVector<int> roles;
- roles.reserve(2);
- roles.append(Qt::DisplayRole);
- roles.append(Qt::EditRole);
- emit dataChanged(index, index, roles);
- // once Q_COMPILER_UNIFORM_INIT can be used, change to:
- // emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole});
+ emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole});
return true;
}
return false;
}
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+/*!
+ \reimp
+ */
+bool QStringListModel::clearItemData(const QModelIndex &index)
+{
+ return setData(index, QVariant(), Qt::EditRole);
+}
+#endif
+
/*!
Inserts \a count rows into the model, beginning at the given \a row.
@@ -249,6 +289,38 @@ bool QStringListModel::removeRows(int row, int count, const QModelIndex &parent)
return true;
}
+/*!
+ \since 5.13
+ \reimp
+*/
+bool QStringListModel::moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild)
+{
+ if (sourceRow < 0
+ || sourceRow + count - 1 >= rowCount(sourceParent)
+ || destinationChild <= 0
+ || destinationChild > rowCount(destinationParent)
+ || sourceRow == destinationChild - 1
+ || count <= 0) {
+ return false;
+ }
+ if (!beginMoveRows(QModelIndex(), sourceRow, sourceRow + count - 1, QModelIndex(), destinationChild))
+ return false;
+ /*
+ QList::move assumes that the second argument is the index where the item will end up to
+ i.e. the valid range for that argument is from 0 to QList::size()-1
+ QAbstractItemModel::moveRows when source and destinations have the same parent assumes that
+ the item will end up being in the row BEFORE the one indicated by destinationChild
+ i.e. the valid range for that argument is from 1 to QList::size()
+ For this reason we remove 1 from destinationChild when using it inside QList
+ */
+ destinationChild--;
+ const int fromRow = destinationChild < sourceRow ? (sourceRow + count - 1) : sourceRow;
+ while (count--)
+ lst.move(fromRow, destinationChild);
+ endMoveRows();
+ return true;
+}
+
static bool ascendingLessThan(const QPair<QString, int> &s1, const QPair<QString, int> &s2)
{
return s1.first < s2.first;
diff --git a/src/corelib/itemmodels/qstringlistmodel.h b/src/corelib/itemmodels/qstringlistmodel.h
index a40c13ae40..6c83917054 100644
--- a/src/corelib/itemmodels/qstringlistmodel.h
+++ b/src/corelib/itemmodels/qstringlistmodel.h
@@ -59,11 +59,18 @@ public:
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ bool clearItemData(const QModelIndex &index) override;
+#endif
Qt::ItemFlags flags(const QModelIndex &index) const override;
bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
+ bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) override;
+
+ QMap<int, QVariant> itemData(const QModelIndex &index) const override;
+ bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles) override;
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp
index 4c780a9294..d2201df41b 100644
--- a/src/corelib/kernel/qeventdispatcher_glib.cpp
+++ b/src/corelib/kernel/qeventdispatcher_glib.cpp
@@ -86,9 +86,10 @@ static gboolean socketNotifierSourceCheck(GSource *source)
p->pollfd.fd, t[int(p->socketNotifier->type())]);
// ### note, modifies src->pollfds!
p->socketNotifier->setEnabled(false);
+ i--;
+ } else {
+ pending = pending || ((p->pollfd.revents & p->pollfd.events) != 0);
}
-
- pending = ((p->pollfd.revents & p->pollfd.events) != 0);
}
return pending;
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index eb67544f21..af838ab090 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -290,6 +290,10 @@ struct DefinedTypesFilter {
\value QJsonObject QJsonObject
\value QJsonArray QJsonArray
\value QJsonDocument QJsonDocument
+ \value QCborValue QCborValue
+ \value QCborArray QCborArray
+ \value QCborMap QCborMap
+ \value QCborSimpleType QCborSimpleType
\value QModelIndex QModelIndex
\value QPersistentModelIndex QPersistentModelIndex (since 5.5)
\value QUuid QUuid
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 6254330d25..66afa52617 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -2142,7 +2142,8 @@ void QObject::removeEventFilter(QObject *obj)
\fn void QObject::destroyed(QObject *obj)
This signal is emitted immediately before the object \a obj is
- destroyed, and can not be blocked.
+ destroyed, after any instances of QPointer have been notified,
+ and can not be blocked.
All the objects's children are destroyed immediately after this
signal is emitted.
diff --git a/src/corelib/plugin/qplugin.h b/src/corelib/plugin/qplugin.h
index 5aca22497a..676b5047d6 100644
--- a/src/corelib/plugin/qplugin.h
+++ b/src/corelib/plugin/qplugin.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2018 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -71,13 +72,27 @@ inline constexpr unsigned char qPluginArchRequirements()
}
typedef QObject *(*QtPluginInstanceFunction)();
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
typedef const char *(*QtPluginMetaDataFunction)();
+#else
+typedef QPair<const uchar *, size_t> (*QtPluginMetaDataFunction)();
+#endif
+
struct Q_CORE_EXPORT QStaticPlugin
{
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+public:
+ constexpr QStaticPlugin(QtPluginInstanceFunction i, QtPluginMetaDataFunction m)
+ : instance(i), rawMetaData(m().first), rawMetaDataSize(m().second)
+ QtPluginInstanceFunction instance;
+private:
+ // ### Qt 6: revise, as this is not standard-layout
+ const void *rawMetaData;
+ qsizetype rawMetaDataSize
+#elif !defined(Q_QDOC)
// Note: This struct is initialized using an initializer list.
// As such, it cannot have any new constructors or variables.
-#ifndef Q_QDOC
QtPluginInstanceFunction instance;
QtPluginMetaDataFunction rawMetaData;
#else
@@ -148,6 +163,15 @@ void Q_CORE_EXPORT qRegisterStaticPluginFunction(QStaticPlugin staticPlugin);
return plugin; \
}
+#elif QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+
+# define QT_MOC_EXPORT_PLUGIN(PLUGINCLASS, PLUGINCLASSNAME) \
+ Q_EXTERN_C Q_DECL_EXPORT \
+ auto qt_plugin_query_metadata() \
+ { return qMakePair<const void *, size_t>(qt_pluginMetaData, sizeof qt_pluginMetaData); } \
+ Q_EXTERN_C Q_DECL_EXPORT QT_PREPEND_NAMESPACE(QObject) *qt_plugin_instance() \
+ Q_PLUGIN_INSTANCE(PLUGINCLASS)
+
#else
# define QT_MOC_EXPORT_PLUGIN(PLUGINCLASS, PLUGINCLASSNAME) \
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index b53a60b9bf..1e591d6d69 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -3885,9 +3885,7 @@ static qulonglong toIntegral_helper(const char *data, bool *ok, int base, qulong
template <typename T> static inline
T toIntegral_helper(const char *data, bool *ok, int base)
{
- // ### Qt6: use std::conditional<std::is_unsigned<T>::value, qulonglong, qlonglong>::type
- const bool isUnsigned = T(0) < T(-1);
- typedef typename QtPrivate::QConditional<isUnsigned, qulonglong, qlonglong>::Type Int64;
+ using Int64 = typename std::conditional<std::is_unsigned<T>::value, qulonglong, qlonglong>::type;
#if defined(QT_CHECK_RANGE)
if (base != 0 && (base < 2 || base > 36)) {
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index b285e58779..0081b5d566 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -620,13 +620,18 @@ static QLocalePrivate *c_private()
*/
/*!
- Constructs a QSystemLocale object. The constructor will automatically
- install this object as the system locale and remove any earlier installed
- system locales.
+ Constructs a QSystemLocale object.
+
+ The constructor will automatically install this object as the system locale,
+ if there's not one active. It also resets the flag that'll prompt
+ QLocale::system() to re-initialize its data, so that instantiating a
+ QSystemLocale transiently (doesn't install the transient as system locale if
+ there was one already and) triggers an update to the system locale's data.
*/
QSystemLocale::QSystemLocale()
{
- _systemLocale = this;
+ if (!_systemLocale)
+ _systemLocale = this;
globalLocaleData.m_language_id = 0;
}
@@ -656,15 +661,17 @@ static const QSystemLocale *systemLocale()
return QSystemLocale_globalSystemLocale();
}
-void QLocalePrivate::updateSystemPrivate()
+static void updateSystemPrivate()
{
- // this function is NOT thread-safe!
+ // This function is NOT thread-safe!
+ // It *should not* be called by anything but systemData()
const QSystemLocale *sys_locale = systemLocale();
// tell the object that the system locale has changed.
sys_locale->query(QSystemLocale::LocaleChanged, QVariant());
- globalLocaleData = *sys_locale->fallbackUiLocale().d->m_data;
+ // Populate global with fallback as basis:
+ globalLocaleData = *sys_locale->fallbackUiLocaleData();
QVariant res = sys_locale->query(QSystemLocale::LanguageId, QVariant());
if (!res.isNull()) {
@@ -715,7 +722,7 @@ static const QLocaleData *systemData()
static QBasicMutex systemDataMutex;
systemDataMutex.lock();
if (globalLocaleData.m_language_id == 0)
- QLocalePrivate::updateSystemPrivate();
+ updateSystemPrivate();
systemDataMutex.unlock();
}
@@ -1180,9 +1187,7 @@ static qulonglong toIntegral_helper(const QLocaleData *d, QStringView str, bool
template <typename T> static inline
T toIntegral_helper(const QLocalePrivate *d, QStringView str, bool *ok)
{
- // ### Qt6: use std::conditional<std::is_unsigned<T>::value, qulonglong, qlonglong>::type
- const bool isUnsigned = T(0) < T(-1);
- typedef typename QtPrivate::QConditional<isUnsigned, qulonglong, qlonglong>::Type Int64;
+ using Int64 = typename std::conditional<std::is_unsigned<T>::value, qulonglong, qlonglong>::type;
// we select the right overload by the last, unused parameter
Int64 val = toIntegral_helper(d->m_data, str, ok, d->m_numberOptions, Int64());
@@ -2353,7 +2358,6 @@ QString QLocale::toString(double i, char f, int prec) const
QLocale QLocale::system()
{
- // this function is NOT thread-safe!
QT_PREPEND_NAMESPACE(systemData)(); // trigger updating of the system data if necessary
return QLocale(*systemLocalePrivate->data());
}
diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h
index 8e6c5c503b..2c7229d28b 100644
--- a/src/corelib/tools/qlocale.h
+++ b/src/corelib/tools/qlocale.h
@@ -436,6 +436,11 @@ public:
Cantonese = 357,
Osage = 358,
Tangut = 359,
+ Ido = 360,
+ Lojban = 361,
+ Sicilian = 362,
+ SouthernKurdish = 363,
+ WesternBalochi = 364,
Afan = Oromo,
Bhutani = Dzongkha,
@@ -452,7 +457,7 @@ public:
Twi = Akan,
Uigur = Uighur,
- LastLanguage = Tangut
+ LastLanguage = WesternBalochi
};
enum Script {
@@ -1091,6 +1096,7 @@ public:
private:
QLocale(QLocalePrivate &dd);
friend class QLocalePrivate;
+ friend class QSystemLocale;
friend Q_CORE_EXPORT uint qHash(const QLocale &key, uint seed) Q_DECL_NOTHROW;
QSharedDataPointer<QLocalePrivate> d;
diff --git a/src/corelib/tools/qlocale.qdoc b/src/corelib/tools/qlocale.qdoc
index 5c0a9b63e5..0f83a765a5 100644
--- a/src/corelib/tools/qlocale.qdoc
+++ b/src/corelib/tools/qlocale.qdoc
@@ -105,42 +105,80 @@
\value AnyLanguage
\value C The "C" locale is identical in behavior to English/UnitedStates.
+
\value Abkhazian
- \value Oromo
\value Afan Obsolete, please use Oromo
\value Afar
\value Afrikaans
+ \value Aghem
+ \value Ahom Since Qt 5.7
+ \value Akan
+ \value Akkadian Since Qt 5.1
\value Akoose Since Qt 5.3
\value Albanian
+ \value AmericanSignLanguage Since Qt 5.7
\value Amharic
+ \value AncientEgyptian Since Qt 5.1
+ \value AncientGreek Since Qt 5.1
+ \value AncientNorthArabian Since Qt 5.5
\value Arabic
+ \value Aragonese Since Qt 5.1
+ \value Aramaic Since Qt 5.1
+ \value ArdhamagadhiPrakrit Since Qt 5.7
\value Armenian
\value Assamese
+ \value Asturian
+ \value Asu
+ \value Atsam
\value Avaric
+ \value Avestan
\value Aymara
\value Azerbaijani
+ \value Bafia
+ \value Balinese Since Qt 5.1
+ \value Bambara
+ \value Bamun Since Qt 5.1
+ \value Basaa
\value Bashkir
\value Basque
+ \value Bassa Since Qt 5.5
+ \value BatakToba Since Qt 5.1
+ \value Belarusian
+ \value Bemba
+ \value Bena
\value Bengali
- \value Dzongkha
+ \value Bhojpuri Since Qt 5.7
\value Bhutani Obsolete, please use Dzongkha
\value Bihari
\value Bislama
- \value Bosnian
+ \value Blin
\value Bodo
+ \value Bosnian
\value Breton
+ \value Buginese Since Qt 5.1
+ \value Buhid Since Qt 5.1
\value Bulgarian
\value Burmese
- \value Belarusian
\value Byelorussian Obsolete, please use Belarusian
- \value Khmer
\value Cambodian Obsolete, please use Khmer
+ \value Cantonese Since Qt 5.7
+ \value Carian Since Qt 5.1
\value Catalan
+ \value CentralKurdish Since Qt 5.5
+ \value CentralMoroccoTamazight
+ \value Chakma Since Qt 5.1
\value Chamorro
\value Chechen
+ \value Cherokee
+ \value Chewa Obsolete, please use Nyanja
+ \value Chiga
\value Chinese
\value Church
\value Chuvash
+ \value ClassicalMandaic Since Qt 5.1
+ \value Colognian
+ \value CongoSwahili
+ \value Coptic Since Qt 5.1
\value Cornish
\value Corsican
\value Cree
@@ -148,33 +186,58 @@
\value Czech
\value Danish
\value Divehi
+ \value Dogri Since Qt 5.1
+ \value Duala
\value Dutch
+ \value Dzongkha
+ \value EasternCham Since Qt 5.1
+ \value EasternKayah Since Qt 5.1
+ \value Embu
\value English
\value Esperanto
\value Estonian
+ \value Etruscan Since Qt 5.1
+ \value Ewe
+ \value Ewondo
\value Faroese
\value Fijian
+ \value Filipino
\value Finnish
\value French
- \value WesternFrisian same as Frisian
\value Frisian same as WesternFrisian
+ \value Friulian
+ \value Fulah
+ \value Ga
\value Gaelic
\value Galician
+ \value Ganda
+ \value Geez
\value Georgian
\value German
+ \value Gothic Since Qt 5.1
\value Greek
\value Greenlandic
\value Guarani
\value Gujarati
+ \value Gusii
\value Haitian
+ \value Hanunoo Since Qt 5.1
\value Hausa
+ \value Hawaiian
\value Hebrew
\value Herero
+ \value HieroglyphicLuwian Since Qt 5.7
\value Hindi
\value HiriMotu
+ \value HmongNjua Since Qt 5.5
+ \value Ho Since Qt 5.5
\value Hungarian
\value Icelandic
+ \value Ido Since Qt 5.12
+ \value Igbo
+ \value InariSami Since Qt 5.5
\value Indonesian
+ \value Ingush Since Qt 5.1
\value Interlingua
\value Interlingue
\value Inuktitut
@@ -183,306 +246,244 @@
\value Italian
\value Japanese
\value Javanese
+ \value Jju
+ \value JolaFonyi
+ \value Kabuverdianu
+ \value Kabyle
+ \value Kako
+ \value Kalenjin
+ \value Kamba
\value Kannada
\value Kanuri
\value Kashmiri
\value Kazakh
+ \value Kenyang Since Qt 5.5
+ \value Khmer
+ \value Kiche Since Qt 5.5
+ \value Kikuyu
\value Kinyarwanda
\value Kirghiz
\value Komi
\value Kongo
+ \value Konkani
\value Korean
+ \value Koro
+ \value KoyraboroSenni
+ \value KoyraChiini
+ \value Kpelle
\value Kurdish
- \value Rundi
\value Kurundi Obsolete, please use Rundi
\value Kwanyama
+ \value Kwasio
\value Lakota Since Qt 5.3
+ \value Langi
\value Lao
+ \value LargeFloweryMiao Since Qt 5.1
\value Latin
\value Latvian
+ \value Lepcha Since Qt 5.1
+ \value Lezghian Since Qt 5.5
\value Limburgish
+ \value Limbu Since Qt 5.1
+ \value LinearA Since Qt 5.5
\value Lingala
+ \value Lisu Since Qt 5.1
+ \value LiteraryChinese Since Qt 5.7
\value Lithuanian
+ \value Lojban Since Qt 5.12
+ \value LowerSorbian Since Qt 5.5
+ \value LowGerman
\value LubaKatanga
+ \value LuleSami Since Qt 5.5
+ \value Luo
+ \value Lu Since Qt 5.1
\value Luxembourgish
- \value Marshallese
+ \value Luyia
+ \value Lycian Since Qt 5.1
+ \value Lydian Since Qt 5.1
\value Macedonian
+ \value Machame
+ \value Maithili Since Qt 5.5
+ \value MakhuwaMeetto
+ \value Makonde
\value Malagasy
\value Malay
\value Malayalam
\value Maltese
+ \value Mandingo Since Qt 5.1
+ \value ManichaeanMiddlePersian Since Qt 5.5
+ \value Manipuri Since Qt 5.1
\value Manx
\value Maori
+ \value Mapuche Since Qt 5.5
\value Marathi
+ \value Marshallese
+ \value Masai
+ \value Mazanderani Since Qt 5.7
+ \value Mende Since Qt 5.5
+ \value Meroitic Since Qt 5.1
+ \value Meru
+ \value Meta
+ \value Mohawk Since Qt 5.5
\value Moldavian Obsolete, please use Romanian
\value Mongolian
+ \value Mono Since Qt 5.5
+ \value Morisyen
+ \value Mru Since Qt 5.7
+ \value Mundang
+ \value Nama
\value NauruLanguage
\value Navaho
\value Ndonga
\value Nepali
- \value Norwegian same as NorwegianBokmal
+ \value Newari Since Qt 5.7
+ \value Ngiemboon
+ \value Ngomba
+ \value Nko Since Qt 5.5
+ \value NorthernLuri Since Qt 5.7
+ \value NorthernSami
+ \value NorthernSotho
+ \value NorthernThai Since Qt 5.1
+ \value NorthNdebele
\value NorwegianBokmal same as Norwegian
\value NorwegianNynorsk
+ \value Norwegian same as NorwegianBokmal
+ \value Nuer
+ \value Nyanja
+ \value Nyankole
\value Occitan
\value Ojibwa
+ \value OldIrish Since Qt 5.1
+ \value OldNorse Since Qt 5.1
+ \value OldPersian Since Qt 5.1
+ \value OldTurkish Since Qt 5.1
\value Oriya
+ \value Oromo
+ \value Osage Since Qt 5.7
\value Ossetic
+ \value Pahlavi Since Qt 5.1
+ \value Palauan Since Qt 5.7
\value Pali
+ \value Papiamento Since Qt 5.7
+ \value Parthian Since Qt 5.1
\value Pashto
\value Persian
+ \value Phoenician Since Qt 5.1
\value Polish
\value Portuguese
+ \value PrakritLanguage Since Qt 5.1
+ \value Prussian Since Qt 5.5
\value Punjabi
\value Quechua
- \value Romansh
+ \value Rejang Since Qt 5.1
\value RhaetoRomance Obsolete, please use Romansh
\value Romanian
+ \value Romansh
+ \value Rombo
+ \value Rundi
\value Russian
+ \value Rwa
+ \value Sabaean Since Qt 5.1
+ \value Saho
+ \value Sakha
+ \value Samaritan Since Qt 5.1
+ \value Samburu
\value Samoan
\value Sango
+ \value Sangu
\value Sanskrit
+ \value Santali Since Qt 5.1
+ \value Saraiki Since Qt 5.7
\value Sardinian
+ \value Saurashtra Since Qt 5.1
+ \value Sena
\value Serbian
\value SerboCroatian Obsolete, please use Serbian
- \value SouthernSotho
- \value Tswana
+ \value Shambala
\value Shona
+ \value SichuanYi
+ \value Sicilian Since Qt 5.12
+ \value Sidamo
\value Sindhi
\value Sinhala
- \value Swati
+ \value SkoltSami Since Qt 5.5
\value Slovak
\value Slovenian
+ \value Soga
\value Somali
+ \value Sora Since Qt 5.1
+ \value SouthernKurdish Since Qt 5.12
+ \value SouthernSami Since Qt 5.5
+ \value SouthernSotho
+ \value SouthNdebele
\value Spanish
\value StandardMoroccanTamazight Since Qt 5.3
\value Sundanese
\value Swahili
+ \value Swati
\value Swedish
+ \value SwissGerman
+ \value Sylheti Since Qt 5.1
+ \value Syriac
+ \value Tachelhit
\value Tagalog Obsolete, please use Filipino
+ \value Tagbanwa Since Qt 5.1
\value Tahitian
+ \value TaiDam Since Qt 5.1
+ \value TaiNua Since Qt 5.1
+ \value Taita
\value Tajik
\value Tamil
+ \value Tangut Since Qt 5.7
+ \value Taroko
+ \value Tasawaq
\value Tatar
+ \value TedimChin Since Qt 5.5
\value Telugu
+ \value Teso
\value Thai
\value Tibetan
+ \value Tigre
\value Tigrinya
+ \value TokelauLanguage Since Qt 5.7
+ \value TokPisin Since Qt 5.7
\value Tongan
\value Tsonga
+ \value Tswana
\value Turkish
\value Turkmen
+ \value TuvaluLanguage Since Qt 5.7
\value Twi Obsolete, please use Akan
+ \value Tyap
+ \value Ugaritic Since Qt 5.1
\value Uighur
\value Uigur Obsolete, please use Uighur
\value Ukrainian
+ \value UncodedLanguages Since Qt 5.7
+ \value UpperSorbian Since Qt 5.5
\value Urdu
\value Uzbek
+ \value Vai
+ \value Venda
\value Vietnamese
\value Volapuk
+ \value Vunjo
+ \value Walamo
\value Walloon
+ \value Walser
+ \value Warlpiri Since Qt 5.5
\value Welsh
+ \value WesternBalochi Since Qt 5.12
+ \value WesternFrisian same as Frisian
\value Wolof
\value Xhosa
+ \value Yangben
\value Yiddish
\value Yoruba
+ \value Zarma
\value Zhuang
\value Zulu
- \value Bosnian
- \value Divehi
- \value Manx
- \value Cornish
- \value Akan
- \value Konkani
- \value Ga
- \value Igbo
- \value Kamba
- \value Syriac
- \value Blin
- \value Geez
- \value Koro
- \value Sidamo
- \value Atsam
- \value Tigre
- \value Jju
- \value Friulian
- \value Venda
- \value Ewe
- \value Walamo
- \value Hawaiian
- \value Tyap
- \value Nyanja
- \value Chewa Obsolete, please use Nyanja
- \value Filipino
- \value SwissGerman
- \value SichuanYi
- \value Kpelle
- \value LowGerman
- \value SouthNdebele
- \value NorthernSotho
- \value NorthernSami
- \value Taroko
- \value Gusii
- \value Taita
- \value Fulah
- \value Kikuyu
- \value Samburu
- \value Sena
- \value NorthNdebele
- \value Rombo
- \value Tachelhit
- \value Kabyle
- \value Nyankole
- \value Bena
- \value Vunjo
- \value Bambara
- \value Embu
- \value Cherokee
- \value Morisyen
- \value Makonde
- \value Langi
- \value Ganda
- \value Bemba
- \value Kabuverdianu
- \value Meru
- \value Kalenjin
- \value Nama
- \value Machame
- \value Colognian
- \value Masai
- \value Soga
- \value Luyia
- \value Asu
- \value Teso
- \value Saho
- \value KoyraChiini
- \value Rwa
- \value Luo
- \value Chiga
- \value CentralMoroccoTamazight
- \value KoyraboroSenni
- \value Shambala
- \value Aghem
- \value Basaa
- \value Zarma
- \value Duala
- \value JolaFonyi
- \value Ewondo
- \value Bafia
- \value MakhuwaMeetto
- \value Mundang
- \value Kwasio
- \value Nuer
- \value Sakha
- \value Sangu
- \value CongoSwahili
- \value Tasawaq
- \value Vai
- \value Walser
- \value Yangben
- \value Avestan
- \value Asturian
- \value Ngomba
- \value Kako
- \value Meta
- \value Ngiemboon
- \value Aragonese
- \value Akkadian
- \value AncientEgyptian
- \value AncientGreek
- \value Aramaic
- \value Balinese
- \value Bamun
- \value BatakToba
- \value Buginese
- \value Buhid
- \value Carian
- \value Chakma
- \value ClassicalMandaic
- \value Coptic
- \value Dogri
- \value EasternCham
- \value EasternKayah
- \value Etruscan
- \value Gothic
- \value Hanunoo
- \value Ingush
- \value LargeFloweryMiao
- \value Lepcha
- \value Limbu
- \value Lisu
- \value Lu
- \value Lycian
- \value Lydian
- \value Mandingo
- \value Manipuri
- \value Meroitic
- \value NorthernThai
- \value OldIrish
- \value OldNorse
- \value OldPersian
- \value OldTurkish
- \value Pahlavi
- \value Parthian
- \value Phoenician
- \value PrakritLanguage
- \value Rejang
- \value Sabaean
- \value Samaritan
- \value Santali
- \value Saurashtra
- \value Sora
- \value Sylheti
- \value Tagbanwa
- \value TaiDam
- \value TaiNua
- \value Ugaritic
- \value Mapuche Since Qt 5.5
- \value CentralKurdish Since Qt 5.5
- \value LowerSorbian Since Qt 5.5
- \value UpperSorbian Since Qt 5.5
- \value Kenyang Since Qt 5.5
- \value Mohawk Since Qt 5.5
- \value Nko Since Qt 5.5
- \value Prussian Since Qt 5.5
- \value Kiche Since Qt 5.5
- \value SouthernSami Since Qt 5.5
- \value LuleSami Since Qt 5.5
- \value InariSami Since Qt 5.5
- \value SkoltSami Since Qt 5.5
- \value Warlpiri Since Qt 5.5
- \value ManichaeanMiddlePersian Since Qt 5.5
- \value Mende Since Qt 5.5
- \value AncientNorthArabian Since Qt 5.5
- \value LinearA Since Qt 5.5
- \value HmongNjua Since Qt 5.5
- \value Ho Since Qt 5.5
- \value Lezghian Since Qt 5.5
- \value Bassa Since Qt 5.5
- \value Mono Since Qt 5.5
- \value TedimChin Since Qt 5.5
- \value Maithili Since Qt 5.5
- \value LowerSorbian Since Qt 5.5
- \value UpperSorbian Since Qt 5.5
- \value Ahom Since Qt 5.7
- \value AmericanSignLanguage Since Qt 5.7
- \value ArdhamagadhiPrakrit Since Qt 5.7
- \value Bhojpuri Since Qt 5.7
- \value Cantonese Since Qt 5.7
- \value HieroglyphicLuwian Since Qt 5.7
- \value LiteraryChinese Since Qt 5.7
- \value Mazanderani Since Qt 5.7
- \value Mru Since Qt 5.7
- \value Newari Since Qt 5.7
- \value NorthernLuri Since Qt 5.7
- \value Osage Since Qt 5.7
- \value Palauan Since Qt 5.7
- \value Papiamento Since Qt 5.7
- \value Saraiki Since Qt 5.7
- \value Tangut Since Qt 5.7
- \value TokelauLanguage Since Qt 5.7
- \value TokPisin Since Qt 5.7
- \value TuvaluLanguage Since Qt 5.7
- \value UncodedLanguages Since Qt 5.7
+
\omitvalue LastLanguage
\sa language(), languageToString()
@@ -494,7 +495,9 @@
This enumerated type is used to specify a country.
\value AnyCountry
+
\value Afghanistan
+ \value AlandIslands
\value Albania
\value Algeria
\value AmericanSamoa
@@ -506,6 +509,7 @@
\value Argentina
\value Armenia
\value Aruba
+ \value AscensionIsland
\value Australia
\value Austria
\value Azerbaijan
@@ -520,11 +524,13 @@
\value Bermuda
\value Bhutan
\value Bolivia
+ \value Bonaire
\value BosniaAndHerzegowina
\value Botswana
\value BouvetIsland
\value Brazil
\value BritishIndianOceanTerritory
+ \value BritishVirginIslands
\value Brunei
\value Bulgaria
\value BurkinaFaso
@@ -536,6 +542,7 @@
\value CapeVerde
\value CaymanIslands
\value CentralAfricanRepublic
+ \value CeutaAndMelilla
\value Chad
\value Chile
\value China
@@ -544,18 +551,19 @@
\value CocosIslands
\value Colombia
\value Comoros
- \value CongoKinshasa
\value CongoBrazzaville
- \value DemocraticRepublicOfCongo Obsolete, please use CongoKinshasa
- \value PeoplesRepublicOfCongo Obsolete, please use CongoBrazzaville
+ \value CongoKinshasa
\value CookIslands
\value CostaRica
- \value IvoryCoast
\value Croatia
\value Cuba
+ \value CuraSao
\value Cyprus
\value CzechRepublic
+ \value DemocraticRepublicOfCongo Obsolete, please use CongoKinshasa
+ \value DemocraticRepublicOfKorea Obsolete, please use NorthKorea
\value Denmark
+ \value DiegoGarcia
\value Djibouti
\value Dominica
\value DominicanRepublic
@@ -604,19 +612,18 @@
\value Iran
\value Iraq
\value Ireland
+ \value IsleOfMan
\value Israel
\value Italy
+ \value IvoryCoast
\value Jamaica
\value Japan
+ \value Jersey
\value Jordan
\value Kazakhstan
\value Kenya
\value Kiribati
- \value NorthKorea
- \value SouthKorea
- \value DemocraticRepublicOfKorea Obsolete, please use NorthKorea
- \value RepublicOfKorea Obsolete, please use SouthKorea
- \value Kosovo
+ \value Kosovo Since Qt 5.2
\value Kuwait
\value Kyrgyzstan
\value Laos
@@ -648,6 +655,7 @@
\value Moldova
\value Monaco
\value Mongolia
+ \value Montenegro
\value Montserrat
\value Morocco
\value Mozambique
@@ -664,6 +672,7 @@
\value Niue
\value NorfolkIsland
\value NorthernMarianaIslands
+ \value NorthKorea
\value Norway
\value Oman
\value OutlyingOceania Since Qt 5.7
@@ -673,6 +682,7 @@
\value Panama
\value PapuaNewGuinea
\value Paraguay
+ \value PeoplesRepublicOfCongo Obsolete, please use CongoBrazzaville
\value Peru
\value Philippines
\value Pitcairn
@@ -680,32 +690,39 @@
\value Portugal
\value PuertoRico
\value Qatar
+ \value RepublicOfKorea Obsolete, please use SouthKorea
\value Reunion
\value Romania
- \value Russia same as RussianFederation
\value RussianFederation same as Russia
+ \value Russia same as RussianFederation
\value Rwanda
+ \value SaintBarthelemy
+ \value SaintHelena
\value SaintKittsAndNevis
\value SaintLucia
+ \value SaintMartin
+ \value SaintPierreAndMiquelon
\value SaintVincentAndTheGrenadines
\value Samoa
\value SanMarino
\value SaoTomeAndPrincipe
\value SaudiArabia
\value Senegal
+ \value Serbia
\value Seychelles
\value SierraLeone
\value Singapore
+ \value SintMaarten
\value Slovakia
\value Slovenia
\value SolomonIslands
\value Somalia
\value SouthAfrica
\value SouthGeorgiaAndTheSouthSandwichIslands
+ \value SouthKorea
+ \value SouthSudan
\value Spain
\value SriLanka
- \value SaintHelena
- \value SaintPierreAndMiquelon
\value Sudan
\value Suriname
\value SvalbardAndJanMayenIslands
@@ -723,6 +740,7 @@
\value Tokelau Obsolete, please use TokelauCountry
\value Tonga
\value TrinidadAndTobago
+ \value TristanDaCunha
\value Tunisia
\value Turkey
\value Turkmenistan
@@ -735,35 +753,20 @@
\value UnitedKingdom
\value UnitedStates
\value UnitedStatesMinorOutlyingIslands
+ \value UnitedStatesVirginIslands
\value Uruguay
\value Uzbekistan
\value Vanuatu
\value VaticanCityState
\value Venezuela
\value Vietnam
- \value BritishVirginIslands
- \value UnitedStatesVirginIslands
\value WallisAndFutunaIslands
\value WesternSahara
\value World Since Qt 5.12
\value Yemen
\value Zambia
\value Zimbabwe
- \value Montenegro
- \value Serbia
- \value SaintBarthelemy
- \value SaintMartin
- \value AscensionIsland
- \value AlandIslands
- \value DiegoGarcia
- \value CeutaAndMelilla
- \value IsleOfMan
- \value Jersey
- \value TristanDaCunha
- \value SouthSudan
- \value CuraSao
- \value Bonaire
- \value SintMaarten
+
\omitvalue LastCountry
\sa country(), countryToString()
@@ -775,135 +778,136 @@
This enumerated type is used to specify a script.
\value AnyScript
+
\value AdlamScript Since Qt 5.7
\value AhomScript Since Qt 5.7
\value AnatolianHieroglyphsScript Since Qt 5.7
\value ArabicScript
\value ArmenianScript
- \value AvestanScript
- \value BalineseScript
- \value BamumScript
+ \value AvestanScript Since Qt 5.1
+ \value BalineseScript Since Qt 5.1
+ \value BamumScript Since Qt 5.1
\value BassaVahScript Since Qt 5.5
- \value BatakScript
+ \value BatakScript Since Qt 5.1
\value BengaliScript
\value BhaiksukiScript Since Qt 5.7
- \value BopomofoScript
- \value BrahmiScript
- \value BrailleScript
- \value BugineseScript
- \value BuhidScript
- \value CanadianAboriginalScript
- \value CarianScript
+ \value BopomofoScript Since Qt 5.1
+ \value BrahmiScript Since Qt 5.1
+ \value BrailleScript Since Qt 5.1
+ \value BugineseScript Since Qt 5.1
+ \value BuhidScript Since Qt 5.1
+ \value CanadianAboriginalScript Since Qt 5.1
+ \value CarianScript Since Qt 5.1
\value CaucasianAlbanianScript Since Qt 5.5
- \value ChakmaScript
- \value ChamScript
+ \value ChakmaScript Since Qt 5.1
+ \value ChamScript Since Qt 5.1
\value CherokeeScript
- \value CopticScript
- \value CypriotScript
+ \value CopticScript Since Qt 5.1
+ \value CuneiformScript Since Qt 5.1
+ \value CypriotScript Since Qt 5.1
\value CyrillicScript
- \value DeseretScript
+ \value DeseretScript Since Qt 5.1
\value DevanagariScript
\value DuployanScript Since Qt 5.5
- \value EgyptianHieroglyphsScript
+ \value EgyptianHieroglyphsScript Since Qt 5.1
\value ElbasanScript Since Qt 5.5
\value EthiopicScript
- \value FraserScript
+ \value FraserScript Since Qt 5.1
\value GeorgianScript
- \value GlagoliticScript
- \value GothicScript
+ \value GlagoliticScript Since Qt 5.1
+ \value GothicScript Since Qt 5.1
\value GranthaScript Since Qt 5.5
\value GreekScript
\value GujaratiScript
\value GurmukhiScript
- \value HanScript
- \value HangulScript
- \value HanunooScript
+ \value HangulScript Since Qt 5.1
+ \value HanScript Since Qt 5.1
+ \value HanunooScript Since Qt 5.1
\value HanWithBopomofoScript Since Qt 5.7
\value HatranScript Since Qt 5.7
\value HebrewScript
- \value HiraganaScript
- \value ImperialAramaicScript
- \value InscriptionalPahlaviScript
- \value InscriptionalParthianScript
+ \value HiraganaScript Since Qt 5.1
+ \value ImperialAramaicScript Since Qt 5.1
+ \value InscriptionalPahlaviScript Since Qt 5.1
+ \value InscriptionalParthianScript Since Qt 5.1
\value JamoScript Since Qt 5.7
\value JapaneseScript
- \value JavaneseScript
- \value KaithiScript
+ \value JavaneseScript Since Qt 5.1
+ \value KaithiScript Since Qt 5.1
\value KannadaScript
- \value KatakanaScript
- \value KayahLiScript
- \value KharoshthiScript
- \value KhmerScript
+ \value KatakanaScript Since Qt 5.1
+ \value KayahLiScript Since Qt 5.1
+ \value KharoshthiScript Since Qt 5.1
+ \value KhmerScript Since Qt 5.1
\value KhojkiScript Since Qt 5.5
\value KhudawadiScript Since Qt 5.5
\value KoreanScript
- \value LannaScript
+ \value LannaScript Since Qt 5.1
\value LaoScript
\value LatinScript
- \value LepchaScript
- \value LimbuScript
+ \value LepchaScript Since Qt 5.1
+ \value LimbuScript Since Qt 5.1
\value LinearAScript Since Qt 5.5
- \value LinearBScript
- \value LycianScript
- \value LydianScript
+ \value LinearBScript Since Qt 5.1
+ \value LycianScript Since Qt 5.1
+ \value LydianScript Since Qt 5.1
\value MahajaniScript Since Qt 5.5
\value MalayalamScript
- \value MandaeanScript
+ \value MandaeanScript Since Qt 5.1
\value ManichaeanScript Since Qt 5.5
\value MarchenScript Since Qt 5.7
- \value MeiteiMayekScript
+ \value MeiteiMayekScript Since Qt 5.1
\value MendeKikakuiScript Since Qt 5.5
- \value MeroiticScript
- \value MeroiticCursiveScript
+ \value MeroiticCursiveScript Since Qt 5.1
+ \value MeroiticScript Since Qt 5.1
\value ModiScript Since Qt 5.5
\value MongolianScript
\value MroScript Since Qt 5.5
\value MultaniScript Since Qt 5.7
\value MyanmarScript
\value NabataeanScript Since Qt 5.5
- \value NkoScript
\value NewaScript Since Qt 5.7
- \value NewTaiLueScript
- \value OghamScript
- \value OlChikiScript
- \value OldItalicScript
+ \value NewTaiLueScript Since Qt 5.1
+ \value NkoScript Since Qt 5.1
+ \value OghamScript Since Qt 5.1
+ \value OlChikiScript Since Qt 5.1
\value OldHungarianScript Since Qt 5.7
+ \value OldItalicScript Since Qt 5.1
\value OldNorthArabianScript Since Qt 5.5
\value OldPermicScript Since Qt 5.5
- \value OldPersianScript
- \value OldSouthArabianScript
+ \value OldPersianScript Since Qt 5.1
+ \value OldSouthArabianScript Since Qt 5.1
\value OriyaScript
- \value OrkhonScript
+ \value OrkhonScript Since Qt 5.1
\value OsageScript Since Qt 5.7
- \value OsmanyaScript
+ \value OsmanyaScript Since Qt 5.1
\value PahawhHmongScript Since Qt 5.5
\value PalmyreneScript Since Qt 5.5
\value PauCinHauScript Since Qt 5.5
- \value PhagsPaScript
- \value PhoenicianScript
- \value PollardPhoneticScript
+ \value PhagsPaScript Since Qt 5.1
+ \value PhoenicianScript Since Qt 5.1
+ \value PollardPhoneticScript Since Qt 5.1
\value PsalterPahlaviScript Since Qt 5.5
- \value RejangScript
- \value RunicScript
- \value SamaritanScript
- \value SaurashtraScript
- \value SharadaScript
- \value ShavianScript
+ \value RejangScript Since Qt 5.1
+ \value RunicScript Since Qt 5.1
+ \value SamaritanScript Since Qt 5.1
+ \value SaurashtraScript Since Qt 5.1
+ \value SharadaScript Since Qt 5.1
+ \value ShavianScript Since Qt 5.1
\value SiddhamScript Since Qt 5.5
\value SignWritingScript Since Qt 5.7
- \value SimplifiedHanScript same as SimplifiedChineseScript
\value SimplifiedChineseScript same as SimplifiedHanScript
+ \value SimplifiedHanScript same as SimplifiedChineseScript
\value SinhalaScript
- \value SoraSompengScript
- \value CuneiformScript
- \value SundaneseScript
- \value SylotiNagriScript
+ \value SoraSompengScript Since Qt 5.1
+ \value SundaneseScript Since Qt 5.1
+ \value SylotiNagriScript Since Qt 5.1
\value SyriacScript
- \value TagalogScript
- \value TagbanwaScript
- \value TaiLeScript
- \value TaiVietScript
- \value TakriScript
+ \value TagalogScript Since Qt 5.1
+ \value TagbanwaScript Since Qt 5.1
+ \value TaiLeScript Since Qt 5.1
+ \value TaiVietScript Since Qt 5.1
+ \value TakriScript Since Qt 5.1
\value TamilScript
\value TangutScript Since Qt 5.7
\value TeluguScript
@@ -912,12 +916,13 @@
\value TibetanScript
\value TifinaghScript
\value TirhutaScript Since Qt 5.5
- \value TraditionalHanScript same as TraditionalChineseScript
\value TraditionalChineseScript same as TraditionalHanScript
- \value UgariticScript
+ \value TraditionalHanScript same as TraditionalChineseScript
+ \value UgariticScript Since Qt 5.1
\value VaiScript
\value VarangKshitiScript Since Qt 5.5
\value YiScript
+
\omitvalue LastScript
\sa script(), scriptToString(), languageToString()
diff --git a/src/corelib/tools/qlocale_data_p.h b/src/corelib/tools/qlocale_data_p.h
index aeeec2b085..fcff04011f 100644
--- a/src/corelib/tools/qlocale_data_p.h
+++ b/src/corelib/tools/qlocale_data_p.h
@@ -77,7 +77,7 @@ static const int ImperialMeasurementSystemsCount =
// GENERATED PART STARTS HERE
/*
- This part of the file was generated on 2018-08-13 from the
+ This part of the file was generated on 2018-08-15 from the
Common Locale Data Repository v33.1
http://www.unicode.org/cldr/
@@ -122,6 +122,7 @@ static const QLocaleId likely_subtags[] = {
{ 195, 0, 0 }, { 195, 7, 239 }, // bem -> bem_Latn_ZM
{ 186, 0, 0 }, { 186, 7, 210 }, // bez -> bez_Latn_TZ
{ 20, 0, 0 }, { 20, 2, 33 }, // bg -> bg_Cyrl_BG
+ { 364, 0, 0 }, { 364, 1, 163 }, // bgn -> bgn_Arab_PK
{ 343, 0, 0 }, { 343, 13, 100 }, // bho -> bho_Deva_IN
{ 18, 0, 0 }, { 18, 7, 229 }, // bi -> bi_Latn_VU
{ 270, 0, 0 }, { 270, 7, 170 }, // bku -> bku_Latn_PH
@@ -224,10 +225,12 @@ static const QLocaleId likely_subtags[] = {
{ 168, 0, 0 }, { 168, 34, 44 }, // ii -> ii_Yiii_CN
{ 56, 0, 0 }, { 56, 7, 225 }, // ik -> ik_Latn_US
{ 281, 0, 0 }, { 281, 2, 178 }, // inh -> inh_Cyrl_RU
+ { 360, 0, 0 }, { 360, 7, 260 }, // io -> io_Latn_001
{ 51, 0, 0 }, { 51, 7, 99 }, // is -> is_Latn_IS
{ 58, 0, 0 }, { 58, 7, 106 }, // it -> it_Latn_IT
{ 55, 0, 0 }, { 55, 44, 38 }, // iu -> iu_Cans_CA
{ 59, 0, 0 }, { 59, 19, 108 }, // ja -> ja_Jpan_JP
+ { 361, 0, 0 }, { 361, 7, 260 }, // jbo -> jbo_Latn_001
{ 257, 0, 0 }, { 257, 7, 37 }, // jgo -> jgo_Latn_CM
{ 200, 0, 0 }, { 200, 7, 210 }, // jmc -> jmc_Latn_TZ
{ 60, 0, 0 }, { 60, 7, 101 }, // jv -> jv_Latn_ID
@@ -385,10 +388,12 @@ static const QLocaleId likely_subtags[] = {
{ 305, 0, 0 }, { 305, 90, 100 }, // saz -> saz_Saur_IN
{ 249, 0, 0 }, { 249, 7, 210 }, // sbp -> sbp_Latn_TZ
{ 115, 0, 0 }, { 115, 7, 106 }, // sc -> sc_Latn_IT
+ { 362, 0, 0 }, { 362, 7, 106 }, // scn -> scn_Latn_IT
{ 105, 0, 0 }, { 105, 1, 163 }, // sd -> sd_Arab_PK
{ 105, 13, 0 }, { 105, 13, 100 }, // sd_Deva -> sd_Deva_IN
{ 105, 111, 0 }, { 105, 111, 100 }, // sd_Khoj -> sd_Khoj_IN
{ 105, 125, 0 }, { 105, 125, 100 }, // sd_Sind -> sd_Sind_IN
+ { 363, 0, 0 }, { 363, 1, 102 }, // sdh -> sdh_Arab_IR
{ 173, 0, 0 }, { 173, 7, 161 }, // se -> se_Latn_NO
{ 180, 0, 0 }, { 180, 7, 146 }, // seh -> seh_Latn_MZ
{ 213, 0, 0 }, { 213, 7, 132 }, // ses -> ses_Latn_ML
@@ -1252,6 +1257,11 @@ static const quint16 locale_index[] = {
564, // Cantonese
0, // Osage
0, // Tangut
+ 566, // Ido
+ 567, // Lojban
+ 568, // Sicilian
+ 569, // Southern Kurdish
+ 570, // Western Balochi
0 // trailing 0
};
@@ -1823,6 +1833,11 @@ static const QLocaleData locale_data[] = {
{ 349, 1, 103, 1643, 1644, 1563, 1642, 1776, 45, 43, 101, 8220, 8221, 8216, 8217, 0,6 , 0,6 , 0,6 , 0,6 , 53,10 , 63,17 , 18,7 , 25,12 , 38181,77 , 38181,77 , 158,27 , 38181,77 , 38181,77 , 158,27 , 0,28 , 0,28 , 85,14 , 0,28 , 0,28 , 85,14 , 0,2 , 0,2 , 45,4 , 5,17 , 22,23 , {73,81,68}, 44,5 , 0,7 , 8,5 , 4,0 , 5731,11 , 0,0 , 0, 0, 6, 5, 6 }, // Northern Luri/Arabic/Iraq
{ 357, 6, 97, 46, 44, 59, 37, 48, 45, 43, 101, 12300, 12301, 12302, 12303, 170,5 , 170,5 , 951,5 , 951,5 , 412,8 , 441,14 , 198,6 , 215,13 , 4671,39 , 4671,39 , 158,27 , 4671,39 , 4671,39 , 158,27 , 2023,28 , 2023,28 , 2051,14 , 2023,28 , 2023,28 , 2051,14 , 60,2 , 57,2 , 45,4 , 5,17 , 22,23 , {72,75,68}, 130,3 , 17057,11 , 4,4 , 4,0 , 5742,2 , 5744,14 , 2, 1, 7, 6, 7 }, // Cantonese/Traditional Han/Hong Kong
{ 357, 5, 44, 46, 44, 59, 37, 48, 45, 43, 101, 8220, 8221, 8216, 8217, 170,5 , 170,5 , 951,5 , 951,5 , 412,8 , 420,13 , 198,6 , 204,11 , 4671,39 , 4710,38 , 158,27 , 4671,39 , 4710,38 , 158,27 , 2002,21 , 2023,28 , 2051,14 , 2002,21 , 2023,28 , 2051,14 , 60,2 , 57,2 , 45,4 , 5,17 , 22,23 , {67,78,89}, 129,1 , 3122,13 , 4,4 , 4,0 , 5758,2 , 5760,7 , 2, 1, 7, 6, 7 }, // Cantonese/Simplified Han/China
+ { 360, 7, 260, 46, 44, 59, 37, 48, 45, 43, 101, 8220, 8221, 8216, 8217, 0,6 , 0,6 , 0,6 , 0,6 , 53,10 , 63,17 , 37,5 , 8,10 , 368,48 , 368,48 , 158,27 , 368,48 , 368,48 , 158,27 , 0,28 , 0,28 , 85,14 , 0,28 , 0,28 , 85,14 , 0,2 , 0,2 , 45,4 , 5,17 , 22,23 , {0,0,0}, 0,0 , 2586,0 , 8,5 , 4,0 , 0,0 , 0,0 , 2, 1, 1, 6, 7 }, // Ido/Latin/World
+ { 361, 7, 260, 46, 44, 59, 37, 48, 45, 43, 101, 8220, 8221, 8216, 8217, 0,6 , 0,6 , 0,6 , 0,6 , 53,10 , 63,17 , 37,5 , 8,10 , 368,48 , 368,48 , 158,27 , 368,48 , 368,48 , 158,27 , 0,28 , 0,28 , 85,14 , 0,28 , 0,28 , 85,14 , 0,2 , 0,2 , 45,4 , 5,17 , 22,23 , {0,0,0}, 0,0 , 2586,0 , 8,5 , 4,0 , 0,0 , 0,0 , 2, 1, 1, 6, 7 }, // Lojban/Latin/World
+ { 362, 7, 106, 46, 44, 59, 37, 48, 45, 43, 101, 8220, 8221, 8216, 8217, 0,6 , 0,6 , 0,6 , 0,6 , 53,10 , 63,17 , 37,5 , 8,10 , 368,48 , 368,48 , 158,27 , 368,48 , 368,48 , 158,27 , 0,28 , 0,28 , 85,14 , 0,28 , 0,28 , 85,14 , 0,2 , 0,2 , 45,4 , 5,17 , 22,23 , {69,85,82}, 14,1 , 0,7 , 8,5 , 4,0 , 0,0 , 0,0 , 2, 1, 1, 6, 7 }, // Sicilian/Latin/Italy
+ { 363, 1, 102, 46, 44, 59, 37, 48, 45, 43, 101, 8220, 8221, 8216, 8217, 0,6 , 0,6 , 0,6 , 0,6 , 53,10 , 63,17 , 37,5 , 8,10 , 368,48 , 368,48 , 158,27 , 368,48 , 368,48 , 158,27 , 0,28 , 0,28 , 85,14 , 0,28 , 0,28 , 85,14 , 0,2 , 0,2 , 45,4 , 5,17 , 22,23 , {73,82,82}, 0,0 , 0,7 , 8,5 , 4,0 , 0,0 , 0,0 , 0, 0, 6, 5, 5 }, // Southern Kurdish/Arabic/Iran
+ { 364, 1, 163, 46, 44, 59, 37, 48, 45, 43, 101, 8220, 8221, 8216, 8217, 0,6 , 0,6 , 0,6 , 0,6 , 53,10 , 63,17 , 37,5 , 8,10 , 368,48 , 368,48 , 158,27 , 368,48 , 368,48 , 158,27 , 0,28 , 0,28 , 85,14 , 0,28 , 0,28 , 85,14 , 0,2 , 0,2 , 45,4 , 5,17 , 22,23 , {80,75,82}, 172,2 , 0,7 , 8,5 , 4,0 , 0,0 , 0,0 , 0, 0, 7, 6, 7 }, // Western Balochi/Arabic/Pakistan
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, {0,0,0}, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0, 0, 0, 0, 0 } // trailing 0s
};
@@ -6667,6 +6682,11 @@ static const char language_name_list[] =
"Cantonese\0"
"Osage\0"
"Tangut\0"
+"Ido\0"
+"Lojban\0"
+"Sicilian\0"
+"Southern Kurdish\0"
+"Western Balochi\0"
;
static const quint16 language_name_index[] = {
@@ -7030,6 +7050,11 @@ static const quint16 language_name_index[] = {
3050, // Cantonese
3060, // Osage
3066, // Tangut
+ 3073, // Ido
+ 3077, // Lojban
+ 3084, // Sicilian
+ 3093, // Southern Kurdish
+ 3110, // Western Balochi
};
static const char script_name_list[] =
@@ -8213,6 +8238,11 @@ static const unsigned char language_code_list[] =
"yue" // Cantonese
"osa" // Osage
"txg" // Tangut
+"io\0" // Ido
+"jbo" // Lojban
+"scn" // Sicilian
+"sdh" // Southern Kurdish
+"bgn" // Western Balochi
;
static const unsigned char script_code_list[] =
diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h
index f2e11499c8..f7dbb3a815 100644
--- a/src/corelib/tools/qlocale_p.h
+++ b/src/corelib/tools/qlocale_p.h
@@ -66,6 +66,7 @@
QT_BEGIN_NAMESPACE
#ifndef QT_NO_SYSTEMLOCALE
+struct QLocaleData;
class Q_CORE_EXPORT QSystemLocale
{
public:
@@ -126,6 +127,7 @@ public:
virtual QVariant query(QueryType type, QVariant in) const;
virtual QLocale fallbackUiLocale() const;
+ inline const QLocaleData *fallbackUiLocaleData() const;
private:
QSystemLocale(bool);
friend class QSystemLocaleSingleton;
@@ -364,8 +366,6 @@ public:
QLocale::MeasurementSystem measurementSystem() const;
- static void updateSystemPrivate();
-
QString dateTimeToString(QStringView format, const QDateTime &datetime,
const QDate &dateOnly, const QTime &timeOnly,
const QLocale *q) const;
@@ -375,6 +375,10 @@ public:
QLocale::NumberOptions m_numberOptions;
};
+#ifndef QT_NO_SYSTEMLOCALE
+const QLocaleData *QSystemLocale::fallbackUiLocaleData() const { return fallbackUiLocale().d->m_data; }
+#endif
+
template <>
inline QLocalePrivate *QSharedDataPointer<QLocalePrivate>::clone()
{
diff --git a/src/corelib/tools/qmakearray_p.h b/src/corelib/tools/qmakearray_p.h
index ae4d7f07c6..71441c2c27 100644
--- a/src/corelib/tools/qmakearray_p.h
+++ b/src/corelib/tools/qmakearray_p.h
@@ -111,10 +111,10 @@ struct QuickSortFilter<Predicate, QuickSortData<Head, Tail...>>
using TailFilteredData = typename QuickSortFilter<
Predicate, QuickSortData<Tail...>>::Type;
- using Type = typename QConditional<
+ using Type = typename std::conditional<
Predicate<Head>::value,
decltype(quickSortConcat(QuickSortData<Head> {}, TailFilteredData{})),
- TailFilteredData>::Type;
+ TailFilteredData>::type;
};
template <template <typename> class Predicate>
diff --git a/src/corelib/tools/qoffsetstringarray_p.h b/src/corelib/tools/qoffsetstringarray_p.h
new file mode 100644
index 0000000000..076316396b
--- /dev/null
+++ b/src/corelib/tools/qoffsetstringarray_p.h
@@ -0,0 +1,197 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtCore 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 QOFFSETSTRINGARRAY_P_H
+#define QOFFSETSTRINGARRAY_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/qglobal_p.h"
+
+#include <tuple>
+#include <array>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtPrivate {
+template<int N, int O, int I, int ... Idx>
+struct OffsetSequenceHelper : OffsetSequenceHelper<N - 1, O + I, Idx..., O> { };
+
+template<int Last, int I, int S, int ... Idx>
+struct OffsetSequenceHelper<1, Last, I, S, Idx...> : IndexesList<Last + I, Idx..., Last>
+{
+ static const constexpr auto Length = Last + I;
+ using Type = typename std::conditional<
+ Last <= std::numeric_limits<quint8>::max(),
+ quint8,
+ typename std::conditional<
+ Last <= std::numeric_limits<quint16>::max(),
+ quint16,
+ int>::type
+ >::type;
+};
+
+template<int ... Idx>
+struct OffsetSequence : OffsetSequenceHelper<sizeof ... (Idx), 0, Idx..., 0> { };
+
+template<int N>
+struct StaticString
+{
+ const char data[N];
+
+ constexpr StaticString(const StaticString<N> &other) noexcept = default;
+};
+
+
+template<>
+struct StaticString<0>
+{
+ static constexpr int size() noexcept
+ {
+ return 0;
+ }
+};
+
+template<typename, typename>
+struct StaticStringBuilder;
+
+template<int ... I1, int ... I2>
+struct StaticStringBuilder<IndexesList<I1...>, IndexesList<I2...>>
+{
+
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_MSVC(4100) // The formal parameter is not referenced in the body of the function.
+ // The unreferenced parameter is ignored.
+ // It happens when 'rs' is StaticString<0>
+ template<int N1, int N2>
+ static constexpr StaticString<N1 + N2> concatenate(
+ const char (&ls)[N1], const StaticString<N2> &rs) noexcept
+ {
+ return StaticString<N1 + N2>{ls[I1]..., rs.data[I2]...};
+ }
+QT_WARNING_POP
+};
+
+template<int Sum>
+constexpr StaticString<0> staticString() noexcept
+{
+ return StaticString<0>{};
+}
+
+template<int Sum, int I, int ... Ix>
+constexpr StaticString<Sum> staticString(const char (&s)[I], const char (&...sx)[Ix]) noexcept
+{
+ return StaticStringBuilder<
+ makeIndexSequence<I>,
+ makeIndexSequence<Sum - I>>::concatenate(s, staticString<Sum - I>(sx...));
+}
+} // namespace QtPrivate
+
+template<typename T, int SizeString, int SizeOffsets>
+class QOffsetStringArray
+{
+public:
+ using Type = T;
+
+ template<int ... Ox>
+ constexpr QOffsetStringArray(const QtPrivate::StaticString<SizeString> &str,
+ QtPrivate::IndexesList<SizeString, Ox...>) noexcept
+ : m_string(str),
+ m_offsets{Ox...}
+ { }
+
+ constexpr inline const char *operator[](const int index) const noexcept
+ {
+ return m_string.data + m_offsets[qBound(int(0), index, SizeOffsets - 1)];
+ }
+
+ constexpr inline const char *at(const int index) const noexcept
+ {
+ return m_string.data + m_offsets[index];
+ }
+
+ constexpr inline const char *str() const { return m_string.data; }
+ constexpr inline const T *offsets() const { return m_offsets; }
+ constexpr inline int count() const { return SizeOffsets; };
+
+ static constexpr const auto sizeString = SizeString;
+ static constexpr const auto sizeOffsets = SizeOffsets;
+
+private:
+ QtPrivate::StaticString<SizeString> m_string;
+ const T m_offsets[SizeOffsets];
+};
+
+template<typename T, int N, int ... Ox>
+constexpr QOffsetStringArray<T, N, sizeof ... (Ox)> qOffsetStringArray(
+ const QtPrivate::StaticString<N> &string,
+ QtPrivate::IndexesList<N, Ox...> offsets) noexcept
+{
+ return QOffsetStringArray<T, N, sizeof ... (Ox)>(
+ string,
+ offsets);
+}
+
+template<int ... Nx>
+struct QOffsetStringArrayRet
+{
+ using Offsets = QtPrivate::OffsetSequence<Nx...>;
+ using Type = QOffsetStringArray<typename Offsets::Type, Offsets::Length, sizeof ... (Nx)>;
+};
+
+template<int ... Nx>
+constexpr auto qOffsetStringArray(const char (&...strings)[Nx]) noexcept -> typename QOffsetStringArrayRet<Nx...>::Type
+{
+ using Offsets = QtPrivate::OffsetSequence<Nx...>;
+ return qOffsetStringArray<typename Offsets::Type>(
+ QtPrivate::staticString<Offsets::Length>(strings...), Offsets{});
+}
+
+QT_END_NAMESPACE
+
+#endif // QOFFSETSTRINGARRAY_P_H
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 6be3dcdbe1..da76601e88 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -899,10 +899,8 @@ private:
template <typename T> static
T toIntegral_helper(const QChar *data, int len, bool *ok, int base)
{
- // ### Qt6: use std::conditional<std::is_unsigned<T>::value, qulonglong, qlonglong>::type
- const bool isUnsigned = T(0) < T(-1);
- typedef typename QtPrivate::QConditional<isUnsigned, qulonglong, qlonglong>::Type Int64;
- typedef typename QtPrivate::QConditional<isUnsigned, uint, int>::Type Int32;
+ using Int64 = typename std::conditional<std::is_unsigned<T>::value, qulonglong, qlonglong>::type;
+ using Int32 = typename std::conditional<std::is_unsigned<T>::value, uint, int>::type;
// we select the right overload by casting size() to int or uint
Int64 val = toIntegral_helper(data, Int32(len), ok, base);
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index dc28e0e0a2..995bab694e 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -39,6 +39,7 @@ HEADERS += \
tools/qmargins.h \
tools/qmessageauthenticationcode.h \
tools/qcontiguouscache.h \
+ tools/qoffsetstringarray_p.h \
tools/qpair.h \
tools/qpoint.h \
tools/qqueue.h \
diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp
index 8ec88ebc60..aa640f4d7e 100644
--- a/src/gui/itemmodels/qstandarditemmodel.cpp
+++ b/src/gui/itemmodels/qstandarditemmodel.cpp
@@ -3010,11 +3010,17 @@ bool QStandardItemModel::setData(const QModelIndex &index, const QVariant &value
return true;
}
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+/*!
+ \reimp
+ */
+#else
/*!
\since 5.12
Removes the data stored in all the roles for the given \a index.
\sa setData(), data()
*/
+#endif
bool QStandardItemModel::clearItemData(const QModelIndex &index)
{
if (!checkIndex(index, CheckIndexOption::IndexIsValid))
diff --git a/src/network/access/qnetworkcookiejar.cpp b/src/network/access/qnetworkcookiejar.cpp
index 072a7f249d..af5b126953 100644
--- a/src/network/access/qnetworkcookiejar.cpp
+++ b/src/network/access/qnetworkcookiejar.cpp
@@ -45,6 +45,14 @@
#include "QtCore/qdatetime.h"
#if QT_CONFIG(topleveldomain)
#include "private/qtldurl_p.h"
+#else
+QT_BEGIN_NAMESPACE
+static bool qIsEffectiveTLD(QString domain)
+{
+ // provide minimal checking by not accepting cookies on real TLDs
+ return !domain.contains(QLatin1Char('.'));
+}
+QT_END_NAMESPACE
#endif
QT_BEGIN_NAMESPACE
@@ -356,19 +364,12 @@ bool QNetworkCookieJar::validateCookie(const QNetworkCookie &cookie, const QUrl
// https://tools.ietf.org/html/rfc6265#section-5.3 step 5
if (host == domain)
return true;
-#if QT_CONFIG(topleveldomain)
// the check for effective TLDs makes the "embedded dot" rule from RFC 2109 section 4.3.2
// redundant; the "leading dot" rule has been relaxed anyway, see QNetworkCookie::normalize()
// we remove the leading dot for this check if it's present
- if (qIsEffectiveTLD(domain))
- return false; // not accepted
-#else
- // provide minimal checking by not accepting cookies on real TLDs
- if (!domain.contains(QLatin1Char('.')))
- return false;
-#endif
-
- return true;
+ // Normally defined in qtldurl_p.h, but uses fall-back in this file when topleveldomain isn't
+ // configured:
+ return !qIsEffectiveTLD(domain);
}
QT_END_NAMESPACE
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp
index 34db5b4b31..47ce9ab0c6 100644
--- a/src/network/kernel/qauthenticator.cpp
+++ b/src/network/kernel/qauthenticator.cpp
@@ -465,27 +465,12 @@ QByteArray QAuthenticatorPrivate::calculateResponse(const QByteArray &requestMet
methodString = "";
phase = Done;
break;
- case QAuthenticatorPrivate::Plain:
- response = '\0' + user.toUtf8() + '\0' + password.toUtf8();
- phase = Done;
- break;
case QAuthenticatorPrivate::Basic:
methodString = "Basic ";
response = user.toLatin1() + ':' + password.toLatin1();
response = response.toBase64();
phase = Done;
break;
- case QAuthenticatorPrivate::Login:
- if (challenge.contains("VXNlciBOYW1lAA==")) {
- response = user.toUtf8().toBase64();
- phase = Phase2;
- } else if (challenge.contains("UGFzc3dvcmQA")) {
- response = password.toUtf8().toBase64();
- phase = Done;
- }
- break;
- case QAuthenticatorPrivate::CramMd5:
- break;
case QAuthenticatorPrivate::DigestMd5:
methodString = "Digest ";
response = digestMd5Response(challenge, requestMethod, path);
diff --git a/src/network/kernel/qauthenticator_p.h b/src/network/kernel/qauthenticator_p.h
index 8a1ee0ebe6..265cb7afe2 100644
--- a/src/network/kernel/qauthenticator_p.h
+++ b/src/network/kernel/qauthenticator_p.h
@@ -68,7 +68,7 @@ class QNtlmWindowsHandles;
class Q_AUTOTEST_EXPORT QAuthenticatorPrivate
{
public:
- enum Method { None, Basic, Plain, Login, Ntlm, CramMd5, DigestMd5 };
+ enum Method { None, Basic, Ntlm, DigestMd5 };
QAuthenticatorPrivate();
~QAuthenticatorPrivate();
diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp
index a33f76838f..98d6ddf882 100644
--- a/src/sql/models/qsqltablemodel.cpp
+++ b/src/sql/models/qsqltablemodel.cpp
@@ -607,6 +607,16 @@ bool QSqlTableModel::setData(const QModelIndex &index, const QVariant &value, in
return true;
}
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+/*!
+ \reimp
+ */
+bool QStringListModel::clearItemData(const QModelIndex &index)
+{
+ return setData(index, QVariant(), Qt::EditRole);
+}
+#endif
+
/*!
This function simply calls QSqlQueryModel::setQuery(\a query).
You should normally not call it on a QSqlTableModel. Instead, use
diff --git a/src/sql/models/qsqltablemodel.h b/src/sql/models/qsqltablemodel.h
index 7acc7dc94d..eba27e60ec 100644
--- a/src/sql/models/qsqltablemodel.h
+++ b/src/sql/models/qsqltablemodel.h
@@ -74,6 +74,9 @@ public:
QSqlRecord record(int row) const;
QVariant data(const QModelIndex &idx, int role = Qt::DisplayRole) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ bool clearItemData(const QModelIndex &index) override;
+#endif
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 3396a91dc5..2f276a7a8c 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -3877,9 +3877,9 @@ void QHeaderViewPrivate::updateDefaultSectionSizeFromStyle()
void QHeaderViewPrivate::recalcSectionStartPos() const // linear (but fast)
{
int pixelpos = 0;
- for (QVector<SectionItem>::const_iterator i = sectionItems.constBegin(); i != sectionItems.constEnd(); ++i) {
- i->calculated_startpos = pixelpos; // write into const mutable
- pixelpos += i->size;
+ for (const SectionItem &i : sectionItems) {
+ i.calculated_startpos = pixelpos; // write into const mutable
+ pixelpos += i.size;
}
sectionStartposRecalc = false;
}
diff --git a/src/widgets/itemviews/qitemdelegate.cpp b/src/widgets/itemviews/qitemdelegate.cpp
index dff4cc4593..9c65d5fddd 100644
--- a/src/widgets/itemviews/qitemdelegate.cpp
+++ b/src/widgets/itemviews/qitemdelegate.cpp
@@ -1089,7 +1089,7 @@ QRect QItemDelegate::doCheck(const QStyleOptionViewItem &option,
opt.rect = bounding;
const QWidget *widget = d->widget(option); // cast
QStyle *style = widget ? widget->style() : QApplication::style();
- return style->subElementRect(QStyle::SE_ViewItemCheckIndicator, &opt, widget);
+ return style->subElementRect(QStyle::SE_ItemViewItemCheckIndicator, &opt, widget);
}
return QRect();
}
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index e5769940d4..fdac332367 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -2246,8 +2246,8 @@ int QListModeViewBase::verticalScrollToValue(int index, QListView::ScrollHint hi
} else {
int scrollBarValue = verticalScrollBar()->value();
int numHidden = 0;
- for (int i = 0; i < flowPositions.count() - 1 && i <= scrollBarValue; ++i)
- if (isHidden(i))
+ for (const auto &idx : qAsConst(dd->hiddenRows))
+ if (idx.row() <= scrollBarValue)
++numHidden;
value = qBound(0, scrollValueMap.at(verticalScrollBar()->value()) - numHidden, flowPositions.count() - 1);
}
@@ -2687,21 +2687,24 @@ int QListModeViewBase::perItemScrollToValue(int index, int scrollValue, int view
return scrollValue;
itemExtent += spacing();
- QVector<int> visibleFlowPositions;
- visibleFlowPositions.reserve(flowPositions.count() - 1);
- for (int i = 0; i < flowPositions.count() - 1; i++) { // flowPositions count is +1 larger than actual row count
- if (!isHidden(i))
- visibleFlowPositions.append(flowPositions.at(i));
- }
-
+ QVector<int> hiddenRows = dd->hiddenRowIds();
+ std::sort(hiddenRows.begin(), hiddenRows.end());
+ int hiddenRowsBefore = 0;
+ for (int i = 0; i < hiddenRows.size() - 1; ++i)
+ if (hiddenRows.at(i) > index + hiddenRowsBefore)
+ break;
+ else
+ ++hiddenRowsBefore;
if (!wrap) {
int topIndex = index;
const int bottomIndex = topIndex;
- const int bottomCoordinate = visibleFlowPositions.at(index);
-
+ const int bottomCoordinate = flowPositions.at(index + hiddenRowsBefore);
while (topIndex > 0 &&
- (bottomCoordinate - visibleFlowPositions.at(topIndex - 1) + itemExtent) <= (viewportSize)) {
+ (bottomCoordinate - flowPositions.at(topIndex + hiddenRowsBefore - 1) + itemExtent) <= (viewportSize)) {
topIndex--;
+ // will the next one be a hidden row -> skip
+ while (hiddenRowsBefore > 0 && hiddenRows.at(hiddenRowsBefore - 1) >= topIndex + hiddenRowsBefore - 1)
+ hiddenRowsBefore--;
}
const int itemCount = bottomIndex - topIndex + 1;
@@ -2720,7 +2723,7 @@ int QListModeViewBase::perItemScrollToValue(int index, int scrollValue, int view
? Qt::Horizontal : Qt::Vertical);
if (flowOrientation == orientation) { // scrolling in the "flow" direction
// ### wrapped scrolling in the flow direction
- return visibleFlowPositions.at(index); // ### always pixel based for now
+ return flowPositions.at(index + hiddenRowsBefore); // ### always pixel based for now
} else if (!segmentStartRows.isEmpty()) { // we are scrolling in the "segment" direction
int segment = qBinarySearch<int>(segmentStartRows, index, 0, segmentStartRows.count() - 1);
int leftSegment = segment;
@@ -3354,9 +3357,9 @@ int QListView::visualIndex(const QModelIndex &index) const
d->executePostedLayout();
QListViewItem itm = d->indexToListViewItem(index);
int visualIndex = d->commonListView->itemIndex(itm);
- for (int row = 0; row <= index.row() && visualIndex >= 0; row++) {
- if (d->isHidden(row))
- visualIndex--;
+ for (const auto &idx : qAsConst(d->hiddenRows)) {
+ if (idx.row() <= index.row())
+ --visualIndex;
}
return visualIndex;
}
diff --git a/src/widgets/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h
index 181386d4d0..3f997ef7e3 100644
--- a/src/widgets/itemviews/qlistview_p.h
+++ b/src/widgets/itemviews/qlistview_p.h
@@ -377,6 +377,14 @@ public:
QModelIndex idx = model->index(row, 0, root);
return isPersistent(idx) && hiddenRows.contains(idx);
}
+ // helper to avoid checking for isPersistent and creating persistent indexes as above in isHidden
+ QVector<int> hiddenRowIds() const {
+ QVector<int> rowIds;
+ rowIds.reserve(hiddenRows.size());
+ for (const auto &idx : hiddenRows)
+ rowIds += idx.row();
+ return rowIds;
+ }
inline bool isHiddenOrDisabled(int row) const { return isHidden(row) || !isIndexEnabled(modelIndex(row)); }
void removeCurrentAndDisabled(QVector<QModelIndex> *indexes, const QModelIndex &current) const;
diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp
index 72e0a67a64..895622616e 100644
--- a/src/widgets/itemviews/qlistwidget.cpp
+++ b/src/widgets/itemviews/qlistwidget.cpp
@@ -227,6 +227,22 @@ bool QListModel::setData(const QModelIndex &index, const QVariant &value, int ro
return true;
}
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+bool QListModel::clearItemData(const QModelIndex &index)
+{
+ if (!checkIndex(index, CheckIndexOption::IndexIsValid))
+ return false;
+ QListWidgetItem *item = items.at(index.row());
+ const auto beginIter = item->d->values.cbegin();
+ const auto endIter = item->d->values.cend();
+ if (std::all_of(beginIter, endIter, [](const QWidgetItemData& data) -> bool { return !data.value.isValid(); }))
+ return true; //it's already cleared
+ item->d->values.clear();
+ emit dataChanged(index, index, QVector<int>{});
+ return true;
+}
+#endif
+
QMap<int, QVariant> QListModel::itemData(const QModelIndex &index) const
{
QMap<int, QVariant> roles;
@@ -277,6 +293,30 @@ bool QListModel::removeRows(int row, int count, const QModelIndex &parent)
return true;
}
+/*!
+ \since 5.13
+ \reimp
+*/
+bool QListModel::moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild)
+{
+ if (sourceRow < 0
+ || sourceRow + count - 1 >= rowCount(sourceParent)
+ || destinationChild <= 0
+ || destinationChild > rowCount(destinationParent)
+ || sourceRow == destinationChild - 1
+ || count <= 0) {
+ return false;
+ }
+ if (!beginMoveRows(QModelIndex(), sourceRow, sourceRow + count - 1, QModelIndex(), destinationChild))
+ return false;
+ destinationChild--;
+ const int fromRow = destinationChild < sourceRow ? (sourceRow + count - 1) : sourceRow;
+ while (count--)
+ items.move(fromRow, destinationChild);
+ endMoveRows();
+ return true;
+}
+
Qt::ItemFlags QListModel::flags(const QModelIndex &index) const
{
if (!index.isValid() || index.row() >= items.count() || index.model() != this)
@@ -289,7 +329,7 @@ void QListModel::sort(int column, Qt::SortOrder order)
if (column != 0)
return;
- emit layoutAboutToBeChanged();
+ emit layoutAboutToBeChanged({}, QAbstractItemModel::VerticalSortHint);
QVector < QPair<QListWidgetItem*,int> > sorting(items.count());
for (int i = 0; i < items.count(); ++i) {
@@ -313,7 +353,7 @@ void QListModel::sort(int column, Qt::SortOrder order)
}
changePersistentIndexList(fromIndexes, toIndexes);
- emit layoutChanged();
+ emit layoutChanged({}, QAbstractItemModel::VerticalSortHint);
}
/**
diff --git a/src/widgets/itemviews/qlistwidget_p.h b/src/widgets/itemviews/qlistwidget_p.h
index 9cb3d5966b..65a7124322 100644
--- a/src/widgets/itemviews/qlistwidget_p.h
+++ b/src/widgets/itemviews/qlistwidget_p.h
@@ -100,11 +100,15 @@ public:
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ bool clearItemData(const QModelIndex &index) override;
+#endif
QMap<int, QVariant> itemData(const QModelIndex &index) const override;
bool insertRows(int row, int count = 1, const QModelIndex &parent = QModelIndex()) override;
bool removeRows(int row, int count = 1, const QModelIndex &parent = QModelIndex()) override;
+ bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) override;
Qt::ItemFlags flags(const QModelIndex &index) const override;
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index 9725a768de..e7edd08d2a 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -1383,12 +1383,12 @@ void QTableView::paintEvent(QPaintEvent *event)
//firstVisualRow is the visual index of the first visible row. lastVisualRow is the visual index of the last visible Row.
//same goes for ...VisualColumn
int firstVisualRow = qMax(verticalHeader->visualIndexAt(0),0);
- int lastVisualRow = verticalHeader->visualIndexAt(verticalHeader->viewport()->height());
+ int lastVisualRow = verticalHeader->visualIndexAt(verticalHeader->height());
if (lastVisualRow == -1)
lastVisualRow = d->model->rowCount(d->root) - 1;
int firstVisualColumn = horizontalHeader->visualIndexAt(0);
- int lastVisualColumn = horizontalHeader->visualIndexAt(horizontalHeader->viewport()->width());
+ int lastVisualColumn = horizontalHeader->visualIndexAt(horizontalHeader->width());
if (rightToLeft)
qSwap(firstVisualColumn, lastVisualColumn);
if (firstVisualColumn == -1)
diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp
index 11925af7a0..169cc5a17c 100644
--- a/src/widgets/itemviews/qtablewidget.cpp
+++ b/src/widgets/itemviews/qtablewidget.cpp
@@ -189,7 +189,7 @@ void QTableModel::setItem(int row, int column, QTableWidgetItem *item)
sortedRow = qMax((int)(it - colItems.begin()), 0);
}
if (sortedRow != row) {
- emit layoutAboutToBeChanged();
+ emit layoutAboutToBeChanged({}, QAbstractItemModel::VerticalSortHint);
// move the items @ row to sortedRow
int cc = columnCount();
QVector<QTableWidgetItem*> rowItems(cc);
@@ -209,7 +209,7 @@ void QTableModel::setItem(int row, int column, QTableWidgetItem *item)
changePersistentIndexList(oldPersistentIndexes,
newPersistentIndexes);
- emit layoutChanged();
+ emit layoutChanged({}, QAbstractItemModel::VerticalSortHint);
return;
}
}
@@ -480,6 +480,24 @@ bool QTableModel::setItemData(const QModelIndex &index, const QMap<int, QVariant
return true;
}
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+bool QTableModel::clearItemData(const QModelIndex &index)
+{
+ if (!checkIndex(index, CheckIndexOption::IndexIsValid))
+ return false;
+ QTableWidgetItem *itm = item(index);
+ if (!itm)
+ return false;
+ const auto beginIter = itm->values.cbegin();
+ const auto endIter = itm->values.cend();
+ if (std::all_of(beginIter, endIter, [](const QWidgetItemData& data) -> bool { return !data.value.isValid(); }))
+ return true; //it's already cleared
+ itm->values.clear();
+ emit dataChanged(index, index, QVector<int>{});
+ return true;
+}
+#endif
+
Qt::ItemFlags QTableModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
@@ -530,12 +548,12 @@ void QTableModel::sort(int column, Qt::SortOrder order)
}
}
- emit layoutAboutToBeChanged();
+ emit layoutAboutToBeChanged({}, QAbstractItemModel::VerticalSortHint);
tableItems = sorted_table;
changePersistentIndexList(from, to); // ### slow
- emit layoutChanged();
+ emit layoutChanged({}, QAbstractItemModel::VerticalSortHint);
}
/*
@@ -580,7 +598,7 @@ void QTableModel::ensureSorted(int column, Qt::SortOrder order,
vit = colItems.insert(vit, item);
if (newRow != oldRow) {
if (!changed) {
- emit layoutAboutToBeChanged();
+ emit layoutAboutToBeChanged({}, QAbstractItemModel::VerticalSortHint);
oldPersistentIndexes = persistentIndexList();
newPersistentIndexes = oldPersistentIndexes;
changed = true;
@@ -615,7 +633,7 @@ void QTableModel::ensureSorted(int column, Qt::SortOrder order,
verticalHeaderItems = newVertical;
changePersistentIndexList(oldPersistentIndexes,
newPersistentIndexes);
- emit layoutChanged();
+ emit layoutChanged({}, QAbstractItemModel::VerticalSortHint);
}
}
diff --git a/src/widgets/itemviews/qtablewidget_p.h b/src/widgets/itemviews/qtablewidget_p.h
index 9899272fce..d88326f129 100644
--- a/src/widgets/itemviews/qtablewidget_p.h
+++ b/src/widgets/itemviews/qtablewidget_p.h
@@ -129,6 +129,9 @@ public:
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles) override;
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ bool clearItemData(const QModelIndex &index) override;
+#endif
QMap<int, QVariant> itemData(const QModelIndex &index) const override;
diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp
index a0af27115d..4768869843 100644
--- a/src/widgets/itemviews/qtreewidget.cpp
+++ b/src/widgets/itemviews/qtreewidget.cpp
@@ -390,6 +390,27 @@ bool QTreeModel::setData(const QModelIndex &index, const QVariant &value, int ro
return false;
}
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+bool QTreeModel::clearItemData(const QModelIndex &index)
+{
+ if (!checkIndex(index, CheckIndexOption::IndexIsValid))
+ return false;
+ QTreeWidgetItem *itm = item(index);
+ if (!itm)
+ return false;
+ const auto beginIter = itm->values.at(index.column()).cbegin();
+ const auto endIter = itm->values.at(index.column()).cend();
+ if (std::all_of(beginIter, endIter, [](const QWidgetItemData& data) -> bool { return !data.value.isValid(); })
+ && !itm->d->display.at(index.column()).isValid()) {
+ return true; //it's already cleared
+ }
+ itm->d->display[index.column()] = QVariant();
+ itm->values[index.column()].clear();
+ emit dataChanged(index, index, QVector<int>{});
+ return true;
+}
+#endif
+
QMap<int, QVariant> QTreeModel::itemData(const QModelIndex &index) const
{
QMap<int, QVariant> roles;
@@ -635,7 +656,7 @@ void QTreeModel::ensureSorted(int column, Qt::SortOrder order,
// we are going to change the persistent indexes, so we need to prepare
if (!changed) { // this will only happen once
changed = true;
- emit layoutAboutToBeChanged(); // the selection model needs to know
+ emit layoutAboutToBeChanged({parent}, QAbstractItemModel::VerticalSortHint); // the selection model needs to know
oldPersistentIndexes = persistentIndexList();
newPersistentIndexes = oldPersistentIndexes;
}
@@ -668,7 +689,7 @@ void QTreeModel::ensureSorted(int column, Qt::SortOrder order,
if (changed) {
itm->children = lst;
changePersistentIndexList(oldPersistentIndexes, newPersistentIndexes);
- emit layoutChanged();
+ emit layoutChanged({parent}, QAbstractItemModel::VerticalSortHint);
}
}
@@ -2164,9 +2185,9 @@ void QTreeWidgetItem::sortChildren(int column, Qt::SortOrder order, bool climb)
QTreeModel::SkipSorting skipSorting(model);
int oldSortColumn = view->d_func()->explicitSortColumn;
view->d_func()->explicitSortColumn = column;
- emit model->layoutAboutToBeChanged();
+ emit model->layoutAboutToBeChanged({}, QAbstractItemModel::VerticalSortHint);
d->sortChildren(column, order, climb);
- emit model->layoutChanged();
+ emit model->layoutChanged({}, QAbstractItemModel::VerticalSortHint);
view->d_func()->explicitSortColumn = oldSortColumn;
}
diff --git a/src/widgets/itemviews/qtreewidget_p.h b/src/widgets/itemviews/qtreewidget_p.h
index adc2c2c421..ee4a633468 100644
--- a/src/widgets/itemviews/qtreewidget_p.h
+++ b/src/widgets/itemviews/qtreewidget_p.h
@@ -99,7 +99,9 @@ public:
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
-
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ bool clearItemData(const QModelIndex &index) override;
+#endif
QMap<int, QVariant> itemData(const QModelIndex &index) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 3ee3e856bc..87d233f024 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -3067,7 +3067,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
}
d->cachedOption = new QStyleOptionViewItem(*vopt);
}
- if (sr == SE_ViewItemCheckIndicator)
+ if (sr == SE_ItemViewItemCheckIndicator)
r = d->checkRect;
else if (sr == SE_ItemViewItemDecoration)
r = d->decorationRect;
diff --git a/src/widgets/styles/qstyle.h b/src/widgets/styles/qstyle.h
index 9192dae864..8256f908db 100644
--- a/src/widgets/styles/qstyle.h
+++ b/src/widgets/styles/qstyle.h
@@ -308,8 +308,8 @@ public:
SE_TabWidgetLeftCorner,
SE_TabWidgetRightCorner,
- SE_ViewItemCheckIndicator, // ### Qt 6: remove
- SE_ItemViewItemCheckIndicator = SE_ViewItemCheckIndicator,
+ SE_ItemViewItemCheckIndicator,
+ SE_ViewItemCheckIndicator = SE_ItemViewItemCheckIndicator, // ### Qt 6: remove
SE_TabBarTearIndicator,
SE_TabBarTearIndicatorLeft = SE_TabBarTearIndicator,
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index c2ffcc82b1..5c9d19a49d 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -44,6 +44,7 @@
#include "private/qcssutil_p.h"
#include <qdebug.h>
+#include <qdir.h>
#include <qapplication.h>
#if QT_CONFIG(menu)
#include <qmenu.h>
@@ -952,8 +953,12 @@ QRenderRule::QRenderRule(const QVector<Declaration> &declarations, const QObject
Attachment attachment = Attachment_Scroll;
origin = Origin_Padding;
Origin clip = Origin_Border;
- if (v.extractBackground(&brush, &uri, &repeat, &alignment, &origin, &attachment, &clip))
- bg = new QStyleSheetBackgroundData(brush, QPixmap(uri), repeat, alignment, origin, attachment, clip);
+ if (v.extractBackground(&brush, &uri, &repeat, &alignment, &origin, &attachment, &clip)) {
+ QPixmap pixmap(uri);
+ if (!uri.isEmpty() && pixmap.isNull())
+ qWarning("Could not create pixmap from %s", qPrintable(QDir::toNativeSeparators(uri)));
+ bg = new QStyleSheetBackgroundData(brush, pixmap, repeat, alignment, origin, attachment, clip);
+ }
QBrush sfg, fg;
QBrush sbg, abg;
@@ -5818,7 +5823,7 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c
return ParentStyle::subElementRect(se, opt, w);
#if QT_CONFIG(itemviews)
- case SE_ViewItemCheckIndicator:
+ case SE_ItemViewItemCheckIndicator:
if (!qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
return subElementRect(SE_CheckBoxIndicator, opt, w);
}