From b0f9c06a9b199a7474eb94a6292b5824364344b6 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 26 Jun 2020 08:21:15 +0200 Subject: Use QList instead of QVector in corelib implementation Omitting state machine and docs for now. Task-number: QTBUG-84469 Change-Id: Ibfa5e7035515773461f6cdbff35299315ef65737 Reviewed-by: Sona Kurazyan --- src/corelib/animation/qvariantanimation.cpp | 4 +- src/corelib/global/qglobal.cpp | 3 +- src/corelib/global/qlogging.cpp | 2 +- src/corelib/global/qrandom.cpp | 2 +- src/corelib/io/qdebug.cpp | 8 - src/corelib/io/qdir.cpp | 1 - src/corelib/io/qdiriterator.cpp | 2 +- src/corelib/io/qfilesystemengine_win.cpp | 5 +- src/corelib/io/qfilesystemiterator_win.cpp | 1 - src/corelib/io/qfilesystemwatcher_win.cpp | 2 +- src/corelib/io/qloggingregistry.cpp | 6 +- src/corelib/io/qresource.cpp | 2 +- src/corelib/io/qsettings.cpp | 4 +- src/corelib/io/qsettings_win.cpp | 4 +- src/corelib/itemmodels/qabstractitemmodel.cpp | 136 +++++++---------- .../itemmodels/qconcatenatetablesproxymodel.cpp | 12 +- src/corelib/itemmodels/qidentityproxymodel.cpp | 12 +- src/corelib/itemmodels/qitemselectionmodel.cpp | 14 +- src/corelib/itemmodels/qsortfilterproxymodel.cpp | 167 ++++++++++----------- src/corelib/itemmodels/qstringlistmodel.cpp | 6 +- src/corelib/itemmodels/qtransposeproxymodel.cpp | 7 +- src/corelib/kernel/qcoreapplication_win.cpp | 1 - src/corelib/kernel/qjnihelpers.cpp | 5 +- src/corelib/kernel/qmetaobjectbuilder.cpp | 2 +- src/corelib/kernel/qmetatype.cpp | 6 +- src/corelib/plugin/qfactoryloader.cpp | 2 +- src/corelib/plugin/qlibrary.cpp | 2 +- src/corelib/plugin/qpluginloader.cpp | 6 +- src/corelib/serialization/qcborarray.cpp | 2 +- src/corelib/serialization/qcbormap.cpp | 4 +- src/corelib/serialization/qcborvalue.cpp | 2 +- src/corelib/serialization/qdatastream.cpp | 2 +- src/corelib/serialization/qxmlstream.cpp | 12 +- src/corelib/text/qcollator_macx.cpp | 2 +- src/corelib/text/qcollator_posix.cpp | 2 +- src/corelib/text/qlocale.cpp | 2 +- src/corelib/text/qregexp.cpp | 61 ++++---- src/corelib/text/qregularexpression.cpp | 4 +- src/corelib/text/qstring.cpp | 69 ++++----- src/corelib/text/qstringtokenizer.cpp | 2 +- src/corelib/text/qstringview.cpp | 8 +- src/corelib/thread/qthread_win.cpp | 6 +- src/corelib/thread/qthreadstorage.cpp | 8 +- src/corelib/time/qdatetime.cpp | 6 +- src/corelib/time/qdatetimeparser.cpp | 2 +- src/corelib/time/qtimezone.cpp | 2 +- src/corelib/time/qtimezoneprivate_tz.cpp | 36 ++--- src/corelib/tools/qalgorithms.qdoc | 4 +- src/corelib/tools/qbitarray.cpp | 2 +- src/corelib/tools/qcommandlineparser.cpp | 4 +- src/corelib/tools/qeasingcurve.cpp | 22 +-- src/corelib/tools/qmap.cpp | 2 +- src/corelib/tools/qstack.cpp | 10 +- src/corelib/tools/qvector_msvc.cpp | 6 +- src/corelib/tools/qversionnumber.cpp | 16 +- 55 files changed, 334 insertions(+), 388 deletions(-) (limited to 'src') diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp index 98b02f0202..e50cdd05ec 100644 --- a/src/corelib/animation/qvariantanimation.cpp +++ b/src/corelib/animation/qvariantanimation.cpp @@ -389,7 +389,7 @@ void QVariantAnimation::setEasingCurve(const QEasingCurve &easing) d->recalculateCurrentInterval(); } -typedef QVector QInterpolatorVector; +typedef QList QInterpolatorVector; Q_GLOBAL_STATIC(QInterpolatorVector, registeredInterpolators) static QBasicMutex registeredInterpolatorsMutex; @@ -571,7 +571,7 @@ QVariant QVariantAnimation::keyValueAt(qreal step) const /*! \typedef QVariantAnimation::KeyValues - This is a typedef for QVector + This is a typedef for QList */ /*! diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 460a36e2bc..2ed15595b7 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -40,7 +40,6 @@ #include "qplatformdefs.h" #include "qstring.h" -#include "qvector.h" #include "qlist.h" #include "qdir.h" #include "qdatetime.h" @@ -4267,7 +4266,7 @@ bool qunsetenv(const char *varName) */ struct QInternal_CallBackTable { - QVector > callbacks; + QList> callbacks; }; Q_GLOBAL_STATIC(QInternal_CallBackTable, global_callback_table) diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 4e78062ba7..5c17679fb1 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1088,7 +1088,7 @@ struct QMessagePattern { QString backtraceSeparator; int backtraceDepth; }; - QVector backtraceArgs; // backtrace argumens in sequence of %{backtrace + QList backtraceArgs; // backtrace argumens in sequence of %{backtrace #endif bool fromEnvironment; diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp index c18ee6acbb..99b8a8320a 100644 --- a/src/corelib/global/qrandom.cpp +++ b/src/corelib/global/qrandom.cpp @@ -790,7 +790,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel \snippet code/src_corelib_global_qrandom.cpp 8 If the range refers to contiguous memory (such as an array or the data from - a QVector), the fillRange() function may be used too. + a QList), the fillRange() function may be used too. \sa fillRange() */ diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp index e8933b4526..bac362dc80 100644 --- a/src/corelib/io/qdebug.cpp +++ b/src/corelib/io/qdebug.cpp @@ -730,14 +730,6 @@ QDebug &QDebug::resetFormat() support streaming into QDebug. */ -/*! - \fn template QDebug operator<<(QDebug debug, const QVector &vec) - \relates QDebug - - Writes the contents of vector \a vec to \a debug. \c T needs to - support streaming into QDebug. -*/ - /*! \fn template QDebug operator<<(QDebug debug, const std::vector &vec) \relates QDebug diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 026e93b418..8bf87eacae 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -51,7 +51,6 @@ #if QT_CONFIG(regularexpression) # include #endif -#include "qvector.h" #include "qvarlengtharray.h" #include "qfilesystementry_p.h" #include "qfilesystemmetadata_p.h" diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp index 0c60ca8920..4486a92741 100644 --- a/src/corelib/io/qdiriterator.cpp +++ b/src/corelib/io/qdiriterator.cpp @@ -142,7 +142,7 @@ public: const QDirIterator::IteratorFlags iteratorFlags; #if QT_CONFIG(regularexpression) - QVector nameRegExps; + QList nameRegExps; #endif QDirIteratorPrivateIteratorStack fileEngineIterators; diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index 6e5e19e12f..e91a7558d7 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -47,12 +47,11 @@ #include #include -#include "qfile.h" #include "qdir.h" -#include "qvarlengtharray.h" #include "qdatetime.h" +#include "qfile.h" +#include "qvarlengtharray.h" #include "qt_windows.h" -#include "qvector.h" #if QT_CONFIG(regularexpression) #include "qregularexpression.h" #endif diff --git a/src/corelib/io/qfilesystemiterator_win.cpp b/src/corelib/io/qfilesystemiterator_win.cpp index a680964129..65596643bc 100644 --- a/src/corelib/io/qfilesystemiterator_win.cpp +++ b/src/corelib/io/qfilesystemiterator_win.cpp @@ -41,7 +41,6 @@ #include "qfilesystemengine_p.h" #include "qoperatingsystemversion.h" #include "qplatformdefs.h" -#include "qvector.h" #include diff --git a/src/corelib/io/qfilesystemwatcher_win.cpp b/src/corelib/io/qfilesystemwatcher_win.cpp index cc04288de5..9544dd7a04 100644 --- a/src/corelib/io/qfilesystemwatcher_win.cpp +++ b/src/corelib/io/qfilesystemwatcher_win.cpp @@ -648,7 +648,7 @@ void QWindowsFileSystemWatcherEngineThread::run() { auto locker = qt_unique_lock(mutex); forever { - QVector handlesCopy = handles; + QList handlesCopy = handles; locker.unlock(); DEBUG() << "QWindowsFileSystemWatcherThread" << this << "waiting on" << handlesCopy.count() << "handles"; DWORD r = WaitForMultipleObjects(handlesCopy.count(), handlesCopy.constData(), false, INFINITE); diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp index d40f312fc4..e2a866372c 100644 --- a/src/corelib/io/qloggingregistry.cpp +++ b/src/corelib/io/qloggingregistry.cpp @@ -283,7 +283,7 @@ static bool qtLoggingDebug() return debugEnv; } -static QVector loadRulesFromFile(const QString &filePath) +static QList loadRulesFromFile(const QString &filePath) { QFile file(filePath); if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { @@ -295,7 +295,7 @@ static QVector loadRulesFromFile(const QString &filePath) parser.setContent(stream); return parser.rules(); } - return QVector(); + return QList(); } /*! @@ -305,7 +305,7 @@ static QVector loadRulesFromFile(const QString &filePath) */ void QLoggingRegistry::initializeRules() { - QVector er, qr, cr; + QList er, qr, cr; // get rules from environment const QByteArray rulesFilePath = qgetenv("QT_LOGGING_CONF"); if (!rulesFilePath.isEmpty()) diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index 9324261939..5c5a796278 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -46,7 +46,7 @@ #include "qdebug.h" #include "qlocale.h" #include "qglobal.h" -#include "qvector.h" +#include "qlist.h" #include "qdatetime.h" #include "qbytearray.h" #include "qstringlist.h" diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 5d84713a67..b9bb237544 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -124,7 +124,7 @@ namespace { }; } typedef QHash PathHash; -typedef QVector CustomFormatVector; +typedef QList CustomFormatVector; Q_GLOBAL_STATIC(ConfFileHash, usedHashFunc) Q_GLOBAL_STATIC(ConfFileCache, unusedCacheFunc) @@ -1772,7 +1772,7 @@ bool QConfFileSettingsPrivate::writeIniFile(QIODevice &device, const ParsedSetti } const int sectionCount = iniMap.size(); - QVector sections; + QList sections; sections.reserve(sectionCount); for (i = iniMap.constBegin(); i != iniMap.constEnd(); ++i) sections.append(QSettingsIniKey(i.key(), i.value().position)); diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp index 7a4c1b5f02..b2167aa2bc 100644 --- a/src/corelib/io/qsettings_win.cpp +++ b/src/corelib/io/qsettings_win.cpp @@ -40,7 +40,7 @@ #include "qsettings.h" #include "qsettings_p.h" -#include "qvector.h" +#include "qlist.h" #include "qmap.h" #include "qdebug.h" #include @@ -369,7 +369,7 @@ void RegistryKey::close() m_handle = 0; } -typedef QVector RegistryKeyList; +typedef QList RegistryKeyList; /******************************************************************************* ** class QWinSettingsPrivate diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index 5c6cc7b587..27885bcb9b 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -44,7 +44,7 @@ #include #include #include -#include +#include #if QT_CONFIG(regularexpression) # include #endif @@ -658,10 +658,9 @@ void QAbstractItemModelPrivate::rowsAboutToBeInserted(const QModelIndex &parent, { Q_Q(QAbstractItemModel); Q_UNUSED(last); - QVector persistent_moved; + QList persistent_moved; if (first < q->rowCount(parent)) { - for (auto it = persistent.indexes.constBegin(); it != persistent.indexes.constEnd(); ++it) { - QPersistentModelIndexData *data = *it; + for (auto *data : qAsConst(persistent.indexes)) { const QModelIndex &index = data->index; if (index.row() >= first && index.isValid() && index.parent() == parent) { persistent_moved.append(data); @@ -674,11 +673,9 @@ void QAbstractItemModelPrivate::rowsAboutToBeInserted(const QModelIndex &parent, void QAbstractItemModelPrivate::rowsInserted(const QModelIndex &parent, int first, int last) { - QVector persistent_moved = persistent.moved.pop(); - int count = (last - first) + 1; // it is important to only use the delta, because the change could be nested - for (QVector::const_iterator it = persistent_moved.constBegin(); - it != persistent_moved.constEnd(); ++it) { - QPersistentModelIndexData *data = *it; + const QList persistent_moved = persistent.moved.pop(); + const int count = (last - first) + 1; // it is important to only use the delta, because the change could be nested + for (auto *data : persistent_moved) { QModelIndex old = data->index; persistent.indexes.erase(persistent.indexes.constFind(old)); data->index = q_func()->index(old.row() + count, old.column(), parent); @@ -692,18 +689,14 @@ void QAbstractItemModelPrivate::rowsInserted(const QModelIndex &parent, void QAbstractItemModelPrivate::itemsAboutToBeMoved(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation) { - QVector persistent_moved_explicitly; - QVector persistent_moved_in_source; - QVector persistent_moved_in_destination; - - const auto begin = persistent.indexes.constBegin(); - const auto end = persistent.indexes.constEnd(); + QList persistent_moved_explicitly; + QList persistent_moved_in_source; + QList persistent_moved_in_destination; const bool sameParent = (srcParent == destinationParent); const bool movingUp = (srcFirst > destinationChild); - for (auto it = begin; it != end; ++it) { - QPersistentModelIndexData *data = *it; + for (auto *data : qAsConst(persistent.indexes)) { const QModelIndex &index = data->index; const QModelIndex &parent = index.parent(); const bool isSourceIndex = (parent == srcParent); @@ -754,16 +747,10 @@ void QAbstractItemModelPrivate::itemsAboutToBeMoved(const QModelIndex &srcParent column value depending on the value of \a orientation. The indexes may also be moved to a different parent if \a parent differs from the existing parent for the index. */ -void QAbstractItemModelPrivate::movePersistentIndexes(const QVector &indexes, int change, const QModelIndex &parent, Qt::Orientation orientation) +void QAbstractItemModelPrivate::movePersistentIndexes(const QList &indexes, int change, + const QModelIndex &parent, Qt::Orientation orientation) { - QVector::const_iterator it; - const QVector::const_iterator begin = indexes.constBegin(); - const QVector::const_iterator end = indexes.constEnd(); - - for (it = begin; it != end; ++it) - { - QPersistentModelIndexData *data = *it; - + for (auto *data : indexes) { int row = data->index.row(); int column = data->index.column(); @@ -784,9 +771,9 @@ void QAbstractItemModelPrivate::movePersistentIndexes(const QVector moved_in_destination = persistent.moved.pop(); - QVector moved_in_source = persistent.moved.pop(); - QVector moved_explicitly = persistent.moved.pop(); + const QList moved_in_destination = persistent.moved.pop(); + const QList moved_in_source = persistent.moved.pop(); + const QList moved_explicitly = persistent.moved.pop(); const bool sameParent = (sourceParent == destinationParent); const bool movingUp = (sourceFirst > destinationChild); @@ -803,12 +790,11 @@ void QAbstractItemModelPrivate::itemsMoved(const QModelIndex &sourceParent, int void QAbstractItemModelPrivate::rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last) { - QVector persistent_moved; - QVector persistent_invalidated; + QList persistent_moved; + QList persistent_invalidated; // find the persistent indexes that are affected by the change, either by being in the removed subtree // or by being on the same level and below the removed rows - for (auto it = persistent.indexes.constBegin(); it != persistent.indexes.constEnd(); ++it) { - QPersistentModelIndexData *data = *it; + for (auto *data : qAsConst(persistent.indexes)) { bool level_changed = false; QModelIndex current = data->index; while (current.isValid()) { @@ -832,11 +818,9 @@ void QAbstractItemModelPrivate::rowsAboutToBeRemoved(const QModelIndex &parent, void QAbstractItemModelPrivate::rowsRemoved(const QModelIndex &parent, int first, int last) { - QVector persistent_moved = persistent.moved.pop(); - int count = (last - first) + 1; // it is important to only use the delta, because the change could be nested - for (QVector::const_iterator it = persistent_moved.constBegin(); - it != persistent_moved.constEnd(); ++it) { - QPersistentModelIndexData *data = *it; + const QList persistent_moved = persistent.moved.pop(); + const int count = (last - first) + 1; // it is important to only use the delta, because the change could be nested + for (auto *data : persistent_moved) { QModelIndex old = data->index; persistent.indexes.erase(persistent.indexes.constFind(old)); data->index = q_func()->index(old.row() - count, old.column(), parent); @@ -846,10 +830,8 @@ void QAbstractItemModelPrivate::rowsRemoved(const QModelIndex &parent, qWarning() << "QAbstractItemModel::endRemoveRows: Invalid index (" << old.row() - count << ',' << old.column() << ") in model" << q_func(); } } - QVector persistent_invalidated = persistent.invalidated.pop(); - for (QVector::const_iterator it = persistent_invalidated.constBegin(); - it != persistent_invalidated.constEnd(); ++it) { - QPersistentModelIndexData *data = *it; + const QList persistent_invalidated = persistent.invalidated.pop(); + for (auto *data : persistent_invalidated) { auto pit = persistent.indexes.constFind(data->index); if (pit != persistent.indexes.cend()) persistent.indexes.erase(pit); @@ -862,10 +844,9 @@ void QAbstractItemModelPrivate::columnsAboutToBeInserted(const QModelIndex &pare { Q_Q(QAbstractItemModel); Q_UNUSED(last); - QVector persistent_moved; + QList persistent_moved; if (first < q->columnCount(parent)) { - for (auto it = persistent.indexes.constBegin(); it != persistent.indexes.constEnd(); ++it) { - QPersistentModelIndexData *data = *it; + for (auto *data : qAsConst(persistent.indexes)) { const QModelIndex &index = data->index; if (index.column() >= first && index.isValid() && index.parent() == parent) persistent_moved.append(data); @@ -877,11 +858,9 @@ void QAbstractItemModelPrivate::columnsAboutToBeInserted(const QModelIndex &pare void QAbstractItemModelPrivate::columnsInserted(const QModelIndex &parent, int first, int last) { - QVector persistent_moved = persistent.moved.pop(); - int count = (last - first) + 1; // it is important to only use the delta, because the change could be nested - for (QVector::const_iterator it = persistent_moved.constBegin(); - it != persistent_moved.constEnd(); ++it) { - QPersistentModelIndexData *data = *it; + const QList persistent_moved = persistent.moved.pop(); + const int count = (last - first) + 1; // it is important to only use the delta, because the change could be nested + for (auto *data : persistent_moved) { QModelIndex old = data->index; persistent.indexes.erase(persistent.indexes.constFind(old)); data->index = q_func()->index(old.row(), old.column() + count, parent); @@ -890,18 +869,17 @@ void QAbstractItemModelPrivate::columnsInserted(const QModelIndex &parent, } else { qWarning() << "QAbstractItemModel::endInsertColumns: Invalid index (" << old.row() << ',' << old.column() + count << ") in model" << q_func(); } - } + } } void QAbstractItemModelPrivate::columnsAboutToBeRemoved(const QModelIndex &parent, int first, int last) { - QVector persistent_moved; - QVector persistent_invalidated; + QList persistent_moved; + QList persistent_invalidated; // find the persistent indexes that are affected by the change, either by being in the removed subtree // or by being on the same level and to the right of the removed columns - for (auto it = persistent.indexes.constBegin(); it != persistent.indexes.constEnd(); ++it) { - QPersistentModelIndexData *data = *it; + for (auto *data : qAsConst(persistent.indexes)) { bool level_changed = false; QModelIndex current = data->index; while (current.isValid()) { @@ -926,11 +904,9 @@ void QAbstractItemModelPrivate::columnsAboutToBeRemoved(const QModelIndex &paren void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent, int first, int last) { - QVector persistent_moved = persistent.moved.pop(); - int count = (last - first) + 1; // it is important to only use the delta, because the change could be nested - for (QVector::const_iterator it = persistent_moved.constBegin(); - it != persistent_moved.constEnd(); ++it) { - QPersistentModelIndexData *data = *it; + const QList persistent_moved = persistent.moved.pop(); + const int count = (last - first) + 1; // it is important to only use the delta, because the change could be nested + for (auto *data : persistent_moved) { QModelIndex old = data->index; persistent.indexes.erase(persistent.indexes.constFind(old)); data->index = q_func()->index(old.row(), old.column() - count, parent); @@ -940,10 +916,8 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent, qWarning() << "QAbstractItemModel::endRemoveColumns: Invalid index (" << old.row() << ',' << old.column() - count << ") in model" << q_func(); } } - QVector persistent_invalidated = persistent.invalidated.pop(); - for (QVector::const_iterator it = persistent_invalidated.constBegin(); - it != persistent_invalidated.constEnd(); ++it) { - QPersistentModelIndexData *data = *it; + const QList persistent_invalidated = persistent.invalidated.pop(); + for (auto *data : persistent_invalidated) { auto index = persistent.indexes.constFind(data->index); if (index != persistent.indexes.constEnd()) persistent.indexes.erase(index); @@ -1565,7 +1539,7 @@ QAbstractItemModel::~QAbstractItemModel() */ /*! - \fn void QAbstractItemModel::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector &roles = QVector()) + \fn void QAbstractItemModel::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList &roles = QList()) This signal is emitted whenever the data in an existing item changes. @@ -2555,9 +2529,8 @@ bool QAbstractItemModel::setHeaderData(int section, Qt::Orientation orientation, */ void QAbstractItemModel::encodeData(const QModelIndexList &indexes, QDataStream &stream) const { - QModelIndexList::ConstIterator it = indexes.begin(); - for (; it != indexes.end(); ++it) - stream << (*it).row() << (*it).column() << itemData(*it); + for (const auto &index : indexes) + stream << index.row() << index.column() << itemData(index); } /*! @@ -2570,8 +2543,8 @@ bool QAbstractItemModel::decodeData(int row, int column, const QModelIndex &pare int left = INT_MAX; int bottom = 0; int right = 0; - QVector rows, columns; - QVector > data; + QList rows, columns; + QList> data; while (!stream.atEnd()) { int r, c; @@ -2592,7 +2565,7 @@ bool QAbstractItemModel::decodeData(int row, int column, const QModelIndex &pare int dragColumnCount = right - left + 1; // Compute the number of continuous rows upon insertion and modify the rows to match - QVector rowsToInsert(bottom + 1); + QList rowsToInsert(bottom + 1); for (int i = 0; i < rows.count(); ++i) rowsToInsert[rows.at(i)] = 1; for (int i = 0; i < rowsToInsert.count(); ++i) { @@ -2617,7 +2590,7 @@ bool QAbstractItemModel::decodeData(int row, int column, const QModelIndex &pare row = qMax(0, row); column = qMax(0, column); - QVector newIndexes(data.size()); + QList newIndexes(data.size()); // set the data in the table for (int j = 0; j < data.size(); ++j) { int relativeRow = rows.at(j) - top; @@ -3258,7 +3231,7 @@ void QAbstractItemModel::changePersistentIndexList(const QModelIndexList &from, Q_D(QAbstractItemModel); if (d->persistent.indexes.isEmpty()) return; - QVector toBeReinserted; + QList toBeReinserted; toBeReinserted.reserve(to.count()); for (int i = 0; i < from.count(); ++i) { if (from.at(i) == to.at(i)) @@ -3273,11 +3246,8 @@ void QAbstractItemModel::changePersistentIndexList(const QModelIndexList &from, } } - for (QVector::const_iterator it = toBeReinserted.constBegin(); - it != toBeReinserted.constEnd() ; ++it) { - QPersistentModelIndexData *data = *it; + for (auto *data : qAsConst(toBeReinserted)) d->persistent.insertMultiAtEnd(data->index, data); - } } /*! @@ -3290,10 +3260,8 @@ QModelIndexList QAbstractItemModel::persistentIndexList() const Q_D(const QAbstractItemModel); QModelIndexList result; result.reserve(d->persistent.indexes.count()); - for (auto it = d->persistent.indexes.constBegin(); it != d->persistent.indexes.constEnd(); ++it) { - QPersistentModelIndexData *data = *it; + for (auto *data : qAsConst(d->persistent.indexes)) result.append(data->index); - } return result; } @@ -3768,8 +3736,8 @@ bool QAbstractTableModel::dropMimeData(const QMimeData *data, Qt::DropAction act if (parent.isValid() && row == -1 && column == -1) { int top = INT_MAX; int left = INT_MAX; - QVector rows, columns; - QVector > data; + QList rows, columns; + QList> data; while (!stream.atEnd()) { int r, c; @@ -3819,8 +3787,8 @@ bool QAbstractListModel::dropMimeData(const QMimeData *data, Qt::DropAction acti if (parent.isValid() && row == -1 && column == -1) { int top = INT_MAX; int left = INT_MAX; - QVector rows, columns; - QVector > data; + QList rows, columns; + QList> data; while (!stream.atEnd()) { int r, c; diff --git a/src/corelib/itemmodels/qconcatenatetablesproxymodel.cpp b/src/corelib/itemmodels/qconcatenatetablesproxymodel.cpp index 0e29714677..05baa7eed2 100644 --- a/src/corelib/itemmodels/qconcatenatetablesproxymodel.cpp +++ b/src/corelib/itemmodels/qconcatenatetablesproxymodel.cpp @@ -69,7 +69,7 @@ public: 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 &roles); + void _q_slotDataChanged(const QModelIndex &from, const QModelIndex &to, const QList &roles); void _q_slotSourceLayoutAboutToBeChanged(const QList &sourceParents, QAbstractItemModel::LayoutChangeHint hint); void _q_slotSourceLayoutChanged(const QList &sourceParents, QAbstractItemModel::LayoutChangeHint hint); void _q_slotModelAboutToBeReset(); @@ -80,7 +80,7 @@ public: bool mapDropCoordinatesToSource(int row, int column, const QModelIndex &parent, int *sourceRow, int *sourceColumn, QModelIndex *sourceParent, QAbstractItemModel **sourceModel) const; - QVector m_models; + QList m_models; int m_rowCount; // have to maintain it here since we can't compute during model destruction int m_columnCount; @@ -88,8 +88,8 @@ public: int m_newColumnCount; // for layoutAboutToBeChanged/layoutChanged - QVector layoutChangePersistentIndexes; - QVector layoutChangeProxyIndexes; + QList layoutChangePersistentIndexes; + QList layoutChangeProxyIndexes; }; QConcatenateTablesProxyModelPrivate::QConcatenateTablesProxyModelPrivate() @@ -470,7 +470,7 @@ void QConcatenateTablesProxyModel::addSourceModel(QAbstractItemModel *sourceMode Q_D(QConcatenateTablesProxyModel); Q_ASSERT(sourceModel); Q_ASSERT(!d->m_models.contains(sourceModel)); - connect(sourceModel, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector)), this, SLOT(_q_slotDataChanged(QModelIndex,QModelIndex,QVector))); + connect(sourceModel, SIGNAL(dataChanged(QModelIndex,QModelIndex,QList)), this, SLOT(_q_slotDataChanged(QModelIndex,QModelIndex,QList))); 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))); @@ -617,7 +617,7 @@ void QConcatenateTablesProxyModelPrivate::_q_slotColumnsRemoved(const QModelInde } } -void QConcatenateTablesProxyModelPrivate::_q_slotDataChanged(const QModelIndex &from, const QModelIndex &to, const QVector &roles) +void QConcatenateTablesProxyModelPrivate::_q_slotDataChanged(const QModelIndex &from, const QModelIndex &to, const QList &roles) { Q_Q(QConcatenateTablesProxyModel); Q_ASSERT(from.isValid()); diff --git a/src/corelib/itemmodels/qidentityproxymodel.cpp b/src/corelib/itemmodels/qidentityproxymodel.cpp index 8210e27f8a..209626a0ee 100644 --- a/src/corelib/itemmodels/qidentityproxymodel.cpp +++ b/src/corelib/itemmodels/qidentityproxymodel.cpp @@ -69,7 +69,7 @@ class QIdentityProxyModelPrivate : public QAbstractProxyModelPrivate void _q_sourceColumnsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest); void _q_sourceColumnsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest); - void _q_sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector &roles); + void _q_sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList &roles); void _q_sourceHeaderDataChanged(Qt::Orientation orientation, int first, int last); void _q_sourceLayoutAboutToBeChanged(const QList &sourceParents, QAbstractItemModel::LayoutChangeHint hint); @@ -390,8 +390,8 @@ void QIdentityProxyModel::setSourceModel(QAbstractItemModel* newSourceModel) this, SLOT(_q_sourceModelAboutToBeReset())); disconnect(sourceModel(), SIGNAL(modelReset()), this, SLOT(_q_sourceModelReset())); - disconnect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector)), - this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex,QVector))); + disconnect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex,QList)), + this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex,QList))); disconnect(sourceModel(), SIGNAL(headerDataChanged(Qt::Orientation,int,int)), this, SLOT(_q_sourceHeaderDataChanged(Qt::Orientation,int,int))); disconnect(sourceModel(), SIGNAL(layoutAboutToBeChanged(QList,QAbstractItemModel::LayoutChangeHint)), @@ -431,8 +431,8 @@ void QIdentityProxyModel::setSourceModel(QAbstractItemModel* newSourceModel) SLOT(_q_sourceModelAboutToBeReset())); connect(sourceModel(), SIGNAL(modelReset()), SLOT(_q_sourceModelReset())); - connect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector)), - SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex,QVector))); + connect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex,QList)), + SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex,QList))); connect(sourceModel(), SIGNAL(headerDataChanged(Qt::Orientation,int,int)), SLOT(_q_sourceHeaderDataChanged(Qt::Orientation,int,int))); connect(sourceModel(), SIGNAL(layoutAboutToBeChanged(QList,QAbstractItemModel::LayoutChangeHint)), @@ -499,7 +499,7 @@ void QIdentityProxyModelPrivate::_q_sourceColumnsRemoved(const QModelIndex &pare q->endRemoveColumns(); } -void QIdentityProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector &roles) +void QIdentityProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList &roles) { Q_ASSERT(topLeft.isValid() ? topLeft.model() == model : true); Q_ASSERT(bottomRight.isValid() ? bottomRight.model() == model : true); diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp index fe7be8753b..5eed378f9e 100644 --- a/src/corelib/itemmodels/qitemselectionmodel.cpp +++ b/src/corelib/itemmodels/qitemselectionmodel.cpp @@ -306,7 +306,7 @@ bool QItemSelectionRange::operator<(const QItemSelectionRange &other) const */ -static void rowLengthsFromRange(const QItemSelectionRange &range, QVector > &result) +static void rowLengthsFromRange(const QItemSelectionRange &range, QList> &result) { if (range.isValid() && range.model()) { const QModelIndex topLeft = range.topLeft(); @@ -495,9 +495,9 @@ QModelIndexList QItemSelection::indexes() const return qSelectionIndexes(*this); } -static QVector > qSelectionPersistentRowLengths(const QItemSelection &sel) +static QList> qSelectionPersistentRowLengths(const QItemSelection &sel) { - QVector > result; + QList> result; for (const QItemSelectionRange &range : sel) rowLengthsFromRange(range, result); return result; @@ -902,14 +902,14 @@ void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged(const QList>(ranges); - savedPersistentCurrentIndexes = qSelectionIndexes>(currentSelection); + savedPersistentIndexes = qSelectionIndexes>(ranges); + savedPersistentCurrentIndexes = qSelectionIndexes>(currentSelection); } } /*! \internal */ -static QItemSelection mergeRowLengths(const QVector > &rowLengths) +static QItemSelection mergeRowLengths(const QList> &rowLengths) { if (rowLengths.isEmpty()) return QItemSelection(); @@ -949,7 +949,7 @@ static QItemSelection mergeRowLengths(const QVector &indexes) +static QItemSelection mergeIndexes(const QList &indexes) { QItemSelection colSpans; // merge columns diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp index 03db159618..728be151c6 100644 --- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp +++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE -typedef QVector > QModelIndexPairList; +typedef QList> QModelIndexPairList; struct QSortFilterProxyModelDataChanged { @@ -62,7 +62,7 @@ struct QSortFilterProxyModelDataChanged QModelIndex bottomRight; }; -static inline QSet qVectorToSet(const QVector &vector) +static inline QSet qListToSet(const QList &vector) { return {vector.begin(), vector.end()}; } @@ -154,11 +154,11 @@ public: }; struct Mapping { - QVector source_rows; - QVector source_columns; - QVector proxy_rows; - QVector proxy_columns; - QVector mapped_children; + QList source_rows; + QList source_columns; + QList proxy_rows; + QList proxy_columns; + QList mapped_children; QModelIndex source_parent; }; @@ -215,7 +215,7 @@ public: void _q_sourceDataChanged(const QModelIndex &source_top_left, const QModelIndex &source_bottom_right, - const QVector &roles); + const QList &roles); void _q_sourceHeaderDataChanged(Qt::Orientation orientation, int start, int end); void _q_sourceAboutToBeReset(); @@ -258,27 +258,27 @@ public: void sort(); bool update_source_sort_column(); int find_source_sort_column() const; - void sort_source_rows(QVector &source_rows, + void sort_source_rows(QList &source_rows, const QModelIndex &source_parent) const; - QVector > > proxy_intervals_for_source_items_to_add( - const QVector &proxy_to_source, const QVector &source_items, + QList>> proxy_intervals_for_source_items_to_add( + const QList &proxy_to_source, const QList &source_items, const QModelIndex &source_parent, Qt::Orientation orient) const; - QVector > proxy_intervals_for_source_items( - const QVector &source_to_proxy, const QVector &source_items) const; + QList> proxy_intervals_for_source_items( + const QList &source_to_proxy, const QList &source_items) const; void insert_source_items( - QVector &source_to_proxy, QVector &proxy_to_source, - const QVector &source_items, const QModelIndex &source_parent, + QList &source_to_proxy, QList &proxy_to_source, + const QList &source_items, const QModelIndex &source_parent, Qt::Orientation orient, bool emit_signal = true); void remove_source_items( - QVector &source_to_proxy, QVector &proxy_to_source, - const QVector &source_items, const QModelIndex &source_parent, + QList &source_to_proxy, QList &proxy_to_source, + const QList &source_items, const QModelIndex &source_parent, Qt::Orientation orient, bool emit_signal = true); void remove_proxy_interval( - QVector &source_to_proxy, QVector &proxy_to_source, + QList &source_to_proxy, QList &proxy_to_source, int proxy_start, int proxy_end, const QModelIndex &proxy_parent, Qt::Orientation orient, bool emit_signal = true); static inline void build_source_to_proxy_mapping( - const QVector &proxy_to_source, QVector &source_to_proxy, int start = 0); + const QList &proxy_to_source, QList &source_to_proxy, int start = 0); void source_items_inserted(const QModelIndex &source_parent, int start, int end, Qt::Orientation orient); void source_items_about_to_be_removed(const QModelIndex &source_parent, @@ -286,7 +286,7 @@ public: void source_items_removed(const QModelIndex &source_parent, int start, int end, Qt::Orientation orient); void proxy_item_range( - const QVector &source_to_proxy, const QVector &source_items, + const QList &source_to_proxy, const QList &source_items, int &proxy_low, int &proxy_high) const; QModelIndexPairList store_persistent_indexes() const; @@ -295,7 +295,7 @@ public: void filter_about_to_be_changed(const QModelIndex &source_parent = QModelIndex()); void filter_changed(Direction dir, const QModelIndex &source_parent = QModelIndex()); QSet handle_filter_changed( - QVector &source_to_proxy, QVector &proxy_to_source, + QList &source_to_proxy, QList &proxy_to_source, const QModelIndex &source_parent, Qt::Orientation orient); void updateChildrenMapping(const QModelIndex &source_parent, Mapping *parent_mapping, @@ -303,7 +303,7 @@ public: void _q_sourceModelDestroyed() override; - bool needsReorder(const QVector &source_rows, const QModelIndex &source_parent) const; + bool needsReorder(const QList &source_rows, const QModelIndex &source_parent) const; bool filterAcceptsRowInternal(int source_row, const QModelIndex &source_parent) const; bool recursiveChildAcceptsRow(int source_row, const QModelIndex &source_parent) const; @@ -582,7 +582,7 @@ int QSortFilterProxyModelPrivate::find_source_sort_column() const Sorts the given \a source_rows according to current sort column and order. */ void QSortFilterProxyModelPrivate::sort_source_rows( - QVector &source_rows, const QModelIndex &source_parent) const + QList &source_rows, const QModelIndex &source_parent) const { Q_Q(const QSortFilterProxyModel); if (source_sort_column >= 0) { @@ -609,10 +609,10 @@ void QSortFilterProxyModelPrivate::sort_source_rows( The result is a vector of pairs, where each pair represents a (start, end) tuple, sorted in ascending order. */ -QVector > QSortFilterProxyModelPrivate::proxy_intervals_for_source_items( - const QVector &source_to_proxy, const QVector &source_items) const +QList> QSortFilterProxyModelPrivate::proxy_intervals_for_source_items( + const QList &source_to_proxy, const QList &source_items) const { - QVector > proxy_intervals; + QList> proxy_intervals; if (source_items.isEmpty()) return proxy_intervals; @@ -657,8 +657,8 @@ QVector > QSortFilterProxyModelPrivate::proxy_intervals_for_sou rows/columnsRemoved(start, end) signals will be generated. */ void QSortFilterProxyModelPrivate::remove_source_items( - QVector &source_to_proxy, QVector &proxy_to_source, - const QVector &source_items, const QModelIndex &source_parent, + QList &source_to_proxy, QList &proxy_to_source, + const QList &source_items, const QModelIndex &source_parent, Qt::Orientation orient, bool emit_signal) { Q_Q(QSortFilterProxyModel); @@ -687,7 +687,7 @@ void QSortFilterProxyModelPrivate::remove_source_items( (inclusive) from this proxy model. */ void QSortFilterProxyModelPrivate::remove_proxy_interval( - QVector &source_to_proxy, QVector &proxy_to_source, int proxy_start, int proxy_end, + QList &source_to_proxy, QList &proxy_to_source, int proxy_start, int proxy_end, const QModelIndex &proxy_parent, Qt::Orientation orient, bool emit_signal) { Q_Q(QSortFilterProxyModel); @@ -725,19 +725,19 @@ void QSortFilterProxyModelPrivate::remove_proxy_interval( items), where items is a vector containing the (sorted) source items that should be inserted at that proxy model location. */ -QVector > > QSortFilterProxyModelPrivate::proxy_intervals_for_source_items_to_add( - const QVector &proxy_to_source, const QVector &source_items, +QList>> QSortFilterProxyModelPrivate::proxy_intervals_for_source_items_to_add( + const QList &proxy_to_source, const QList &source_items, const QModelIndex &source_parent, Qt::Orientation orient) const { Q_Q(const QSortFilterProxyModel); - QVector > > proxy_intervals; + QList>> proxy_intervals; if (source_items.isEmpty()) return proxy_intervals; int proxy_low = 0; int proxy_item = 0; int source_items_index = 0; - QVector source_items_in_interval; + QList source_items_in_interval; bool compare = (orient == Qt::Vertical && source_sort_column >= 0 && dynamic_sortfilter); while (source_items_index < source_items.size()) { source_items_in_interval.clear(); @@ -786,7 +786,7 @@ QVector > > QSortFilterProxyModelPrivate::proxy_interva } // Add interval to result - proxy_intervals.append(QPair >(proxy_item, source_items_in_interval)); + proxy_intervals.append(QPair>(proxy_item, source_items_in_interval)); } return proxy_intervals; } @@ -800,8 +800,8 @@ QVector > > QSortFilterProxyModelPrivate::proxy_interva that the proper rows/columnsInserted(start, end) signals will be generated. */ void QSortFilterProxyModelPrivate::insert_source_items( - QVector &source_to_proxy, QVector &proxy_to_source, - const QVector &source_items, const QModelIndex &source_parent, + QList &source_to_proxy, QList &proxy_to_source, + const QList &source_items, const QModelIndex &source_parent, Qt::Orientation orient, bool emit_signal) { Q_Q(QSortFilterProxyModel); @@ -814,9 +814,9 @@ void QSortFilterProxyModelPrivate::insert_source_items( const auto end = proxy_intervals.rend(); for (auto it = proxy_intervals.rbegin(); it != end; ++it) { - const QPair > &interval = *it; + const QPair> &interval = *it; const int proxy_start = interval.first; - const QVector &source_items = interval.second; + const QList &source_items = interval.second; const int proxy_end = proxy_start + source_items.size() - 1; if (emit_signal) { @@ -877,8 +877,8 @@ void QSortFilterProxyModelPrivate::source_items_inserted( } Mapping *m = it.value(); - QVector &source_to_proxy = (orient == Qt::Vertical) ? m->proxy_rows : m->proxy_columns; - QVector &proxy_to_source = (orient == Qt::Vertical) ? m->source_rows : m->source_columns; + QList &source_to_proxy = (orient == Qt::Vertical) ? m->proxy_rows : m->proxy_columns; + QList &proxy_to_source = (orient == Qt::Vertical) ? m->source_rows : m->source_columns; int delta_item_count = end - start + 1; int old_item_count = source_to_proxy.size(); @@ -905,7 +905,7 @@ void QSortFilterProxyModelPrivate::source_items_inserted( } // Figure out which items to add to mapping based on filter - QVector source_items; + QList source_items; for (int i = start; i <= end; ++i) { if ((orient == Qt::Vertical) ? filterAcceptsRowInternal(i, source_parent) @@ -919,8 +919,8 @@ void QSortFilterProxyModelPrivate::source_items_inserted( // If it was new rows make sure to create mappings for columns so that a // valid mapping can be retrieved later and vice-versa. - QVector &orthogonal_proxy_to_source = (orient == Qt::Horizontal) ? m->source_rows : m->source_columns; - QVector &orthogonal_source_to_proxy = (orient == Qt::Horizontal) ? m->proxy_rows : m->proxy_columns; + QList &orthogonal_proxy_to_source = (orient == Qt::Horizontal) ? m->source_rows : m->source_columns; + QList &orthogonal_source_to_proxy = (orient == Qt::Horizontal) ? m->proxy_rows : m->proxy_columns; if (orthogonal_source_to_proxy.isEmpty()) { const int ortho_end = (orient == Qt::Horizontal) ? model->rowCount(source_parent) : model->columnCount(source_parent); @@ -965,11 +965,11 @@ void QSortFilterProxyModelPrivate::source_items_about_to_be_removed( } Mapping *m = it.value(); - QVector &source_to_proxy = (orient == Qt::Vertical) ? m->proxy_rows : m->proxy_columns; - QVector &proxy_to_source = (orient == Qt::Vertical) ? m->source_rows : m->source_columns; + QList &source_to_proxy = (orient == Qt::Vertical) ? m->proxy_rows : m->proxy_columns; + QList &proxy_to_source = (orient == Qt::Vertical) ? m->source_rows : m->source_columns; // figure out which items to remove - QVector source_items_to_remove; + QList source_items_to_remove; int proxy_count = proxy_to_source.size(); for (int proxy_item = 0; proxy_item < proxy_count; ++proxy_item) { int source_item = proxy_to_source.at(proxy_item); @@ -998,8 +998,8 @@ void QSortFilterProxyModelPrivate::source_items_removed( } Mapping *m = it.value(); - QVector &source_to_proxy = (orient == Qt::Vertical) ? m->proxy_rows : m->proxy_columns; - QVector &proxy_to_source = (orient == Qt::Vertical) ? m->source_rows : m->source_columns; + QList &source_to_proxy = (orient == Qt::Vertical) ? m->proxy_rows : m->proxy_columns; + QList &proxy_to_source = (orient == Qt::Vertical) ? m->source_rows : m->source_columns; if (end >= source_to_proxy.size()) end = source_to_proxy.size() - 1; @@ -1042,8 +1042,8 @@ void QSortFilterProxyModelPrivate::updateChildrenMapping(const QModelIndex &sour Qt::Orientation orient, int start, int end, int delta_item_count, bool remove) { // see if any mapped children should be (re)moved - QVector > moved_source_index_mappings; - QVector::iterator it2 = parent_mapping->mapped_children.begin(); + QList> moved_source_index_mappings; + auto it2 = parent_mapping->mapped_children.begin(); for ( ; it2 != parent_mapping->mapped_children.end();) { const QModelIndex source_child_index = *it2; const int pos = (orient == Qt::Vertical) @@ -1081,10 +1081,9 @@ void QSortFilterProxyModelPrivate::updateChildrenMapping(const QModelIndex &sour } // reinsert moved, mapped indexes - QVector >::iterator it = moved_source_index_mappings.begin(); - for (; it != moved_source_index_mappings.end(); ++it) { - it->second->source_parent = it->first; - source_index_mapping.insert(it->first, it->second); + for (auto &pair : qAsConst(moved_source_index_mappings)) { + pair.second->source_parent = pair.first; + source_index_mapping.insert(pair.first, pair.second); } } @@ -1092,7 +1091,7 @@ void QSortFilterProxyModelPrivate::updateChildrenMapping(const QModelIndex &sour \internal */ void QSortFilterProxyModelPrivate::proxy_item_range( - const QVector &source_to_proxy, const QVector &source_items, + const QList &source_to_proxy, const QList &source_items, int &proxy_low, int &proxy_high) const { proxy_low = INT_MAX; @@ -1111,7 +1110,7 @@ void QSortFilterProxyModelPrivate::proxy_item_range( \internal */ void QSortFilterProxyModelPrivate::build_source_to_proxy_mapping( - const QVector &proxy_to_source, QVector &source_to_proxy, int start) + const QList &proxy_to_source, QList &source_to_proxy, int start) { if (start == 0) source_to_proxy.fill(-1); @@ -1197,8 +1196,8 @@ void QSortFilterProxyModelPrivate::filter_changed(Direction dir, const QModelInd // the iterator it2. // The m->mapped_children vector can be appended to with indexes which are no longer filtered // out (in create_mapping) when this function recurses for child indexes. - const QVector mappedChildren = m->mapped_children; - QVector indexesToRemove; + const QList mappedChildren = m->mapped_children; + QList indexesToRemove; for (int i = 0; i < mappedChildren.size(); ++i) { const QModelIndex &source_child_index = mappedChildren.at(i); if (rows_removed.contains(source_child_index.row()) || columns_removed.contains(source_child_index.column())) { @@ -1208,8 +1207,8 @@ void QSortFilterProxyModelPrivate::filter_changed(Direction dir, const QModelInd filter_changed(dir, source_child_index); } } - QVector::const_iterator removeIt = indexesToRemove.constEnd(); - const QVector::const_iterator removeBegin = indexesToRemove.constBegin(); + QList::const_iterator removeIt = indexesToRemove.constEnd(); + const QList::const_iterator removeBegin = indexesToRemove.constBegin(); // We can't just remove these items from mappedChildren while iterating above and then // do something like m->mapped_children = mappedChildren, because mapped_children might @@ -1227,12 +1226,12 @@ void QSortFilterProxyModelPrivate::filter_changed(Direction dir, const QModelInd returns the removed items indexes */ QSet QSortFilterProxyModelPrivate::handle_filter_changed( - QVector &source_to_proxy, QVector &proxy_to_source, + QList &source_to_proxy, QList &proxy_to_source, const QModelIndex &source_parent, Qt::Orientation orient) { Q_Q(QSortFilterProxyModel); // Figure out which mapped items to remove - QVector source_items_remove; + QList source_items_remove; for (int i = 0; i < proxy_to_source.count(); ++i) { const int source_item = proxy_to_source.at(i); if ((orient == Qt::Vertical) @@ -1243,7 +1242,7 @@ QSet QSortFilterProxyModelPrivate::handle_filter_changed( } } // Figure out which non-mapped items to insert - QVector source_items_insert; + QList source_items_insert; int source_count = source_to_proxy.size(); for (int source_item = 0; source_item < source_count; ++source_item) { if (source_to_proxy.at(source_item) == -1) { @@ -1264,10 +1263,10 @@ QSet QSortFilterProxyModelPrivate::handle_filter_changed( insert_source_items(source_to_proxy, proxy_to_source, source_items_insert, source_parent, orient); } - return qVectorToSet(source_items_remove); + return qListToSet(source_items_remove); } -bool QSortFilterProxyModelPrivate::needsReorder(const QVector &source_rows, const QModelIndex &source_parent) const +bool QSortFilterProxyModelPrivate::needsReorder(const QList &source_rows, const QModelIndex &source_parent) const { Q_Q(const QSortFilterProxyModel); Q_ASSERT(source_sort_column != -1); @@ -1296,7 +1295,7 @@ bool QSortFilterProxyModelPrivate::needsReorder(const QVector &source_rows, void QSortFilterProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &source_top_left, const QModelIndex &source_bottom_right, - const QVector &roles) + const QList &roles) { Q_Q(QSortFilterProxyModel); if (!source_top_left.isValid() || !source_bottom_right.isValid()) @@ -1328,10 +1327,10 @@ void QSortFilterProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &sourc Mapping *m = it.value(); // Figure out how the source changes affect us - QVector source_rows_remove; - QVector source_rows_insert; - QVector source_rows_change; - QVector source_rows_resort; + QList source_rows_remove; + QList source_rows_insert; + QList source_rows_change; + QList source_rows_resort; int end = qMin(source_bottom_right.row(), m->proxy_rows.count() - 1); for (int source_row = source_top_left.row(); source_row <= end; ++source_row) { if (dynamic_sortfilter) { @@ -1361,8 +1360,8 @@ void QSortFilterProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &sourc if (!source_rows_remove.isEmpty()) { remove_source_items(m->proxy_rows, m->source_rows, source_rows_remove, source_parent, Qt::Vertical); - QSet source_rows_remove_set = qVectorToSet(source_rows_remove); - QVector::iterator childIt = m->mapped_children.end(); + QSet source_rows_remove_set = qListToSet(source_rows_remove); + QList::iterator childIt = m->mapped_children.end(); while (childIt != m->mapped_children.begin()) { --childIt; const QModelIndex source_child_index = *childIt; @@ -1433,14 +1432,14 @@ void QSortFilterProxyModelPrivate::_q_sourceHeaderDataChanged(Qt::Orientation or Q_Q(QSortFilterProxyModel); Mapping *m = create_mapping(QModelIndex()).value(); - const QVector &source_to_proxy = (orientation == Qt::Vertical) ? m->proxy_rows : m->proxy_columns; + const QList &source_to_proxy = (orientation == Qt::Vertical) ? m->proxy_rows : m->proxy_columns; - QVector proxy_positions; + QList proxy_positions; proxy_positions.reserve(end - start + 1); { Q_ASSERT(source_to_proxy.size() > end); - QVector::const_iterator it = source_to_proxy.constBegin() + start; - const QVector::const_iterator endIt = source_to_proxy.constBegin() + end + 1; + QList::const_iterator it = source_to_proxy.constBegin() + start; + const QList::const_iterator endIt = source_to_proxy.constBegin() + end + 1; for ( ; it != endIt; ++it) { if (*it != -1) proxy_positions.push_back(*it); @@ -1594,7 +1593,7 @@ void QSortFilterProxyModelPrivate::_q_sourceRowsInserted( return; // last_top_source should now become visible - _q_sourceDataChanged(last_top_source, last_top_source, QVector()); + _q_sourceDataChanged(last_top_source, last_top_source, QList()); } } @@ -1630,7 +1629,7 @@ void QSortFilterProxyModelPrivate::_q_sourceRowsRemoved( } if (to_hide.isValid()) - _q_sourceDataChanged(to_hide, to_hide, QVector()); + _q_sourceDataChanged(to_hide, to_hide, QList()); } } @@ -1934,8 +1933,8 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel) beginResetModel(); - disconnect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector)), - this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex,QVector))); + disconnect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QList)), + this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex,QList))); disconnect(d->model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)), this, SLOT(_q_sourceHeaderDataChanged(Qt::Orientation,int,int))); @@ -1991,8 +1990,8 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel) QAbstractProxyModel::setSourceModel(sourceModel); - connect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector)), - this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex,QVector))); + connect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QList)), + this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex,QList))); connect(d->model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)), this, SLOT(_q_sourceHeaderDataChanged(Qt::Orientation,int,int))); @@ -2311,7 +2310,7 @@ bool QSortFilterProxyModel::removeRows(int row, int count, const QModelIndex &pa } // remove corresponding source intervals // ### if this proves to be slow, we can switch to single-row removal - QVector rows; + QList rows; rows.reserve(count); for (int i = row; i < row + count; ++i) rows.append(m->source_rows.at(i)); @@ -2351,7 +2350,7 @@ bool QSortFilterProxyModel::removeColumns(int column, int count, const QModelInd return d->model->removeColumns(source_column, count, source_parent); } // remove corresponding source intervals - QVector columns; + QList columns; columns.reserve(count); for (int i = column; i < column + count; ++i) columns.append(m->source_columns.at(i)); diff --git a/src/corelib/itemmodels/qstringlistmodel.cpp b/src/corelib/itemmodels/qstringlistmodel.cpp index f5f67c516f..829d4cf3ed 100644 --- a/src/corelib/itemmodels/qstringlistmodel.cpp +++ b/src/corelib/itemmodels/qstringlistmodel.cpp @@ -43,7 +43,7 @@ #include "qstringlistmodel.h" -#include +#include #include @@ -344,7 +344,7 @@ void QStringListModel::sort(int, Qt::SortOrder order) { emit layoutAboutToBeChanged(QList(), VerticalSortHint); - QVector > list; + QList> list; const int lstCount = lst.count(); list.reserve(lstCount); for (int i = 0; i < lstCount; ++i) @@ -356,7 +356,7 @@ void QStringListModel::sort(int, Qt::SortOrder order) std::sort(list.begin(), list.end(), decendingLessThan); lst.clear(); - QVector forwarding(lstCount); + QList forwarding(lstCount); for (int i = 0; i < lstCount; ++i) { lst.append(list.at(i).first); forwarding[list.at(i).second] = i; diff --git a/src/corelib/itemmodels/qtransposeproxymodel.cpp b/src/corelib/itemmodels/qtransposeproxymodel.cpp index 207faa6151..c72128fa7d 100644 --- a/src/corelib/itemmodels/qtransposeproxymodel.cpp +++ b/src/corelib/itemmodels/qtransposeproxymodel.cpp @@ -39,7 +39,7 @@ #include "qtransposeproxymodel.h" #include -#include +#include #include #include @@ -111,7 +111,8 @@ void QTransposeProxyModelPrivate::onLayoutAboutToBeChanged(const QListlayoutAboutToBeChanged(proxyParents, proxyHint); } -void QTransposeProxyModelPrivate::onDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector& roles) +void QTransposeProxyModelPrivate::onDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, + const QList &roles) { Q_Q(QTransposeProxyModel); emit q->dataChanged(q->mapFromSource(topLeft), q->mapFromSource(bottomRight), roles); @@ -205,7 +206,7 @@ void QTransposeProxyModel::setSourceModel(QAbstractItemModel* newSourceModel) QAbstractProxyModel::setSourceModel(newSourceModel); if (d->model) { using namespace std::placeholders; - d->sourceConnections = QVector{ + d->sourceConnections = QList{ connect(d->model, &QAbstractItemModel::modelAboutToBeReset, this, &QTransposeProxyModel::beginResetModel), connect(d->model, &QAbstractItemModel::modelReset, this, &QTransposeProxyModel::endResetModel), connect(d->model, &QAbstractItemModel::dataChanged, this, std::bind(&QTransposeProxyModelPrivate::onDataChanged, d, _1, _2, _3)), diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp index a0fbf97838..524dd5b25b 100644 --- a/src/corelib/kernel/qcoreapplication_win.cpp +++ b/src/corelib/kernel/qcoreapplication_win.cpp @@ -41,7 +41,6 @@ #include "qcoreapplication.h" #include "qcoreapplication_p.h" #include "qstringlist.h" -#include "qvector.h" #include "qfileinfo.h" #include "qcorecmdlineargs_p.h" #ifndef QT_NO_QOBJECT diff --git a/src/corelib/kernel/qjnihelpers.cpp b/src/corelib/kernel/qjnihelpers.cpp index 7d278c69f2..f845eb37ed 100644 --- a/src/corelib/kernel/qjnihelpers.cpp +++ b/src/corelib/kernel/qjnihelpers.cpp @@ -43,7 +43,6 @@ #include "qlist.h" #include "qsemaphore.h" #include "qsharedpointer.h" -#include "qvector.h" #include "qthread.h" #include "qcoreapplication.h" #include @@ -119,7 +118,7 @@ static void runPendingCppRunnables(JNIEnv */*env*/, jobject /*obj*/) namespace { struct GenericMotionEventListeners { QMutex mutex; - QVector listeners; + QList listeners; }; enum { @@ -168,7 +167,7 @@ static jboolean dispatchGenericMotionEvent(JNIEnv *, jclass, jobject event) namespace { struct KeyEventListeners { QMutex mutex; - QVector listeners; + QList listeners; }; } Q_GLOBAL_STATIC(KeyEventListeners, g_keyEventListeners) diff --git a/src/corelib/kernel/qmetaobjectbuilder.cpp b/src/corelib/kernel/qmetaobjectbuilder.cpp index 1902b5e360..b418cd2dab 100644 --- a/src/corelib/kernel/qmetaobjectbuilder.cpp +++ b/src/corelib/kernel/qmetaobjectbuilder.cpp @@ -196,7 +196,7 @@ public: bool isFlag; bool isScoped; QList keys; - QVector values; + QList values; }; Q_DECLARE_TYPEINFO(QMetaEnumBuilderPrivate, Q_MOVABLE_TYPE); diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 61515f7ea5..9841758c80 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -45,7 +45,7 @@ #include "qreadwritelock.h" #include "qstring.h" #include "qstringlist.h" -#include "qvector.h" +#include "qlist.h" #include "qlocale.h" #if QT_CONFIG(easingcurve) #include "qeasingcurve.h" @@ -103,7 +103,7 @@ struct DefinedTypesFilter { struct QMetaTypeCustomRegistry { QReadWriteLock lock; - QVector registry; + QList registry; QHash aliases; #ifndef QT_NO_DATASTREAM struct DataStreamOps @@ -237,7 +237,7 @@ Q_GLOBAL_STATIC(QMetaTypeCustomRegistry, customTypeRegistry) \list \li Pointers to classes derived from QObject - \li QList, QVector, QQueue, QStack or QSet + \li QList, QQueue, QStack or QSet where T is a registered meta type \li QHash, QMap or QPair where T1 and T2 are registered meta types diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index 32b07a5636..8b87baaff9 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -404,7 +404,7 @@ QObject *QFactoryLoader::instance(int index) const lock.unlock(); #endif - QVector staticPlugins = QPluginLoader::staticPlugins(); + QList staticPlugins = QPluginLoader::staticPlugins(); for (int i = 0; i < staticPlugins.count(); ++i) { const QJsonObject object = staticPlugins.at(i).metaData(); if (object.value(QLatin1String("IID")) != QLatin1String(d->iid.constData(), d->iid.size())) diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index b66eb3e993..9ea8e2793c 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -56,7 +56,7 @@ #include #endif // NO_ERROR_H #include -#include +#include #include #include #include diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp index 2ae6913868..b8de3690d9 100644 --- a/src/corelib/plugin/qpluginloader.cpp +++ b/src/corelib/plugin/qpluginloader.cpp @@ -427,7 +427,7 @@ QLibrary::LoadHints QPluginLoader::loadHints() const #endif // QT_CONFIG(library) -typedef QVector StaticPluginList; +typedef QList StaticPluginList; Q_GLOBAL_STATIC(StaticPluginList, staticPluginList) /*! @@ -467,12 +467,12 @@ QObjectList QPluginLoader::staticInstances() meta data information. \sa staticInstances() */ -QVector QPluginLoader::staticPlugins() +QList QPluginLoader::staticPlugins() { StaticPluginList *plugins = staticPluginList(); if (plugins) return *plugins; - return QVector(); + return QList(); } /*! diff --git a/src/corelib/serialization/qcborarray.cpp b/src/corelib/serialization/qcborarray.cpp index 4a96d3dc32..2e0de4f4fc 100644 --- a/src/corelib/serialization/qcborarray.cpp +++ b/src/corelib/serialization/qcborarray.cpp @@ -66,7 +66,7 @@ using namespace QtCbor; from those two, though there may be loss of information in some conversions. - \sa QCborValue, QCborMap, QJsonArray, QList, QVector + \sa QCborValue, QCborMap, QJsonArray, QList */ /*! diff --git a/src/corelib/serialization/qcbormap.cpp b/src/corelib/serialization/qcbormap.cpp index 9179ed81b6..34c8c72059 100644 --- a/src/corelib/serialization/qcbormap.cpp +++ b/src/corelib/serialization/qcbormap.cpp @@ -298,9 +298,9 @@ void QCborMap::clear() \sa QMap::keys(), QHash::keys() */ -QVector QCborMap::keys() const +QList QCborMap::keys() const { - QVector result; + QList result; if (d) { result.reserve(size()); for (qsizetype i = 0; i < d->elements.size(); i += 2) diff --git a/src/corelib/serialization/qcborvalue.cpp b/src/corelib/serialization/qcborvalue.cpp index b9eb2b646c..7e2d8003c7 100644 --- a/src/corelib/serialization/qcborvalue.cpp +++ b/src/corelib/serialization/qcborvalue.cpp @@ -1494,7 +1494,7 @@ static inline QCborContainerPrivate *createContainerFromCbor(QCborStreamReader & // Clamp allocation to 1M elements (avoids crashing due to corrupt // stream or loss of precision when converting from quint64 to - // QVector::size_type). + // QList::size_type). len = qMin(len, quint64(1024 * 1024 - 1)); if (len) { d = new QCborContainerPrivate; diff --git a/src/corelib/serialization/qdatastream.cpp b/src/corelib/serialization/qdatastream.cpp index 316a164c6d..7888296b85 100644 --- a/src/corelib/serialization/qdatastream.cpp +++ b/src/corelib/serialization/qdatastream.cpp @@ -163,7 +163,7 @@ QT_BEGIN_NAMESPACE \section1 Reading and Writing Qt Collection Classes The Qt container classes can also be serialized to a QDataStream. - These include QList, QVector, QSet, QHash, and QMap. + These include QList, QSet, QHash, and QMap. The stream operators are declared as non-members of the classes. \target Serializing Qt Classes diff --git a/src/corelib/serialization/qxmlstream.cpp b/src/corelib/serialization/qxmlstream.cpp index c26b0d11d2..21f80eec66 100644 --- a/src/corelib/serialization/qxmlstream.cpp +++ b/src/corelib/serialization/qxmlstream.cpp @@ -1935,7 +1935,7 @@ QStringRef QXmlStreamReader::text() const /*! If the tokenType() is \l DTD, this function returns the DTD's notation declarations. Otherwise an empty vector is returned. - The QXmlStreamNotationDeclarations class is defined to be a QVector + The QXmlStreamNotationDeclarations class is defined to be a QList of QXmlStreamNotationDeclaration. */ QXmlStreamNotationDeclarations QXmlStreamReader::notationDeclarations() const @@ -1950,7 +1950,7 @@ QXmlStreamNotationDeclarations QXmlStreamReader::notationDeclarations() const /*! If the tokenType() is \l DTD, this function returns the DTD's unparsed (external) entity declarations. Otherwise an empty vector is returned. - The QXmlStreamEntityDeclarations class is defined to be a QVector + The QXmlStreamEntityDeclarations class is defined to be a QList of QXmlStreamEntityDeclaration. */ QXmlStreamEntityDeclarations QXmlStreamReader::entityDeclarations() const @@ -2046,7 +2046,7 @@ void QXmlStreamReader::setEntityExpansionLimit(int limit) element's namespace declarations. Otherwise an empty vector is returned. - The QXmlStreamNamespaceDeclarations class is defined to be a QVector + The QXmlStreamNamespaceDeclarations class is defined to be a QList of QXmlStreamNamespaceDeclaration. \sa addExtraNamespaceDeclaration(), addExtraNamespaceDeclarations() @@ -2428,7 +2428,7 @@ QXmlStreamAttribute& QXmlStreamAttribute::operator=(const QXmlStreamAttribute &o \typedef QXmlStreamNotationDeclarations \relates QXmlStreamNotationDeclaration - Synonym for QVector. + Synonym for QList. */ @@ -2507,7 +2507,7 @@ Returns the public identifier. \typedef QXmlStreamNamespaceDeclarations \relates QXmlStreamNamespaceDeclaration - Synonym for QVector. + Synonym for QList. */ /*! @@ -2592,7 +2592,7 @@ Returns the namespaceUri. \typedef QXmlStreamEntityDeclarations \relates QXmlStreamEntityDeclaration - Synonym for QVector. + Synonym for QList. */ /*! diff --git a/src/corelib/text/qcollator_macx.cpp b/src/corelib/text/qcollator_macx.cpp index cb8e073d4a..62b3a904a0 100644 --- a/src/corelib/text/qcollator_macx.cpp +++ b/src/corelib/text/qcollator_macx.cpp @@ -127,7 +127,7 @@ QCollatorSortKey QCollator::sortKey(const QString &string) const } //Documentation recommends having it 5 times as big as the input - QVector ret(string.size() * 5); + QList ret(string.size() * 5); ItemCount actualSize; int status = UCGetCollationKey(d->collator, reinterpret_cast(string.constData()), diff --git a/src/corelib/text/qcollator_posix.cpp b/src/corelib/text/qcollator_posix.cpp index ffcd214cfb..92148fa315 100644 --- a/src/corelib/text/qcollator_posix.cpp +++ b/src/corelib/text/qcollator_posix.cpp @@ -98,7 +98,7 @@ QCollatorSortKey QCollator::sortKey(const QString &string) const QVarLengthArray original; stringToWCharArray(original, string); - QVector result(original.size()); + QList result(original.size()); if (d->isC()) { std::copy(original.cbegin(), original.cend(), result.begin()); } else { diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index 6c6b371532..40defe386f 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -4261,7 +4261,7 @@ QString QLocale::formattedDataSize(qint64 bytes, int precision, DataSizeFormats QStringList QLocale::uiLanguages() const { QStringList uiLanguages; - QVector locales; + QList locales; #ifndef QT_NO_SYSTEMLOCALE if (d->m_data == systemData()) { QVariant res = systemLocale()->query(QSystemLocale::UILanguages, QVariant()); diff --git a/src/corelib/text/qregexp.cpp b/src/corelib/text/qregexp.cpp index 68fc0d054f..d7a2434b52 100644 --- a/src/corelib/text/qregexp.cpp +++ b/src/corelib/text/qregexp.cpp @@ -51,7 +51,6 @@ #include "qstring.h" #include "qstringlist.h" #include "qstringmatcher.h" -#include "qvector.h" #include "private/qlocking_p.h" #include @@ -849,7 +848,7 @@ static bool isWord(QChar ch) Merges two vectors of ints and puts the result into the first one. */ -static void mergeInto(QVector *a, const QVector &b) +static void mergeInto(QList *a, const QList &b) { int asize = a->size(); int bsize = b.size(); @@ -862,7 +861,7 @@ static void mergeInto(QVector *a, const QVector &b) #endif } else if (bsize >= 1) { int csize = asize + bsize; - QVector c(csize); + QList c(csize); int i = 0, j = 0, k = 0; while (i < asize) { if (j < bsize) { @@ -1035,8 +1034,6 @@ static size_t qHash(const QRegExpEngineKey &key, size_t seed = 0) noexcept class QRegExpEngine; -//Q_DECLARE_TYPEINFO(QVector, Q_MOVABLE_TYPE); - /* This is the engine state during matching. */ @@ -1064,7 +1061,7 @@ struct QRegExpMatchState int slideTabSize; // size of slide table int capturedSize; #ifndef QT_NO_REGEXP_BACKREF - QList > sleeping; // list of back-reference sleepers + QList> sleeping; // list of back-reference sleepers #endif int matchLen; // length of match int oneTestMatchedLen; // length of partial match @@ -1094,7 +1091,7 @@ struct QRegExpAutomatonState int atom; // which atom does this state belong to? #endif int match; // what does it match? (see CharClassBit and BackRefBit) - QVector outs; // out-transitions + QList outs; // out-transitions QMap reenter; // atoms reentered when transiting out QMap anchors; // anchors met when transiting out @@ -1176,7 +1173,7 @@ public: bool in(QChar ch) const; #ifndef QT_NO_REGEXP_OPTIM - const QVector &firstOccurrence() const { return occ1; } + const QList &firstOccurrence() const { return occ1; } #endif #if defined(QT_DEBUG) @@ -1184,9 +1181,9 @@ public: #endif private: - QVector r; // character ranges + QList r; // character ranges #ifndef QT_NO_REGEXP_OPTIM - QVector occ1; // first-occurrence array + QList occ1; // first-occurrence array #endif uint c; // character classes bool n; // negative? @@ -1199,8 +1196,8 @@ struct QRegExpCharClass #ifndef QT_NO_REGEXP_OPTIM QRegExpCharClass() { occ1.fill(0, NumBadChars); } - const QVector &firstOccurrence() const { return occ1; } - QVector occ1; + const QList &firstOccurrence() const { return occ1; } + QList occ1; #endif }; #endif @@ -1230,9 +1227,9 @@ public: int createState(int bref); #endif - void addCatTransitions(const QVector &from, const QVector &to); + void addCatTransitions(const QList &from, const QList &to); #ifndef QT_NO_REGEXP_CAPTURE - void addPlusTransitions(const QVector &from, const QVector &to, int atom); + void addPlusTransitions(const QList &from, const QList &to, int atom); #endif #ifndef QT_NO_REGEXP_ANCHOR_ALT @@ -1290,23 +1287,23 @@ private: bool bruteMatch(QRegExpMatchState &matchState) const; #endif - QVector s; // array of states + QList s; // array of states #ifndef QT_NO_REGEXP_CAPTURE - QVector f; // atom hierarchy + QList f; // atom hierarchy int nf; // number of atoms int cf; // current atom - QVector captureForOfficialCapture; + QList captureForOfficialCapture; #endif int officialncap; // number of captures, seen from the outside int ncap; // number of captures, seen from the inside #ifndef QT_NO_REGEXP_CCLASS - QVector cl; // array of character classes + QList cl; // array of character classes #endif #ifndef QT_NO_REGEXP_LOOKAHEAD - QVector ahead; // array of lookaheads + QList ahead; // array of lookaheads #endif #ifndef QT_NO_REGEXP_ANCHOR_ALT - QVector aa; // array of (a, b) pairs of anchors + QList aa; // array of (a, b) pairs of anchors #endif #ifndef QT_NO_REGEXP_OPTIM bool caretAnchored; // does the regexp start with ^? @@ -1328,7 +1325,7 @@ private: QString goodStr; // the string that any match has to contain int minl; // the minimum length of a match - QVector occ1; // first-occurrence array + QList occ1; // first-occurrence array #endif /* @@ -1370,8 +1367,8 @@ private: void addAnchorsToEngine(const Box &to) const; QRegExpEngine *eng; // the automaton under construction - QVector ls; // the left states (firstpos) - QVector rs; // the right states (lastpos) + QList ls; // the left states (firstpos) + QList rs; // the right states (lastpos) QMap lanchors; // the left anchors QMap ranchors; // the right anchors int skipanchors; // the anchors to match if the box is skipped @@ -1387,7 +1384,7 @@ private: int minl; // the minimum length of this box #ifndef QT_NO_REGEXP_OPTIM - QVector occ1; // first-occurrence array + QList occ1; // first-occurrence array #endif }; @@ -1502,7 +1499,7 @@ QRegExpEngine::~QRegExpEngine() void QRegExpMatchState::prepareForMatch(QRegExpEngine *eng) { /* - We use one QVector for all the big data used a lot in + We use one QList for all the big data used a lot in matchHere() and friends. */ int ns = eng->s.size(); // number of states @@ -1661,18 +1658,18 @@ int QRegExpEngine::createState(int bref) capturing. */ -void QRegExpEngine::addCatTransitions(const QVector &from, const QVector &to) +void QRegExpEngine::addCatTransitions(const QList &from, const QList &to) { for (int i = 0; i < from.size(); i++) mergeInto(&s[from.at(i)].outs, to); } #ifndef QT_NO_REGEXP_CAPTURE -void QRegExpEngine::addPlusTransitions(const QVector &from, const QVector &to, int atom) +void QRegExpEngine::addPlusTransitions(const QList &from, const QList &to, int atom) { for (int i = 0; i < from.size(); i++) { QRegExpAutomatonState &st = s[from.at(i)]; - const QVector oldOuts = st.outs; + const QList oldOuts = st.outs; mergeInto(&st.outs, to); if (f.at(atom).capture != QRegExpAtom::NoCapture) { for (int j = 0; j < to.size(); j++) { @@ -1971,7 +1968,7 @@ bool QRegExpMatchState::testAnchor(int i, int a, const int *capBegin) #endif #ifndef QT_NO_REGEXP_LOOKAHEAD if ((a & QRegExpEngine::Anchor_LookaheadMask) != 0) { - const QVector &ahead = eng->ahead; + const QList &ahead = eng->ahead; for (j = 0; j < ahead.size(); j++) { if ((a & (QRegExpEngine::Anchor_FirstLookahead << j)) != 0) { QRegExpMatchState matchState; @@ -2134,7 +2131,7 @@ bool QRegExpMatchState::matchHere() for (j = 0; j < ncur; j++) { int cur = curStack[j]; const QRegExpAutomatonState &scur = eng->s.at(cur); - const QVector &outs = scur.outs; + const QList &outs = scur.outs; for (k = 0; k < outs.size(); k++) { int next = outs.at(k); const QRegExpAutomatonState &snext = eng->s.at(next); @@ -2363,7 +2360,7 @@ bool QRegExpMatchState::matchHere() nextStack. */ if (needSomeSleep > 0) { - QVector zzZ(2 + 2 * ncap); + QList zzZ(2 + 2 * ncap); zzZ[0] = i + needSomeSleep; zzZ[1] = next; if (ncap > 0) { @@ -2394,7 +2391,7 @@ bool QRegExpMatchState::matchHere() j = 0; while (j < sleeping.count()) { if (sleeping.at(j)[0] == i) { - const QVector &zzZ = sleeping.at(j); + const QList &zzZ = sleeping.at(j); int next = zzZ[1]; const int *capBegin = zzZ.data() + 2; const int *capEnd = zzZ.data() + 2 + ncap; diff --git a/src/corelib/text/qregularexpression.cpp b/src/corelib/text/qregularexpression.cpp index 45d10c24f7..44bdc2e463 100644 --- a/src/corelib/text/qregularexpression.cpp +++ b/src/corelib/text/qregularexpression.cpp @@ -43,8 +43,8 @@ #include #include +#include #include -#include #include #include #include @@ -787,7 +787,7 @@ struct QRegularExpressionMatchPrivate : QSharedData // the capturedOffsets vector contains pairs of (start, end) positions // for each captured substring - QVector capturedOffsets; + QList capturedOffsets; int capturedCount = 0; diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index dff0dbce7f..5bd063ee42 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -3906,9 +3906,9 @@ QString &QString::replace(const QRegularExpression &re, const QString &after) int numCaptures = re.captureCount(); - // 1. build the backreferences vector, holding where the backreferences + // 1. build the backreferences list, holding where the backreferences // are in the replacement string - QVector backReferences; + QList backReferences; const int al = after.length(); const QChar *ac = after.unicode(); @@ -3940,7 +3940,7 @@ QString &QString::replace(const QRegularExpression &re, const QString &after) int newLength = 0; // length of the new string, with all the replacements int lastEnd = 0; - QVector chunks; + QList chunks; while (iterator.hasNext()) { QRegularExpressionMatch match = iterator.next(); int len; @@ -4317,8 +4317,8 @@ int QString::count(const QRegularExpression &re) const QString QString::section(const QString &sep, int start, int end, SectionFlags flags) const { - const QVector sections = splitRef(sep, Qt::KeepEmptyParts, - (flags & SectionCaseInsensitiveSeps) ? Qt::CaseInsensitive : Qt::CaseSensitive); + const QList sections = splitRef( + sep, Qt::KeepEmptyParts, (flags & SectionCaseInsensitiveSeps) ? Qt::CaseInsensitive : Qt::CaseSensitive); const int sectionsSize = sections.size(); if (!(flags & SectionSkipEmpty)) { if (start < 0) @@ -4373,10 +4373,7 @@ public: }; Q_DECLARE_TYPEINFO(qt_section_chunk, Q_MOVABLE_TYPE); -static QString extractSections(const QVector §ions, - int start, - int end, - QString::SectionFlags flags) +static QString extractSections(const QList §ions, int start, int end, QString::SectionFlags flags) { const int sectionsSize = sections.size(); @@ -4465,7 +4462,7 @@ QString QString::section(const QRegularExpression &re, int start, int end, Secti if (flags & SectionCaseInsensitiveSeps) sep.setPatternOptions(sep.patternOptions() | QRegularExpression::CaseInsensitiveOption); - QVector sections; + QList sections; int n = length(), m = 0, last_m = 0, last_len = 0; QRegularExpressionMatchIterator iterator = sep.globalMatch(*this); while (iterator.hasNext()) { @@ -4951,30 +4948,30 @@ QByteArray QtPrivate::convertToUtf8(QStringView string) return qt_convert_to_utf8(string); } -static QVector qt_convert_to_ucs4(QStringView string); +static QList qt_convert_to_ucs4(QStringView string); /*! \since 4.2 - Returns a UCS-4/UTF-32 representation of the string as a QVector. + Returns a UCS-4/UTF-32 representation of the string as a QList. UCS-4 is a Unicode codec and therefore it is lossless. All characters from this string will be encoded in UCS-4. Any invalid sequence of code units in this string is replaced by the Unicode's replacement character (QChar::ReplacementCharacter, which corresponds to \c{U+FFFD}). - The returned vector is not \\0'-terminated. + The returned list is not \\0'-terminated. \sa fromUtf8(), toUtf8(), toLatin1(), toLocal8Bit(), QStringEncoder, fromUcs4(), toWCharArray() */ -QVector QString::toUcs4() const +QList QString::toUcs4() const { return qt_convert_to_ucs4(*this); } -static QVector qt_convert_to_ucs4(QStringView string) +static QList qt_convert_to_ucs4(QStringView string) { - QVector v(string.length()); + QList v(string.length()); uint *a = const_cast(v.constData()); QStringIterator it(string); while (it.hasNext()) @@ -4988,19 +4985,19 @@ static QVector qt_convert_to_ucs4(QStringView string) \internal \relates QStringView - Returns a UCS-4/UTF-32 representation of \a string as a QVector. + Returns a UCS-4/UTF-32 representation of \a string as a QList. UCS-4 is a Unicode codec and therefore it is lossless. All characters from this string will be encoded in UCS-4. Any invalid sequence of code units in this string is replaced by the Unicode's replacement character (QChar::ReplacementCharacter, which corresponds to \c{U+FFFD}). - The returned vector is not \\0'-terminated. + The returned list is not \\0'-terminated. \sa QString::toUcs4(), QStringView::toUcs4(), QtPrivate::convertToLatin1(), QtPrivate::convertToLocal8Bit(), QtPrivate::convertToUtf8() */ -QVector QtPrivate::convertToUcs4(QStringView string) +QList QtPrivate::convertToUcs4(QStringView string) { return qt_convert_to_ucs4(string); } @@ -7242,10 +7239,9 @@ QStringList QString::split(const QString &sep, Qt::SplitBehavior behavior, Qt::C \since 5.14 \sa QStringRef split() */ -QVector QString::splitRef(const QString &sep, Qt::SplitBehavior behavior, - Qt::CaseSensitivity cs) const +QList QString::splitRef(const QString &sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const { - return splitString>(QStringRef(this), sep, behavior, cs); + return splitString>(QStringRef(this), sep, behavior, cs); } /*! @@ -7261,10 +7257,9 @@ QStringList QString::split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensit \overload \since 5.14 */ -QVector QString::splitRef(QChar sep, Qt::SplitBehavior behavior, - Qt::CaseSensitivity cs) const +QList QString::splitRef(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const { - return splitString >(QStringRef(this), QStringView(&sep, 1), behavior, cs); + return splitString>(QStringRef(this), QStringView(&sep, 1), behavior, cs); } /*! @@ -7279,18 +7274,18 @@ QVector QString::splitRef(QChar sep, Qt::SplitBehavior behavior, \since 5.14 */ -QVector QStringRef::split(const QString &sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const +QList QStringRef::split(const QString &sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const { - return splitString >(*this, sep, behavior, cs); + return splitString>(*this, sep, behavior, cs); } /*! \overload \since 5.14 */ -QVector QStringRef::split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const +QList QStringRef::split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const { - return splitString >(*this, QStringView(&sep, 1), behavior, cs); + return splitString>(*this, QStringView(&sep, 1), behavior, cs); } /*! @@ -7311,7 +7306,7 @@ QVector QStringRef::split(QChar sep, Qt::SplitBehavior behavior, Qt: */ QList QStringView::split(QStringView sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const { - return splitString>(QStringView(*this), sep, behavior, cs); + return splitString>(QStringView(*this), sep, behavior, cs); } QList QStringView::split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const @@ -7388,16 +7383,16 @@ QStringList QString::split(const QRegularExpression &re, Qt::SplitBehavior behav Splits the string into substring references wherever the regular expression \a re matches, and returns the list of those strings. If \a re does not match anywhere in the string, splitRef() returns a - single-element vector containing this string reference. + single-element list containing this string reference. \note All references are valid as long this string is alive. Destroying this string will cause all references to be dangling pointers. \sa split() QStringRef */ -QVector QString::splitRef(const QRegularExpression &re, Qt::SplitBehavior behavior) const +QList QString::splitRef(const QRegularExpression &re, Qt::SplitBehavior behavior) const { - return splitString >(QStringRef(this), re, behavior); + return splitString>(QStringRef(this), re, behavior); } /*! @@ -7406,7 +7401,7 @@ QVector QString::splitRef(const QRegularExpression &re, Qt::SplitBeh Splits the string into substring views wherever the regular expression \a re matches, and returns the list of those strings. If \a re does not match anywhere in the string, splitRef() returns a - single-element vector containing this string reference. + single-element list containing this string reference. \note All references are valid as long this string is alive. Destroying this string will cause all references to be dangling pointers. @@ -11638,18 +11633,18 @@ QByteArray QStringRef::toUtf8() const /*! \since 4.8 - Returns a UCS-4/UTF-32 representation of the string as a QVector. + Returns a UCS-4/UTF-32 representation of the string as a QList. UCS-4 is a Unicode codec and therefore it is lossless. All characters from this string will be encoded in UCS-4. Any invalid sequence of code units in this string is replaced by the Unicode's replacement character (QChar::ReplacementCharacter, which corresponds to \c{U+FFFD}). - The returned vector is not \\0'-terminated. + The returned list is not \\0'-terminated. \sa toUtf8(), toLatin1(), toLocal8Bit(), QStringEncoder */ -QVector QStringRef::toUcs4() const +QList QStringRef::toUcs4() const { return qt_convert_to_ucs4(*this); } diff --git a/src/corelib/text/qstringtokenizer.cpp b/src/corelib/text/qstringtokenizer.cpp index 043269a3ac..a0316e568d 100644 --- a/src/corelib/text/qstringtokenizer.cpp +++ b/src/corelib/text/qstringtokenizer.cpp @@ -296,7 +296,7 @@ QT_BEGIN_NAMESPACE \code // assuming tok's value_type is QStringView, then... auto tok = QStringTokenizer{~~~}; - // ... rac1 is a QVector: + // ... rac1 is a QList: auto rac1 = tok.toContainer(); // ... rac2 is std::pmr::vector: auto rac2 = tok.toContainer>(); diff --git a/src/corelib/text/qstringview.cpp b/src/corelib/text/qstringview.cpp index 092f58a90a..985d87ac51 100644 --- a/src/corelib/text/qstringview.cpp +++ b/src/corelib/text/qstringview.cpp @@ -107,7 +107,7 @@ QT_BEGIN_NAMESPACE \note We strongly discourage the use of QList, because QList is a very inefficient container for QStringViews (it would heap-allocate - every element). Use QVector (or std::vector) to hold QStringViews instead. + every element). Use QList (or std::vector) to hold QStringViews instead. \sa QString, QStringRef */ @@ -898,16 +898,16 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QVector QStringView::toUcs4() const + \fn QList QStringView::toUcs4() const - Returns a UCS-4/UTF-32 representation of the string as a QVector. + Returns a UCS-4/UTF-32 representation of the string as a QList. UCS-4 is a Unicode codec and therefore it is lossless. All characters from this string will be encoded in UCS-4. Any invalid sequence of code units in this string is replaced by the Unicode replacement character (QChar::ReplacementCharacter, which corresponds to \c{U+FFFD}). - The returned vector is not 0-terminated. + The returned list is not 0-terminated. \sa toUtf8(), toLatin1(), toLocal8Bit(), QStringEncoder */ diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index 78c4d8d672..ffd476d6d3 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -135,8 +135,8 @@ void QAdoptedThread::init() d_func()->id = GetCurrentThreadId(); } -static QVector qt_adopted_thread_handles; -static QVector qt_adopted_qthreads; +static QList qt_adopted_thread_handles; +static QList qt_adopted_qthreads; static QBasicMutex qt_adopted_thread_watcher_mutex; static DWORD qt_adopted_thread_watcher_id = 0; static HANDLE qt_adopted_thread_wakeup = 0; @@ -188,7 +188,7 @@ DWORD WINAPI qt_adopted_thread_watcher_function(LPVOID) break; } - QVector handlesCopy = qt_adopted_thread_handles; + QList handlesCopy = qt_adopted_thread_handles; qt_adopted_thread_watcher_mutex.unlock(); DWORD ret = WAIT_TIMEOUT; diff --git a/src/corelib/thread/qthreadstorage.cpp b/src/corelib/thread/qthreadstorage.cpp index 464559ffa5..9c9a63d29b 100644 --- a/src/corelib/thread/qthreadstorage.cpp +++ b/src/corelib/thread/qthreadstorage.cpp @@ -69,7 +69,7 @@ void qtsDebug(const char *fmt, ...) #endif static QBasicMutex destructorsMutex; -typedef QVector DestructorMap; +typedef QList DestructorMap; Q_GLOBAL_STATIC(DestructorMap, destructors) QThreadStorageData::QThreadStorageData(void (*func)(void *)) @@ -118,7 +118,7 @@ void **QThreadStorageData::get() const qWarning("QThreadStorage::get: QThreadStorage can only be used with threads started with QThread"); return nullptr; } - QVector &tls = data->tls; + QList &tls = data->tls; if (tls.size() <= id) tls.resize(id + 1); void **v = &tls[id]; @@ -138,7 +138,7 @@ void **QThreadStorageData::set(void *p) qWarning("QThreadStorage::set: QThreadStorage can only be used with threads started with QThread"); return nullptr; } - QVector &tls = data->tls; + QList &tls = data->tls; if (tls.size() <= id) tls.resize(id + 1); @@ -170,7 +170,7 @@ void **QThreadStorageData::set(void *p) void QThreadStorageData::finish(void **p) { - QVector *tls = reinterpret_cast *>(p); + QList *tls = reinterpret_cast *>(p); if (!tls || tls->isEmpty() || !destructors()) return; // nothing to do diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index 183bc0f5ef..7a3e49e076 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -4748,7 +4748,7 @@ QDateTime QDateTime::fromString(const QString &string, Qt::DateFormat format) return QDateTime(date, time, spec, offset); } case Qt::TextDate: { - QVector parts = QStringView{string}.split(QLatin1Char(' '), Qt::SkipEmptyParts); + QList parts = QStringView { string }.split(QLatin1Char(' '), Qt::SkipEmptyParts); if ((parts.count() < 5) || (parts.count() > 6)) return QDateTime(); @@ -4800,7 +4800,7 @@ QDateTime QDateTime::fromString(const QString &string, Qt::DateFormat format) return QDateTime(); // ### fixme, use QStringView::tokenize() when available - QVector timeParts = parts.at(timePart).split(QLatin1Char(':')); + QList timeParts = parts.at(timePart).split(QLatin1Char(':')); if (timeParts.count() < 2 || timeParts.count() > 3) return QDateTime(); @@ -4816,7 +4816,7 @@ QDateTime QDateTime::fromString(const QString &string, Qt::DateFormat format) int millisecond = 0; if (timeParts.count() > 2) { // ### fixme, use QStringView::tokenize() when available - const QVector secondParts = timeParts.at(2).split(QLatin1Char('.')); + const QList secondParts = timeParts.at(2).split(QLatin1Char('.')); if (secondParts.size() > 2) { return QDateTime(); } diff --git a/src/corelib/time/qdatetimeparser.cpp b/src/corelib/time/qdatetimeparser.cpp index 1ca2f3735f..dd9e1507e4 100644 --- a/src/corelib/time/qdatetimeparser.cpp +++ b/src/corelib/time/qdatetimeparser.cpp @@ -414,7 +414,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat) QDTPDEBUGN("parseFormat: %s", newFormat.toLatin1().constData()); - QVector newSectionNodes; + QList newSectionNodes; Sections newDisplay; QStringList newSeparators; int i, index = 0; diff --git a/src/corelib/time/qtimezone.cpp b/src/corelib/time/qtimezone.cpp index 87d8ea75f1..24834d1284 100644 --- a/src/corelib/time/qtimezone.cpp +++ b/src/corelib/time/qtimezone.cpp @@ -310,7 +310,7 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz); /*! \typedef QTimeZone::OffsetDataList - Synonym for QVector. + Synonym for QList. */ /*! diff --git a/src/corelib/time/qtimezoneprivate_tz.cpp b/src/corelib/time/qtimezoneprivate_tz.cpp index bbfd502bc2..7a31677db0 100644 --- a/src/corelib/time/qtimezoneprivate_tz.cpp +++ b/src/corelib/time/qtimezoneprivate_tz.cpp @@ -193,9 +193,9 @@ static QTzHeader parseTzHeader(QDataStream &ds, bool *ok) return hdr; } -static QVector parseTzTransitions(QDataStream &ds, int tzh_timecnt, bool longTran) +static QList parseTzTransitions(QDataStream &ds, int tzh_timecnt, bool longTran) { - QVector transitions(tzh_timecnt); + QList transitions(tzh_timecnt); if (longTran) { // Parse tzh_timecnt x 8-byte transition times @@ -226,9 +226,9 @@ static QVector parseTzTransitions(QDataStream &ds, int tzh_timecn return transitions; } -static QVector parseTzTypes(QDataStream &ds, int tzh_typecnt) +static QList parseTzTypes(QDataStream &ds, int tzh_typecnt) { - QVector types(tzh_typecnt); + QList types(tzh_typecnt); // Parse tzh_typecnt x transition types for (int i = 0; i < tzh_typecnt && ds.status() == QDataStream::Ok; ++i) { @@ -248,7 +248,7 @@ static QVector parseTzTypes(QDataStream &ds, int tzh_typecnt) return types; } -static QMap parseTzAbbreviations(QDataStream &ds, int tzh_charcnt, const QVector &types) +static QMap parseTzAbbreviations(QDataStream &ds, int tzh_charcnt, const QList &types) { // Parse the abbreviation list which is tzh_charcnt long with '\0' separated strings. The // QTzType.tz_abbrind index points to the first char of the abbreviation in the array, not the @@ -304,9 +304,10 @@ static void parseTzLeapSeconds(QDataStream &ds, int tzh_leapcnt, bool longTran) } } -static QVector parseTzIndicators(QDataStream &ds, const QVector &types, int tzh_ttisstdcnt, int tzh_ttisgmtcnt) +static QList parseTzIndicators(QDataStream &ds, const QList &types, int tzh_ttisstdcnt, + int tzh_ttisgmtcnt) { - QVector result = types; + QList result = types; bool temp; /* Scan and discard indicators. @@ -531,11 +532,10 @@ PosixZone PosixZone::parse(const char *&pos, const char *end) return {std::move(name), offset}; } -static QVector calculatePosixTransitions(const QByteArray &posixRule, - int startYear, int endYear, - qint64 lastTranMSecs) +static QList calculatePosixTransitions(const QByteArray &posixRule, int startYear, int endYear, + qint64 lastTranMSecs) { - QVector result; + QList result; // POSIX Format is like "TZ=CST6CDT,M3.2.0/2:00:00,M11.1.0/2:00:00" // i.e. "std offset dst [offset],start[/time],end[/time]" @@ -699,10 +699,10 @@ QTzTimeZoneCacheEntry QTzTimeZoneCache::findEntry(const QByteArray &ianaId) QTzHeader hdr = parseTzHeader(ds, &ok); if (!ok || ds.status() != QDataStream::Ok) return ret; - QVector tranList = parseTzTransitions(ds, hdr.tzh_timecnt, false); + QList tranList = parseTzTransitions(ds, hdr.tzh_timecnt, false); if (ds.status() != QDataStream::Ok) return ret; - QVector typeList = parseTzTypes(ds, hdr.tzh_typecnt); + QList typeList = parseTzTypes(ds, hdr.tzh_typecnt); if (ds.status() != QDataStream::Ok) return ret; QMap abbrevMap = parseTzAbbreviations(ds, hdr.tzh_charcnt, typeList); @@ -747,7 +747,7 @@ QTzTimeZoneCacheEntry QTzTimeZoneCache::findEntry(const QByteArray &ianaId) const int size = abbrevMap.size(); ret.m_abbreviations.clear(); ret.m_abbreviations.reserve(size); - QVector abbrindList; + QList abbrindList; abbrindList.reserve(size); for (auto it = abbrevMap.cbegin(), end = abbrevMap.cend(); it != end; ++it) { ret.m_abbreviations.append(it.value()); @@ -1008,7 +1008,7 @@ QTimeZonePrivate::Data QTzTimeZonePrivate::dataForTzTransition(QTzTransitionTime return data; } -QVector QTzTimeZonePrivate::getPosixTransitions(qint64 msNear) const +QList QTzTimeZonePrivate::getPosixTransitions(qint64 msNear) const { const int year = QDateTime::fromMSecsSinceEpoch(msNear, Qt::UTC).date().year(); // The Data::atMSecsSinceEpoch of the single entry if zone is constant: @@ -1022,7 +1022,7 @@ QTimeZonePrivate::Data QTzTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const // and we have a POSIX rule, then use it: if (!cached_data.m_posixRule.isEmpty() && (tranCache().isEmpty() || tranCache().last().atMSecsSinceEpoch < forMSecsSinceEpoch)) { - QVector posixTrans = getPosixTransitions(forMSecsSinceEpoch); + QList posixTrans = getPosixTransitions(forMSecsSinceEpoch); auto it = std::partition_point(posixTrans.cbegin(), posixTrans.cend(), [forMSecsSinceEpoch] (const QTimeZonePrivate::Data &at) { return at.atMSecsSinceEpoch <= forMSecsSinceEpoch; @@ -1060,7 +1060,7 @@ QTimeZonePrivate::Data QTzTimeZonePrivate::nextTransition(qint64 afterMSecsSince // and we have a POSIX rule, then use it: if (!cached_data.m_posixRule.isEmpty() && (tranCache().isEmpty() || tranCache().last().atMSecsSinceEpoch < afterMSecsSinceEpoch)) { - QVector posixTrans = getPosixTransitions(afterMSecsSinceEpoch); + QList posixTrans = getPosixTransitions(afterMSecsSinceEpoch); auto it = std::partition_point(posixTrans.cbegin(), posixTrans.cend(), [afterMSecsSinceEpoch] (const QTimeZonePrivate::Data &at) { return at.atMSecsSinceEpoch <= afterMSecsSinceEpoch; @@ -1083,7 +1083,7 @@ QTimeZonePrivate::Data QTzTimeZonePrivate::previousTransition(qint64 beforeMSecs // and we have a POSIX rule, then use it: if (!cached_data.m_posixRule.isEmpty() && (tranCache().isEmpty() || tranCache().last().atMSecsSinceEpoch < beforeMSecsSinceEpoch)) { - QVector posixTrans = getPosixTransitions(beforeMSecsSinceEpoch); + QList posixTrans = getPosixTransitions(beforeMSecsSinceEpoch); auto it = std::partition_point(posixTrans.cbegin(), posixTrans.cend(), [beforeMSecsSinceEpoch] (const QTimeZonePrivate::Data &at) { return at.atMSecsSinceEpoch < beforeMSecsSinceEpoch; diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc index a4a30cc798..d480f2b487 100644 --- a/src/corelib/tools/qalgorithms.qdoc +++ b/src/corelib/tools/qalgorithms.qdoc @@ -39,7 +39,7 @@ on all items in a given container or in a given range. You can use these algorithms with any \l {container class} that provides STL-style iterators, including Qt's QList, - QVector, QMap, and QHash classes. + QMap, and QHash classes. Most algorithms take \l {STL-style iterators} as parameters. The algorithms are generic in the sense that they aren't bound to a @@ -143,7 +143,7 @@ \row \li \c{i < j} \li returns \c true if iterator \c j comes after iterator \c i \endtable - QList and QVector's non-const iterator types are random access iterators. + QList's non-const iterator type is random access iterator. \section1 Qt and the STL Algorithms diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp index 12ad6f4573..9bcd6a9306 100644 --- a/src/corelib/tools/qbitarray.cpp +++ b/src/corelib/tools/qbitarray.cpp @@ -107,7 +107,7 @@ QT_BEGIN_NAMESPACE QBitArray(0). We recommend that you always use isEmpty() and avoid isNull(). - \sa QByteArray, QVector + \sa QByteArray, QList */ /*! diff --git a/src/corelib/tools/qcommandlineparser.cpp b/src/corelib/tools/qcommandlineparser.cpp index 9dec2e1474..1b93fb84cf 100644 --- a/src/corelib/tools/qcommandlineparser.cpp +++ b/src/corelib/tools/qcommandlineparser.cpp @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) # include @@ -109,7 +109,7 @@ public: QString description; QString syntax; }; - QVector positionalArgumentDefinitions; + QList positionalArgumentDefinitions; //! The parsing mode for "-abc" QCommandLineParser::SingleDashWordOptionMode singleDashWordOptionMode; diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 1207ce0659..b9bde51d21 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -308,7 +308,7 @@ #endif #include -#include +#include QT_BEGIN_NAMESPACE @@ -357,7 +357,7 @@ QDataStream &operator>>(QDataStream &stream, TCBPoint &point) return stream; } -typedef QVector TCBPoints; +typedef QList TCBPoints; class QEasingCurveFunction { @@ -375,7 +375,7 @@ public: qreal _p; qreal _a; qreal _o; - QVector _bezierCurves; + QList _bezierCurves; TCBPoints _tcbPoints; }; @@ -468,8 +468,8 @@ struct BezierEase : public QEasingCurveFunction qreal p3x, p3y; }; - QVector _curves; - QVector _intervals; + QList _curves; + QList _intervals; int _curveCount; bool _init; bool _valid; @@ -1307,10 +1307,10 @@ void QEasingCurve::addCubicBezierSegment(const QPointF & c1, const QPointF & c2, d_ptr->config->_bezierCurves << c1 << c2 << endPoint; } -QVector static inline tcbToBezier(const TCBPoints &tcbPoints) +QList static inline tcbToBezier(const TCBPoints &tcbPoints) { const int count = tcbPoints.count(); - QVector bezierPoints; + QList bezierPoints; bezierPoints.reserve(3 * (count - 1)); for (int i = 1; i < count; i++) { @@ -1388,9 +1388,9 @@ void QEasingCurve::addTCBSegment(const QPointF &nextPoint, qreal t, qreal c, qre If the easing curve does not have a custom bezier easing curve the list is empty. */ -QVector QEasingCurve::toCubicSpline() const +QList QEasingCurve::toCubicSpline() const { - return d_ptr->config ? d_ptr->config->_bezierCurves : QVector(); + return d_ptr->config ? d_ptr->config->_bezierCurves : QList(); } /*! @@ -1406,8 +1406,8 @@ void QEasingCurvePrivate::setType_helper(QEasingCurve::Type newType) qreal amp = -1.0; qreal period = -1.0; qreal overshoot = -1.0; - QVector bezierCurves; - QVector tcbPoints; + QList bezierCurves; + QList tcbPoints; if (config) { amp = config->_a; diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp index 6c9eba0c66..fd2136c8ef 100644 --- a/src/corelib/tools/qmap.cpp +++ b/src/corelib/tools/qmap.cpp @@ -43,7 +43,7 @@ #ifdef QT_QMAP_DEBUG # include -# include +# include #endif QT_BEGIN_NAMESPACE diff --git a/src/corelib/tools/qstack.cpp b/src/corelib/tools/qstack.cpp index af72313a67..849a474d2c 100644 --- a/src/corelib/tools/qstack.cpp +++ b/src/corelib/tools/qstack.cpp @@ -61,10 +61,10 @@ The example will output 3, 2, 1 in that order. - QStack inherits from QVector. All of QVector's functionality also + QStack inherits from QList. All of QList's functionality also applies to QStack. For example, you can use isEmpty() to test whether the stack is empty, and you can traverse a QStack using - QVector's iterator classes (for example, QVectorIterator). But in + QList's iterator classes (for example, QListIterator). But in addition, QStack provides three convenience functions that make it easy to implement LIFO semantics: push(), pop(), and top(). @@ -73,7 +73,7 @@ won't let you, for example, store a QWidget as a value; instead, store a QWidget *. - \sa QVector, QQueue + \sa QList, QQueue */ /*! @@ -89,7 +89,7 @@ Adds element \a t to the top of the stack. - This is the same as QVector::append(). + This is the same as QList::append(). \sa pop(), top() */ @@ -100,7 +100,7 @@ Returns a reference to the stack's top item. This function assumes that the stack isn't empty. - This is the same as QVector::last(). + This is the same as QList::last(). \sa pop(), push(), isEmpty() */ diff --git a/src/corelib/tools/qvector_msvc.cpp b/src/corelib/tools/qvector_msvc.cpp index 7e87467d42..e3815852dc 100644 --- a/src/corelib/tools/qvector_msvc.cpp +++ b/src/corelib/tools/qvector_msvc.cpp @@ -38,7 +38,7 @@ ****************************************************************************/ // ### Qt6: verify if we can remove this, somehow. -// First, try to see if the extern template from qvector.h is necessary. +// First, try to see if the extern template from qlist.h is necessary. // If it still is, check if removing the copy constructors in qarraydata.h // make the calling convention of both sets of begin() and end() functions // match, as it does for the IA-64 C++ ABI. @@ -47,5 +47,5 @@ # error "This file must be compiled with no precompiled headers" #endif -// the Q_TEMPLATE_EXTERN at the bottom of qvector.h will do the trick -#include +// the Q_TEMPLATE_EXTERN at the bottom of qlist.h will do the trick +#include diff --git a/src/corelib/tools/qversionnumber.cpp b/src/corelib/tools/qversionnumber.cpp index 4aed715999..517f026547 100644 --- a/src/corelib/tools/qversionnumber.cpp +++ b/src/corelib/tools/qversionnumber.cpp @@ -96,13 +96,13 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QVersionNumber::QVersionNumber(const QVector &seg) + \fn QVersionNumber::QVersionNumber(const QList &seg) Constructs a version number from the list of numbers contained in \a seg. */ /*! - \fn QVersionNumber::QVersionNumber(QVector &&seg) + \fn QVersionNumber::QVersionNumber(QList &&seg) Move-constructs a version number from the list of numbers contained in \a seg. @@ -168,18 +168,18 @@ QT_BEGIN_NAMESPACE */ /*! - \fn const QVector& QVersionNumber::segments() const + \fn const QList& QVersionNumber::segments() const Returns all of the numerical segments. \sa majorVersion(), minorVersion(), microVersion() */ -QVector QVersionNumber::segments() const +QList QVersionNumber::segments() const { if (m_segments.isUsingPointer()) return *m_segments.pointer_segments; - QVector result; + QList result; result.resize(segmentCount()); for (int i = 0; i < segmentCount(); ++i) result[i] = segmentAt(i); @@ -462,7 +462,7 @@ QVersionNumber QVersionNumber::fromString(QStringView string, int *suffixIndex) */ QVersionNumber QVersionNumber::fromString(QLatin1String string, int *suffixIndex) { - QVector seg; + QList seg; const char *start = string.begin(); const char *end = start; @@ -487,7 +487,7 @@ QVersionNumber QVersionNumber::fromString(QLatin1String string, int *suffixIndex void QVersionNumber::SegmentStorage::setVector(int len, int maj, int min, int mic) { - pointer_segments = new QVector; + pointer_segments = new QList; pointer_segments->resize(len); pointer_segments->data()[0] = maj; if (len > 1) { @@ -525,7 +525,7 @@ QDataStream& operator<<(QDataStream &out, const QVersionNumber &version) QDataStream& operator>>(QDataStream &in, QVersionNumber &version) { if (!version.m_segments.isUsingPointer()) - version.m_segments.pointer_segments = new QVector; + version.m_segments.pointer_segments = new QList; in >> *version.m_segments.pointer_segments; return in; } -- cgit v1.2.3