diff options
Diffstat (limited to 'tests/auto/corelib')
53 files changed, 317 insertions, 304 deletions
diff --git a/tests/auto/corelib/animation/qabstractanimation/tst_qabstractanimation.cpp b/tests/auto/corelib/animation/qabstractanimation/tst_qabstractanimation.cpp index 66a752df5d..b490e5ca72 100644 --- a/tests/auto/corelib/animation/qabstractanimation/tst_qabstractanimation.cpp +++ b/tests/auto/corelib/animation/qabstractanimation/tst_qabstractanimation.cpp @@ -58,8 +58,8 @@ public: TestableQAbstractAnimation() : m_duration(10) {} virtual ~TestableQAbstractAnimation() {}; - int duration() const { return m_duration; } - virtual void updateCurrentTime(int) {} + int duration() const override { return m_duration; } + virtual void updateCurrentTime(int) override {} void setDuration(int duration) { m_duration = duration; } private: @@ -70,8 +70,8 @@ class DummyQAnimationGroup : public QAnimationGroup { Q_OBJECT public: - int duration() const { return 10; } - virtual void updateCurrentTime(int) {} + int duration() const override { return 10; } + virtual void updateCurrentTime(int) override {} }; void tst_QAbstractAnimation::construction() diff --git a/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp b/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp index 8fc6d1ac61..cf46d5c14e 100644 --- a/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp +++ b/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp @@ -79,9 +79,9 @@ class TestAnimation : public QVariantAnimation { Q_OBJECT public: - virtual void updateCurrentValue(const QVariant &value) { Q_UNUSED(value)}; + virtual void updateCurrentValue(const QVariant &value) override { Q_UNUSED(value)}; virtual void updateState(QAbstractAnimation::State oldState, - QAbstractAnimation::State newState) + QAbstractAnimation::State newState) override { Q_UNUSED(oldState); Q_UNUSED(newState); @@ -98,10 +98,10 @@ public: setDuration(250); } - int duration() const { return -1; /* not time driven */ } + int duration() const override { return -1; /* not time driven */ } protected: - void timerEvent(QTimerEvent *event) + void timerEvent(QTimerEvent *event) override { if (event->timerId() == id) stop(); diff --git a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp index 8b36a7a246..fa30659d89 100644 --- a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp +++ b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp @@ -92,9 +92,9 @@ class TestAnimation : public QVariantAnimation { Q_OBJECT public: - virtual void updateCurrentValue(const QVariant &value) { Q_UNUSED(value)}; + virtual void updateCurrentValue(const QVariant &value) override { Q_UNUSED(value)}; virtual void updateState(QAbstractAnimation::State newState, - QAbstractAnimation::State oldState) + QAbstractAnimation::State oldState) override { Q_UNUSED(oldState); Q_UNUSED(newState); @@ -108,15 +108,15 @@ public: TestAnimation2(QAbstractAnimation *animation) : QVariantAnimation(animation) {} TestAnimation2(int duration, QAbstractAnimation *animation) : QVariantAnimation(animation), m_duration(duration) {} - virtual void updateCurrentValue(const QVariant &value) { Q_UNUSED(value)}; + virtual void updateCurrentValue(const QVariant &value) override { Q_UNUSED(value)}; virtual void updateState(QAbstractAnimation::State newState, - QAbstractAnimation::State oldState) + QAbstractAnimation::State oldState) override { Q_UNUSED(oldState); Q_UNUSED(newState); }; - virtual int duration() const { + virtual int duration() const override { return m_duration; } private: @@ -134,10 +134,10 @@ public: setEndValue(0); } - int duration() const { return -1; /* not time driven */ } + int duration() const override { return -1; /* not time driven */ } protected: - void timerEvent(QTimerEvent *event) + void timerEvent(QTimerEvent *event) override { if (event->timerId() == id) stop(); diff --git a/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp b/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp index 290c2abc98..a38f3d221d 100644 --- a/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp +++ b/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp @@ -64,7 +64,7 @@ public: int m_updateCurrentTimeCount; protected: - void updateCurrentTime(int currentTime) + void updateCurrentTime(int currentTime) override { QPauseAnimation::updateCurrentTime(currentTime); ++m_updateCurrentTimeCount; diff --git a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp index e1377ab2a3..5add27bbee 100644 --- a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp +++ b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp @@ -39,10 +39,10 @@ class UncontrolledAnimation : public QPropertyAnimation { Q_OBJECT public: - int duration() const { return -1; /* not time driven */ } + int duration() const override { return -1; /* not time driven */ } protected: - void updateCurrentTime(int currentTime) + void updateCurrentTime(int currentTime) override { QPropertyAnimation::updateCurrentTime(currentTime); if (currentTime >= QPropertyAnimation::duration() || currentLoop() >= 1) @@ -1283,7 +1283,7 @@ public: innerAnim->start(); } - void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) + void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) override { QPropertyAnimation::updateState(newState, oldState); if (newState == QAbstractAnimation::Stopped) diff --git a/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp b/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp index 1ea2ab7bd2..008ac696fc 100644 --- a/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp +++ b/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp @@ -96,9 +96,9 @@ class TestAnimation : public QVariantAnimation { Q_OBJECT public: - virtual void updateCurrentValue(const QVariant &value) { Q_UNUSED(value)}; + virtual void updateCurrentValue(const QVariant &value) override { Q_UNUSED(value)}; virtual void updateState(QAbstractAnimation::State newState, - QAbstractAnimation::State oldState) + QAbstractAnimation::State oldState) override { Q_UNUSED(oldState); Q_UNUSED(newState); @@ -129,10 +129,10 @@ public: setEndValue(0); } - int duration() const { return -1; /* not time driven */ } + int duration() const override { return -1; /* not time driven */ } protected: - void updateCurrentTime(int currentTime) + void updateCurrentTime(int currentTime) override { QPropertyAnimation::updateCurrentTime(currentTime); if (currentTime >= QPropertyAnimation::duration()) diff --git a/tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp b/tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp index ac20fb35ec..724db5ae21 100644 --- a/tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp +++ b/tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp @@ -50,7 +50,7 @@ class TestableQVariantAnimation : public QVariantAnimation { Q_OBJECT public: - void updateCurrentValue(const QVariant&) {} + void updateCurrentValue(const QVariant&) override {} }; void tst_QVariantAnimation::construction() diff --git a/tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp b/tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp index 6b8f634e1f..53a521d06d 100644 --- a/tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp +++ b/tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp @@ -182,7 +182,7 @@ void tst_QGlobalStatic::threadStressTest() { public: QReadWriteLock *lock; - void run() + void run() override { QReadLocker l(lock); //usleep(QRandomGenerator::global()->generate(200)); diff --git a/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp b/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp index 1671e9d98b..f85742354e 100644 --- a/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp +++ b/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp @@ -76,7 +76,7 @@ public: { } - bool open(QIODevice::OpenMode openMode) + bool open(QIODevice::OpenMode openMode) override { if (openForRead_ || openForWrite_) { qWarning("%s: file is already open for %s", @@ -108,7 +108,7 @@ public: return true; } - bool close() + bool close() override { openFile_.clear(); @@ -119,7 +119,7 @@ public: return true; } - qint64 size() const + qint64 size() const override { QSharedPointer<File> file = resolveFile(false); if (!file) @@ -129,7 +129,7 @@ public: return file->content.size(); } - qint64 pos() const + qint64 pos() const override { if (!openForRead_ && !openForWrite_) { qWarning("%s: file is not open", Q_FUNC_INFO); @@ -138,7 +138,7 @@ public: return position_; } - bool seek(qint64 pos) + bool seek(qint64 pos) override { if (!openForRead_ && !openForWrite_) { qWarning("%s: file is not open", Q_FUNC_INFO); @@ -153,7 +153,7 @@ public: return false; } - bool flush() + bool flush() override { if (!openForRead_ && !openForWrite_) { qWarning("%s: file is not open", Q_FUNC_INFO); @@ -163,7 +163,7 @@ public: return true; } - bool remove() + bool remove() override { QMutexLocker lock(&fileSystemMutex); int count = fileSystem.remove(fileName_); @@ -171,7 +171,7 @@ public: return (count == 1); } - bool copy(const QString &newName) + bool copy(const QString &newName) override { QMutexLocker lock(&fileSystemMutex); if (!fileSystem.contains(fileName_) @@ -182,7 +182,7 @@ public: return true; } - bool rename(const QString &newName) + bool rename(const QString &newName) override { QMutexLocker lock(&fileSystemMutex); if (!fileSystem.contains(fileName_) @@ -215,7 +215,7 @@ public: // return false; // } - bool setSize(qint64 size) + bool setSize(qint64 size) override { if (size < 0) return false; @@ -234,7 +234,7 @@ public: return (file->content.size() == size); } - FileFlags fileFlags(FileFlags type) const + FileFlags fileFlags(FileFlags type) const override { QSharedPointer<File> file = resolveFile(false); if (file) { @@ -252,7 +252,7 @@ public: // return false; // } - QString fileName(FileName file) const + QString fileName(FileName file) const override { switch (file) { case DefaultName: @@ -281,7 +281,7 @@ public: return QString(); } - uint ownerId(FileOwner owner) const + uint ownerId(FileOwner owner) const override { QSharedPointer<File> file = resolveFile(false); if (file) { @@ -302,7 +302,7 @@ public: return -2; } - QString owner(FileOwner owner) const + QString owner(FileOwner owner) const override { QSharedPointer<File> file = resolveFile(false); if (file) { @@ -335,7 +335,7 @@ public: return QString(); } - QDateTime fileTime(FileTime time) const + QDateTime fileTime(FileTime time) const override { QSharedPointer<File> file = resolveFile(false); if (file) { @@ -355,14 +355,14 @@ public: return QDateTime(); } - bool setFileTime(const QDateTime &newDate, FileTime time) + bool setFileTime(const QDateTime &newDate, FileTime time) override { Q_UNUSED(newDate); Q_UNUSED(time); return false; } - void setFileName(const QString &file) + void setFileName(const QString &file) override { if (openForRead_ || openForWrite_) qWarning("%s: Can't set file name while file is open", Q_FUNC_INFO); @@ -384,7 +384,7 @@ public: // return 0; // } - qint64 read(char *data, qint64 maxLen) + qint64 read(char *data, qint64 maxLen) override { if (!openForRead_) { qWarning("%s: file must be open for reading", Q_FUNC_INFO); @@ -407,7 +407,7 @@ public: return readSize; } - qint64 write(const char *data, qint64 length) + qint64 write(const char *data, qint64 length) override { if (!openForWrite_) { qWarning("%s: file must be open for writing", Q_FUNC_INFO); @@ -508,15 +508,15 @@ public: names.append("bar"); index = -1; } - QString currentFileName() const + QString currentFileName() const override { return names.at(index); } - bool hasNext() const + bool hasNext() const override { return index < names.size() - 1; } - QString next() + QString next() override { if (!hasNext()) return QString(); @@ -530,11 +530,11 @@ public: : QFSFileEngine(fileName) { } - Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) + Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) override { return new Iterator(filters, filterNames); } - FileFlags fileFlags(FileFlags type) const + FileFlags fileFlags(FileFlags type) const override { if (fileName(DefaultName).endsWith(".tar")) { FileFlags ret = QFSFileEngine::fileFlags(type); @@ -556,7 +556,7 @@ QHash<QString, QSharedPointer<ReferenceFileEngine::File> > ReferenceFileEngine:: class FileEngineHandler : QAbstractFileEngineHandler { - QAbstractFileEngine *create(const QString &fileName) const + QAbstractFileEngine *create(const QString &fileName) const override { if (fileName.endsWith(".tar") || fileName.contains(".tar/")) return new MountingFileEngine(fileName); diff --git a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp index 24e6128b4d..c18354d840 100644 --- a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp +++ b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp @@ -477,14 +477,14 @@ public: : QFSFileEngine(fileName) { } - QAbstractFileEngineIterator *beginEntryList(QDir::Filters, const QStringList &) + QAbstractFileEngineIterator *beginEntryList(QDir::Filters, const QStringList &) override { return 0; } }; class EngineWithNoIteratorHandler : public QAbstractFileEngineHandler { public: - QAbstractFileEngine *create(const QString &fileName) const + QAbstractFileEngine *create(const QString &fileName) const override { return new EngineWithNoIterator(fileName); } diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index b81ed67764..e5b7051997 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -2181,33 +2181,33 @@ public: MyEngine(int n) { number = n; } virtual ~MyEngine() {} - void setFileName(const QString &) {} - bool open(QIODevice::OpenMode) { return false; } - bool close() { return false; } - bool flush() { return false; } - qint64 size() const { return 123 + number; } + void setFileName(const QString &) override {} + bool open(QIODevice::OpenMode) override { return false; } + bool close() override { return false; } + bool flush() override { return false; } + qint64 size() const override { return 123 + number; } qint64 at() const { return -1; } - bool seek(qint64) { return false; } - bool isSequential() const { return false; } - qint64 read(char *, qint64) { return -1; } - qint64 write(const char *, qint64) { return -1; } - bool remove() { return false; } - bool copy(const QString &) { return false; } - bool rename(const QString &) { return false; } - bool link(const QString &) { return false; } - bool mkdir(const QString &, bool) const { return false; } - bool rmdir(const QString &, bool) const { return false; } - bool setSize(qint64) { return false; } - QStringList entryList(QDir::Filters, const QStringList &) const { return QStringList(); } - bool caseSensitive() const { return false; } - bool isRelativePath() const { return false; } - FileFlags fileFlags(FileFlags) const { return { }; } + bool seek(qint64) override { return false; } + bool isSequential() const override { return false; } + qint64 read(char *, qint64) override { return -1; } + qint64 write(const char *, qint64) override { return -1; } + bool remove() override { return false; } + bool copy(const QString &) override { return false; } + bool rename(const QString &) override { return false; } + bool link(const QString &) override { return false; } + bool mkdir(const QString &, bool) const override { return false; } + bool rmdir(const QString &, bool) const override { return false; } + bool setSize(qint64) override { return false; } + QStringList entryList(QDir::Filters, const QStringList &) const override { return QStringList(); } + bool caseSensitive() const override { return false; } + bool isRelativePath() const override { return false; } + FileFlags fileFlags(FileFlags) const override { return { }; } bool chmod(uint) { return false; } - QString fileName(FileName) const { return name; } - uint ownerId(FileOwner) const { return 0; } - QString owner(FileOwner) const { return QString(); } - QDateTime fileTime(FileTime) const { return QDateTime(); } - bool setFileTime(const QDateTime &, FileTime) { return false; } + QString fileName(FileName) const override { return name; } + uint ownerId(FileOwner) const override { return 0; } + QString owner(FileOwner) const override { return QString(); } + QDateTime fileTime(FileTime) const override { return QDateTime(); } + bool setFileTime(const QDateTime &, FileTime) override { return false; } private: int number; @@ -2217,7 +2217,7 @@ private: class MyHandler : public QAbstractFileEngineHandler { public: - inline QAbstractFileEngine *create(const QString &) const + inline QAbstractFileEngine *create(const QString &) const override { return new MyEngine(1); } @@ -2226,7 +2226,7 @@ public: class MyHandler2 : public QAbstractFileEngineHandler { public: - inline QAbstractFileEngine *create(const QString &) const + inline QAbstractFileEngine *create(const QString &) const override { return new MyEngine(2); } @@ -2257,7 +2257,7 @@ void tst_QFile::fileEngineHandler() class MyRecursiveHandler : public QAbstractFileEngineHandler { public: - inline QAbstractFileEngine *create(const QString &fileName) const + inline QAbstractFileEngine *create(const QString &fileName) const override { if (fileName.startsWith(":!")) { QDir dir; @@ -2671,7 +2671,7 @@ void tst_QFile::renameWithAtEndSpecialFile() const class PeculiarAtEnd : public QFile { public: - virtual bool atEnd() const + virtual bool atEnd() const override { return true; } diff --git a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp index 79ac6b0fc4..cc73eac9c8 100644 --- a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp +++ b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp @@ -133,7 +133,7 @@ public: : _logtext(logtext), _configuration(configuration) {} protected: - void run() + void run() override { for (int i = 0; i < 2000; i++) { _configuration->addKey("Digia*", true); diff --git a/tests/auto/corelib/io/qprocess-noapplication/tst_qprocessnoapplication.cpp b/tests/auto/corelib/io/qprocess-noapplication/tst_qprocessnoapplication.cpp index b9702a93cf..ae53559de7 100644 --- a/tests/auto/corelib/io/qprocess-noapplication/tst_qprocessnoapplication.cpp +++ b/tests/auto/corelib/io/qprocess-noapplication/tst_qprocessnoapplication.cpp @@ -49,7 +49,7 @@ void tst_QProcessNoApplication::initializationDeadlock() struct MyThread : public QThread { - void run() + void run() override { // what we execute does not matter, as long as we try to // and that the process exits diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index 023e254dc5..1570bb9977 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -1192,7 +1192,7 @@ public: } protected: - inline void run() + inline void run() override { exitCode = 90210; diff --git a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp index df3104eddf..5d384de2b2 100644 --- a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp +++ b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp @@ -134,26 +134,26 @@ class QtTestModel: public QAbstractItemModel public: QtTestModel(int rows, int columns, QObject *parent = 0); QtTestModel(const QList<QList<QString> > tbl, QObject *parent = 0); - QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; - QModelIndex parent(const QModelIndex &) const; - int rowCount(const QModelIndex &parent) const; - int columnCount(const QModelIndex &parent) const; - bool hasChildren(const QModelIndex &) const; - QVariant data(const QModelIndex &idx, int) const; - bool setData(const QModelIndex &idx, const QVariant &value, int); - bool insertRows(int row, int count, const QModelIndex &parent= QModelIndex()); - bool insertColumns(int column, int count, const QModelIndex &parent= QModelIndex()); + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; + QModelIndex parent(const QModelIndex &) const override; + int rowCount(const QModelIndex &parent) const override; + int columnCount(const QModelIndex &parent) const override; + bool hasChildren(const QModelIndex &) const override; + QVariant data(const QModelIndex &idx, int) const override; + bool setData(const QModelIndex &idx, const QVariant &value, int) override; + bool insertRows(int row, int count, const QModelIndex &parent= QModelIndex()) override; + bool insertColumns(int column, int count, const QModelIndex &parent= QModelIndex()) override; void setPersistent(const QModelIndex &from, const QModelIndex &to); - bool removeRows ( int row, int count, const QModelIndex & parent = QModelIndex() ); - bool removeColumns( int column, int count, const QModelIndex & parent = QModelIndex()); + bool removeRows ( int row, int count, const QModelIndex & parent = QModelIndex()) override; + bool removeColumns( int column, int count, const QModelIndex & parent = QModelIndex()) override; bool moveRows (const QModelIndex &sourceParent, int sourceRow, int count, - const QModelIndex &destinationParent, int destinationChild); + const QModelIndex &destinationParent, int destinationChild) override; bool moveColumns(const QModelIndex &sourceParent, int sourceColumn, int count, - const QModelIndex &destinationParent, int destinationChild); + const QModelIndex &destinationParent, int destinationChild) override; void reset(); bool canDropMimeData(const QMimeData *data, Qt::DropAction action, - int row, int column, const QModelIndex &parent) const; + int row, int column, const QModelIndex &parent) const override; int cCount, rCount; mutable bool wrongIndex; @@ -2171,14 +2171,14 @@ public: } - QHash<int, QByteArray> roleNames() const + QHash<int, QByteArray> roleNames() const override { QHash<int, QByteArray> roles = QStringListModel::roleNames(); roles.insert(Qt::UserRole + 2, "custom"); return roles; } - Qt::DropActions supportedDragActions() const + Qt::DropActions supportedDragActions() const override { return QStringListModel::supportedDragActions() | Qt::MoveAction; } diff --git a/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp b/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp index 4406d40986..92700b251e 100644 --- a/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp @@ -67,29 +67,29 @@ class SubQAbstractProxyModel : public QAbstractProxyModel { public: // QAbstractProxyModel::mapFromSource is a pure virtual function. - QModelIndex mapFromSource(QModelIndex const& sourceIndex) const + QModelIndex mapFromSource(QModelIndex const& sourceIndex) const override { Q_UNUSED(sourceIndex); return QModelIndex(); } // QAbstractProxyModel::mapToSource is a pure virtual function. - QModelIndex mapToSource(QModelIndex const& proxyIndex) const + QModelIndex mapToSource(QModelIndex const& proxyIndex) const override { Q_UNUSED(proxyIndex); return QModelIndex(); } - QModelIndex index(int, int, const QModelIndex&) const + QModelIndex index(int, int, const QModelIndex&) const override { return QModelIndex(); } - QModelIndex parent(const QModelIndex&) const + QModelIndex parent(const QModelIndex&) const override { return QModelIndex(); } - int rowCount(const QModelIndex&) const + int rowCount(const QModelIndex&) const override { return 0; } - int columnCount(const QModelIndex&) const + int columnCount(const QModelIndex&) const override { return 0; } @@ -399,7 +399,7 @@ class SwappingProxy : public QAbstractProxyModel } } public: - virtual QModelIndex index(int row, int column, const QModelIndex &parentIdx) const + virtual QModelIndex index(int row, int column, const QModelIndex &parentIdx) const override { if (!sourceModel()) return QModelIndex(); @@ -412,28 +412,28 @@ public: return createIndex(row, column, parentIdx.internalPointer()); } - virtual QModelIndex parent(const QModelIndex &parentIdx) const + virtual QModelIndex parent(const QModelIndex &parentIdx) const override { // well, we're a 2D model Q_UNUSED(parentIdx); return QModelIndex(); } - virtual int rowCount(const QModelIndex &parentIdx) const + virtual int rowCount(const QModelIndex &parentIdx) const override { if (parentIdx.isValid() || !sourceModel()) return 0; return sourceModel()->rowCount(); } - virtual int columnCount(const QModelIndex &parentIdx) const + virtual int columnCount(const QModelIndex &parentIdx) const override { if (parentIdx.isValid() || !sourceModel()) return 0; return sourceModel()->rowCount(); } - virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const + virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const override { if (!proxyIndex.isValid()) return QModelIndex(); @@ -443,7 +443,7 @@ public: return sourceModel()->index(swapRow(proxyIndex.row()), proxyIndex.column(), QModelIndex()); } - virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const + virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override { if (!sourceIndex.isValid()) return QModelIndex(); @@ -485,9 +485,9 @@ void tst_QAbstractProxyModel::testSwappingRowsProxy() class StandardItemModelWithCustomDragAndDrop : public QStandardItemModel { public: - QStringList mimeTypes() const { return QStringList() << QStringLiteral("foo/mimetype"); } - Qt::DropActions supportedDragActions() const { return Qt::CopyAction | Qt::LinkAction; } - Qt::DropActions supportedDropActions() const { return Qt::MoveAction; } + QStringList mimeTypes() const override { return QStringList() << QStringLiteral("foo/mimetype"); } + Qt::DropActions supportedDragActions() const override { return Qt::CopyAction | Qt::LinkAction; } + Qt::DropActions supportedDropActions() const override { return Qt::MoveAction; } }; void tst_QAbstractProxyModel::testDragAndDrop() diff --git a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp index 95743ddb9e..4828df8b94 100644 --- a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp @@ -43,9 +43,9 @@ Q_LOGGING_CATEGORY(lcItemModels, "qt.corelib.tests.itemmodels") class DataChangedModel : public QAbstractListModel { public: - int rowCount(const QModelIndex &parent) const { return parent.isValid() ? 0 : 1; } - QVariant data(const QModelIndex&, int) const { return QVariant(); } - QModelIndex index(int row, int column, const QModelIndex &) const { return createIndex(row, column); } + int rowCount(const QModelIndex &parent) const override { return parent.isValid() ? 0 : 1; } + QVariant data(const QModelIndex&, int) const override { return QVariant(); } + QModelIndex index(int row, int column, const QModelIndex &) const override { return createIndex(row, column); } void changeData() { @@ -399,7 +399,7 @@ void tst_QIdentityProxyModel::dataChanged() class AppendStringProxy : public QIdentityProxyModel { public: - QVariant data(const QModelIndex &index, int role) const + QVariant data(const QModelIndex &index, int role) const override { const QVariant result = QIdentityProxyModel::data(index, role); if (role != Qt::DisplayRole) diff --git a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp index 3185dbcaf4..313facac81 100644 --- a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp +++ b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp @@ -127,17 +127,17 @@ public: return helper.QAbstractItemModel::createIndex(row, column, data); } - QModelIndex index(int, int, const QModelIndex&) const + QModelIndex index(int, int, const QModelIndex&) const override { return QModelIndex(); } - QModelIndex parent(const QModelIndex&) const + QModelIndex parent(const QModelIndex&) const override { return QModelIndex(); } - int rowCount(const QModelIndex & = QModelIndex()) const + int rowCount(const QModelIndex & = QModelIndex()) const override { return 0; } - int columnCount(const QModelIndex & = QModelIndex()) const + int columnCount(const QModelIndex & = QModelIndex()) const override { return 0; } - QVariant data(const QModelIndex &, int = Qt::DisplayRole) const + QVariant data(const QModelIndex &, int = Qt::DisplayRole) const override { return QVariant(); } - bool hasChildren(const QModelIndex &) const + bool hasChildren(const QModelIndex &) const override { return false; } }; @@ -2099,11 +2099,11 @@ public: { } - int rowCount(const QModelIndex& = QModelIndex()) const { return row_count; } - int columnCount(const QModelIndex& = QModelIndex()) const { return column_count; } + int rowCount(const QModelIndex& = QModelIndex()) const override { return row_count; } + int columnCount(const QModelIndex& = QModelIndex()) const override { return column_count; } bool isEditable(const QModelIndex &) const { return true; } - QVariant data(const QModelIndex &idx, int role) const + QVariant data(const QModelIndex &idx, int role) const override { if (role == Qt::DisplayRole || role == Qt::EditRole) return QLatin1Char('[') + QString::number(idx.row()) + QLatin1Char(',') @@ -2305,7 +2305,7 @@ void tst_QItemSelectionModel::layoutChangedWithAllSelected2() struct MyFilterModel : public QSortFilterProxyModel { // Override sort filter proxy to remove even numbered rows. bool filtering; - virtual bool filterAcceptsRow( int source_row, const QModelIndex& /* source_parent */) const + virtual bool filterAcceptsRow( int source_row, const QModelIndex& /* source_parent */) const override { return !filtering || !( source_row & 1 ); } @@ -2693,7 +2693,7 @@ public: { } - void select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command) + void select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command) override { QItemSelectionModel::select(selection, command); m_target->select(selection, command); @@ -2701,13 +2701,13 @@ public: using QItemSelectionModel::select; - void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command) + void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command) override { QItemSelectionModel::setCurrentIndex(index, command); m_target->setCurrentIndex(index, command); } - void clearCurrentIndex() + void clearCurrentIndex() override { QItemSelectionModel::clearCurrentIndex(); m_target->clearCurrentIndex(); diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp index e4036341fd..8567d8c3b9 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp +++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp @@ -44,7 +44,7 @@ class EventSpy : public QObject public: QList<int> recordedEvents; - bool eventFilter(QObject *, QEvent *event) + bool eventFilter(QObject *, QEvent *event) override { recordedEvents.append(event->type()); return false; @@ -234,7 +234,7 @@ class EventGenerator : public QObject public: QObject *other; - bool event(QEvent *e) + bool event(QEvent *e) override { if (e->type() == QEvent::MaxUser) { QCoreApplication::sendPostedEvents(other, 0); @@ -424,7 +424,7 @@ signals: void progress(int); protected: - void run() + void run() override { emit progress(1); emit progress(2); @@ -492,7 +492,7 @@ public slots: } public: - bool event(QEvent *event) + bool event(QEvent *event) override { switch (event->type()) { case QEvent::User: @@ -545,7 +545,7 @@ class GlobalPostedEventsCountObject : public QObject public: QList<int> globalPostedEventsCount; - bool event(QEvent *event) + bool event(QEvent *event) override { if (event->type() == QEvent::User) globalPostedEventsCount.append(qGlobalPostedEventsCount()); @@ -591,7 +591,7 @@ public: : counter(0) { } - bool event(QEvent *event) + bool event(QEvent *event) override { if (event->type() == QEvent::User) ++counter; @@ -622,7 +622,7 @@ class QuitBlocker : public QObject Q_OBJECT public: - bool eventFilter(QObject *, QEvent *event) + bool eventFilter(QObject *, QEvent *event) override { if (event->type() == QEvent::Quit) { event->ignore(); @@ -728,21 +728,21 @@ void tst_QCoreApplication::eventLoopExecAfterExit() class DummyEventDispatcher : public QAbstractEventDispatcher { public: DummyEventDispatcher() : QAbstractEventDispatcher(), visited(false) {} - bool processEvents(QEventLoop::ProcessEventsFlags) { + bool processEvents(QEventLoop::ProcessEventsFlags) override { visited = true; emit awake(); QCoreApplication::sendPostedEvents(); return false; } - void registerSocketNotifier(QSocketNotifier *) {} - void unregisterSocketNotifier(QSocketNotifier *) {} - void registerTimer(int , int , Qt::TimerType, QObject *) {} - bool unregisterTimer(int ) { return false; } - bool unregisterTimers(QObject *) { return false; } - QList<TimerInfo> registeredTimers(QObject *) const { return QList<TimerInfo>(); } - int remainingTime(int) { return 0; } - void wakeUp() {} - void interrupt() {} + void registerSocketNotifier(QSocketNotifier *) override {} + void unregisterSocketNotifier(QSocketNotifier *) override {} + void registerTimer(int , int , Qt::TimerType, QObject *) override {} + bool unregisterTimer(int ) override { return false; } + bool unregisterTimers(QObject *) override { return false; } + QList<TimerInfo> registeredTimers(QObject *) const override { return QList<TimerInfo>(); } + int remainingTime(int) override { return 0; } + void wakeUp() override {} + void interrupt() override {} #ifdef Q_OS_WIN bool registerEventNotifier(QWinEventNotifier *) { return false; } diff --git a/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp b/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp index 7aadd14466..fa5c78bceb 100644 --- a/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp +++ b/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp @@ -51,7 +51,7 @@ class tst_QEventDispatcher : public QObject bool doubleTimer = false; protected: - bool event(QEvent *e); + bool event(QEvent *e) override; public: inline tst_QEventDispatcher() @@ -314,7 +314,7 @@ public: inline ProcessEventsOnlySendsQueuedEvents() : eventsReceived(0) {} - bool event(QEvent *event) + bool event(QEvent *event) override { ++eventsReceived; diff --git a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp index 1f0b8d4b4e..3765b6fbf8 100644 --- a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp +++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp @@ -77,7 +77,7 @@ signals: void checkPoint(); public: QEventLoop *eventLoop; - void run(); + void run() override; }; void EventLoopThread::run() @@ -101,7 +101,7 @@ public: volatile int result2; MultipleExecThread() : result1(0xdead), result2(0xbeef) {} - void run() + void run() override { QMutexLocker locker(&mutex); // this exec should work @@ -180,7 +180,7 @@ private slots: void testQuitLock(); protected: - void customEvent(QEvent *e); + void customEvent(QEvent *e) override; }; void tst_QEventLoop::processEvents() @@ -446,7 +446,7 @@ class SocketTestThread : public QThread Q_OBJECT public: SocketTestThread():QThread(0),testResult(false){}; - void run() + void run() override { SocketEventsTester *tester = new SocketEventsTester(); if (tester->init()) @@ -489,7 +489,7 @@ public: : QObject(), gotTimerEvent(-1) { } - void timerEvent(QTimerEvent *event) + void timerEvent(QTimerEvent *event) override { gotTimerEvent = event->timerId(); } @@ -546,7 +546,7 @@ namespace DeliverInDefinedOrder { } int lastReceived[NbEventQueue]; int count; - virtual void customEvent(QEvent* e) { + virtual void customEvent(QEvent* e) override { QVERIFY(e->type() >= QEvent::User); QVERIFY(e->type() < QEvent::User + 5); uint idx = e->type() - QEvent::User; diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp index a3dd5e05e1..333c7931d9 100644 --- a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp +++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp @@ -1342,9 +1342,9 @@ class TestObject : public QObject // Manually expanded from Q_OBJECT macro public: static QMetaObject staticMetaObject; - virtual const QMetaObject *metaObject() const; - virtual void *qt_metacast(const char *); - virtual int qt_metacall(QMetaObject::Call, int, void **); + virtual const QMetaObject *metaObject() const override; + virtual void *qt_metacast(const char *) override; + virtual int qt_metacall(QMetaObject::Call, int, void **) override; private: Q_DECL_HIDDEN static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index 05fffd928a..ca215386fb 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -477,7 +477,7 @@ class MetaTypeTorturer: public QThread { Q_OBJECT protected: - void run() + void run() override { Bar space[1]; space[0].~Bar(); diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 01a847596e..51df41f5ac 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -776,9 +776,9 @@ public: disconnectedSignals.clear(); } protected: - void connectNotify(const QMetaMethod &signal) + void connectNotify(const QMetaMethod &signal) override { connectedSignals.append(signal); } - void disconnectNotify(const QMetaMethod &signal) + void disconnectNotify(const QMetaMethod &signal) override { disconnectedSignals.append(signal); } }; @@ -1003,9 +1003,9 @@ public: disconnectedSignals.clear(); } protected: - void connectNotify(const QMetaMethod &signal) + void connectNotify(const QMetaMethod &signal) override { connectedSignals.append(signal); } - void disconnectNotify(const QMetaMethod &signal) + void disconnectNotify(const QMetaMethod &signal) override { disconnectedSignals.append(signal); } Q_SIGNALS: void signal1(); @@ -1606,7 +1606,7 @@ class TestThread : public QThread { Q_OBJECT public: - inline void run() + inline void run() override { *object = new QObject; *child = new QObject(*object); @@ -1689,7 +1689,7 @@ public: : QObject(parent), timerEventThread(0), customEventThread(0), slotThread(0) { } - void customEvent(QEvent *) + void customEvent(QEvent *) override { if (customEventThread) qFatal("%s: customEventThread should be null", Q_FUNC_INFO); @@ -1697,7 +1697,7 @@ public: emit theSignal(); } - void timerEvent(QTimerEvent *) + void timerEvent(QTimerEvent *) override { if (timerEventThread) qFatal("%s: timerEventThread should be null", Q_FUNC_INFO); @@ -1736,7 +1736,7 @@ public: // wait for thread to start (void) eventLoop.exec(); } - void run() + void run() override { (void) exec(); } }; @@ -2311,7 +2311,7 @@ class FooObject: public QObject, public Foo::Bar Q_OBJECT Q_INTERFACES(Foo::Bar) public: - int rtti() const { return 42; } + int rtti() const override { return 42; } }; class BlehObject : public QObject, public Foo::Bleh @@ -2319,7 +2319,7 @@ class BlehObject : public QObject, public Foo::Bleh Q_OBJECT Q_INTERFACES(Foo::Bleh) public: - int rtti() const { return 43; } + int rtti() const override { return 43; } }; void tst_QObject::declareInterface() @@ -2913,7 +2913,7 @@ class DynamicPropertyObject : public PropertyObject public: inline DynamicPropertyObject() {} - inline virtual bool event(QEvent *e) { + inline virtual bool event(QEvent *e) override { if (e->type() == QEvent::DynamicPropertyChange) { changedDynamicProperties.append(static_cast<QDynamicPropertyChangeEvent *>(e)->propertyName()); } @@ -3060,7 +3060,7 @@ public: events.clear(); } - bool eventFilter(QObject *object, QEvent *event) + bool eventFilter(QObject *object, QEvent *event) override { events.append(qMakePair(object, event->type())); return false; @@ -3198,7 +3198,7 @@ void tst_QObject::installEventFilter() class EmitThread : public QThread { Q_OBJECT public: - void run(void) { + void run(void) override { emit work(); } signals: @@ -4292,7 +4292,7 @@ public: ThreadAffinityThread(SenderObject *sender) : sender(sender) { } - void run() + void run() override { sender->emitSignal1(); } @@ -5655,7 +5655,7 @@ signals: class VirtualSlotsObject : public VirtualSlotsObjectBase { Q_OBJECT public slots: - virtual void slot1() { + virtual void slot1() override { derived_counter1++; } public: @@ -5704,8 +5704,8 @@ public: public slots: void regularSlot() { ++regular_call_count; } - virtual void slot1() { ++derived_counter2; } - virtual void slot2() { ++virtual_base_count; } + virtual void slot1() override { ++derived_counter2; } + virtual void slot2() override { ++virtual_base_count; } }; struct NormalBase @@ -6804,6 +6804,7 @@ public: explicit CountedExceptionThrower(bool throwException, QObject *parent = nullptr) : QObject(parent) { + Q_UNUSED(throwException); #ifndef QT_NO_EXCEPTIONS if (throwException) throw ObjectException(); diff --git a/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp b/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp index 914f9e2b9b..ba973910a7 100644 --- a/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp +++ b/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp @@ -327,7 +327,8 @@ void tst_QPointer::castDuringDestruction() } class TestRunnable : public QObject, public QRunnable { - void run() { + void run() override + { QPointer<QObject> obj1 = new QObject; QPointer<QObject> obj2 = new QObject; obj1->moveToThread(thread()); // this is the owner thread diff --git a/tests/auto/corelib/kernel/qsharedmemory/tst_qsharedmemory.cpp b/tests/auto/corelib/kernel/qsharedmemory/tst_qsharedmemory.cpp index fa2d5e3723..31b9c9740a 100644 --- a/tests/auto/corelib/kernel/qsharedmemory/tst_qsharedmemory.cpp +++ b/tests/auto/corelib/kernel/qsharedmemory/tst_qsharedmemory.cpp @@ -593,7 +593,7 @@ class Consumer : public QThread { public: - void run() + void run() override { QSharedMemory consumer(QLatin1String("market")); while (!consumer.attach()) { @@ -641,7 +641,7 @@ public: } } - void run() + void run() override { char *memory = (char*)producer.data(); diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp index ff345def85..1db210e0bd 100644 --- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp +++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp @@ -335,7 +335,8 @@ public: secondTimerId = -1; // started later } - bool event(QEvent *e) { + bool event(QEvent *e) override + { if (e->type() == 4002) { // got the posted event if (timeoutsForFirst == 1 && timeoutsForSecond == 0) @@ -345,7 +346,8 @@ public: return QObject::event(e); } - void timerEvent(QTimerEvent *te) { + void timerEvent(QTimerEvent *te) override + { if (te->timerId() == firstTimerId) { if (++timeoutsForFirst == 1) { killTimer(extraTimerId); @@ -403,7 +405,7 @@ public: : inTimerEvent(false), timerEventRecursed(false), interval(interval) { } - void timerEvent(QTimerEvent *timerEvent) + void timerEvent(QTimerEvent *timerEvent) override { timerEventRecursed = inTimerEvent; if (timerEventRecursed) { @@ -460,7 +462,7 @@ public: : times(0), target(target), recurse(false) { } - void timerEvent(QTimerEvent *timerEvent) + void timerEvent(QTimerEvent *timerEvent) override { if (++times == target) { killTimer(timerEvent->timerId()); @@ -579,7 +581,7 @@ public: interval = interval ? 0 : 1000; } - void timerEvent(QTimerEvent* ev) + void timerEvent(QTimerEvent* ev) override { if (ev->timerId() != m_timer.timerId()) return; @@ -677,7 +679,7 @@ public: delete timer; } - void run() + void run() override { QEventLoop eventLoop; timer = new QTimer; @@ -947,7 +949,7 @@ class DontBlockEvents : public QObject Q_OBJECT public: DontBlockEvents(); - void timerEvent(QTimerEvent*); + void timerEvent(QTimerEvent*) override; int count; int total; diff --git a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp index 1b159e8c9e..cc35b6cb59 100644 --- a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp +++ b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp @@ -37,7 +37,7 @@ class tst_QTranslator : public QObject public: tst_QTranslator(); protected: - bool eventFilter(QObject *obj, QEvent *event); + bool eventFilter(QObject *obj, QEvent *event) override; private slots: void initTestCase(); @@ -157,7 +157,7 @@ void tst_QTranslator::load() class TranslatorThread : public QThread { - void run() { + void run() override { QTranslator tor( 0 ); tor.load("hellotr_la"); @@ -316,7 +316,7 @@ struct TranslateThread : public QThread QMutex startupLock; QWaitCondition runningCondition; - void run() { + void run() override { bool startSignalled = false; while (terminate.loadRelaxed() == 0) { diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.h b/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.h index ca2ceed7a9..8091ba52bf 100644 --- a/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.h +++ b/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.h @@ -39,7 +39,7 @@ class Plugin1 : public QObject, public PluginInterface1 Q_INTERFACES(PluginInterface1) public: - virtual QString pluginName() const; + virtual QString pluginName() const override; }; #endif // THEPLUGIN_H diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.h b/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.h index 130bf66561..ce214f7571 100644 --- a/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.h +++ b/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.h @@ -39,7 +39,7 @@ class Plugin2 : public QObject, public PluginInterface2 Q_INTERFACES(PluginInterface2) public: - virtual QString pluginName() const; + virtual QString pluginName() const override; }; #endif // THEPLUGIN_H diff --git a/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.h b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.h index 6071d0c4d7..4dd8df52f0 100644 --- a/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.h +++ b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.h @@ -39,7 +39,7 @@ class AlmostPlugin : public QObject, public PluginInterface Q_INTERFACES(PluginInterface) public: - QString pluginName() const; + QString pluginName() const override; void unresolvedSymbol() const; }; diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h index ac349c2f75..7c9324b8b3 100644 --- a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h +++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h @@ -39,7 +39,7 @@ class ThePlugin : public QObject, public PluginInterface Q_INTERFACES(PluginInterface) public: - virtual QString pluginName() const; + virtual QString pluginName() const override; }; #endif // THEPLUGIN_H diff --git a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp index 568da10b00..8563804ff8 100644 --- a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp +++ b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp @@ -380,7 +380,7 @@ class UuidThread : public QThread public: QUuid uuid; - void run() + void run() override { uuid = QUuid::createUuid(); } diff --git a/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp index 72a69a6dfd..e1fd7a7147 100644 --- a/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp +++ b/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp @@ -2795,7 +2795,7 @@ void tst_QTextStream::status_word_read() class FakeBuffer : public QBuffer { protected: - qint64 writeData(const char *c, qint64 i) { return m_lock ? 0 : QBuffer::writeData(c, i); } + qint64 writeData(const char *c, qint64 i) override { return m_lock ? 0 : QBuffer::writeData(c, i); } public: FakeBuffer(bool locked = false) : m_lock(locked) {} void setLocked(bool locked) { m_lock = locked; } diff --git a/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp b/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp index 5cace2c36b..7046fe33a6 100644 --- a/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp +++ b/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp @@ -853,7 +853,7 @@ void tst_QXmlStream::addExtraNamespaceDeclarations() class EntityResolver : public QXmlStreamEntityResolver { public: - QString resolveUndeclaredEntity(const QString &name) { + QString resolveUndeclaredEntity(const QString &name) override { static int count = 0; return name.toUpper() + QString::number(++count); } @@ -1467,7 +1467,7 @@ void tst_QXmlStream::crashInXmlStreamReader() const class FakeBuffer : public QBuffer { protected: - qint64 writeData(const char *c, qint64 i) + qint64 writeData(const char *c, qint64 i) override { qint64 ai = qMin(m_capacity, i); m_capacity -= ai; diff --git a/tests/auto/corelib/text/qstringconverter/tst_qstringconverter.cpp b/tests/auto/corelib/text/qstringconverter/tst_qstringconverter.cpp index dcb6bbd419..49306cc8fd 100644 --- a/tests/auto/corelib/text/qstringconverter/tst_qstringconverter.cpp +++ b/tests/auto/corelib/text/qstringconverter/tst_qstringconverter.cpp @@ -1828,7 +1828,7 @@ public: QStringEncoder encode; QStringDecoder decode; QString *target; - void run() + void run() override { QString str = QString::fromLatin1("abcdefghijklmonpqrstufvxyz"); for (int i = 0; i < 10000; ++i) { diff --git a/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp b/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp index 58275e0372..e447f27653 100644 --- a/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp +++ b/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp @@ -887,7 +887,7 @@ void tst_QAtomicInt::fetchAndAdd_loop() class FetchAndAddThread : public QThread { public: - void run() + void run() override { for (int i = 0; i < iterations; ++i) diff --git a/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp b/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp index 0f14336a24..027bd1313e 100644 --- a/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp +++ b/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp @@ -232,7 +232,7 @@ void tst_QFutureWatcher::canceled() class IntTask : public RunFunctionTask<int> { public: - void runFunctor() + void runFunctor() override { result = 10; } @@ -466,7 +466,7 @@ const int maxProgress = 100000; class ProgressEmitterTask : public RunFunctionTask<void> { public: - void runFunctor() + void runFunctor() override { promise.setProgressRange(0, maxProgress); for (int p = 0; p <= maxProgress; ++p) @@ -496,7 +496,7 @@ template <typename T> class ProgressTextTask : public RunFunctionTask<T> { public: - void runFunctor() + void runFunctor() override { this->promise.setProgressValueAndText(1, QLatin1String("Foo 1")); diff --git a/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp b/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp index b07f8196c5..51e46f87ea 100644 --- a/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp +++ b/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp @@ -204,7 +204,7 @@ void tst_QMutex::tryLock_non_recursive() class Thread : public QThread { public: - void run() + void run() override { testsTurn.release(); @@ -331,7 +331,7 @@ void tst_QMutex::try_lock_for_non_recursive() { class Thread : public QThread { public: - void run() + void run() override { testsTurn.release(); @@ -460,7 +460,7 @@ void tst_QMutex::try_lock_until_non_recursive() class Thread : public QThread { public: - void run() + void run() override { const std::chrono::milliseconds systemTimersResolutionAsDuration(systemTimersResolution); testsTurn.release(); @@ -586,7 +586,7 @@ void tst_QMutex::tryLock_recursive() class Thread : public QThread { public: - void run() + void run() override { testsTurn.release(); @@ -713,7 +713,7 @@ void tst_QMutex::try_lock_for_recursive() class Thread : public QThread { public: - void run() + void run() override { testsTurn.release(); @@ -841,7 +841,7 @@ void tst_QMutex::try_lock_until_recursive() class Thread : public QThread { public: - void run() + void run() override { const std::chrono::milliseconds systemTimersResolutionAsDuration(systemTimersResolution); testsTurn.release(); @@ -972,7 +972,7 @@ public: inline mutex_Thread(QMutex &m) : test_mutex(m) { } - void run() + void run() override { test_mutex.lock(); @@ -997,7 +997,7 @@ public: inline rmutex_Thread(QRecursiveMutex &m) : test_mutex(m) { } - void run() + void run() override { test_mutex.lock(); test_mutex.lock(); @@ -1101,7 +1101,7 @@ public: t.start(); QThread::start(); } - void run() + void run() override { while (t.elapsed() < one_minute) { mutex.lock(); @@ -1140,7 +1140,7 @@ class TryLockRaceThread : public QThread public: static QMutex mutex; - void run() + void run() override { QElapsedTimer t; t.start(); @@ -1186,7 +1186,8 @@ void tst_QMutex::tryLockDeadlock() struct TrylockThread : QThread { TrylockThread(QMutex &mut) : mut(mut) {} QMutex &mut; - void run() { + void run() override + { for (int i = 0; i < 100000; ++i) { if (mut.tryLock(0)) { if ((++tryLockDeadlockCounter) != 1) @@ -1239,7 +1240,8 @@ void tst_QMutex::tryLockNegative() QMutex &mut; int timeout; int tryLockResult; - void run() { + void run() override + { tryLockResult = mut.tryLock(timeout); mut.unlock(); } @@ -1281,7 +1283,7 @@ public: t.start(); QThread::start(); } - void run() + void run() override { quint64 i = 0; while (t.elapsed() < one_minute) { diff --git a/tests/auto/corelib/thread/qmutexlocker/tst_qmutexlocker.cpp b/tests/auto/corelib/thread/qmutexlocker/tst_qmutexlocker.cpp index c83e186ca7..46cdd8073e 100644 --- a/tests/auto/corelib/thread/qmutexlocker/tst_qmutexlocker.cpp +++ b/tests/auto/corelib/thread/qmutexlocker/tst_qmutexlocker.cpp @@ -74,7 +74,7 @@ void tst_QMutexLocker::scopeTest() class ScopeTestThread : public tst_QMutexLockerThread { public: - void run() + void run() override { waitForTest(); @@ -119,7 +119,7 @@ void tst_QMutexLocker::unlockAndRelockTest() class UnlockAndRelockThread : public tst_QMutexLockerThread { public: - void run() + void run() override { QMutexLocker locker(&mutex); @@ -165,7 +165,7 @@ void tst_QMutexLocker::lockerStateTest() class LockerStateThread : public tst_QMutexLockerThread { public: - void run() + void run() override { { QMutexLocker locker(&mutex); diff --git a/tests/auto/corelib/thread/qreadlocker/tst_qreadlocker.cpp b/tests/auto/corelib/thread/qreadlocker/tst_qreadlocker.cpp index 7d1b3709c2..241f064a21 100644 --- a/tests/auto/corelib/thread/qreadlocker/tst_qreadlocker.cpp +++ b/tests/auto/corelib/thread/qreadlocker/tst_qreadlocker.cpp @@ -73,7 +73,7 @@ void tst_QReadLocker::scopeTest() class ScopeTestThread : public tst_QReadLockerThread { public: - void run() + void run() override { waitForTest(); @@ -118,7 +118,7 @@ void tst_QReadLocker::unlockAndRelockTest() class UnlockAndRelockThread : public tst_QReadLockerThread { public: - void run() + void run() override { QReadLocker locker(&lock); @@ -164,7 +164,7 @@ void tst_QReadLocker::lockerStateTest() class LockerStateThread : public tst_QReadLockerThread { public: - void run() + void run() override { { QReadLocker locker(&lock); diff --git a/tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp b/tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp index 0fe6a5294d..f984aec0e8 100644 --- a/tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp +++ b/tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp @@ -214,7 +214,7 @@ void tst_QReadWriteLock::tryReadLock() class Thread : public QThread { public: - void run() + void run() override { testsTurn.release(); @@ -331,7 +331,7 @@ void tst_QReadWriteLock::tryWriteLock() { public: Thread() : failureCount(0) { } - void run() + void run() override { testsTurn.release(); @@ -416,7 +416,7 @@ class WriteLockThread : public QThread public: QReadWriteLock &testRwlock; inline WriteLockThread(QReadWriteLock &l) : testRwlock(l) { } - void run() + void run() override { testRwlock.lockForWrite(); testRwlock.unlock(); @@ -434,7 +434,7 @@ class ReadLockThread : public QThread public: QReadWriteLock &testRwlock; inline ReadLockThread(QReadWriteLock &l) : testRwlock(l) { } - void run() + void run() override { testRwlock.lockForRead(); testRwlock.unlock(); @@ -451,7 +451,7 @@ class WriteLockReleasableThread : public QThread public: QReadWriteLock &testRwlock; inline WriteLockReleasableThread(QReadWriteLock &l) : testRwlock(l) { } - void run() + void run() override { testRwlock.lockForWrite(); while (release.loadRelaxed() == false) { @@ -471,7 +471,7 @@ class ReadLockReleasableThread : public QThread public: QReadWriteLock &testRwlock; inline ReadLockReleasableThread(QReadWriteLock &l) : testRwlock(l) { } - void run() + void run() override { testRwlock.lockForRead(); while (release.loadRelaxed() == false) { @@ -505,7 +505,7 @@ public: ,waitTime(waitTime) ,print(print) { } - void run() + void run() override { t.start(); while (t.elapsed()<runTime) { @@ -541,7 +541,7 @@ public: ,waitTime(waitTime) ,print(print) { } - void run() + void run() override { t.start(); while (t.elapsed() < runTime) { @@ -578,7 +578,7 @@ public: ,waitTime(waitTime) ,maxval(maxval) { } - void run() + void run() override { t.start(); while (t.elapsed() < runTime) { @@ -618,7 +618,7 @@ public: ,runTime(runTime) ,waitTime(waitTime) { } - void run() + void run() override { t.start(); while (t.elapsed() < runTime) { @@ -845,7 +845,7 @@ class DeleteOnUnlockThread : public QThread public: DeleteOnUnlockThread(QReadWriteLock **lock, QWaitCondition *startup, QMutex *waitMutex) :m_lock(lock), m_startup(startup), m_waitMutex(waitMutex) {} - void run() + void run() override { m_waitMutex->lock(); m_startup->wakeAll(); @@ -943,7 +943,7 @@ void tst_QReadWriteLock::recursiveReadLock() QReadWriteLock *lock; bool tryLockForWriteResult; - void run() + void run() override { testsTurn.release(); @@ -1038,7 +1038,7 @@ void tst_QReadWriteLock::recursiveWriteLock() QReadWriteLock *lock; bool tryLockForReadResult; - void run() + void run() override { testsTurn.release(); diff --git a/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp b/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp index 7654d0e74b..cf27c23591 100644 --- a/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp +++ b/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp @@ -57,7 +57,7 @@ public: ThreadOne() {} protected: - void run() + void run() override { int i = 0; while ( i < 100 ) { @@ -76,7 +76,7 @@ public: ThreadN(int n) :N(n) { } protected: - void run() + void run() override { int i = 0; while ( i < 100 ) { @@ -400,7 +400,7 @@ void tst_QSemaphore::tryAcquireWithTimeoutStarvation() QSemaphore *semaphore; int amountToConsume, timeout; - void run() + void run() override { startup.release(); forever { @@ -497,7 +497,7 @@ QSemaphore usedSpace; class Producer : public QThread { public: - void run(); + void run() override; }; static const int Timeout = 60 * 1000; // 1min @@ -521,7 +521,7 @@ void Producer::run() class Consumer : public QThread { public: - void run(); + void run() override; }; void Consumer::run() diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp index 3f2679831e..8cb846d98f 100644 --- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp +++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp @@ -142,7 +142,7 @@ public: Qt::HANDLE id; QThread *thread; - void run() + void run() override { id = QThread::currentThreadId(); thread = QThread::currentThread(); @@ -155,7 +155,7 @@ public: QMutex mutex; QWaitCondition cond; - void run() + void run() override { QMutexLocker locker(&mutex); cond.wakeOne(); @@ -180,7 +180,7 @@ public: int code; int result; - void run() + void run() override { Simple_Thread::run(); if (object) { @@ -195,7 +195,7 @@ public: class Terminate_Thread : public Simple_Thread { public: - void run() + void run() override { setTerminationEnabled(false); { @@ -224,7 +224,7 @@ public: Quit_Object *object; int result; - void run() + void run() override { Simple_Thread::run(); if (object) { @@ -245,7 +245,7 @@ public: int elapsed; // result, in *MILLISECONDS* - void run() + void run() override { QMutexLocker locker(&mutex); @@ -563,7 +563,7 @@ void tst_QThread::exec() MultipleExecThread() : res1(-2), res2(-2) { } - void run() + void run() override { { Exit_Object o; @@ -1002,7 +1002,8 @@ void tst_QThread::exitAndExec() QSemaphore sem1; QSemaphore sem2; volatile int value; - void run() { + void run() override + { sem1.acquire(); value = exec(); //First entrence sem2.release(); @@ -1053,7 +1054,7 @@ public: QWaitCondition cond1; QWaitCondition cond2; - void run() + void run() override { QMutexLocker locker(&mutex); cond1.wait(&mutex); @@ -1118,7 +1119,7 @@ void tst_QThread::wait3_slowDestructor() void tst_QThread::destroyFinishRace() { - class Thread : public QThread { void run() {} }; + class Thread : public QThread { void run() override {} }; for (int i = 0; i < 15; i++) { Thread *thr = new Thread; connect(thr, SIGNAL(finished()), thr, SLOT(deleteLater())); @@ -1138,7 +1139,8 @@ void tst_QThread::startFinishRace() class Thread : public QThread { public: Thread() : i (50) {} - void run() { + void run() override + { i--; if (!i) disconnect(this, SIGNAL(finished()), 0, 0); } @@ -1161,7 +1163,7 @@ void tst_QThread::startFinishRace() void tst_QThread::startAndQuitCustomEventLoop() { struct Thread : QThread { - void run() { QEventLoop().exec(); } + void run() override { QEventLoop().exec(); } }; for (int i = 0; i < 5; i++) { @@ -1213,21 +1215,21 @@ QT_END_NAMESPACE class DummyEventDispatcher : public QAbstractEventDispatcher { public: DummyEventDispatcher() : QAbstractEventDispatcher() {} - bool processEvents(QEventLoop::ProcessEventsFlags) { + bool processEvents(QEventLoop::ProcessEventsFlags) override { visited.storeRelaxed(true); emit awake(); QCoreApplication::sendPostedEvents(); return false; } - void registerSocketNotifier(QSocketNotifier *) {} - void unregisterSocketNotifier(QSocketNotifier *) {} - void registerTimer(int, int, Qt::TimerType, QObject *) {} - bool unregisterTimer(int ) { return false; } - bool unregisterTimers(QObject *) { return false; } - QList<TimerInfo> registeredTimers(QObject *) const { return QList<TimerInfo>(); } - int remainingTime(int) { return 0; } - void wakeUp() {} - void interrupt() {} + void registerSocketNotifier(QSocketNotifier *) override {} + void unregisterSocketNotifier(QSocketNotifier *) override {} + void registerTimer(int, int, Qt::TimerType, QObject *) override {} + bool unregisterTimer(int) override { return false; } + bool unregisterTimers(QObject *) override { return false; } + QList<TimerInfo> registeredTimers(QObject *) const override { return QList<TimerInfo>(); } + int remainingTime(int) override { return 0; } + void wakeUp() override {} + void interrupt() override {} #ifdef Q_OS_WIN bool registerEventNotifier(QWinEventNotifier *) { return false; } diff --git a/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp b/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp index 710288af9e..6859a55725 100644 --- a/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp +++ b/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp @@ -77,7 +77,7 @@ public: ~IncrementThread() { wait(); } protected: - void run() + void run() override { sem2.release(); sem1.acquire(); // synchronize diff --git a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp index 1d3d75d930..9b536aec00 100644 --- a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp +++ b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp @@ -43,7 +43,7 @@ class FunctionPointerTask : public QRunnable public: FunctionPointerTask(FunctionPointer function) :function(function) {} - void run() { function(); } + void run() override { function(); } private: FunctionPointer function; }; @@ -228,7 +228,7 @@ QAtomicInt ran; // bool class TestTask : public QRunnable { public: - void run() + void run() override { ran.storeRelaxed(true); } @@ -256,7 +256,7 @@ QAtomicInt *value = 0; class IntAccessor : public QRunnable { public: - void run() + void run() override { for (int i = 0; i < 100; ++i) { value->ref(); @@ -286,7 +286,7 @@ QThread *recycledThread = 0; class ThreadRecorderTask : public QRunnable { public: - void run() + void run() override { recycledThread = QThread::currentThread(); threadRecyclingSemaphore.release(); @@ -332,7 +332,7 @@ public: setAutoDelete(false); } - void run() + void run() override { thread = QThread::currentThread(); runCount.ref(); @@ -474,7 +474,7 @@ void tst_QThreadPool::setMaxThreadCountStartsAndStopsThreads() WaitingTask() { setAutoDelete(false); } - void run() + void run() override { waitForStarted.release(); waitToFinish.acquire(); @@ -671,7 +671,7 @@ void tst_QThreadPool::reserveAndStart() // QTBUG-21051 WaitingTask() { setAutoDelete(false); } - void run() + void run() override { count.ref(); waitForStarted.release(); @@ -722,7 +722,8 @@ void tst_QThreadPool::reserveAndStart() // QTBUG-21051 QAtomicInt count; class CountingRunnable : public QRunnable { - public: void run() +public: + void run() override { count.ref(); } @@ -750,7 +751,7 @@ void tst_QThreadPool::tryStart() WaitingTask() { setAutoDelete(false); } - void run() + void run() override { semaphore.acquire(); count.ref(); @@ -780,7 +781,7 @@ void tst_QThreadPool::tryStartPeakThreadCount() public: CounterTask() { setAutoDelete(false); } - void run() + void run() override { { QMutexLocker lock(&mutex); @@ -819,7 +820,7 @@ void tst_QThreadPool::tryStartCount() public: SleeperTask() { setAutoDelete(false); } - void run() + void run() override { QTest::qWait(50); } @@ -854,7 +855,7 @@ void tst_QThreadPool::priorityStart() public: QSemaphore &sem; Holder(QSemaphore &sem) : sem(sem) {} - void run() + void run() override { sem.acquire(); } @@ -864,7 +865,7 @@ void tst_QThreadPool::priorityStart() public: QAtomicPointer<QRunnable> &ptr; Runner(QAtomicPointer<QRunnable> &ptr) : ptr(ptr) {} - void run() + void run() override { ptr.testAndSetRelaxed(0, this); } @@ -928,7 +929,7 @@ void tst_QThreadPool::waitForDoneTimeout() QMutex &mutex; explicit BlockedTask(QMutex &m) : mutex(m) {} - void run() + void run() override { mutex.lock(); mutex.unlock(); @@ -953,7 +954,7 @@ void tst_QThreadPool::clear() public: QSemaphore & sem; BlockingRunnable(QSemaphore & sem) : sem(sem){} - void run() + void run() override { sem.acquire(); count.ref(); @@ -1105,7 +1106,7 @@ void tst_QThreadPool::stackSize() } - void run() + void run() override { *stackSize = QThread::currentThread()->stackSize(); } @@ -1136,7 +1137,7 @@ void tst_QThreadPool::stressTest() semaphore.acquire(); } - void run() + void run() override { semaphore.release(); } @@ -1162,7 +1163,8 @@ void tst_QThreadPool::takeAllAndIncreaseMaxThreadCount() { setAutoDelete(false); } - void run() { + void run() override + { m_mainBarrier->release(); m_threadBarrier->acquire(); } @@ -1224,7 +1226,7 @@ void tst_QThreadPool::waitForDoneAfterTake() , m_threadBarrier(threadBarrier) {} - void run() + void run() override { m_mainBarrier->release(); m_threadBarrier->acquire(); diff --git a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp index 737cb86c01..ab1dd677e9 100644 --- a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp +++ b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp @@ -129,7 +129,7 @@ public: : pointers(p) { } - void run() + void run() override { pointers.setLocalData(new Pointer); @@ -249,7 +249,7 @@ void tst_QThreadStorage::ensureCleanupOrder() : first(first), second(second) { } - void run() + void run() override { // set in reverse order, but shouldn't matter, the data // will be deleted in the order the thread storage objects @@ -340,7 +340,7 @@ void tst_QThreadStorage::leakInDestructor() Thread(QThreadStorage<ThreadStorageLocalDataTester *> &t) : tls(t) { } - void run() + void run() override { QVERIFY(!tls.hasLocalData()); tls.setLocalData(new ThreadStorageLocalDataTester); @@ -392,7 +392,7 @@ void tst_QThreadStorage::resetInDestructor() class Thread : public QThread { public: - void run() + void run() override { QVERIFY(!ThreadStorageResetLocalDataTesterTls()->hasLocalData()); ThreadStorageResetLocalDataTesterTls()->setLocalData(new ThreadStorageResetLocalDataTester); @@ -428,7 +428,8 @@ void tst_QThreadStorage::valueBased() Thread(QThreadStorage<SPointer> &t1, QThreadStorage<QString> &t2, QThreadStorage<int> &t3) : tlsSPointer(t1), tlsString(t2), tlsInt(t3) { } - void run() { + void run() override + { /*QVERIFY(!tlsSPointer.hasLocalData()); QVERIFY(!tlsString.hasLocalData()); QVERIFY(!tlsInt.hasLocalData());*/ diff --git a/tests/auto/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp b/tests/auto/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp index 5363231895..3fcac48788 100644 --- a/tests/auto/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp +++ b/tests/auto/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp @@ -77,7 +77,7 @@ public: inline wait_QMutex_Thread_1() { } - void run() + void run() override { mutex.lock(); cond.wakeOne(); @@ -98,7 +98,7 @@ public: : mutex(0), cond(0) { } - void run() + void run() override { mutex->lock(); started.wakeOne(); @@ -116,7 +116,7 @@ public: inline wait_QReadWriteLock_Thread_1() { } - void run() + void run() override { readWriteLock.lockForWrite(); cond.wakeOne(); @@ -137,7 +137,7 @@ public: : readWriteLock(0), cond(0) { } - void run() + void run() override { readWriteLock->lockForRead(); started.wakeOne(); @@ -398,7 +398,7 @@ public: static inline void sleep(ulong s) { QThread::sleep(s); } - void run() + void run() override { Q_ASSERT(count); Q_ASSERT(mutex); @@ -430,7 +430,7 @@ public: static inline void sleep(ulong s) { QThread::sleep(s); } - void run() + void run() override { Q_ASSERT(count); Q_ASSERT(readWriteLock); @@ -764,7 +764,8 @@ public: QWaitCondition *startup; QWaitCondition *waitCondition; - void run() { + void run() override + { mutex->lock(); ready = true; @@ -796,7 +797,8 @@ public: QWaitCondition *startup; QWaitCondition *waitCondition; - void run() { + void run() override + { readWriteLock->lockForWrite(); ready = true; diff --git a/tests/auto/corelib/thread/qwritelocker/tst_qwritelocker.cpp b/tests/auto/corelib/thread/qwritelocker/tst_qwritelocker.cpp index 876c18c721..3dc3c37961 100644 --- a/tests/auto/corelib/thread/qwritelocker/tst_qwritelocker.cpp +++ b/tests/auto/corelib/thread/qwritelocker/tst_qwritelocker.cpp @@ -73,7 +73,7 @@ void tst_QWriteLocker::scopeTest() class ScopeTestThread : public tst_QWriteLockerThread { public: - void run() + void run() override { waitForTest(); @@ -118,7 +118,7 @@ void tst_QWriteLocker::unlockAndRelockTest() class UnlockAndRelockThread : public tst_QWriteLockerThread { public: - void run() + void run() override { QWriteLocker locker(&lock); @@ -164,7 +164,7 @@ void tst_QWriteLocker::lockerStateTest() class LockerStateThread : public tst_QWriteLockerThread { public: - void run() + void run() override { { QWriteLocker locker(&lock); diff --git a/tests/auto/corelib/tools/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp b/tests/auto/corelib/tools/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp index 7c1e90f5d4..86b5c32cbf 100644 --- a/tests/auto/corelib/tools/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp +++ b/tests/auto/corelib/tools/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp @@ -79,8 +79,8 @@ public: class Derived : public Base { public: - virtual Base *clone() { return new Derived(*this); } - virtual bool isBase() const { return false; } + virtual Base *clone() override { return new Derived(*this); } + virtual bool isBase() const override { return false; } }; QT_BEGIN_NAMESPACE diff --git a/tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp b/tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp index a09bcd5121..06c2cf173a 100644 --- a/tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp +++ b/tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp @@ -120,7 +120,7 @@ class FreeListThread : public QThread public: inline FreeListThread() : QThread() { } - inline void run() + inline void run() override { QElapsedTimer t; t.start(); diff --git a/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp b/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp index 9c90b44e87..07a4f5fc96 100644 --- a/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp +++ b/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp @@ -160,7 +160,7 @@ public: class SubClass : public AbstractClass { public: - virtual int member() const + virtual int member() const override { return 5; } diff --git a/tests/auto/corelib/tools/qtaggedpointer/tst_qtaggedpointer.cpp b/tests/auto/corelib/tools/qtaggedpointer/tst_qtaggedpointer.cpp index 1ef510e93f..be4d338e95 100644 --- a/tests/auto/corelib/tools/qtaggedpointer/tst_qtaggedpointer.cpp +++ b/tests/auto/corelib/tools/qtaggedpointer/tst_qtaggedpointer.cpp @@ -115,7 +115,7 @@ public: class SubClass : public AbstractClass { public: - int member() const { return 5; } + int member() const override { return 5; } }; void tst_QTaggedPointer::dereferenceOperator() |