call QList and QVector constructors in classes inheriting from them

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2021-01-27 16:56:00 +02:00
parent ce84e8e3ec
commit ae7ff42a4b
12 changed files with 15 additions and 16 deletions

View file

@ -44,7 +44,7 @@ template <class T>
class QQueue : public QList<T>
{
public:
inline QQueue() {}
inline QQueue() : QList<T>() {}
inline ~QQueue() {}
inline void swap(QQueue<T> &other) { QList<T>::swap(other); } // prevent QList<->QQueue swaps
inline void enqueue(const T &t) { QList<T>::append(t); }

View file

@ -44,7 +44,7 @@ template<class T>
class Q_CORE_EXPORT QStack : public QVector<T>
{
public:
inline QStack() {}
inline QStack() : QVector<T>() {}
inline ~QStack() {}
inline void swap(QStack<T> &other) { QVector<T>::swap(other); } // prevent QVector<->QStack swaps
inline void push(const T &t) { QVector<T>::append(t); }

View file

@ -47,7 +47,7 @@ typedef QMutableListIterator<QString> QMutableStringListIterator;
class Q_CORE_EXPORT QStringList : public QList<QString>
{
public:
inline QStringList() { }
inline QStringList() : QList<QString>() { }
inline explicit QStringList(const QString &i) { append(i); }
inline QStringList(const QStringList &l) : QList<QString>(l) { }
inline QStringList(const QList<QString> &l) : QList<QString>(l) { }

View file

@ -173,7 +173,7 @@ private:
class List : public QList<QObject*>
{
public:
List(int lpi) : notifyIndex(lpi) {}
List(int lpi) : QList<QObject*>(), notifyIndex(lpi) {}
int notifyIndex;
};
QList<List> listProperties;

View file

@ -369,6 +369,7 @@ QModelIndexList QItemSelectionRange::indexes() const
by \a bottomRight.
*/
QItemSelection::QItemSelection(const QModelIndex &topLeft, const QModelIndex &bottomRight)
: QList<QItemSelectionRange>()
{
select(topLeft, bottomRight);
}

View file

@ -221,7 +221,7 @@ inline uint qHash(const QItemSelectionRange &) { return 0; }
class Q_GUI_EXPORT QItemSelection : public QList<QItemSelectionRange>
{
public:
QItemSelection() {}
QItemSelection() : QList<QItemSelectionRange>() {}
QItemSelection(const QModelIndex &topLeft, const QModelIndex &bottomRight);
void select(const QModelIndex &topLeft, const QModelIndex &bottomRight);
bool contains(const QModelIndex &index) const;

View file

@ -50,9 +50,9 @@ class QVariant;
class Q_GUI_EXPORT QPolygon : public QVector<QPoint>
{
public:
inline QPolygon() {}
inline QPolygon() : QVector<QPoint>() {}
inline ~QPolygon() {}
inline QPolygon(int size);
inline QPolygon(int asize) : QVector<QPoint>(asize) {}
inline QPolygon(const QPolygon &a) : QVector<QPoint>(a) {}
inline QPolygon(const QVector<QPoint> &v) : QVector<QPoint>(v) {}
QPolygon(const QRect &r, bool closed=false);
@ -86,8 +86,6 @@ public:
QPolygon subtracted(const QPolygon &r) const;
};
inline QPolygon::QPolygon(int asize) : QVector<QPoint>(asize) {}
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QPolygon &);
#endif
@ -124,9 +122,9 @@ class QRectF;
class Q_GUI_EXPORT QPolygonF : public QVector<QPointF>
{
public:
inline QPolygonF() {}
inline QPolygonF() : QVector<QPointF>() {}
inline ~QPolygonF() {}
inline QPolygonF(int size);
inline QPolygonF(int asize) : QVector<QPointF>(asize) {}
inline QPolygonF(const QPolygonF &a) : QVector<QPointF>(a) {}
inline QPolygonF(const QVector<QPointF> &v) : QVector<QPointF>(v) {}
QPolygonF(const QRectF &r);
@ -152,8 +150,6 @@ public:
QPolygonF subtracted(const QPolygonF &r) const;
};
inline QPolygonF::QPolygonF(int asize) : QVector<QPointF>(asize) {}
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QPolygonF &);
#endif

View file

@ -51,6 +51,7 @@ class QNetworkAuthenticationCache: private QVector<QNetworkAuthenticationCredent
{
public:
QNetworkAuthenticationCache()
: QVector<QNetworkAuthenticationCredential>(), QNetworkAccessCache::CacheableObject()
{
setExpires(false);
setShareable(true);

View file

@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
class QNetworkAccessBackendFactoryData: public QList<QNetworkAccessBackendFactory *>
{
public:
QNetworkAccessBackendFactoryData() : mutex(QMutex::Recursive)
QNetworkAccessBackendFactoryData() : QList<QNetworkAccessBackendFactory *>(), mutex(QMutex::Recursive)
{
valid.ref();
}

View file

@ -52,6 +52,7 @@ class Q_TEST_EXPORT QSignalSpy: public QObject, public QList<QList<QVariant> >
{
public:
QSignalSpy(QObject *obj, const char *aSignal)
: QObject(obj), QList<QList<QVariant> >()
{
static const int memberOffset = QObject::staticMetaObject.methodCount();
Q_ASSERT(obj);

View file

@ -138,7 +138,7 @@ private:
class QTestEventList: public QList<QTestEvent *>
{
public:
inline QTestEventList() {}
inline QTestEventList() : QList<QTestEvent *>() {}
inline QTestEventList(const QTestEventList &other): QList<QTestEvent *>()
{ for (int i = 0; i < other.count(); ++i) append(other.at(i)->clone()); }
inline ~QTestEventList()

View file

@ -81,7 +81,7 @@ Q_DECLARE_TYPEINFO(QXmlStreamAttribute, Q_MOVABLE_TYPE);
class Q_XML_EXPORT QXmlStreamAttributes : public QVector<QXmlStreamAttribute>
{
public:
inline QXmlStreamAttributes() {}
inline QXmlStreamAttributes() : QVector<QXmlStreamAttribute>() {}
QStringRef value(const QString &namespaceUri, const QString &name) const;
QStringRef value(const QString &namespaceUri, const QLatin1String &name) const;
QStringRef value(const QLatin1String &namespaceUri, const QLatin1String &name) const;