Use QList instead of QVector in qtbase
Fixes all other QVector occurrences Task-number: QTBUG-84469 Change-Id: I5f9311298d341a9a3061a6a640539583d1618939 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
989fca660c
commit
77bb50de8f
@ -184,19 +184,19 @@ QFuture<QString> fooString =
|
||||
|
||||
//! [15]
|
||||
// keep only even integers
|
||||
QVector<int> vector { 1, 2, 3, 4 };
|
||||
QtConcurrent::blockingFilter(vector, [](int n) { return (n & 1) == 0; });
|
||||
QList<int> list { 1, 2, 3, 4 };
|
||||
QtConcurrent::blockingFilter(list, [](int n) { return (n & 1) == 0; });
|
||||
|
||||
// retrieve only even integers
|
||||
QVector<int> vector2 { 1, 2, 3, 4 };
|
||||
QFuture<int> future = QtConcurrent::filtered(vector2, [](int x) {
|
||||
QList<int> list2 { 1, 2, 3, 4 };
|
||||
QFuture<int> future = QtConcurrent::filtered(list2, [](int x) {
|
||||
return (x & 1) == 0;
|
||||
});
|
||||
QVector<int> results = future.results();
|
||||
QList<int> results = future.results();
|
||||
|
||||
// add up all even integers
|
||||
QVector<int> vector3 { 1, 2, 3, 4 };
|
||||
int sum = QtConcurrent::filteredReduced<int>(vector3,
|
||||
QList<int> list3 { 1, 2, 3, 4 };
|
||||
int sum = QtConcurrent::filteredReduced<int>(list3,
|
||||
[](int x) {
|
||||
return (x & 1) == 0;
|
||||
},
|
||||
@ -212,8 +212,8 @@ void intSumReduce(int &sum, int x)
|
||||
sum += x;
|
||||
}
|
||||
|
||||
QVector<int> vector { 1, 2, 3, 4 };
|
||||
int sum = QtConcurrent::filteredReduced(vector,
|
||||
QList<int> list { 1, 2, 3, 4 };
|
||||
int sum = QtConcurrent::filteredReduced(list,
|
||||
[] (int x) {
|
||||
return (x & 1) == 0;
|
||||
},
|
||||
@ -227,8 +227,8 @@ bool keepEvenIntegers(int x)
|
||||
return (x & 1) == 0;
|
||||
}
|
||||
|
||||
QVector<int> vector { 1, 2, 3, 4 };
|
||||
int sum = QtConcurrent::filteredReduced<int>(vector,
|
||||
QList<int> list { 1, 2, 3, 4 };
|
||||
int sum = QtConcurrent::filteredReduced<int>(list,
|
||||
keepEvenIntegers,
|
||||
[](int &sum, int x) {
|
||||
sum += x;
|
||||
|
@ -200,13 +200,13 @@ QFuture<QImage> thumbnails = QtConcurrent::mapped(images, Scaled(100));
|
||||
//! [14]
|
||||
|
||||
//! [15]
|
||||
QVector<int> vector { 1, 2, 3, 4 };
|
||||
QList<int> vector { 1, 2, 3, 4 };
|
||||
QtConcurrent::blockingMap(vector, [](int &x) { x *= 2; });
|
||||
|
||||
int size = 100;
|
||||
QVector<QImage> images = ...;
|
||||
QList<QImage> images = ...;
|
||||
|
||||
QVector<QImage> thumbnails = QtConcurrent::mapped(images,
|
||||
QList<QImage> thumbnails = QtConcurrent::mapped(images,
|
||||
[&size](const QImage &image) {
|
||||
return image.scaled(size, size);
|
||||
}
|
||||
@ -214,7 +214,7 @@ QVector<QImage> thumbnails = QtConcurrent::mapped(images,
|
||||
//! [15]
|
||||
|
||||
//! [16]
|
||||
QVector<QImage> collage = QtConcurrent::mappedReduced(images,
|
||||
QList<QImage> collage = QtConcurrent::mappedReduced(images,
|
||||
[&size](const QImage &image) {
|
||||
return image.scaled(size, size);
|
||||
},
|
||||
@ -223,7 +223,7 @@ QVector<QImage> collage = QtConcurrent::mappedReduced(images,
|
||||
//! [16]
|
||||
|
||||
//! [17]
|
||||
QVector<QImage> collage = QtConcurrent::mappedReduced<QImage>(images,
|
||||
QList<QImage> collage = QtConcurrent::mappedReduced<QImage>(images,
|
||||
[&size](const QImage &image) {
|
||||
return image.scaled(size, size);
|
||||
},
|
||||
|
@ -107,7 +107,7 @@
|
||||
|
||||
Qt Concurrent supports several STL-compatible container and iterator types,
|
||||
but works best with Qt containers that have random-access iterators, such as
|
||||
QList or QVector. The map and filter functions accept both containers and begin/end iterators.
|
||||
QList. The map and filter functions accept both containers and begin/end iterators.
|
||||
|
||||
STL Iterator support overview:
|
||||
|
||||
@ -134,7 +134,7 @@
|
||||
\li Supported
|
||||
\row
|
||||
\li Random Access Iterator
|
||||
\li QList, QVector, std::vector
|
||||
\li QList, std::vector
|
||||
\li Supported and Recommended
|
||||
\endtable
|
||||
|
||||
|
@ -50,7 +50,6 @@
|
||||
#include <QtCore/qmutex.h>
|
||||
#include <QtCore/qthread.h>
|
||||
#include <QtCore/qthreadpool.h>
|
||||
#include <QtCore/qvector.h>
|
||||
|
||||
#include <mutex>
|
||||
|
||||
|
@ -39,9 +39,8 @@
|
||||
|
||||
#include "private/qsqlcachedresult_p.h"
|
||||
|
||||
#include <qvariant.h>
|
||||
#include <qdatetime.h>
|
||||
#include <qvector.h>
|
||||
#include <qvariant.h>
|
||||
#include <QtSql/private/qsqldriver_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -42,8 +42,8 @@
|
||||
|
||||
#include <QtSql/qtsqlglobal.h>
|
||||
#include <QtSql/qsqlrecord.h>
|
||||
#include <QtCore/qlist.h>
|
||||
#include <QtCore/qstring.h>
|
||||
#include <QtCore/qvector.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -41,16 +41,15 @@
|
||||
|
||||
//#define QT_DEBUG_SQL
|
||||
|
||||
#include "qatomic.h"
|
||||
#include "qdebug.h"
|
||||
#include "qelapsedtimer.h"
|
||||
#include "qatomic.h"
|
||||
#include "qmap.h"
|
||||
#include "qsqlrecord.h"
|
||||
#include "qsqlresult.h"
|
||||
#include "qsqldriver.h"
|
||||
#include "qsqldatabase.h"
|
||||
#include "private/qsqlnulldriver_p.h"
|
||||
#include "qvector.h"
|
||||
#include "qmap.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -39,12 +39,12 @@
|
||||
|
||||
#include "qsqlrecord.h"
|
||||
|
||||
#include "qdebug.h"
|
||||
#include "qstringlist.h"
|
||||
#include "qatomic.h"
|
||||
#include "qdebug.h"
|
||||
#include "qlist.h"
|
||||
#include "qsqlfield.h"
|
||||
#include "qstring.h"
|
||||
#include "qvector.h"
|
||||
#include "qstringlist.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -39,15 +39,15 @@
|
||||
|
||||
#include "qsqlresult.h"
|
||||
|
||||
#include "qvariant.h"
|
||||
#include "qhash.h"
|
||||
#include "qlist.h"
|
||||
#include "qpointer.h"
|
||||
#include "qsqldriver.h"
|
||||
#include "qsqlerror.h"
|
||||
#include "qsqlfield.h"
|
||||
#include "qsqlrecord.h"
|
||||
#include "qvector.h"
|
||||
#include "qsqldriver.h"
|
||||
#include "qpointer.h"
|
||||
#include "qsqlresult_p.h"
|
||||
#include "qvariant.h"
|
||||
#include "private/qsqldriver_p.h"
|
||||
#include <QDebug>
|
||||
|
||||
|
@ -57,8 +57,8 @@
|
||||
#include "QtSql/qsqlquery.h"
|
||||
#include "QtSql/qsqlrecord.h"
|
||||
#include "QtCore/qhash.h"
|
||||
#include "QtCore/qlist.h"
|
||||
#include "QtCore/qvarlengtharray.h"
|
||||
#include "QtCore/qvector.h"
|
||||
|
||||
QT_REQUIRE_CONFIG(sqlmodel);
|
||||
|
||||
|
@ -44,9 +44,8 @@
|
||||
#include <QtCore/qlist.h>
|
||||
#include <QtCore/qobject.h>
|
||||
#include <QtCore/qmetaobject.h>
|
||||
#include <QtCore/qvariant.h>
|
||||
#include <QtCore/qvector.h>
|
||||
#include <QtTest/qtesteventloop.h>
|
||||
#include <QtCore/qvariant.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -42,23 +42,23 @@
|
||||
#include <QtTest/qtestassert.h>
|
||||
|
||||
#include <QtCore/qbytearray.h>
|
||||
#include <QtCore/qcoreapplication.h>
|
||||
#include <QtCore/qdebug.h>
|
||||
#include <QtCore/qdir.h>
|
||||
#include <QtCore/qdiriterator.h>
|
||||
#include <QtCore/qfile.h>
|
||||
#include <QtCore/qfileinfo.h>
|
||||
#include <QtCore/qfloat16.h>
|
||||
#include <QtCore/qlibraryinfo.h>
|
||||
#include <QtCore/qlist.h>
|
||||
#include <QtCore/qmetaobject.h>
|
||||
#include <QtCore/qobject.h>
|
||||
#include <QtCore/qstringlist.h>
|
||||
#include <QtCore/qvector.h>
|
||||
#include <QtCore/qvarlengtharray.h>
|
||||
#include <QtCore/qcoreapplication.h>
|
||||
#include <QtCore/qfile.h>
|
||||
#include <QtCore/qfileinfo.h>
|
||||
#include <QtCore/qdir.h>
|
||||
#include <QtCore/qdebug.h>
|
||||
#include <QtCore/qfloat16.h>
|
||||
#include <QtCore/qlibraryinfo.h>
|
||||
#include <QtCore/private/qtools_p.h>
|
||||
#include <QtCore/qdiriterator.h>
|
||||
#include <QtCore/qtemporarydir.h>
|
||||
#include <QtCore/qthread.h>
|
||||
#include <QtCore/qvarlengtharray.h>
|
||||
#include <QtCore/private/qlocking_p.h>
|
||||
#include <QtCore/private/qtools_p.h>
|
||||
#include <QtCore/private/qwaitcondition_p.h>
|
||||
|
||||
#include <QtCore/qtestsupport_core.h>
|
||||
|
@ -58,9 +58,9 @@
|
||||
|
||||
#include <QtCore/qatomic.h>
|
||||
#include <QtCore/qbytearray.h>
|
||||
#include <QtCore/QElapsedTimer>
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtCore/qvector.h>
|
||||
#include <QtCore/qelapsedtimer.h>
|
||||
#include <QtCore/qlist.h>
|
||||
#include <QtCore/qvariant.h>
|
||||
#if QT_CONFIG(regularexpression)
|
||||
#include <QtCore/QRegularExpression>
|
||||
#endif
|
||||
|
@ -31,26 +31,26 @@
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <qcommandlineoption.h>
|
||||
#include <qcommandlineparser.h>
|
||||
#include <qcoreapplication.h>
|
||||
#include <qdebug.h>
|
||||
#include <qdir.h>
|
||||
#include <qfile.h>
|
||||
#include <qhash.h>
|
||||
#include <qjsonarray.h>
|
||||
#include <qjsondocument.h>
|
||||
#include <qjsonobject.h>
|
||||
#include <qdir.h>
|
||||
#include <qstring.h>
|
||||
#include <qhash.h>
|
||||
#include <qvector.h>
|
||||
#include <qstack.h>
|
||||
#include <qdebug.h>
|
||||
#include <qset.h>
|
||||
#include <qlist.h>
|
||||
#include <qmap.h>
|
||||
#include <qcoreapplication.h>
|
||||
#include <qcommandlineoption.h>
|
||||
#include <qcommandlineparser.h>
|
||||
#include <qset.h>
|
||||
#include <qstring.h>
|
||||
#include <qstack.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using AutoGenHeaderMap = QMap<QString, QString>;
|
||||
using AutoGenSourcesList = QVector<QString>;
|
||||
using AutoGenSourcesList = QList<QString>;
|
||||
|
||||
static bool readAutogenInfoJson(AutoGenHeaderMap &headers, AutoGenSourcesList &sources,
|
||||
QStringList &headerExts, const QString &autoGenInfoJsonPath)
|
||||
@ -194,7 +194,7 @@ static bool readParseCache(ParseCacheMap &entries, const QString &parseCacheFile
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool readJsonFiles(QVector<QString> &entries, const QString &filePath)
|
||||
static bool readJsonFiles(QList<QString> &entries, const QString &filePath)
|
||||
{
|
||||
|
||||
QFile file(filePath);
|
||||
@ -212,7 +212,7 @@ static bool readJsonFiles(QVector<QString> &entries, const QString &filePath)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeJsonFiles(const QVector<QString> &fileList, const QString &fileListFilePath)
|
||||
static bool writeJsonFiles(const QList<QString> &fileList, const QString &fileListFilePath)
|
||||
{
|
||||
QFile file(fileListFilePath);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
@ -308,7 +308,7 @@ int main(int argc, char **argv)
|
||||
// entry for it in the parse cache. Use the value for the location of the
|
||||
// moc.json file
|
||||
|
||||
QVector<QString> jsonFileList;
|
||||
QList<QString> jsonFileList;
|
||||
QDir dir(cmakeIncludeDir);
|
||||
jsonFileList.reserve(autoGenSources.size());
|
||||
|
||||
@ -379,7 +379,7 @@ int main(int argc, char **argv)
|
||||
|
||||
// Read Previous file list (if any)
|
||||
const QString fileListFilePath = parser.value(outputFileOption);
|
||||
QVector<QString> previousList;
|
||||
QList<QString> previousList;
|
||||
QFile prev_file(fileListFilePath);
|
||||
|
||||
// Only try to open file if it exists to avoid error messages
|
||||
|
@ -31,11 +31,11 @@
|
||||
#define SYMBOLS_H
|
||||
|
||||
#include "token.h"
|
||||
#include <qstring.h>
|
||||
#include <qhash.h>
|
||||
#include <qvector.h>
|
||||
#include <qstack.h>
|
||||
#include <qdebug.h>
|
||||
#include <qhash.h>
|
||||
#include <qlist.h>
|
||||
#include <qstack.h>
|
||||
#include <qstring.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -26,14 +26,13 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <qbuffer.h>
|
||||
#include <qbytearray.h>
|
||||
#include <qstring.h>
|
||||
#include <qvarlengtharray.h>
|
||||
#include <qdebug.h>
|
||||
#include <qfile.h>
|
||||
#include <qlist.h>
|
||||
#include <qbuffer.h>
|
||||
#include <qvector.h>
|
||||
#include <qdebug.h>
|
||||
#include <qstring.h>
|
||||
#include <qvarlengtharray.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -29,7 +29,7 @@
|
||||
#ifndef COMPRESS_H
|
||||
#define COMPRESS_H
|
||||
|
||||
#include <QtCore/qvector.h>
|
||||
#include <QtCore/qlist.h>
|
||||
|
||||
class Compress
|
||||
{
|
||||
|
@ -27,9 +27,9 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtCore/qcoreapplication.h>
|
||||
#include <QtCore/qvector.h>
|
||||
#include <QtCore/qfile.h>
|
||||
#include <QtCore/qfileinfo.h>
|
||||
#include <QtCore/qlist.h>
|
||||
#include <QtCore/qxmlstream.h>
|
||||
|
||||
class VkSpecParser
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include "provider.h"
|
||||
|
||||
#include <qvector.h>
|
||||
#include <qlist.h>
|
||||
#include <qstring.h>
|
||||
|
||||
enum ParamType {
|
||||
|
@ -40,7 +40,7 @@
|
||||
#ifndef PROVIDER_H
|
||||
#define PROVIDER_H
|
||||
|
||||
#include <qvector.h>
|
||||
#include <qlist.h>
|
||||
#include <qstring.h>
|
||||
#include <qstringlist.h>
|
||||
#include <qtypeinfo.h>
|
||||
|
@ -29,7 +29,7 @@
|
||||
#ifndef TREEWALKER_H
|
||||
#define TREEWALKER_H
|
||||
|
||||
#include <qvector.h>
|
||||
#include <qlist.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -45,7 +45,6 @@
|
||||
#include <qlist.h>
|
||||
#include <qstring.h>
|
||||
#include <qstringlist.h>
|
||||
#include <qvector.h>
|
||||
#include <qxmlstream.h>
|
||||
#include <qglobal.h>
|
||||
|
||||
|
@ -53,7 +53,7 @@
|
||||
#define CARD_H
|
||||
|
||||
#include <QtWidgets>
|
||||
#include <QVector>
|
||||
#include <QList>
|
||||
|
||||
class CardLayout : public QLayout
|
||||
{
|
||||
@ -73,7 +73,7 @@ public:
|
||||
void setGeometry(const QRect &rect) override;
|
||||
|
||||
private:
|
||||
QVector<QLayoutItem*> m_items;
|
||||
QList<QLayoutItem *> m_items;
|
||||
};
|
||||
#endif
|
||||
//! [0]
|
||||
@ -86,7 +86,7 @@ private:
|
||||
//! [2]
|
||||
int CardLayout::count() const
|
||||
{
|
||||
// QVector::size() returns the number of QLayoutItems in m_items
|
||||
// QList::size() returns the number of QLayoutItems in m_items
|
||||
return m_items.size();
|
||||
}
|
||||
//! [2]
|
||||
@ -94,14 +94,14 @@ int CardLayout::count() const
|
||||
//! [3]
|
||||
QLayoutItem *CardLayout::itemAt(int idx) const
|
||||
{
|
||||
// QVector::value() performs index checking, and returns nullptr if we are
|
||||
// QList::value() performs index checking, and returns nullptr if we are
|
||||
// outside the valid range
|
||||
return m_items.value(idx);
|
||||
}
|
||||
|
||||
QLayoutItem *CardLayout::takeAt(int idx)
|
||||
{
|
||||
// QVector::take does not do index checking
|
||||
// QList::take does not do index checking
|
||||
return idx >= 0 && idx < m_items.size() ? m_items.takeAt(idx) : 0;
|
||||
}
|
||||
//! [3]
|
||||
|
@ -299,7 +299,7 @@
|
||||
\list
|
||||
\li A data structure to store the items handled by the layout. Each
|
||||
item is a \l{QLayoutItem}{QLayoutItem}. We will use a
|
||||
QVector in this example.
|
||||
QList in this example.
|
||||
\li \l{QLayout::}{addItem()}, how to add items to the layout.
|
||||
\li \l{QLayout::}{setGeometry()}, how to perform the layout.
|
||||
\li \l{QLayout::}{sizeHint()}, the preferred size of the layout.
|
||||
|
@ -42,11 +42,11 @@
|
||||
\value Direct Pixel values are derived directly from the RGB
|
||||
values, also known as "True Color."
|
||||
|
||||
\value Indexed Pixel values represent indexes into a vector of
|
||||
\value Indexed Pixel values represent indexes into a list of
|
||||
available colors, i.e. QColormap uses the index of the color that
|
||||
most closely matches an RGB value.
|
||||
|
||||
\value Gray Similar to \c Indexed, pixel values represent a vector
|
||||
\value Gray Similar to \c Indexed, pixel values represent a list
|
||||
of available gray tones. QColormap uses the index of the gray
|
||||
tone that most closely matches the computed gray tone of an RGB
|
||||
value.
|
||||
@ -113,11 +113,11 @@
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn const QVector<QColor> QColormap::colormap() const
|
||||
\fn const QList<QColor> QColormap::colormap() const
|
||||
|
||||
Returns a vector of colors which represents the devices colormap
|
||||
Returns a list of colors which represents the devices colormap
|
||||
for \c Indexed and \c Gray modes. This function returns an empty
|
||||
vector for \c Direct mode.
|
||||
list for \c Direct mode.
|
||||
|
||||
\sa size()
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user