summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/widgets/tools/plugandpaint/app/interfaces.h1
-rw-r--r--examples/widgets/tools/plugandpaint/app/plugindialog.h1
-rw-r--r--src/corelib/doc/snippets/qsignalmapper/buttonwidget.h1
-rw-r--r--src/corelib/global/qlibraryinfo.h2
-rw-r--r--src/corelib/kernel/qcoreapplication.h1
-rw-r--r--src/corelib/kernel/qjnihelpers_p.h1
-rw-r--r--src/corelib/kernel/qmetatype.h3
-rw-r--r--src/corelib/kernel/qvariant.h1
-rw-r--r--src/corelib/serialization/qjsonarray.h1
-rw-r--r--src/corelib/text/qbytearraylist.h8
-rw-r--r--src/corelib/text/qregularexpression.h1
-rw-r--r--src/corelib/text/qstring.h1
-rw-r--r--src/corelib/text/qstringlist.h294
-rw-r--r--src/corelib/tools/qcontainerfwd.h2
-rw-r--r--src/corelib/tools/qlist.h43
-rw-r--r--src/gui/accessible/qaccessibleplugin.h1
-rw-r--r--src/gui/image/qimage.h1
-rw-r--r--src/gui/image/qimagereader.h1
-rw-r--r--src/gui/text/qfont.h1
-rw-r--r--src/gui/text/qfontdatabase.h1
-rw-r--r--src/gui/util/qdesktopservices.h1
-rw-r--r--src/network/ssl/qsslcertificate.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm2
-rw-r--r--src/sql/kernel/qsqlrecord.h1
-rw-r--r--src/testlib/qbenchmarkvalgrind_p.h2
-rw-r--r--src/testlib/qtest.h7
-rw-r--r--src/widgets/styles/qcommonstyle_p.h1
27 files changed, 114 insertions, 267 deletions
diff --git a/examples/widgets/tools/plugandpaint/app/interfaces.h b/examples/widgets/tools/plugandpaint/app/interfaces.h
index 705e578809..5e92b01dc3 100644
--- a/examples/widgets/tools/plugandpaint/app/interfaces.h
+++ b/examples/widgets/tools/plugandpaint/app/interfaces.h
@@ -61,7 +61,6 @@ class QPainterPath;
class QPoint;
class QRect;
class QString;
-class QStringList;
QT_END_NAMESPACE
//! [0]
diff --git a/examples/widgets/tools/plugandpaint/app/plugindialog.h b/examples/widgets/tools/plugandpaint/app/plugindialog.h
index b18b30e62c..d480fe4283 100644
--- a/examples/widgets/tools/plugandpaint/app/plugindialog.h
+++ b/examples/widgets/tools/plugandpaint/app/plugindialog.h
@@ -57,7 +57,6 @@
QT_BEGIN_NAMESPACE
class QLabel;
class QPushButton;
-class QStringList;
class QTreeWidget;
class QTreeWidgetItem;
QT_END_NAMESPACE
diff --git a/src/corelib/doc/snippets/qsignalmapper/buttonwidget.h b/src/corelib/doc/snippets/qsignalmapper/buttonwidget.h
index b9d59f8dd8..24acae997c 100644
--- a/src/corelib/doc/snippets/qsignalmapper/buttonwidget.h
+++ b/src/corelib/doc/snippets/qsignalmapper/buttonwidget.h
@@ -55,7 +55,6 @@
class QSignalMapper;
class QString;
-class QStringList;
//! [0]
class ButtonWidget : public QWidget
diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h
index 3ceb20336b..bb5c9a8e08 100644
--- a/src/corelib/global/qlibraryinfo.h
+++ b/src/corelib/global/qlibraryinfo.h
@@ -46,8 +46,6 @@
QT_BEGIN_NAMESPACE
-class QStringList;
-
class Q_CORE_EXPORT QLibraryInfo
{
public:
diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h
index 19ce85aa25..a67ac29bb9 100644
--- a/src/corelib/kernel/qcoreapplication.h
+++ b/src/corelib/kernel/qcoreapplication.h
@@ -62,7 +62,6 @@ QT_BEGIN_NAMESPACE
class QCoreApplicationPrivate;
class QTranslator;
class QPostEventList;
-class QStringList;
class QAbstractEventDispatcher;
class QAbstractNativeEventFilter;
diff --git a/src/corelib/kernel/qjnihelpers_p.h b/src/corelib/kernel/qjnihelpers_p.h
index ea5103c173..c849013ba2 100644
--- a/src/corelib/kernel/qjnihelpers_p.h
+++ b/src/corelib/kernel/qjnihelpers_p.h
@@ -60,7 +60,6 @@
QT_BEGIN_NAMESPACE
class QRunnable;
-class QStringList;
namespace QtAndroidPrivate
{
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index feabede0dd..6d31441b73 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -125,7 +125,6 @@ inline constexpr int qMetaTypeId();
#define QT_FOR_EACH_STATIC_CORE_CLASS(F)\
F(QChar, 7, QChar) \
F(QString, 10, QString) \
- F(QStringList, 11, QStringList) \
F(QByteArray, 12, QByteArray) \
F(QBitArray, 13, QBitArray) \
F(QDate, 14, QDate) \
@@ -163,6 +162,7 @@ inline constexpr int qMetaTypeId();
F(QVariantHash, 28, QVariantHash) \
F(QVariantPair, 58, QVariantPair) \
F(QByteArrayList, 49, QByteArrayList) \
+ F(QStringList, 11, QStringList) \
#if QT_CONFIG(shortcut)
#define QT_FOR_EACH_STATIC_KEYSEQUENCE_CLASS(F)\
@@ -221,6 +221,7 @@ inline constexpr int qMetaTypeId();
F(QVariantHash, -1, QVariantHash, "QHash<QString,QVariant>") \
F(QVariantPair, -1, QVariantPair, "QPair<QVariant,QVariant>") \
F(QByteArrayList, -1, QByteArrayList, "QList<QByteArray>") \
+ F(QStringList, -1, QStringList, "QList<QString>") \
#define QT_FOR_EACH_STATIC_TYPE(F)\
QT_FOR_EACH_STATIC_PRIMITIVE_TYPE(F)\
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index 47103725f8..ad766c9a8e 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -74,7 +74,6 @@ class QLine;
class QLineF;
class QLocale;
class QTransform;
-class QStringList;
class QTime;
class QPoint;
class QPointF;
diff --git a/src/corelib/serialization/qjsonarray.h b/src/corelib/serialization/qjsonarray.h
index b39e85a726..406fbc2f47 100644
--- a/src/corelib/serialization/qjsonarray.h
+++ b/src/corelib/serialization/qjsonarray.h
@@ -48,7 +48,6 @@
QT_BEGIN_NAMESPACE
class QDebug;
-class QStringList;
typedef QList<QVariant> QVariantList;
class Q_CORE_EXPORT QJsonArray
diff --git a/src/corelib/text/qbytearraylist.h b/src/corelib/text/qbytearraylist.h
index 3f85a24329..1ce8d21445 100644
--- a/src/corelib/text/qbytearraylist.h
+++ b/src/corelib/text/qbytearraylist.h
@@ -54,7 +54,6 @@ typedef QMutableListIterator<QByteArray> QMutableByteArrayListIterator;
#endif
#ifndef Q_CLANG_QDOC
-typedef QList<QByteArray> QByteArrayList;
namespace QtPrivate {
QByteArray Q_CORE_EXPORT QByteArrayList_join(const QByteArrayList *that, const char *separator, int separatorLength);
@@ -73,6 +72,13 @@ protected:
~QListSpecialMethods() = default;
#endif
public:
+ qsizetype indexOf(const QByteArray &ba, qsizetype from = 0) const noexcept
+ { return QtPrivate::indexOf(*self(), ba, from); }
+ qsizetype lastIndexOf(const QByteArray &ba, qsizetype from = -1) const noexcept
+ { return QtPrivate::lastIndexOf(*self(), ba, from); }
+ bool contains(const QByteArray &ba) const noexcept
+ { return indexOf(ba) != -1; }
+
inline QByteArray join() const
{ return QtPrivate::QByteArrayList_join(self(), nullptr, 0); }
inline QByteArray join(const QByteArray &sep) const
diff --git a/src/corelib/text/qregularexpression.h b/src/corelib/text/qregularexpression.h
index 24fa4ea9da..6af48f5fb0 100644
--- a/src/corelib/text/qregularexpression.h
+++ b/src/corelib/text/qregularexpression.h
@@ -51,7 +51,6 @@ QT_REQUIRE_CONFIG(regularexpression);
QT_BEGIN_NAMESPACE
-class QStringList;
class QLatin1String;
class QRegularExpressionMatch;
diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h
index e11457461c..76ac8b1119 100644
--- a/src/corelib/text/qstring.h
+++ b/src/corelib/text/qstring.h
@@ -75,7 +75,6 @@ QT_BEGIN_NAMESPACE
class QRegularExpression;
class QRegularExpressionMatch;
class QString;
-class QStringList;
namespace QtPrivate {
template <bool...B> class BoolList;
diff --git a/src/corelib/text/qstringlist.h b/src/corelib/text/qstringlist.h
index 2b5c960b75..3ed6a2f499 100644
--- a/src/corelib/text/qstringlist.h
+++ b/src/corelib/text/qstringlist.h
@@ -57,101 +57,6 @@ using QStringListIterator = QListIterator<QString>;
using QMutableStringListIterator = QMutableListIterator<QString>;
#endif
-class QStringList;
-
-#ifdef Q_QDOC
-class QStringList : public QList<QString>
-#else
-template <> struct QListSpecialMethods<QString>
-#endif
-{
-#ifndef Q_QDOC
-protected:
- ~QListSpecialMethods() = default;
-#endif
-public:
- inline void sort(Qt::CaseSensitivity cs = Qt::CaseSensitive);
- inline qsizetype removeDuplicates();
-
-#if QT_STRINGVIEW_LEVEL < 2
- inline QString join(const QString &sep) const;
-#endif
- inline QString join(QStringView sep) const;
- inline QString join(QLatin1String sep) const;
- inline QString join(QChar sep) const;
-
- inline QStringList filter(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
- inline QStringList &replaceInStrings(QStringView before, QStringView after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
-#if QT_STRINGVIEW_LEVEL < 2
- inline QStringList filter(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
- inline QStringList &replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
- inline QStringList &replaceInStrings(const QString &before, QStringView after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
- inline QStringList &replaceInStrings(QStringView before, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
-#endif
-
-#if QT_CONFIG(regularexpression)
- inline QStringList filter(const QRegularExpression &re) const;
- inline QStringList &replaceInStrings(const QRegularExpression &re, const QString &after);
-#endif // QT_CONFIG(regularexpression)
-
-#ifndef Q_QDOC
-private:
- inline QStringList *self();
- inline const QStringList *self() const;
-};
-
-// ### Qt6: check if there's a better way
-class QStringList : public QList<QString>
-{
-#endif
-public:
- using QList<QString>::QList;
- inline explicit QStringList(const QString &i) { append(i); }
- inline QStringList(const QList<QString> &l) : QList<QString>(l) { }
- inline QStringList(QList<QString> &&l) noexcept : QList<QString>(std::move(l)) { }
-
- QStringList &operator=(const QList<QString> &other)
- { QList<QString>::operator=(other); return *this; }
- QStringList &operator=(QList<QString> &&other) noexcept
- { QList<QString>::operator=(std::move(other)); return *this; }
-
-#if QT_STRINGVIEW_LEVEL < 2
- inline bool contains(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
-#endif
- inline bool contains(QLatin1String str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
- inline bool contains(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
-
- inline QStringList operator+(const QStringList &other) const
- { QStringList n = *this; n += other; return n; }
- inline QStringList &operator<<(const QString &str)
- { append(str); return *this; }
- inline QStringList &operator<<(const QStringList &l)
- { *this += l; return *this; }
- inline QStringList &operator<<(const QList<QString> &l)
- { *this += l; return *this; }
-
- inline qsizetype indexOf(QStringView str, qsizetype from = 0) const;
- inline qsizetype indexOf(QLatin1String str, qsizetype from = 0) const;
-
- inline qsizetype lastIndexOf(QStringView str, qsizetype from = -1) const;
- inline qsizetype lastIndexOf(QLatin1String str, qsizetype from = -1) const;
-
-#if QT_CONFIG(regularexpression)
- inline qsizetype indexOf(const QRegularExpression &re, qsizetype from = 0) const;
- inline qsizetype lastIndexOf(const QRegularExpression &re, qsizetype from = -1) const;
-#endif // QT_CONFIG(regularexpression)
-
- using QList<QString>::indexOf;
- using QList<QString>::lastIndexOf;
-};
-
-Q_DECLARE_TYPEINFO(QStringList, Q_MOVABLE_TYPE);
-
-#ifndef Q_QDOC
-inline QStringList *QListSpecialMethods<QString>::self()
-{ return static_cast<QStringList *>(this); }
-inline const QStringList *QListSpecialMethods<QString>::self() const
-{ return static_cast<const QStringList *>(this); }
namespace QtPrivate {
void Q_CORE_EXPORT QStringList_sort(QStringList *that, Qt::CaseSensitivity cs);
@@ -174,143 +79,98 @@ namespace QtPrivate {
#endif // QT_CONFIG(regularexpression)
}
-inline void QListSpecialMethods<QString>::sort(Qt::CaseSensitivity cs)
-{
- QtPrivate::QStringList_sort(self(), cs);
-}
-
-inline qsizetype QListSpecialMethods<QString>::removeDuplicates()
-{
- return QtPrivate::QStringList_removeDuplicates(self());
-}
-
-#if QT_STRINGVIEW_LEVEL < 2
-inline QString QListSpecialMethods<QString>::join(const QString &sep) const
-{
- return QtPrivate::QStringList_join(self(), sep.constData(), sep.length());
-}
+#ifdef Q_QDOC
+class QStringList : public QList<QString>
+#else
+template <> struct QListSpecialMethods<QString>
#endif
-
-inline QString QListSpecialMethods<QString>::join(QStringView sep) const
{
- return QtPrivate::QStringList_join(self(), sep);
-}
+ inline QStringList *self()
+ { return static_cast<QStringList *>(this); }
+ inline const QStringList *self() const
+ { return static_cast<const QStringList *>(this); }
-QString QListSpecialMethods<QString>::join(QLatin1String sep) const
-{
- return QtPrivate::QStringList_join(*self(), sep);
-}
-
-inline QString QListSpecialMethods<QString>::join(QChar sep) const
-{
- return QtPrivate::QStringList_join(self(), &sep, 1);
-}
-
-inline QStringList QListSpecialMethods<QString>::filter(QStringView str, Qt::CaseSensitivity cs) const
-{
- return QtPrivate::QStringList_filter(self(), str, cs);
-}
-
-#if QT_STRINGVIEW_LEVEL < 2
-inline QStringList QListSpecialMethods<QString>::filter(const QString &str, Qt::CaseSensitivity cs) const
-{
- return QtPrivate::QStringList_filter(self(), str, cs);
-}
-#endif
+public:
+ inline void sort(Qt::CaseSensitivity cs = Qt::CaseSensitive)
+ { QtPrivate::QStringList_sort(self(), cs); }
+ inline qsizetype removeDuplicates()
+ { return QtPrivate::QStringList_removeDuplicates(self()); }
+
+ inline QString join(QStringView sep) const
+ { return QtPrivate::QStringList_join(self(), sep); }
+ inline QString join(QLatin1String sep) const
+ { return QtPrivate::QStringList_join(*self(), sep); }
+ inline QString join(QChar sep) const
+ { return QtPrivate::QStringList_join(self(), &sep, 1); }
+
+ inline QStringList filter(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
+ { return QtPrivate::QStringList_filter(self(), str, cs); }
+ inline QStringList &replaceInStrings(QStringView before, QStringView after, Qt::CaseSensitivity cs = Qt::CaseSensitive)
+ {
+ QtPrivate::QStringList_replaceInStrings(self(), before, after, cs);
+ return *self();
+ }
#if QT_STRINGVIEW_LEVEL < 2
-inline bool QStringList::contains(const QString &str, Qt::CaseSensitivity cs) const
-{
- return QtPrivate::QStringList_contains(this, str, cs);
-}
+ inline QString join(const QString &sep) const
+ { return QtPrivate::QStringList_join(self(), sep.constData(), sep.length()); }
+ inline QStringList filter(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
+ { return QtPrivate::QStringList_filter(self(), str, cs); }
+ inline QStringList &replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive)
+ {
+ QtPrivate::QStringList_replaceInStrings(self(), before, after, cs);
+ return *self();
+ }
+ inline QStringList &replaceInStrings(const QString &before, QStringView after, Qt::CaseSensitivity cs = Qt::CaseSensitive)
+ {
+ QtPrivate::QStringList_replaceInStrings(self(), before, after, cs);
+ return *self();
+ }
+ inline QStringList &replaceInStrings(QStringView before, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive)
+ {
+ QtPrivate::QStringList_replaceInStrings(self(), before, after, cs);
+ return *self();
+ }
#endif
-inline bool QStringList::contains(QLatin1String str, Qt::CaseSensitivity cs) const
-{
- return QtPrivate::QStringList_contains(this, str, cs);
-}
+ inline bool contains(QLatin1String str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
+ { return QtPrivate::QStringList_contains(self(), str, cs); }
+ inline bool contains(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
+ { return QtPrivate::QStringList_contains(self(), str, cs); }
-inline bool QStringList::contains(QStringView str, Qt::CaseSensitivity cs) const
-{
- return QtPrivate::QStringList_contains(this, str, cs);
-}
+ inline qsizetype indexOf(QStringView str, qsizetype from = 0) const noexcept
+ { return QtPrivate::indexOf<QString, QStringView>(*self(), str, from); }
+ inline qsizetype indexOf(QLatin1String str, qsizetype from = 0) const noexcept
+ { return QtPrivate::indexOf<QString, QLatin1String>(*self(), str, from); }
-inline QStringList &QListSpecialMethods<QString>::replaceInStrings(QStringView before, QStringView after, Qt::CaseSensitivity cs)
-{
- QtPrivate::QStringList_replaceInStrings(self(), before, after, cs);
- return *self();
-}
+ inline qsizetype lastIndexOf(QStringView str, qsizetype from = -1) const noexcept
+ { return QtPrivate::lastIndexOf<QString, QStringView>(*self(), str, from); }
+ inline qsizetype lastIndexOf(QLatin1String str, qsizetype from = -1) const noexcept
+ { return QtPrivate::lastIndexOf<QString, QLatin1String>(*self(), str, from); }
#if QT_STRINGVIEW_LEVEL < 2
-inline QStringList &QListSpecialMethods<QString>::replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs)
-{
- QtPrivate::QStringList_replaceInStrings(self(), before, after, cs);
- return *self();
-}
-
-inline QStringList &QListSpecialMethods<QString>::replaceInStrings(QStringView before, const QString &after, Qt::CaseSensitivity cs)
-{
- QtPrivate::QStringList_replaceInStrings(self(), before, qToStringViewIgnoringNull(after), cs);
- return *self();
-}
-
-inline QStringList &QListSpecialMethods<QString>::replaceInStrings(const QString &before, QStringView after, Qt::CaseSensitivity cs)
-{
- QtPrivate::QStringList_replaceInStrings(self(), QStringView(before), after, cs);
- return *self();
-}
+ inline bool contains(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
+ { return QtPrivate::QStringList_contains(self(), str, cs); }
+ qsizetype indexOf(const QString &str, qsizetype from = 0) const noexcept
+ { return indexOf(QStringView(str), from); }
+ qsizetype lastIndexOf(const QString &str, qsizetype from = -1) const noexcept
+ { return lastIndexOf(QStringView(str), from); }
#endif
-inline QStringList operator+(const QList<QString> &one, const QStringList &other)
-{
- QStringList n = one;
- n += other;
- return n;
-}
-
-inline qsizetype QStringList::indexOf(QStringView string, qsizetype from) const
-{
- return QtPrivate::indexOf<QString, QStringView>(*this, string, from);
-}
-
-inline qsizetype QStringList::indexOf(QLatin1String string, qsizetype from) const
-{
- return QtPrivate::indexOf<QString, QLatin1String>(*this, string, from);
-}
-
-inline qsizetype QStringList::lastIndexOf(QStringView string, qsizetype from) const
-{
- return QtPrivate::lastIndexOf<QString, QStringView>(*this, string, from);
-}
-
-inline qsizetype QStringList::lastIndexOf(QLatin1String string, qsizetype from) const
-{
- return QtPrivate::lastIndexOf<QString, QLatin1String>(*this, string, from);
-}
-
#if QT_CONFIG(regularexpression)
-inline QStringList &QListSpecialMethods<QString>::replaceInStrings(const QRegularExpression &rx, const QString &after)
-{
- QtPrivate::QStringList_replaceInStrings(self(), rx, after);
- return *self();
-}
-
-inline QStringList QListSpecialMethods<QString>::filter(const QRegularExpression &rx) const
-{
- return QtPrivate::QStringList_filter(self(), rx);
-}
-
-inline qsizetype QStringList::indexOf(const QRegularExpression &rx, qsizetype from) const
-{
- return QtPrivate::QStringList_indexOf(this, rx, from);
-}
-
-inline qsizetype QStringList::lastIndexOf(const QRegularExpression &rx, qsizetype from) const
-{
- return QtPrivate::QStringList_lastIndexOf(this, rx, from);
-}
+ inline QStringList filter(const QRegularExpression &re) const
+ { return QtPrivate::QStringList_filter(self(), re); }
+ inline QStringList &replaceInStrings(const QRegularExpression &re, const QString &after)
+ {
+ QtPrivate::QStringList_replaceInStrings(self(), re, after);
+ return *self();
+ }
+ inline qsizetype indexOf(const QRegularExpression &re, qsizetype from = 0) const
+ { return QtPrivate::QStringList_indexOf(self(), re, from); }
+ inline qsizetype lastIndexOf(const QRegularExpression &re, qsizetype from = -1) const
+ { return QtPrivate::QStringList_lastIndexOf(self(), re, from); }
#endif // QT_CONFIG(regularexpression)
-#endif // Q_QDOC
+};
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qcontainerfwd.h b/src/corelib/tools/qcontainerfwd.h
index 069be4ef10..46c2801b00 100644
--- a/src/corelib/tools/qcontainerfwd.h
+++ b/src/corelib/tools/qcontainerfwd.h
@@ -61,7 +61,7 @@ template <class T> class QStack;
template<class T, qsizetype Prealloc = 256> class QVarLengthArray;
template <class T> class QList;
template<typename T> using QVector = QList<T>;
-class QStringList;
+using QStringList = QList<QString>;
using QByteArrayList = QList<QByteArray>;
class QMetaType;
class QVariant;
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index ebb0fd9531..5bdc993b67 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -54,14 +54,22 @@
QT_BEGIN_NAMESPACE
namespace QtPrivate {
- template <typename V, typename U> qsizetype indexOf(const QList<V> &list, const U &u, qsizetype from);
- template <typename V, typename U> qsizetype lastIndexOf(const QList<V> &list, const U &u, qsizetype from);
+ template <typename V, typename U> qsizetype indexOf(const QList<V> &list, const U &u, qsizetype from) noexcept;
+ template <typename V, typename U> qsizetype lastIndexOf(const QList<V> &list, const U &u, qsizetype from) noexcept;
}
template <typename T> struct QListSpecialMethods
{
protected:
~QListSpecialMethods() = default;
+public:
+ qsizetype indexOf(const T &t, qsizetype from = 0) const noexcept;
+ qsizetype lastIndexOf(const T &t, qsizetype from = -1) const noexcept;
+
+ bool contains(const T &t) const noexcept
+ {
+ return indexOf(t) != -1;
+ }
};
template <> struct QListSpecialMethods<QByteArray>;
template <> struct QListSpecialMethods<QString>;
@@ -79,8 +87,8 @@ class QList
DataPointer d;
- template <typename V, typename U> friend qsizetype QtPrivate::indexOf(const QList<V> &list, const U &u, qsizetype from);
- template <typename V, typename U> friend qsizetype QtPrivate::lastIndexOf(const QList<V> &list, const U &u, qsizetype from);
+ template <typename V, typename U> friend qsizetype QtPrivate::indexOf(const QList<V> &list, const U &u, qsizetype from) noexcept;
+ template <typename V, typename U> friend qsizetype QtPrivate::lastIndexOf(const QList<V> &list, const U &u, qsizetype from) noexcept;
public:
typedef T Type;
@@ -158,6 +166,11 @@ public:
std::copy(i1, i2, std::back_inserter(*this));
}
+ // This constructor is here for compatibility with QStringList in Qt 5, that has a QStringList(const QString &) constructor
+ template<typename String, typename = std::enable_if_t<std::is_same_v<T, QString> && std::is_convertible_v<String, QString>>>
+ inline explicit QList(const String &str)
+ { append(str); }
+
// compiler-generated special member functions are fine!
void swap(QList<T> &other) noexcept { qSwap(d, other.d); }
@@ -289,12 +302,10 @@ public:
QList<T> &fill(parameter_type t, qsizetype size = -1);
- qsizetype indexOf(const T &t, qsizetype from = 0) const noexcept;
- qsizetype lastIndexOf(const T &t, qsizetype from = -1) const noexcept;
- bool contains(const T &t) const noexcept
- {
- return indexOf(t) != -1;
- }
+ using QListSpecialMethods<T>::contains;
+ using QListSpecialMethods<T>::indexOf;
+ using QListSpecialMethods<T>::lastIndexOf;
+
qsizetype count(const T &t) const noexcept
{
return qsizetype(std::count(&*cbegin(), &*cend(), t));
@@ -705,7 +716,7 @@ inline QList<T> &QList<T>::fill(parameter_type t, qsizetype newSize)
namespace QtPrivate {
template <typename T, typename U>
-qsizetype indexOf(const QList<T> &vector, const U &u, qsizetype from)
+qsizetype indexOf(const QList<T> &vector, const U &u, qsizetype from) noexcept
{
if (from < 0)
from = qMax(from + vector.size(), qsizetype(0));
@@ -720,7 +731,7 @@ qsizetype indexOf(const QList<T> &vector, const U &u, qsizetype from)
}
template <typename T, typename U>
-qsizetype lastIndexOf(const QList<T> &vector, const U &u, qsizetype from)
+qsizetype lastIndexOf(const QList<T> &vector, const U &u, qsizetype from) noexcept
{
if (from < 0)
from += vector.d->size;
@@ -739,15 +750,15 @@ qsizetype lastIndexOf(const QList<T> &vector, const U &u, qsizetype from)
}
template <typename T>
-qsizetype QList<T>::indexOf(const T &t, qsizetype from) const noexcept
+qsizetype QListSpecialMethods<T>::indexOf(const T &t, qsizetype from) const noexcept
{
- return QtPrivate::indexOf<T, T>(*this, t, from);
+ return QtPrivate::indexOf(*static_cast<const QList<T> *>(this), t, from);
}
template <typename T>
-qsizetype QList<T>::lastIndexOf(const T &t, qsizetype from) const noexcept
+qsizetype QListSpecialMethods<T>::lastIndexOf(const T &t, qsizetype from) const noexcept
{
- return QtPrivate::lastIndexOf(*this, t, from);
+ return QtPrivate::lastIndexOf(*static_cast<const QList<T> *>(this), t, from);
}
template <typename T>
diff --git a/src/gui/accessible/qaccessibleplugin.h b/src/gui/accessible/qaccessibleplugin.h
index 68e6a839d8..04169fdeac 100644
--- a/src/gui/accessible/qaccessibleplugin.h
+++ b/src/gui/accessible/qaccessibleplugin.h
@@ -49,7 +49,6 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
-class QStringList;
class QAccessibleInterface;
#define QAccessibleFactoryInterface_iid "org.qt-project.Qt.QAccessibleFactoryInterface"
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index 0866984dec..2ce9d96e6a 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -61,7 +61,6 @@ QT_BEGIN_NAMESPACE
class QColorSpace;
class QColorTransform;
class QIODevice;
-class QStringList;
class QTransform;
class QVariant;
diff --git a/src/gui/image/qimagereader.h b/src/gui/image/qimagereader.h
index 4d418bd7d0..23c8a916d2 100644
--- a/src/gui/image/qimagereader.h
+++ b/src/gui/image/qimagereader.h
@@ -53,7 +53,6 @@ class QColor;
class QIODevice;
class QRect;
class QSize;
-class QStringList;
class QImageReaderPrivate;
class Q_GUI_EXPORT QImageReader
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
index 65d126374e..4079e48dda 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -50,7 +50,6 @@ QT_BEGIN_NAMESPACE
class QFontPrivate; /* don't touch */
-class QStringList;
class QVariant;
class Q_GUI_EXPORT QFont
diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h
index eacce5a2c4..67f06b8485 100644
--- a/src/gui/text/qfontdatabase.h
+++ b/src/gui/text/qfontdatabase.h
@@ -48,7 +48,6 @@
QT_BEGIN_NAMESPACE
-class QStringList;
struct QFontDef;
class QFontEngine;
diff --git a/src/gui/util/qdesktopservices.h b/src/gui/util/qdesktopservices.h
index 6e2836e26a..658b601532 100644
--- a/src/gui/util/qdesktopservices.h
+++ b/src/gui/util/qdesktopservices.h
@@ -48,7 +48,6 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_DESKTOPSERVICES
-class QStringList;
class QUrl;
class QObject;
diff --git a/src/network/ssl/qsslcertificate.h b/src/network/ssl/qsslcertificate.h
index 46119ae046..8cfeaeb273 100644
--- a/src/network/ssl/qsslcertificate.h
+++ b/src/network/ssl/qsslcertificate.h
@@ -61,7 +61,6 @@ class QIODevice;
class QSslError;
class QSslKey;
class QSslCertificateExtension;
-class QStringList;
class QSslCertificate;
// qHash is a friend, but we can't use default arguments for friends (ยง8.3.6.4)
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
index 92b4c9f09a..bdf185d275 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
@@ -68,8 +68,6 @@
#include <CoreFoundation/CFNumber.h>
-QT_FORWARD_DECLARE_CLASS(QString)
-QT_FORWARD_DECLARE_CLASS(QStringList)
QT_FORWARD_DECLARE_CLASS(QFileInfo)
QT_FORWARD_DECLARE_CLASS(QWindow)
QT_USE_NAMESPACE
diff --git a/src/sql/kernel/qsqlrecord.h b/src/sql/kernel/qsqlrecord.h
index 94631bafd9..08aae535da 100644
--- a/src/sql/kernel/qsqlrecord.h
+++ b/src/sql/kernel/qsqlrecord.h
@@ -47,7 +47,6 @@ QT_BEGIN_NAMESPACE
class QSqlField;
-class QStringList;
class QVariant;
class QSqlRecordPrivate;
diff --git a/src/testlib/qbenchmarkvalgrind_p.h b/src/testlib/qbenchmarkvalgrind_p.h
index 0619be9f22..0cbb8bb103 100644
--- a/src/testlib/qbenchmarkvalgrind_p.h
+++ b/src/testlib/qbenchmarkvalgrind_p.h
@@ -56,8 +56,6 @@
#include <QtCore/qmap.h>
#include <QtCore/qstring.h>
-class QStringList;
-
QT_REQUIRE_CONFIG(valgrind);
QT_BEGIN_NAMESPACE
diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h
index 7a6bbb5edf..f9cf7aa941 100644
--- a/src/testlib/qtest.h
+++ b/src/testlib/qtest.h
@@ -499,13 +499,6 @@ bool qCompare(QList<T> const &t1, const T (& t2)[N],
actual, expected, file, line);
}
-template <>
-inline bool qCompare(QStringList const &t1, QStringList const &t2, const char *actual, const char *expected,
- const char *file, int line)
-{
- return qCompare<QString>(t1, t2, actual, expected, file, line);
-}
-
template <typename T>
inline bool qCompare(QFlags<T> const &t1, T const &t2, const char *actual, const char *expected,
const char *file, int line)
diff --git a/src/widgets/styles/qcommonstyle_p.h b/src/widgets/styles/qcommonstyle_p.h
index 5513463104..aaf0fc2ae3 100644
--- a/src/widgets/styles/qcommonstyle_p.h
+++ b/src/widgets/styles/qcommonstyle_p.h
@@ -61,7 +61,6 @@ QT_BEGIN_NAMESPACE
// We mean it.
//
-class QStringList;
class QTextOption;
// Private class