Fix a bunch of qdoc warnings from QList types

For documentation purposes, we treat QList, QByteArrayList, and QStringList as
simple classes, whereas reality is a bit more complicated. We conditionally
change the declaration of the types for qdoc runs, and need to be consistent
to avoid a flood of warnings from clang when building documentation.

Change-Id: I22d529079e10f8fd3d93edc771e5f05729fa925f
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
This commit is contained in:
Volker Hilsheimer 2020-09-21 13:37:08 +02:00
parent e59e924f52
commit 33349e3fce
2 changed files with 11 additions and 0 deletions

View File

@ -61,8 +61,13 @@ template <class T> class QStack;
template<class T, qsizetype Prealloc = 256> class QVarLengthArray; template<class T, qsizetype Prealloc = 256> class QVarLengthArray;
template <class T> class QList; template <class T> class QList;
template<typename T> using QVector = QList<T>; template<typename T> using QVector = QList<T>;
#ifndef Q_CLANG_QDOC
using QStringList = QList<QString>; using QStringList = QList<QString>;
using QByteArrayList = QList<QByteArray>; using QByteArrayList = QList<QByteArray>;
#else
class QStringList;
class QByteArrayList;
#endif
class QMetaType; class QMetaType;
class QVariant; class QVariant;

View File

@ -302,9 +302,15 @@ public:
QList<T> &fill(parameter_type t, qsizetype size = -1); QList<T> &fill(parameter_type t, qsizetype size = -1);
#ifndef Q_QDOC
using QListSpecialMethods<T>::contains; using QListSpecialMethods<T>::contains;
using QListSpecialMethods<T>::indexOf; using QListSpecialMethods<T>::indexOf;
using QListSpecialMethods<T>::lastIndexOf; using QListSpecialMethods<T>::lastIndexOf;
#else
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;
#endif
qsizetype count(const T &t) const noexcept qsizetype count(const T &t) const noexcept
{ {