diff options
151 files changed, 808 insertions, 772 deletions
diff --git a/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp b/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp index 3dd77ed3d0..574c82b78e 100644 --- a/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp +++ b/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp @@ -89,7 +89,7 @@ class PrintFor : public IterateKernel<TestIterator, void> { public: PrintFor(TestIterator begin, TestIterator end) : IterateKernel<TestIterator, void>(QThreadPool::globalInstance(), begin, end) { iterations.storeRelaxed(0); } - bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) + bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) override { iterations.fetchAndAddRelaxed(end - begin); #ifdef PRINT @@ -97,7 +97,7 @@ public: #endif return false; } - bool runIteration(TestIterator it, int index , void *result) + bool runIteration(TestIterator it, int index , void *result) override { return runIterations(it, index, index + 1, result); } @@ -108,7 +108,7 @@ class SleepPrintFor : public IterateKernel<TestIterator, void> { public: SleepPrintFor(TestIterator begin, TestIterator end) : IterateKernel<TestIterator, void>(QThreadPool::globalInstance(), begin, end) { iterations.storeRelaxed(0); } - inline bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) + inline bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) override { QTest::qSleep(200); iterations.fetchAndAddRelaxed(end - begin); @@ -117,7 +117,7 @@ public: #endif return false; } - bool runIteration(TestIterator it, int index , void *result) + bool runIteration(TestIterator it, int index , void *result) override { return runIterations(it, index, index + 1, result); } @@ -148,12 +148,12 @@ class CountFor : public IterateKernel<TestIterator, void> { public: CountFor(TestIterator begin, TestIterator end) : IterateKernel<TestIterator, void>(QThreadPool::globalInstance(), begin, end) { iterations.storeRelaxed(0); } - inline bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) + inline bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) override { counter.fetchAndAddRelaxed(end - begin); return false; } - bool runIteration(TestIterator it, int index , void *result) + bool runIteration(TestIterator it, int index , void *result) override { return runIterations(it, index, index + 1, result); } @@ -187,7 +187,7 @@ public: // and then records how many threads that run between // iterations 140 and 160. ThrottleFor(TestIterator begin, TestIterator end) : IterateKernel<TestIterator, void>(QThreadPool::globalInstance(), begin, end) { iterations.storeRelaxed(0); throttling = false; } - inline bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) + inline bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) override { if (200 >= begin && 200 < end) { throttling = false; @@ -210,12 +210,12 @@ public: return false; } - bool runIteration(TestIterator it, int index , void *result) + bool runIteration(TestIterator it, int index , void *result) override { return runIterations(it, index, index + 1, result); } - bool shouldThrottleThread() + bool shouldThrottleThread() override { const int load = iterations.loadRelaxed(); return (load > 100 && load < 200); @@ -243,7 +243,7 @@ class MultipleResultsFor : public IterateKernel<TestIterator, int> { public: MultipleResultsFor(TestIterator begin, TestIterator end) : IterateKernel<TestIterator, int>(QThreadPool::globalInstance(), begin, end) { } - inline bool runIterations(TestIterator, int begin, int end, int *results) + inline bool runIterations(TestIterator, int begin, int end, int *results) override { for (int i = begin; i < end; ++i) results[i - begin] = i; diff --git a/tests/auto/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp b/tests/auto/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp index e192dad3bd..a39488fd62 100644 --- a/tests/auto/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp +++ b/tests/auto/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp @@ -56,7 +56,7 @@ class PrintUser : public ThreadEngine<void> { public: PrintUser() : ThreadEngine(QThreadPool::globalInstance()) {} - ThreadFunctionResult threadFunction() + ThreadFunctionResult threadFunction() override { QTest::qSleep(50); QTest::qSleep(100); @@ -86,18 +86,18 @@ public: : ThreadEngine(QThreadPool::globalInstance()) , done(false) { } - bool shouldStartThread() + bool shouldStartThread() override { return !done; } - ThreadFunctionResult threadFunction() + ThreadFunctionResult threadFunction() override { done = true; return ThreadFinished; } - QString *result() + QString *result() override { foo = "Foo"; return &foo; @@ -117,18 +117,18 @@ class VoidResultUser : public ThreadEngine<void> public: VoidResultUser() : ThreadEngine(QThreadPool::globalInstance()) {} - bool shouldStartThread() + bool shouldStartThread() override { return !done; } - ThreadFunctionResult threadFunction() + ThreadFunctionResult threadFunction() override { done = true; return ThreadFinished; } - void *result() + void *result() override { return 0; } @@ -155,12 +155,12 @@ class CancelUser : public ThreadEngine<void> public: CancelUser() : ThreadEngine(QThreadPool::globalInstance()) {} - void *result() + void *result() override { return 0; } - ThreadFunctionResult threadFunction() + ThreadFunctionResult threadFunction() override { while (this->isCanceled() == false) { @@ -198,12 +198,12 @@ public: finishing = false; } - bool shouldStartThread() + bool shouldStartThread() override { return !finishing; } - ThreadFunctionResult threadFunction() + ThreadFunctionResult threadFunction() override { forever { const int local = count.loadRelaxed(); @@ -253,12 +253,12 @@ public: finishing = finishImmediately; } - bool shouldStartThread() + bool shouldStartThread() override { return !finishing; } - ThreadFunctionResult threadFunction() + ThreadFunctionResult threadFunction() override { { QMutexLocker lock(&mutex); @@ -315,12 +315,12 @@ class MultipleResultsUser : public ThreadEngine<int> { public: MultipleResultsUser() : ThreadEngine(QThreadPool::globalInstance()) {} - bool shouldStartThread() + bool shouldStartThread() override { return false; } - ThreadFunctionResult threadFunction() + ThreadFunctionResult threadFunction() override { for (int i = 0; i < 10; ++i) this->reportResult(&i); @@ -344,17 +344,17 @@ void tst_QtConcurrentThreadEngine::multipleResults() class NoThreadsUser : public ThreadEngine<void> { public: - bool shouldStartThread() + bool shouldStartThread() override { return false; } - ThreadFunctionResult threadFunction() + ThreadFunctionResult threadFunction() override { return ThreadFinished; } - void *result() + void *result() override { return 0; } @@ -385,8 +385,8 @@ class SlowUser : public ThreadEngine<void> { public: SlowUser() : ThreadEngine(QThreadPool::globalInstance()) {} - bool shouldStartThread() { return false; } - ThreadFunctionResult threadFunction() { QTest::qSleep(sleepTime); return ThreadFinished; } + bool shouldStartThread() override { return false; } + ThreadFunctionResult threadFunction() override { QTest::qSleep(sleepTime); return ThreadFinished; } }; void tst_QtConcurrentThreadEngine::cancelQueuedSlowUser() 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() diff --git a/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp b/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp index 11896d2f15..615b25e01a 100644 --- a/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp +++ b/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp @@ -487,7 +487,7 @@ public: wait(); } - void run() + void run() override { QDBusConnection con = QDBusConnection::connectToBus(QDBusConnection::SessionBus, "ThreadConnection"); if (!con.isConnected()) diff --git a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h index b4d689e6f4..af42224b79 100644 --- a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h +++ b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h @@ -270,12 +270,12 @@ class VirtualObject: public QDBusVirtualObject public: VirtualObject() :success(true) {} - QString introspect(const QString & /* path */) const + QString introspect(const QString & /* path */) const override { return QString(); } - bool handleMessage(const QDBusMessage &message, const QDBusConnection &connection) { + bool handleMessage(const QDBusMessage &message, const QDBusConnection &connection) override { ++callCount; lastMessage = message; diff --git a/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp b/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp index e416266b5f..481d40d00a 100644 --- a/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp +++ b/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp @@ -405,7 +405,8 @@ class VirtualObject: public QDBusVirtualObject public: VirtualObject() :success(true) {} - QString introspect(const QString &path) const { + QString introspect(const QString &path) const override + { Q_ASSERT(QThread::currentThread() == thread()); if (path == "/some/path/superNode") return "zitroneneis"; @@ -416,7 +417,8 @@ public: return QString(); } - bool handleMessage(const QDBusMessage &message, const QDBusConnection &connection) { + bool handleMessage(const QDBusMessage &message, const QDBusConnection &connection) override + { Q_ASSERT(QThread::currentThread() == thread()); ++callCount; lastMessage = message; diff --git a/tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp b/tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp index 78c3fb223b..99c7504207 100644 --- a/tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp +++ b/tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp @@ -323,7 +323,7 @@ void tst_QDBusPendingCall::watcher_waitForFinished_threaded() public: tst_QDBusPendingCall *tst; WorkerThread(tst_QDBusPendingCall *tst) : tst(tst) {} - void run() + void run() override { QDBusPendingCall ac = tst->sendMessage(); // QVERIFY(!ac.isFinished()); diff --git a/tests/auto/dbus/qdbusthreading/tst_qdbusthreading.cpp b/tests/auto/dbus/qdbusthreading/tst_qdbusthreading.cpp index b4690268c8..13c2c2bb61 100644 --- a/tests/auto/dbus/qdbusthreading/tst_qdbusthreading.cpp +++ b/tests/auto/dbus/qdbusthreading/tst_qdbusthreading.cpp @@ -41,7 +41,7 @@ class Thread : public QThread static int counter; public: Thread(bool automatic = true); - void run(); + void run() override; using QThread::exec; }; diff --git a/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp b/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp index fe12175081..1716570046 100644 --- a/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp +++ b/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp @@ -115,7 +115,8 @@ public: virtual ~QSequentialFile() {} - virtual bool isSequential() const { + virtual bool isSequential() const override + { return true; } diff --git a/tests/auto/gui/image/qimageiohandler/tst_qimageiohandler.cpp b/tests/auto/gui/image/qimageiohandler/tst_qimageiohandler.cpp index e24ba4fa81..9da4d1a1f1 100644 --- a/tests/auto/gui/image/qimageiohandler/tst_qimageiohandler.cpp +++ b/tests/auto/gui/image/qimageiohandler/tst_qimageiohandler.cpp @@ -50,8 +50,8 @@ class MyImageIOHandler : public QImageIOHandler { public: MyImageIOHandler() : QImageIOHandler() { } - bool canRead() const { return true; } - bool read(QImage *) { return true; } + bool canRead() const override { return true; } + bool read(QImage *) override { return true; } }; tst_QImageIOHandler::tst_QImageIOHandler() diff --git a/tests/auto/gui/image/qpicture/tst_qpicture.cpp b/tests/auto/gui/image/qpicture/tst_qpicture.cpp index 6287960457..c55a96d697 100644 --- a/tests/auto/gui/image/qpicture/tst_qpicture.cpp +++ b/tests/auto/gui/image/qpicture/tst_qpicture.cpp @@ -152,11 +152,11 @@ class PaintEngine : public QPaintEngine { public: PaintEngine() : QPaintEngine() {} - bool begin(QPaintDevice *) { return true; } - bool end() { return true; } - void updateState(const QPaintEngineState &) {} - void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) {} - Type type() const { return Raster; } + bool begin(QPaintDevice *) override { return true; } + bool end() override { return true; } + void updateState(const QPaintEngineState &) override {} + void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) override {} + Type type() const override { return Raster; } QFont font() { return state->font(); } }; @@ -165,7 +165,7 @@ class Picture : public QPicture { public: Picture() : QPicture() {} - QPaintEngine *paintEngine() const { return (QPaintEngine*)&mPaintEngine; } + QPaintEngine *paintEngine() const override { return (QPaintEngine*)&mPaintEngine; } private: PaintEngine mPaintEngine; }; diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp index 24f10e559c..33e8671671 100644 --- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp @@ -1063,7 +1063,7 @@ void tst_QPixmap::onlyNullPixmapsOutsideGuiThread() class Thread : public QThread { public: - void run() + void run() override { QTest::ignoreMessage(QtWarningMsg, "QPixmap: It is not safe to use pixmaps outside the GUI thread"); diff --git a/tests/auto/gui/kernel/qbackingstore/tst_qbackingstore.cpp b/tests/auto/gui/kernel/qbackingstore/tst_qbackingstore.cpp index 79c669753b..b2dc8ee035 100644 --- a/tests/auto/gui/kernel/qbackingstore/tst_qbackingstore.cpp +++ b/tests/auto/gui/kernel/qbackingstore/tst_qbackingstore.cpp @@ -53,12 +53,12 @@ public: { } - void resizeEvent(QResizeEvent *) + void resizeEvent(QResizeEvent *) override { backingStore.resize(size()); } - void exposeEvent(QExposeEvent *event) + void exposeEvent(QExposeEvent *event) override { QRect rect(QPoint(), size()); diff --git a/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp b/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp index 43b2b79698..9da15b3e36 100644 --- a/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp +++ b/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp @@ -55,7 +55,7 @@ private: QByteArray readFileContent(QFileOpenEvent& event); bool appendFileContent(QFileOpenEvent& event, const QByteArray& writeContent); - bool event(QEvent *); + bool event(QEvent *) override; QTemporaryDir m_temporaryDir; QString m_originalCurrent; diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp index e0415441b9..b68f00ea46 100644 --- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp +++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp @@ -186,7 +186,7 @@ class DummyWindow : public QWindow public: DummyWindow() : m_focusObject(nullptr) {} - virtual QObject *focusObject() const + virtual QObject *focusObject() const override { return m_focusObject; } @@ -353,14 +353,14 @@ void tst_QGuiApplication::abortQuitOnShow() class FocusChangeWindow: public QWindow { protected: - virtual bool event(QEvent *ev) + virtual bool event(QEvent *ev) override { if (ev->type() == QEvent::FocusAboutToChange) windowDuringFocusAboutToChange = qGuiApp->focusWindow(); return QWindow::event(ev); } - virtual void focusOutEvent(QFocusEvent *) + virtual void focusOutEvent(QFocusEvent *) override { windowDuringFocusOut = qGuiApp->focusWindow(); } @@ -602,7 +602,7 @@ public: inline explicit BlockableWindow(QWindow *parent = nullptr) : QWindow(parent), blocked(false), leaves(0), enters(0) {} - bool event(QEvent *e) + bool event(QEvent *e) override { switch (e->type()) { case QEvent::WindowBlocked: @@ -985,7 +985,7 @@ class TestPluginFactory : public QGenericPlugin Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QGenericPluginFactoryInterface" FILE "testplugin.json") public: - QObject* create(const QString &key, const QString &) + QObject* create(const QString &key, const QString &) override { if (key == "testplugin") return new TestPlugin; @@ -1003,7 +1003,7 @@ public: : customEvents(0) {} - virtual void customEvent(QEvent *) + virtual void customEvent(QEvent *) override { customEvents++; } diff --git a/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp b/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp index 15c905f943..d28dab3ad0 100644 --- a/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp +++ b/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp @@ -39,7 +39,7 @@ class InputItem : public QObject public: InputItem() : cursorRectangle(1, 2, 3, 4), m_enabled(true) {} - bool event(QEvent *event) + bool event(QEvent *event) override { if (event->type() == QEvent::InputMethodQuery) { QInputMethodQueryEvent *query = static_cast<QInputMethodQueryEvent *>(event); @@ -74,7 +74,7 @@ class DummyWindow : public QWindow public: DummyWindow() : m_focusObject(0) {} - virtual QObject *focusObject() const + virtual QObject *focusObject() const override { return m_focusObject; } diff --git a/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp b/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp index 66160df21b..09becfe860 100644 --- a/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp +++ b/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp @@ -37,8 +37,8 @@ class Window : public QWindow public: ~Window() { reset(); } - void keyPressEvent(QKeyEvent *event) { recordEvent(event); } - void keyReleaseEvent(QKeyEvent *event) { recordEvent(event); } + void keyPressEvent(QKeyEvent *event) override { recordEvent(event); } + void keyReleaseEvent(QKeyEvent *event) override { recordEvent(event); } void reset() { qDeleteAll(keyEvents.begin(), keyEvents.end()); diff --git a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp index 258ea0c85d..c0a0eb18f3 100644 --- a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp +++ b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp @@ -46,7 +46,7 @@ public: int mouseReleaseButtons; int mouseReleaseModifiers; protected: - void mousePressEvent(QMouseEvent *e) + void mousePressEvent(QMouseEvent *e) override { QWindow::mousePressEvent(e); mousePressButton = e->button(); @@ -55,7 +55,7 @@ protected: mousePressEventRecieved = true; e->accept(); } - void mouseReleaseEvent(QMouseEvent *e) + void mouseReleaseEvent(QMouseEvent *e) override { QWindow::mouseReleaseEvent(e); mouseReleaseButton = e->button(); diff --git a/tests/auto/gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp b/tests/auto/gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp index 758aeb42b9..c430148a91 100644 --- a/tests/auto/gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp +++ b/tests/auto/gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp @@ -88,7 +88,7 @@ public: TstDialog( QWidget *mouseWidget, QWidget *parent, const char *name ); int count() { return c; } protected: - void showEvent ( QShowEvent * ); + void showEvent(QShowEvent *) override; public slots: void releaseMouse(); void closeDialog(); diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index dd0fb46eca..e84efa6ac3 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -402,7 +402,8 @@ public: using Window::Window; protected: - void paintEvent(QPaintEvent *) { + void paintEvent(QPaintEvent *) override + { // Handled, not calling base class } }; diff --git a/tests/auto/gui/painting/qpaintengine/tst_qpaintengine.cpp b/tests/auto/gui/painting/qpaintengine/tst_qpaintengine.cpp index 64a6ce2939..d6b532887f 100644 --- a/tests/auto/gui/painting/qpaintengine/tst_qpaintengine.cpp +++ b/tests/auto/gui/painting/qpaintengine/tst_qpaintengine.cpp @@ -58,11 +58,11 @@ class MyPaintEngine : public QPaintEngine { public: MyPaintEngine() : QPaintEngine() {} - bool begin(QPaintDevice *) { return true; } - bool end() { return true; } - void updateState(const QPaintEngineState &) {} - void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) {} - Type type() const { return Raster; } + bool begin(QPaintDevice *) override { return true; } + bool end() override { return true; } + void updateState(const QPaintEngineState &) override {} + void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) override {} + Type type() const override { return Raster; } }; // Testing get/set functions diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index 960dfdd04f..5d4e9def83 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -2634,17 +2634,17 @@ class DummyPaintEngine : public QPaintEngine, public QPaintDevice { public: DummyPaintEngine() : QPaintEngine(no_porter_duff()) {} - virtual bool begin(QPaintDevice *) { return true; } - virtual bool end() { return true; } + virtual bool begin(QPaintDevice *) override { return true; } + virtual bool end() override { return true; } - virtual void updateState(const QPaintEngineState &) {} - virtual void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) {} + virtual void updateState(const QPaintEngineState &) override {} + virtual void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) override {} - virtual Type type() const { return User; } + virtual Type type() const override { return User; } - virtual QPaintEngine *paintEngine() const { return (QPaintEngine *)this; } + virtual QPaintEngine *paintEngine() const override { return (QPaintEngine *)this; } - virtual int metric(PaintDeviceMetric metric) const { Q_UNUSED(metric); return 0; }; + virtual int metric(PaintDeviceMetric metric) const override { Q_UNUSED(metric); return 0; }; }; static bool success; @@ -2698,7 +2698,8 @@ class ViewportTestWidget : public QWidget { public: ViewportTestWidget(QWidget *parent = 0) : QWidget(parent), hasPainted(false) {} - QSize sizeHint() const { + QSize sizeHint() const override + { return QSize(100, 100); } @@ -2706,7 +2707,8 @@ public: bool hasPainted; protected: - void paintEvent(QPaintEvent *) { + void paintEvent(QPaintEvent *) override + { hasPainted = true; QPainter p(this); viewport = p.viewport(); @@ -4451,7 +4453,7 @@ class TestProxy : public QGraphicsProxyWidget { public: TestProxy() : QGraphicsProxyWidget() {} - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override { QGraphicsProxyWidget::paint(painter, option, widget); deviceTransform = painter->deviceTransform(); @@ -4464,7 +4466,7 @@ class TestWidget : public QWidget Q_OBJECT public: TestWidget() : QWidget(), painted(false) {} - void paintEvent(QPaintEvent *) + void paintEvent(QPaintEvent *) override { QPainter p(this); deviceTransform = p.deviceTransform(); @@ -4645,7 +4647,7 @@ void tst_QPainter::drawPointScaled() class GradientProducer : public QThread { protected: - void run(); + void run() override; }; void GradientProducer::run() @@ -4739,7 +4741,7 @@ void tst_QPainter::QTBUG38781_NoBrushAndQBitmap() class TextDrawerThread : public QThread { public: - void run(); + void run() override; QImage rendering; }; diff --git a/tests/auto/gui/qopengl/tst_qopengl.cpp b/tests/auto/gui/qopengl/tst_qopengl.cpp index 32c897e172..5e244a4ae9 100644 --- a/tests/auto/gui/qopengl/tst_qopengl.cpp +++ b/tests/auto/gui/qopengl/tst_qopengl.cpp @@ -150,14 +150,14 @@ struct SharedResource : public QOpenGLSharedResource tracker->destructorCalls++; } - void invalidateResource() + void invalidateResource() override { resource = 0; if (tracker) tracker->invalidateResourceCalls++; } - void freeResource(QOpenGLContext *context) + void freeResource(QOpenGLContext *context) override { Q_ASSERT(context == QOpenGLContext::currentContext()); Q_UNUSED(context); diff --git a/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp b/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp index be3ef968ef..5e6f8ce946 100644 --- a/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp +++ b/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp @@ -72,13 +72,14 @@ public: { } - void draw(QPainter *, const PaintContext &) {} - int hitTest(const QPointF &, Qt::HitTestAccuracy) const { return 0; } - int pageCount() const { return 0; } - QSizeF documentSize() const { return QSizeF(); } - QRectF frameBoundingRect(QTextFrame *) const { return QRectF(); } - QRectF blockBoundingRect(const QTextBlock &) const { return QRectF(); } - void documentChanged(int from, int /* oldLength */, int length) { + void draw(QPainter *, const PaintContext &) override {} + int hitTest(const QPointF &, Qt::HitTestAccuracy) const override { return 0; } + int pageCount() const override { return 0; } + QSizeF documentSize() const override { return QSizeF(); } + QRectF frameBoundingRect(QTextFrame *) const override { return QRectF(); } + QRectF blockBoundingRect(const QTextBlock &) const override { return QRectF(); } + void documentChanged(int from, int /* oldLength */, int length) override + { ++changeEvents; QTextBlock last = document()->lastBlock(); diff --git a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp index a01805236a..0c7e53b4fa 100644 --- a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp +++ b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp @@ -887,30 +887,30 @@ public: styleSheets.append(sheet); } - virtual QStringList nodeNames(NodePtr node) const { return QStringList(reinterpret_cast<QDomElement *>(node.ptr)->tagName()); } - virtual QString attribute(NodePtr node, const QString &name) const { return reinterpret_cast<QDomElement *>(node.ptr)->attribute(name); } + virtual QStringList nodeNames(NodePtr node) const override { return QStringList(reinterpret_cast<QDomElement *>(node.ptr)->tagName()); } + virtual QString attribute(NodePtr node, const QString &name) const override { return reinterpret_cast<QDomElement *>(node.ptr)->attribute(name); } virtual bool hasAttribute(NodePtr node, const QString &name) const { return reinterpret_cast<QDomElement *>(node.ptr)->hasAttribute(name); } - virtual bool hasAttributes(NodePtr node) const { return reinterpret_cast<QDomElement *>(node.ptr)->hasAttributes(); } + virtual bool hasAttributes(NodePtr node) const override { return reinterpret_cast<QDomElement *>(node.ptr)->hasAttributes(); } - virtual bool isNullNode(NodePtr node) const { + virtual bool isNullNode(NodePtr node) const override { return reinterpret_cast<QDomElement *>(node.ptr)->isNull(); } - virtual NodePtr parentNode(NodePtr node) const { + virtual NodePtr parentNode(NodePtr node) const override { NodePtr parent; parent.ptr = new QDomElement(reinterpret_cast<QDomElement *>(node.ptr)->parentNode().toElement()); return parent; } - virtual NodePtr duplicateNode(NodePtr node) const { + virtual NodePtr duplicateNode(NodePtr node) const override { NodePtr n; n.ptr = new QDomElement(*reinterpret_cast<QDomElement *>(node.ptr)); return n; } - virtual NodePtr previousSiblingNode(NodePtr node) const { + virtual NodePtr previousSiblingNode(NodePtr node) const override { NodePtr sibling; sibling.ptr = new QDomElement(reinterpret_cast<QDomElement *>(node.ptr)->previousSiblingElement()); return sibling; } - virtual void freeNode(NodePtr node) const { + virtual void freeNode(NodePtr node) const override { delete reinterpret_cast<QDomElement *>(node.ptr); } diff --git a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp index 645ff39cbe..8908d8b9d1 100644 --- a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp @@ -847,7 +847,7 @@ public: TestPixmap(int w, int h) : QPixmap(w, h), testPaintEngine(new TestPaintEngine) {} ~TestPixmap() { delete testPaintEngine; } - QPaintEngine *paintEngine() const + QPaintEngine *paintEngine() const override { return testPaintEngine; } diff --git a/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp b/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp index 1301ccc9cf..da73e7846a 100644 --- a/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp +++ b/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp @@ -45,18 +45,18 @@ public: inline QTestDocumentLayout(QTextDocument *doc) : QAbstractTextDocumentLayout(doc), documentChangedCalled(false) {} - virtual void draw(QPainter *, const QAbstractTextDocumentLayout::PaintContext &) {} + virtual void draw(QPainter *, const QAbstractTextDocumentLayout::PaintContext &) override {} - virtual int hitTest(const QPointF &, Qt::HitTestAccuracy ) const { return 0; } + virtual int hitTest(const QPointF &, Qt::HitTestAccuracy ) const override { return 0; } - virtual void documentChanged(int, int, int) { documentChangedCalled = true; } + virtual void documentChanged(int, int, int) override { documentChangedCalled = true; } - virtual int pageCount() const { return 1; } + virtual int pageCount() const override { return 1; } - virtual QSizeF documentSize() const { return QSize(); } + virtual QSizeF documentSize() const override { return QSize(); } - virtual QRectF frameBoundingRect(QTextFrame *) const { return QRectF(); } - virtual QRectF blockBoundingRect(const QTextBlock &) const { return QRectF(); } + virtual QRectF frameBoundingRect(QTextFrame *) const override { return QRectF(); } + virtual QRectF blockBoundingRect(const QTextBlock &) const override { return QRectF(); } bool documentChangedCalled; }; @@ -122,7 +122,7 @@ public: inline TestHighlighter(QTextDocument *parent) : QSyntaxHighlighter(parent), highlighted(false), callCount(0) {} - virtual void highlightBlock(const QString &text) + virtual void highlightBlock(const QString &text) override { for (int i = 0; i < formats.count(); ++i) { const QTextLayout::FormatRange &range = formats.at(i); @@ -179,7 +179,7 @@ public: highlighted = false; } - virtual void highlightBlock(const QString &text) + virtual void highlightBlock(const QString &text) override { QTextCharFormat commentFormat; commentFormat.setForeground(Qt::darkGreen); @@ -294,7 +294,7 @@ public: state = 0; } - virtual void highlightBlock(const QString &text) + virtual void highlightBlock(const QString &text) override { highlighted = true; if (text == QLatin1String("changestate")) diff --git a/tests/auto/gui/text/qtextdocument/common.h b/tests/auto/gui/text/qtextdocument/common.h index 0681f7f0e2..11ad99cfa0 100644 --- a/tests/auto/gui/text/qtextdocument/common.h +++ b/tests/auto/gui/text/qtextdocument/common.h @@ -36,10 +36,10 @@ class QTestDocumentLayout : public QAbstractTextDocumentLayout Q_OBJECT public: QTestDocumentLayout(QTextDocument *doc) : QAbstractTextDocumentLayout(doc), f(-1), called(false) {} - virtual void draw(QPainter *, const PaintContext &) {} - virtual int hitTest(const QPointF &, Qt::HitTestAccuracy ) const { return 0; } + virtual void draw(QPainter *, const PaintContext &) override {} + virtual int hitTest(const QPointF &, Qt::HitTestAccuracy ) const override { return 0; } - virtual void documentChanged(int from, int oldLength, int length) + virtual void documentChanged(int from, int oldLength, int length) override { called = true; lastDocumentLengths.append(QTextDocumentPrivate::get(document())->length()); @@ -55,11 +55,11 @@ public: } } - virtual int pageCount() const { return 1; } - virtual QSizeF documentSize() const { return QSizeF(); } + virtual int pageCount() const override { return 1; } + virtual QSizeF documentSize() const override { return QSizeF(); } - virtual QRectF frameBoundingRect(QTextFrame *) const { return QRectF(); } - virtual QRectF blockBoundingRect(const QTextBlock &) const { return QRectF(); } + virtual QRectF frameBoundingRect(QTextFrame *) const override { return QRectF(); } + virtual QRectF blockBoundingRect(const QTextBlock &) const override { return QRectF(); } int f; int o; diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp index 04f8a9aa38..aaa3433173 100644 --- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp @@ -209,13 +209,13 @@ class MyAbstractTextDocumentLayout : public QAbstractTextDocumentLayout { public: MyAbstractTextDocumentLayout(QTextDocument *doc) : QAbstractTextDocumentLayout(doc) {} - void draw(QPainter *, const PaintContext &) {} - int hitTest(const QPointF &, Qt::HitTestAccuracy) const { return 0; } - int pageCount() const { return 0; } - QSizeF documentSize() const { return QSizeF(); } - QRectF frameBoundingRect(QTextFrame *) const { return QRectF(); } - QRectF blockBoundingRect(const QTextBlock &) const { return QRectF(); } - void documentChanged(int, int, int) {} + void draw(QPainter *, const PaintContext &) override {} + int hitTest(const QPointF &, Qt::HitTestAccuracy) const override { return 0; } + int pageCount() const override { return 0; } + QSizeF documentSize() const override { return QSizeF(); } + QRectF frameBoundingRect(QTextFrame *) const override { return QRectF(); } + QRectF blockBoundingRect(const QTextBlock &) const override { return QRectF(); } + void documentChanged(int, int, int) override {} }; QString tst_QTextDocument::cssFontSizeString(const QFont &font) @@ -2384,7 +2384,7 @@ public: bool hasResourceCached(); protected: - virtual QVariant loadResource(int type, const QUrl &name); + virtual QVariant loadResource(int type, const QUrl &name) override; private: QUrl url; @@ -3185,7 +3185,7 @@ class BaseDocument : public QTextDocument public: QUrl loadedResource() const { return resourceUrl; } - QVariant loadResource(int type, const QUrl &name) + QVariant loadResource(int type, const QUrl &name) override { resourceUrl = name; return QTextDocument::loadResource(type, name); diff --git a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp index 159effbd8f..3fdfa8ae99 100644 --- a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp +++ b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp @@ -3134,7 +3134,8 @@ public: QPixmap testPixmap; - virtual QVariant loadResource(int type, const QUrl &name) { + virtual QVariant loadResource(int type, const QUrl &name) override + { if (name.toString() == QLatin1String("testPixmap")) { return testPixmap; } diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp index afcae2f4b7..f00d6215c3 100644 --- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp @@ -1683,8 +1683,8 @@ QT_END_NAMESPACE void tst_QTextLayout::testTabDPIScale() { class MyPaintDevice : public QPaintDevice { - QPaintEngine *paintEngine () const { return 0; } - int metric (QPaintDevice::PaintDeviceMetric metric) const { + QPaintEngine *paintEngine () const override { return 0; } + int metric (QPaintDevice::PaintDeviceMetric metric) const override { switch(metric) { case QPaintDevice::PdmWidth: case QPaintDevice::PdmHeight: diff --git a/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp b/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp index 2b0236339c..a848dad3d8 100644 --- a/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp +++ b/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp @@ -1043,30 +1043,30 @@ public: PaintEngine() : QPaintEngine(QPaintEngine::PaintEngineFeatures{ }) {} - virtual Type type() const + virtual Type type() const override { return User; } - virtual bool begin(QPaintDevice *) + virtual bool begin(QPaintDevice *) override { return true; } - virtual bool end() + virtual bool end() override { return true; } - virtual void updateState(const QPaintEngineState &) + virtual void updateState(const QPaintEngineState &) override {} - virtual void drawRects(const QRect *, int) + virtual void drawRects(const QRect *, int) override {} - virtual void drawRects(const QRectF *r, int) + virtual void drawRects(const QRectF *r, int) override { if (painter()->brush() == QBrush(Qt::green)) { rects.append(*r); } } - virtual void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) + virtual void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) override {} }; @@ -1115,7 +1115,7 @@ public: layout.setUnits(QPageLayout::Point); setPageLayout(layout); } - virtual int metric(PaintDeviceMetric metric) const + virtual int metric(PaintDeviceMetric metric) const override { if (PdmDevicePixelRatio == metric) return 1; @@ -1131,11 +1131,11 @@ public: return 700; return 900; } - virtual QPaintEngine *paintEngine() const + virtual QPaintEngine *paintEngine() const override { return engine; } - bool newPage() + bool newPage() override { ++pages; return true; diff --git a/tests/auto/gui/util/qundogroup/tst_qundogroup.cpp b/tests/auto/gui/util/qundogroup/tst_qundogroup.cpp index 617e0239e1..5f82bd8442 100644 --- a/tests/auto/gui/util/qundogroup/tst_qundogroup.cpp +++ b/tests/auto/gui/util/qundogroup/tst_qundogroup.cpp @@ -40,8 +40,8 @@ public: InsertCommand(QString *str, int idx, const QString &text, QUndoCommand *parent = 0); - virtual void undo(); - virtual void redo(); + virtual void undo() override; + virtual void redo() override; private: QString *m_str; @@ -54,8 +54,8 @@ class RemoveCommand : public QUndoCommand public: RemoveCommand(QString *str, int idx, int len, QUndoCommand *parent = 0); - virtual void undo(); - virtual void redo(); + virtual void undo() override; + virtual void redo() override; private: QString *m_str; @@ -68,10 +68,10 @@ class AppendCommand : public QUndoCommand public: AppendCommand(QString *str, const QString &text, QUndoCommand *parent = 0); - virtual void undo(); - virtual void redo(); - virtual int id() const; - virtual bool mergeWith(const QUndoCommand *other); + virtual void undo() override; + virtual void redo() override; + virtual int id() const override; + virtual bool mergeWith(const QUndoCommand *other) override; bool merged; diff --git a/tests/auto/gui/util/qundostack/tst_qundostack.cpp b/tests/auto/gui/util/qundostack/tst_qundostack.cpp index a24798cba7..9415f1325c 100644 --- a/tests/auto/gui/util/qundostack/tst_qundostack.cpp +++ b/tests/auto/gui/util/qundostack/tst_qundostack.cpp @@ -41,8 +41,8 @@ public: InsertCommand(QString *str, int idx, const QString &text, QUndoCommand *parent = 0); - virtual void undo(); - virtual void redo(); + virtual void undo() override; + virtual void redo() override; private: QString *m_str; @@ -55,8 +55,8 @@ class RemoveCommand : public QUndoCommand public: RemoveCommand(QString *str, int idx, int len, QUndoCommand *parent = 0); - virtual void undo(); - virtual void redo(); + virtual void undo() override; + virtual void redo() override; private: QString *m_str; @@ -71,10 +71,10 @@ public: QUndoCommand *parent = 0); ~AppendCommand(); - virtual void undo(); - virtual void redo(); - virtual int id() const; - virtual bool mergeWith(const QUndoCommand *other); + virtual void undo() override; + virtual void redo() override; + virtual int id() const override; + virtual bool mergeWith(const QUndoCommand *other) override; bool merged; bool fail_merge; @@ -91,8 +91,8 @@ public: IdleCommand(QUndoCommand *parent = 0); ~IdleCommand(); - virtual void undo(); - virtual void redo(); + virtual void undo() override; + virtual void redo() override; }; class MoveMouseCommand : public QUndoCommand @@ -101,10 +101,10 @@ public: MoveMouseCommand(QPoint *mouse, QPoint oldPoint, QPoint newPoint, QUndoCommand *parent = 0); ~MoveMouseCommand(); - virtual void undo(); - virtual void redo(); - virtual int id() const; - virtual bool mergeWith(const QUndoCommand *other); + virtual void undo() override; + virtual void redo() override; + virtual int id() const override; + virtual bool mergeWith(const QUndoCommand *other) override; private: QPoint *m_mouse; diff --git a/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp index b6be01d900..4b392d867c 100644 --- a/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp +++ b/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp @@ -86,7 +86,7 @@ public: clear(); } - QIODevice *data(const QUrl &url) + QIODevice *data(const QUrl &url) override { gotData = true; return QNetworkDiskCache::data(url); diff --git a/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp b/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp index edfef09a96..d230fcad4b 100644 --- a/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp +++ b/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp @@ -111,7 +111,7 @@ public: open(QIODevice::ReadOnly | QIODevice::Unbuffered); } - qint64 readData(char *data, qint64 maxlen) { return inputBuffer.read(data, maxlen); } + qint64 readData(char *data, qint64 maxlen) override { return inputBuffer.read(data, maxlen); } QBuffer inputBuffer; }; diff --git a/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp index b724e3a40b..50f118a89f 100644 --- a/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp +++ b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp @@ -668,7 +668,7 @@ public: , cachePath(cachePath) {} - void run() + void run() override { QByteArray longString = "Hello World, this is some long string, well not really that long"; for (int j = 0; j < 10; ++j) diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index e470dd02b4..98f468e49e 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -616,7 +616,7 @@ public: } protected: - void incomingConnection(qintptr socketDescriptor) + void incomingConnection(qintptr socketDescriptor) override { //qDebug() << "incomingConnection" << socketDescriptor << "doSsl:" << doSsl << "ipv6:" << ipv6; #ifndef QT_NO_SSL @@ -767,7 +767,7 @@ public: lastQuery = QNetworkProxyQuery(); } - virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query) + virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query) override { lastQuery = query; ++callCount; @@ -785,17 +785,17 @@ public: MyMemoryCache(QObject *parent) : QAbstractNetworkCache(parent) {} - QNetworkCacheMetaData metaData(const QUrl &url) + QNetworkCacheMetaData metaData(const QUrl &url) override { return cache.value(url.toEncoded()).first; } - void updateMetaData(const QNetworkCacheMetaData &metaData) + void updateMetaData(const QNetworkCacheMetaData &metaData) override { cache[metaData.url().toEncoded()].first = metaData; } - QIODevice *data(const QUrl &url) + QIODevice *data(const QUrl &url) override { CacheData::ConstIterator it = cache.find(url.toEncoded()); if (it == cache.constEnd()) @@ -807,13 +807,13 @@ public: return io; } - bool remove(const QUrl &url) + bool remove(const QUrl &url) override { cache.remove(url.toEncoded()); return true; } - qint64 cacheSize() const + qint64 cacheSize() const override { qint64 total = 0; foreach (const CachedContent &entry, cache) @@ -821,17 +821,17 @@ public: return total; } - QIODevice *prepare(const QNetworkCacheMetaData &) + QIODevice *prepare(const QNetworkCacheMetaData &) override { qFatal("%s: Should not have tried to add to the cache", Q_FUNC_INFO); return 0; } - void insert(QIODevice *) + void insert(QIODevice *) override { qFatal("%s: Should not have tried to add to the cache", Q_FUNC_INFO); } - void clear() { cache.clear(); } + void clear() override { cache.clear(); } }; Q_DECLARE_METATYPE(MyMemoryCache::CachedContent) Q_DECLARE_METATYPE(MyMemoryCache::CacheData) @@ -849,32 +849,32 @@ public: QHash<QUrl, QIODevice*> m_buffers; QList<QUrl> m_insertedUrls; - QNetworkCacheMetaData metaData(const QUrl &) + QNetworkCacheMetaData metaData(const QUrl &) override { return QNetworkCacheMetaData(); } - void updateMetaData(const QNetworkCacheMetaData &) + void updateMetaData(const QNetworkCacheMetaData &) override { } - QIODevice *data(const QUrl &) + QIODevice *data(const QUrl &) override { return 0; } - bool remove(const QUrl &url) + bool remove(const QUrl &url) override { delete m_buffers.take(url); return m_insertedUrls.removeAll(url) > 0; } - qint64 cacheSize() const + qint64 cacheSize() const override { return 0; } - QIODevice *prepare(const QNetworkCacheMetaData &metaData) + QIODevice *prepare(const QNetworkCacheMetaData &metaData) override { QBuffer* buffer = new QBuffer; buffer->open(QIODevice::ReadWrite); @@ -883,14 +883,14 @@ public: return buffer; } - void insert(QIODevice *buffer) + void insert(QIODevice *buffer) override { QUrl url = buffer->property("url").toUrl(); m_insertedUrls << url; delete m_buffers.take(url); } - void clear() { m_insertedUrls.clear(); } + void clear() override { m_insertedUrls.clear(); } }; class DataReader: public QObject @@ -985,7 +985,7 @@ public: return nextPendingConnection(); } } - virtual void incomingConnection(qintptr socketDescriptor) + virtual void incomingConnection(qintptr socketDescriptor) override { #ifndef QT_NO_SSL if (doSsl) { @@ -1090,7 +1090,7 @@ public: } protected: - void run() + void run() override { BlockingTcpServer server(doSsl); server.listen(); @@ -1234,7 +1234,7 @@ private slots: } protected: - void timerEvent(QTimerEvent *) + void timerEvent(QTimerEvent *) override { //qDebug() << "RateControlledReader: timerEvent bytesAvailable=" << device->bytesAvailable(); if (readBufferSize > 0 && device->bytesAvailable() > readBufferSize) { @@ -5011,7 +5011,7 @@ class SslServer : public QTcpServer Q_OBJECT public: SslServer() : socket(0), m_ssl(true) {} - void incomingConnection(qintptr socketDescriptor) + void incomingConnection(qintptr socketDescriptor) override { QSslSocket *serverSocket = new QSslSocket; serverSocket->setParent(this); @@ -7921,7 +7921,7 @@ void tst_QNetworkReply::synchronousAuthenticationCache() { public: MiniAuthServer(QThread *thread) : MiniHttpServer(QByteArray(), false, thread) {} - virtual void reply() + virtual void reply() override { dataToTransmit = @@ -8139,13 +8139,13 @@ public: timer.start(); } - virtual qint64 writeData(const char* , qint64 ) + virtual qint64 writeData(const char* , qint64 ) override { Q_ASSERT(false); return 0; } - virtual qint64 readData(char* data, qint64 maxlen) + virtual qint64 readData(char* data, qint64 maxlen) override { //qDebug() << Q_FUNC_INFO << maxlen << bandwidthQuota; maxlen = qMin(maxlen, buffer.bytesAvailable()); @@ -8163,14 +8163,14 @@ public: //qDebug() << Q_FUNC_INFO << maxlen << bandwidthQuota << read << ret << buffer.bytesAvailable(); return ret; } - virtual bool atEnd() const { return buffer.atEnd(); } - virtual qint64 size() const { return data.length(); } - qint64 bytesAvailable() const + virtual bool atEnd() const override { return buffer.atEnd(); } + virtual qint64 size() const override { return data.length(); } + qint64 bytesAvailable() const override { return buffer.bytesAvailable() + QIODevice::bytesAvailable(); } - virtual bool isSequential() const { return false; } // random access, we can seek - virtual bool seek (qint64 pos) { return buffer.seek(pos); } + virtual bool isSequential() const override { return false; } // random access, we can seek + virtual bool seek (qint64 pos) override { return buffer.seek(pos); } protected slots: void timeoutSlot() { diff --git a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp index 835e279ac3..539043377f 100644 --- a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp @@ -525,7 +525,7 @@ void tst_QHostInfo::raceCondition() class LookupThread : public QThread { protected: - inline void run() + inline void run() override { QHostInfo info = QHostInfo::fromName("a-single" TEST_DOMAIN); QCOMPARE(info.error(), QHostInfo::NoError); diff --git a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp index 6414aa6c82..f0cff5da3e 100644 --- a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp +++ b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp @@ -73,14 +73,14 @@ private slots: void incomplete(); protected slots: - void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth); + void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth) override; private: - void readNotification() { } - void writeNotification() { } - void closeNotification() { } - void exceptionNotification() { } - void connectionNotification() { } + void readNotification() override { } + void writeNotification() override { } + void closeNotification() override { } + void exceptionNotification() override { } + void connectionNotification() override { } }; class MiniSocks5ResponseHandler : public QObject diff --git a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp index 927dc5cf9a..1bf6777040 100644 --- a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -474,7 +474,7 @@ public: } protected: - void run() + void run() override { sleep(2); @@ -575,7 +575,7 @@ public: bool ok; protected: - void incomingConnection(qintptr socketDescriptor) + void incomingConnection(qintptr socketDescriptor) override { // how a user woulddo it (qabstractsocketengine is not public) unsigned long arg = 0; @@ -713,7 +713,7 @@ public: lastQuery = QNetworkProxyQuery(); } - virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query) + virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query) override { lastQuery = query; ++callCount; diff --git a/tests/auto/network/socket/qtcpsocket/stressTest/Test.h b/tests/auto/network/socket/qtcpsocket/stressTest/Test.h index 7839cb2c89..3e61456f75 100644 --- a/tests/auto/network/socket/qtcpsocket/stressTest/Test.h +++ b/tests/auto/network/socket/qtcpsocket/stressTest/Test.h @@ -56,7 +56,7 @@ public: My4Server(QObject *parent = 0); protected: - void incomingConnection(qintptr socket); + void incomingConnection(qintptr socket) override; private slots: void stopServer(); diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index 3c4728afec..b9108932f7 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -1375,7 +1375,7 @@ public: } protected: - void run() + void run() override { bool timedOut = false; while (!quit) { @@ -1865,7 +1865,7 @@ public: } protected: - inline void run() + inline void run() override { #ifndef QT_NO_SSL QFETCH_GLOBAL(bool, ssl); @@ -2265,7 +2265,7 @@ class TestThread2 : public QThread { Q_OBJECT public: - void run() + void run() override { QFile fileWriter("fifo"); QVERIFY(fileWriter.open(QFile::WriteOnly)); @@ -2880,7 +2880,7 @@ public: lastQuery = QNetworkProxyQuery(); } - virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query) + virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query) override { lastQuery = query; ++callCount; diff --git a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp index e84d4eb667..2c7bafba23 100644 --- a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp @@ -1221,7 +1221,7 @@ void tst_QSslCertificate::extensionsCritical() class TestThread : public QThread { public: - void run() + void run() override { effectiveDate = cert.effectiveDate(); expiryDate = cert.expiryDate(); diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index c30d996b3e..470ef1cd25 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -1228,7 +1228,7 @@ signals: void alertSent(QSsl::AlertLevel level, QSsl::AlertType type, const QString &message); protected: - void incomingConnection(qintptr socketDescriptor) + void incomingConnection(qintptr socketDescriptor) override { QSslConfiguration configuration = config; socket = new QSslSocket(this); @@ -1881,7 +1881,7 @@ void tst_QSslSocket::wildcard() class SslServer2 : public QTcpServer { protected: - void incomingConnection(qintptr socketDescriptor) + void incomingConnection(qintptr socketDescriptor) override { QSslSocket *socket = new QSslSocket(this); socket->ignoreSslErrors(); @@ -2111,7 +2111,7 @@ public: QSslSocket *socket; protected: - void incomingConnection(qintptr socketDescriptor) + void incomingConnection(qintptr socketDescriptor) override { socket = new QSslSocket(this); connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot())); @@ -2163,7 +2163,7 @@ signals: void listening(); protected: - void run() + void run() override { // if all goes well (no timeouts), this thread will sleep for a total of 500 ms // (i.e., 5 times 100 ms, one sleep for each operation) @@ -2292,7 +2292,7 @@ public: QSslSocket *socket; protected: - void incomingConnection(qintptr socketDescriptor) + void incomingConnection(qintptr socketDescriptor) override { socket = new QSslSocket(this); @@ -3010,7 +3010,7 @@ public: QSslSocket *socket; protected: - void incomingConnection(qintptr socketDescriptor) + void incomingConnection(qintptr socketDescriptor) override { socket = new QSslSocket; socket->setSocketDescriptor(socketDescriptor); @@ -3612,7 +3612,7 @@ public: PskProvider m_pskProvider; protected: - void incomingConnection(qintptr socketDescriptor) + void incomingConnection(qintptr socketDescriptor) override { socket = new QSslSocket(this); socket->setSslConfiguration(config); diff --git a/tests/auto/other/compiler/derivedclass.h b/tests/auto/other/compiler/derivedclass.h index eab7963236..99d970f4ec 100644 --- a/tests/auto/other/compiler/derivedclass.h +++ b/tests/auto/other/compiler/derivedclass.h @@ -33,7 +33,7 @@ class DerivedClass : public BaseClass { public: - void wasAPureVirtualFunction(); + void wasAPureVirtualFunction() override; }; #endif diff --git a/tests/auto/other/qabstractitemmodelutils/dynamictreemodel.h b/tests/auto/other/qabstractitemmodelutils/dynamictreemodel.h index 0807ffbe94..e28575e50b 100644 --- a/tests/auto/other/qabstractitemmodelutils/dynamictreemodel.h +++ b/tests/auto/other/qabstractitemmodelutils/dynamictreemodel.h @@ -41,12 +41,12 @@ class DynamicTreeModel : public QAbstractItemModel public: DynamicTreeModel(QObject *parent = 0); - QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; - QModelIndex parent(const QModelIndex &index) const; - int rowCount(const QModelIndex &index = QModelIndex()) const; - int columnCount(const QModelIndex &index = QModelIndex()) const; + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; + QModelIndex parent(const QModelIndex &index) const override; + int rowCount(const QModelIndex &index = QModelIndex()) const override; + int columnCount(const QModelIndex &index = QModelIndex()) const override; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; void clear(); @@ -137,7 +137,7 @@ public: { } - virtual void doCommand(); + virtual void doCommand() override; }; class ModelMoveCommand : public ModelChangeCommand @@ -153,7 +153,7 @@ public: virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow); - virtual void doCommand(); + virtual void doCommand() override; virtual void emitPostSignal(); @@ -184,8 +184,8 @@ public: virtual ~ModelResetCommand(); virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, - const QModelIndex &destParent, int destRow); - virtual void emitPostSignal(); + const QModelIndex &destParent, int destRow) override; + virtual void emitPostSignal() override; }; /** @@ -200,8 +200,8 @@ public: virtual ~ModelResetCommandFixed(); virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, - const QModelIndex &destParent, int destRow); - virtual void emitPostSignal(); + const QModelIndex &destParent, int destRow) override; + virtual void emitPostSignal() override; }; class ModelChangeChildrenLayoutsCommand : public ModelChangeCommand @@ -214,7 +214,7 @@ public: { } - virtual void doCommand(); + virtual void doCommand() override; void setSecondAncestorRowNumbers(QList<int> rows) { diff --git a/tests/auto/other/qobjectrace/tst_qobjectrace.cpp b/tests/auto/other/qobjectrace/tst_qobjectrace.cpp index dba1fddb76..119a658471 100644 --- a/tests/auto/other/qobjectrace/tst_qobjectrace.cpp +++ b/tests/auto/other/qobjectrace/tst_qobjectrace.cpp @@ -104,7 +104,8 @@ public: QThread::start(); } - void run() { + void run() override + { QTimer zeroTimer; connect(&zeroTimer, SIGNAL(timeout()), object, SLOT(theSlot())); connect(&zeroTimer, SIGNAL(timeout()), this, SLOT(checkStopWatch()), Qt::DirectConnection); @@ -219,7 +220,8 @@ public: objects[i]->moveToThread(this); } - void run() { + void run() override + { for (int i = number-1; i >= 0; --i) { /* Do some more connection and disconnection between object in this thread that have not been destroyed yet */ @@ -417,7 +419,7 @@ public: { } - void run() + void run() override { while (!isInterruptionRequested()) { QMetaObject::Connection conn = connect(sender, &DisconnectRaceSenderObject::theSignal, @@ -441,7 +443,7 @@ public: { } - void run() + void run() override { while (!isInterruptionRequested()) { emit sender->theSignal(); @@ -490,7 +492,7 @@ public: { } - void run() + void run() override { QScopedPointer<DeleteReceiverRaceReceiver> receiver(new DeleteReceiverRaceReceiver(sender)); exec(); diff --git a/tests/auto/shared/platforminputcontext.h b/tests/auto/shared/platforminputcontext.h index 006bef345a..be05296e2b 100644 --- a/tests/auto/shared/platforminputcontext.h +++ b/tests/auto/shared/platforminputcontext.h @@ -46,10 +46,11 @@ public: m_setFocusObjectCallCount(0) {} - virtual QRectF keyboardRect() const { return m_keyboardRect; } - virtual bool isAnimating() const { return m_animating; } - virtual void reset() { m_resetCallCount++; } - virtual void commit() { + virtual QRectF keyboardRect() const override { return m_keyboardRect; } + virtual bool isAnimating() const override { return m_animating; } + virtual void reset() override { m_resetCallCount++; } + virtual void commit() override + { m_commitCallCount++; if (m_commitString.isEmpty()) return; @@ -65,43 +66,43 @@ public: m_commitString = commitString; } - virtual void update(Qt::InputMethodQueries queries) + virtual void update(Qt::InputMethodQueries queries) override { m_updateCallCount++; m_lastQueries = queries; } - virtual void invokeAction(QInputMethod::Action action, int cursorPosition) + virtual void invokeAction(QInputMethod::Action action, int cursorPosition) override { m_action = action; m_cursorPosition = cursorPosition; } - virtual bool filterEvent(const QEvent *event) + virtual bool filterEvent(const QEvent *event) override { m_lastEventType = event->type(); return false; } - virtual void showInputPanel() + virtual void showInputPanel() override { m_visible = true; } - virtual void hideInputPanel() + virtual void hideInputPanel() override { m_visible = false; } - virtual bool isInputPanelVisible() const + virtual bool isInputPanelVisible() const override { return m_visible; } - virtual QLocale locale() const + virtual QLocale locale() const override { m_localeCallCount++; return QLocale::c(); } - virtual Qt::LayoutDirection inputDirection() const + virtual Qt::LayoutDirection inputDirection() const override { m_inputDirectionCallCount++; return Qt::LeftToRight; } - virtual void setFocusObject(QObject *object) + virtual void setFocusObject(QObject *object) override { Q_UNUSED(object); m_setFocusObjectCallCount++; diff --git a/tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp b/tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp index edee3bf790..6d1062d881 100644 --- a/tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp +++ b/tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp @@ -110,7 +110,7 @@ public: q.clear(); } - void run() + void run() override { QString dbName = QString("QThreadDb%1").arg((size_t)currentThreadId()); runHelper(dbName); @@ -148,7 +148,7 @@ public: } } - void run() + void run() override { QString dbName = QString("Producer%1").arg((size_t)currentThreadId()); runHelper(dbName); @@ -184,7 +184,7 @@ public: } } - void run() + void run() override { QString dbName = QString("Consumer%1").arg((size_t)currentThreadId()); runHelper(dbName); @@ -206,7 +206,7 @@ public: SqlThread(Mode m, const QSqlDatabase &db, QObject *parent = 0) : QThread(parent), sourceDb(db), mode(m) {} - void run() + void run() override { QSqlDatabase &db = sourceDb; switch (mode) { diff --git a/tests/auto/testlib/selftests/badxml/tst_badxml.cpp b/tests/auto/testlib/selftests/badxml/tst_badxml.cpp index bdf48a2f21..e3f650bd85 100644 --- a/tests/auto/testlib/selftests/badxml/tst_badxml.cpp +++ b/tests/auto/testlib/selftests/badxml/tst_badxml.cpp @@ -68,7 +68,7 @@ public: : className("tst_BadXml"), mo(0) {} ~tst_BadXmlSub() { free(mo); } - const QMetaObject* metaObject() const; + const QMetaObject* metaObject() const override; QByteArray className; private: diff --git a/tests/auto/testlib/selftests/benchlibeventcounter/tst_benchlibeventcounter.cpp b/tests/auto/testlib/selftests/benchlibeventcounter/tst_benchlibeventcounter.cpp index c9e3327411..224b720f5f 100644 --- a/tests/auto/testlib/selftests/benchlibeventcounter/tst_benchlibeventcounter.cpp +++ b/tests/auto/testlib/selftests/benchlibeventcounter/tst_benchlibeventcounter.cpp @@ -39,16 +39,16 @@ public: TestEventDispatcher(QObject* parent =0) : QAbstractEventDispatcher(parent) {} - void interrupt() {} - bool processEvents(QEventLoop::ProcessEventsFlags) { return false; } - void registerSocketNotifier(QSocketNotifier*) {} - void registerTimer(int,int,Qt::TimerType,QObject*) {} - QList<TimerInfo> registeredTimers(QObject*) const { return QList<TimerInfo>(); } - void unregisterSocketNotifier(QSocketNotifier*) {} - bool unregisterTimer(int) { return false; } - bool unregisterTimers(QObject*) { return false; } - int remainingTime(int) { return 0; } - void wakeUp() {} + void interrupt() override {} + bool processEvents(QEventLoop::ProcessEventsFlags) override { return false; } + void registerSocketNotifier(QSocketNotifier*) override {} + void registerTimer(int,int,Qt::TimerType,QObject*) override {} + QList<TimerInfo> registeredTimers(QObject*) const override { return QList<TimerInfo>(); } + void unregisterSocketNotifier(QSocketNotifier*) override {} + bool unregisterTimer(int) override { return false; } + bool unregisterTimers(QObject*) override { return false; } + int remainingTime(int) override { return 0; } + void wakeUp() override {} #ifdef Q_OS_WIN bool registerEventNotifier(QWinEventNotifier *) { return false; } diff --git a/tests/auto/testlib/selftests/benchliboptions/tst_benchliboptions.cpp b/tests/auto/testlib/selftests/benchliboptions/tst_benchliboptions.cpp index 689f92cc39..5d77df91a0 100644 --- a/tests/auto/testlib/selftests/benchliboptions/tst_benchliboptions.cpp +++ b/tests/auto/testlib/selftests/benchliboptions/tst_benchliboptions.cpp @@ -39,16 +39,16 @@ public: TestEventDispatcher(QObject* parent =0) : QAbstractEventDispatcher(parent) {} - void interrupt() {} - bool processEvents(QEventLoop::ProcessEventsFlags) { return false; } - void registerSocketNotifier(QSocketNotifier*) {} - void registerTimer(int,int,Qt::TimerType,QObject*) {} - QList<TimerInfo> registeredTimers(QObject*) const { return QList<TimerInfo>(); } - void unregisterSocketNotifier(QSocketNotifier*) {} - bool unregisterTimer(int) { return false; } - bool unregisterTimers(QObject*) { return false; } - int remainingTime(int) { return 0; } - void wakeUp() {} + void interrupt() override {} + bool processEvents(QEventLoop::ProcessEventsFlags) override { return false; } + void registerSocketNotifier(QSocketNotifier*) override {} + void registerTimer(int,int,Qt::TimerType,QObject*) override {} + QList<TimerInfo> registeredTimers(QObject*) const override { return QList<TimerInfo>(); } + void unregisterSocketNotifier(QSocketNotifier*) override {} + bool unregisterTimer(int) override { return false; } + bool unregisterTimers(QObject*) override { return false; } + int remainingTime(int) override { return 0; } + void wakeUp() override {} #ifdef Q_OS_WIN bool registerEventNotifier(QWinEventNotifier *) { return false; } diff --git a/tests/auto/testlib/selftests/mouse/tst_mouse.cpp b/tests/auto/testlib/selftests/mouse/tst_mouse.cpp index 43dda31daf..59dfc26043 100644 --- a/tests/auto/testlib/selftests/mouse/tst_mouse.cpp +++ b/tests/auto/testlib/selftests/mouse/tst_mouse.cpp @@ -61,25 +61,25 @@ public: ulong lastTimeStamp = 0; protected: - void mousePressEvent(QMouseEvent *e) + void mousePressEvent(QMouseEvent *e) override { pressCount++; processEvent(e); } - void mouseMoveEvent(QMouseEvent *e) + void mouseMoveEvent(QMouseEvent *e) override { moveCount++; stateInMouseMove = e->buttons(); processEvent(e); } - void mouseReleaseEvent(QMouseEvent *e) + void mouseReleaseEvent(QMouseEvent *e) override { processEvent(e); } - void mouseDoubleClickEvent(QMouseEvent *e) + void mouseDoubleClickEvent(QMouseEvent *e) override { doubleClickCount++; processEvent(e); diff --git a/tests/auto/tools/moc/pure-virtual-signals.h b/tests/auto/tools/moc/pure-virtual-signals.h index d514ee8a04..f8b3a80f91 100644 --- a/tests/auto/tools/moc/pure-virtual-signals.h +++ b/tests/auto/tools/moc/pure-virtual-signals.h @@ -45,7 +45,7 @@ class PureVirtualSignalsImpl : public PureVirtualSignalsTest Q_OBJECT public: signals: - void mySignal(); - void mySignal2(int foo); + void mySignal() override; + void mySignal2(int foo) override; }; #endif // PURE_VIRTUAL_SIGNALS_H diff --git a/tests/auto/tools/qmakelib/tst_qmakelib.h b/tests/auto/tools/qmakelib/tst_qmakelib.h index b4a4d95b6f..4bc62cbd99 100644 --- a/tests/auto/tools/qmakelib/tst_qmakelib.h +++ b/tests/auto/tools/qmakelib/tst_qmakelib.h @@ -87,14 +87,14 @@ private: class QMakeTestHandler : public QMakeHandler { public: QMakeTestHandler() : QMakeHandler(), printed(false) {} - virtual void message(int type, const QString &msg, const QString &fileName, int lineNo) + virtual void message(int type, const QString &msg, const QString &fileName, int lineNo) override { print(fileName, lineNo, type, msg); } - virtual void fileMessage(int type, const QString &msg) + virtual void fileMessage(int type, const QString &msg) override { Q_UNUSED(type); doPrint(msg); } - virtual void aboutToEval(ProFile *, ProFile *, EvalFileType) {} - virtual void doneWithEval(ProFile *) {} + virtual void aboutToEval(ProFile *, ProFile *, EvalFileType) override {} + virtual void doneWithEval(ProFile *) override {} void setExpectedMessages(const QStringList &msgs) { expected = msgs; } QStringList expectedMessages() const { return expected; } diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp index a73279018d..266ed0de05 100644 --- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp +++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp @@ -104,12 +104,14 @@ public: bool wasActive() const { return mWasActive; } bool wasModalWindow() const { return mWasModalWindow; } - int exec() { + int exec() override + { tId = startTimer(300); return QDialog::exec(); } protected: - void timerEvent(QTimerEvent *event) { + void timerEvent(QTimerEvent *event) override + { if (tId == event->timerId()) { killTimer(tId); mWasActive = isActiveWindow(); @@ -414,7 +416,7 @@ class TestRejectDialog : public QDialog { public: TestRejectDialog() : cancelReject(false), called(0) {} - void reject() + void reject() override { called++; if (!cancelReject) diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp index 20c0dd993b..4b9466d3b6 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp @@ -201,8 +201,8 @@ class MyAbstractItemDelegate : public QAbstractItemDelegate { public: MyAbstractItemDelegate() : QAbstractItemDelegate() {}; - void paint(QPainter *, const QStyleOptionViewItem &, const QModelIndex &) const {} - QSize sizeHint(const QStyleOptionViewItem &, const QModelIndex &) const { return QSize(); } + void paint(QPainter *, const QStyleOptionViewItem &, const QModelIndex &) const override {} + QSize sizeHint(const QStyleOptionViewItem &, const QModelIndex &) const override { return QSize(); } }; // emitted any time the selection model emits current changed diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp index cbb1c72b11..beec8db0d9 100644 --- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp @@ -482,7 +482,7 @@ public: {}; protected: - bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const + bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override { QModelIndex parentIndex; parentIndex = source_parent; @@ -515,7 +515,7 @@ public: { } protected: - virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const + virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const override { QFileSystemModel * const model = qobject_cast<QFileSystemModel *>(sourceModel()); const QFileInfo leftInfo(model->fileInfo(left)); diff --git a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp index 877784041b..2a40af320b 100644 --- a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp +++ b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp @@ -48,7 +48,7 @@ class tst_QInputDialog : public QObject static void testFuncGetText(QInputDialog *dialog); static void testFuncGetItem(QInputDialog *dialog); static void testFuncSingleStepDouble(QInputDialog *dialog); - void timerEvent(QTimerEvent *event); + void timerEvent(QTimerEvent *event) override; private slots: void getInt_data(); void getInt(); diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp index 3169a9cb4e..dfb8dc1c37 100644 --- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp +++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp @@ -80,7 +80,8 @@ public: bool resized; protected: - void resizeEvent ( QResizeEvent * event ) { + void resizeEvent ( QResizeEvent * event ) override + { resized = true; QMessageBox::resizeEvent(event); } diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp index e9bf14b1e6..3e8a81c33c 100644 --- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp +++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp @@ -821,9 +821,9 @@ struct MyPage2 : public QWizardPage public: MyPage2() : init(0), cleanup(0), validate(0) {} - void initializePage() { ++init; QWizardPage::initializePage(); } - void cleanupPage() { ++cleanup; QWizardPage::cleanupPage(); } - bool validatePage() { ++validate; return QWizardPage::validatePage(); } + void initializePage() override { ++init; QWizardPage::initializePage(); } + void cleanupPage() override { ++cleanup; QWizardPage::cleanupPage(); } + bool validatePage() override { ++validate; return QWizardPage::validatePage(); } bool sanityCheck(int init, int cleanup) { @@ -1592,13 +1592,13 @@ protected: class SetPage : public Operation { - void apply(QWizard *wizard) const + void apply(QWizard *wizard) const override { wizard->restart(); for (int j = 0; j < page; ++j) wizard->next(); } - QString describe() const { return QLatin1String("set page ") + QString::number(page); } + QString describe() const override { return QLatin1String("set page ") + QString::number(page); } int page; public: static QSharedPointer<SetPage> create(int page) @@ -1611,8 +1611,8 @@ public: class SetStyle : public Operation { - void apply(QWizard *wizard) const { wizard->setWizardStyle(style); } - QString describe() const { return QLatin1String("set style ") + QString::number(style); } + void apply(QWizard *wizard) const override { wizard->setWizardStyle(style); } + QString describe() const override { return QLatin1String("set style ") + QString::number(style); } QWizard::WizardStyle style; public: static QSharedPointer<SetStyle> create(QWizard::WizardStyle style) @@ -1625,8 +1625,8 @@ public: class SetOption : public Operation { - void apply(QWizard *wizard) const { wizard->setOption(option, on); } - QString describe() const; + void apply(QWizard *wizard) const override { wizard->setOption(option, on); } + QString describe() const override; QWizard::WizardOption option; bool on; public: @@ -2117,8 +2117,8 @@ class WizardPage : public QWizardPage { Q_OBJECT bool shown_; - void showEvent(QShowEvent *) { shown_ = true; } - void hideEvent(QHideEvent *) { shown_ = false; } + void showEvent(QShowEvent *) override { shown_ = true; } + void hideEvent(QHideEvent *) override { shown_ = false; } public: WizardPage() : shown_(false) {} bool shown() const { return shown_; } @@ -2511,7 +2511,7 @@ private: QTreeWidget *treeWidget; QSizePolicy::Policy verticalPolicy; - void initializePage() + void initializePage() override { if (layout()) delete layout(); diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard_2.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard_2.cpp index 0969cecc45..cc48543a76 100644 --- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard_2.cpp +++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard_2.cpp @@ -61,7 +61,7 @@ class taskQTBUG_25691Page2 : public QWizardPage public: taskQTBUG_25691Page2( QWidget * parent = 0 ); - virtual void initializePage(void); + virtual void initializePage(void) override; ~taskQTBUG_25691Page2(void); diff --git a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp index 38181c8af0..bd1b56ebc1 100644 --- a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp @@ -73,7 +73,7 @@ public: m_painter(0), m_styleOption(0) {} - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override { m_painter = painter; m_styleOption = option; @@ -101,7 +101,7 @@ public: doNothingInDraw(false), m_painter(0), m_styleOption(0), m_source(0), m_opacity(1.0) {} - QRectF boundingRectFor(const QRectF &rect) const + QRectF boundingRectFor(const QRectF &rect) const override { return rect.adjusted(-m_margin, -m_margin, m_margin, m_margin); } void reset() @@ -123,7 +123,7 @@ public: int margin() const { return m_margin; } - void draw(QPainter *painter) + void draw(QPainter *painter) override { ++numRepaints; if (doNothingInDraw) @@ -135,7 +135,7 @@ public: drawSource(painter); } - void sourceChanged(QGraphicsEffect::ChangeFlags flags) + void sourceChanged(QGraphicsEffect::ChangeFlags flags) override { m_sourceChangedFlags |= flags; } int numRepaints; @@ -509,10 +509,10 @@ public: , repaints(0) {} - QRectF boundingRectFor(const QRectF &rect) const + QRectF boundingRectFor(const QRectF &rect) const override { return rect; } - void draw(QPainter *painter) + void draw(QPainter *painter) override { QCOMPARE(sourcePixmap(Qt::LogicalCoordinates).handle(), pixmap.handle()); QVERIFY((painter->worldTransform().type() <= QTransform::TxTranslate) == (sourcePixmap(Qt::DeviceCoordinates).handle() == pixmap.handle())); @@ -551,10 +551,10 @@ void tst_QGraphicsEffect::drawPixmapItem() class DeviceEffect : public QGraphicsEffect { public: - QRectF boundingRectFor(const QRectF &rect) const + QRectF boundingRectFor(const QRectF &rect) const override { return rect; } - void draw(QPainter *painter) + void draw(QPainter *painter) override { QPoint offset; QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset, QGraphicsEffect::NoPad); @@ -648,7 +648,7 @@ public: MyGraphicsItem(QGraphicsItem *parent = 0) : QGraphicsWidget(parent), nbPaint(0) {} - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override { nbPaint++; QGraphicsWidget::paint(painter, option, widget); diff --git a/tests/auto/widgets/effects/qpixmapfilter/tst_qpixmapfilter.cpp b/tests/auto/widgets/effects/qpixmapfilter/tst_qpixmapfilter.cpp index 99b0ccd10d..5cc08617c6 100644 --- a/tests/auto/widgets/effects/qpixmapfilter/tst_qpixmapfilter.cpp +++ b/tests/auto/widgets/effects/qpixmapfilter/tst_qpixmapfilter.cpp @@ -59,7 +59,8 @@ public: CustomFilter() : QPixmapFilter((QPixmapFilter::FilterType) Type, 0) { }; - void draw(QPainter *p, const QPointF &pt, const QPixmap &src, const QRectF &srcRect = QRectF()) const { + void draw(QPainter *p, const QPointF &pt, const QPixmap &src, const QRectF &srcRect = QRectF()) const override + { p->drawPixmap(QRectF(pt, srcRect.size()), src, srcRect); } }; diff --git a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index e19ef4c308..934505034e 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -87,7 +87,7 @@ class RectWidget : public QGraphicsWidget public: RectWidget(QGraphicsItem *parent = 0) : QGraphicsWidget(parent){} - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override { Q_UNUSED(option); Q_UNUSED(widget); @@ -1113,7 +1113,7 @@ public: } virtual int pixelMetric(PixelMetric metric, const QStyleOption * option = 0, - const QWidget * widget = 0 ) const; + const QWidget * widget = 0 ) const override; int hspacing; int vspacing; @@ -1122,7 +1122,7 @@ public: QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option = 0, - const QWidget *widget = 0) const; + const QWidget *widget = 0) const override; }; diff --git a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp index 65480bf665..d1f8954ab9 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp @@ -163,7 +163,7 @@ public: } protected: - QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; + QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override; }; QSizeF TestWidget::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const diff --git a/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp index eaad5e478d..5df8b7c1ac 100644 --- a/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp @@ -43,7 +43,7 @@ public: m_painter(0) {} - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override { m_painter = painter; ++numRepaints; @@ -70,7 +70,7 @@ public: m_painter(0), m_source(0) {} - QRectF boundingRectFor(const QRectF &rect) const + QRectF boundingRectFor(const QRectF &rect) const override { return rect.adjusted(-m_margin, -m_margin, m_margin, m_margin); } void reset() @@ -94,7 +94,7 @@ public: int margin() const { return m_margin; } - void draw(QPainter *painter) + void draw(QPainter *painter) override { ++numRepaints; if (storeDeviceDependentStuff) { @@ -109,7 +109,7 @@ public: source()->draw(painter); } - void sourceChanged(ChangeFlags) + void sourceChanged(ChangeFlags) override { m_sourceChanged = true; } void sourceBoundingRectChanged() @@ -310,11 +310,13 @@ public: { } - QRectF boundingRectFor(const QRectF &src) const { + QRectF boundingRectFor(const QRectF &src) const override + { return src.adjusted(-10, -10, 10, 10); } - void draw(QPainter *) { + void draw(QPainter *) override + { pix = source()->pixmap(coordinateMode, &offset, padMode); } diff --git a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index 4d5857c3c8..7e7536a94c 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp @@ -121,7 +121,7 @@ class RectWidget : public QGraphicsWidget public: RectWidget(QGraphicsItem *parent = 0) : QGraphicsWidget(parent), m_fnConstraint(0) {} - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override { Q_UNUSED(option); Q_UNUSED(widget); @@ -130,7 +130,7 @@ public: painter->drawLine(rect().bottomLeft(), rect().topRight()); } - QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const + QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override { if (constraint.width() < 0 && constraint.height() < 0 && m_sizeHints[which].isValid()) { return m_sizeHints[which]; diff --git a/tests/auto/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp b/tests/auto/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp index c5009e9847..cc416f76b2 100644 --- a/tests/auto/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp @@ -93,7 +93,8 @@ public: TestGraphicsWidget(QGraphicsWidget *parent = 0) : QGraphicsWidget(parent) { } - bool event(QEvent *e) { + bool event(QEvent *e) override + { ++(m_eventCount[int(e->type())]); return QGraphicsWidget::event(e); } @@ -111,7 +112,7 @@ public: functionCount.clear(); } - void setGeometry(const QRectF &rect) + void setGeometry(const QRectF &rect) override { QGraphicsWidget::setGeometry(rect); ++(functionCount[SetGeometry]); @@ -235,13 +236,13 @@ class TestLayout : public QGraphicsLinearLayout setSpacing(0); } - void setGeometry(const QRectF &rect) + void setGeometry(const QRectF &rect) override { ++(functionCount[SetGeometry]); QGraphicsLinearLayout::setGeometry(rect); } - void invalidate() + void invalidate() override { ++(functionCount[Invalidate]); QGraphicsLinearLayout::invalidate(); @@ -569,27 +570,29 @@ class Layout : public QGraphicsLayout public: Layout(QGraphicsLayoutItem *parentItem = 0) : QGraphicsLayout(parentItem) {} - void setGeometry(const QRectF &rect) + void setGeometry(const QRectF &rect) override { QGraphicsLayout::setGeometry(rect); } - int count() const { + int count() const override + { return 0; } - QGraphicsLayoutItem *itemAt(int index) const { + QGraphicsLayoutItem *itemAt(int index) const override + { Q_UNUSED(index); return 0; } - void removeAt(int index) + void removeAt(int index) override { Q_UNUSED(index); } protected: - QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const + QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override { Q_UNUSED(constraint); Q_UNUSED(which); @@ -634,9 +637,9 @@ public: setGraphicsItem(item); } - void setGeometry(const QRectF &geom); + void setGeometry(const QRectF &geom) override; - QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF() ) const; + QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF() ) const override; inline QGraphicsRectItem *rectItem() { return static_cast<QGraphicsRectItem *>(graphicsItem()); @@ -674,7 +677,8 @@ public: connect(&m_timeline, SIGNAL(valueChanged(qreal)), this, SLOT(valueChanged(qreal))); } - void setGeometry(const QRectF &geom) { + void setGeometry(const QRectF &geom) override + { fromGeoms.clear(); toGeoms.clear(); for (int i = 0; i < count(); ++i) { @@ -759,7 +763,7 @@ public: setOwnedByLayout(true); } - QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF() ) const; + QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF() ) const override; ~CustomLayoutItem() { m_destructedSet->insert(this); @@ -790,9 +794,9 @@ public: m_destructedSet = destructedSet; } - QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF() ) const; + QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF() ) const override; - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget * = 0) + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget * = 0) override { const QRect r = option->rect.adjusted(0, 0, -1, -1); painter->drawLine(r.topLeft(), r.bottomRight()); @@ -844,18 +848,18 @@ CustomLayout(QGraphicsLayoutItem *parent) { } -int count() const +int count() const override { return items.count(); } -QGraphicsLayoutItem* itemAt(int index) const +QGraphicsLayoutItem* itemAt(int index) const override { return items.at(index); } -void removeAt(int index) +void removeAt(int index) override { items.removeAt(index); } @@ -897,7 +901,7 @@ void updateParentWidget(QGraphicsWidget *item) } } -QSizeF sizeHint(Qt::SizeHint /* which */, const QSizeF & /* constraint */) const +QSizeF sizeHint(Qt::SizeHint /* which */, const QSizeF & /* constraint */) const override { return QSizeF(50,50); } diff --git a/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp b/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp index af21b9f391..2d8bf40ee5 100644 --- a/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp @@ -72,13 +72,13 @@ public: { return QRectF(); } // QGraphicsLayoutItem::setGeometry is a pure virtual function - void setGeometry(QRectF const&) {} + void setGeometry(QRectF const&) override {} // QGraphicsLayoutItem::sizeHint is a pure virtual function - QSizeF sizeHint(Qt::SizeHint, QSizeF const& = QSizeF()) const + QSizeF sizeHint(Qt::SizeHint, QSizeF const& = QSizeF()) const override { return QSizeF(); } - void updateGeometry() + void updateGeometry() override { updateGeometryCalled++; QGraphicsLayoutItem::updateGeometry(); } int updateGeometryCalled; diff --git a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp index 817f67540e..0851b20927 100644 --- a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp @@ -107,7 +107,7 @@ public: layoutDirectionChange(0) { } - void widgetEvent(QEvent *e) + void widgetEvent(QEvent *e) override { switch (e->type()) { case QEvent::GraphicsSceneResize: @@ -145,7 +145,7 @@ class RectWidget : public QGraphicsWidget public: RectWidget(QGraphicsItem *parent = 0, const QBrush &brush = QBrush()) : QGraphicsWidget(parent){ m_brush = brush;} - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override { Q_UNUSED(option); Q_UNUSED(widget); @@ -158,7 +158,8 @@ public: updateGeometry(); } - virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const { + virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override + { if (m_sizeHints[which].isValid()) { return m_sizeHints[which]; } diff --git a/tests/auto/widgets/graphicsview/qgraphicsobject/tst_qgraphicsobject.cpp b/tests/auto/widgets/graphicsview/qgraphicsobject/tst_qgraphicsobject.cpp index 6ef17a14af..ddcdc809d9 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsobject/tst_qgraphicsobject.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsobject/tst_qgraphicsobject.cpp @@ -53,8 +53,8 @@ class MyGraphicsObject : public QGraphicsObject { public: MyGraphicsObject() : QGraphicsObject() {} - virtual QRectF boundingRect() const { return QRectF(); } - virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) {} + virtual QRectF boundingRect() const override { return QRectF(); } + virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override {} }; void tst_QGraphicsObject::pos() @@ -223,9 +223,9 @@ public: } } - void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = 0) + void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = 0) override { } - QRectF boundingRect() const + QRectF boundingRect() const override { return QRectF(); } bool *wasDeleted; diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index 0b3e132936..6b292bc713 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -122,7 +122,7 @@ public: bool isHovered = false; protected: - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *) + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *) override { isHovered = (option->state & QStyle::State_MouseOver); @@ -2190,7 +2190,7 @@ public: bool ignoresDragMove = false; protected: - void dragEnterEvent(QGraphicsSceneDragDropEvent *event) + void dragEnterEvent(QGraphicsSceneDragDropEvent *event) override { storeLastEvent(event); event->setAccepted(!ignoresDragEnter); @@ -2199,20 +2199,20 @@ protected: eventList << event->type(); } - void dragMoveEvent(QGraphicsSceneDragDropEvent *event) + void dragMoveEvent(QGraphicsSceneDragDropEvent *event) override { storeLastEvent(event); event->setAccepted(!ignoresDragMove); eventList << event->type(); } - void dragLeaveEvent(QGraphicsSceneDragDropEvent *event) + void dragLeaveEvent(QGraphicsSceneDragDropEvent *event) override { storeLastEvent(event); eventList << event->type(); } - void dropEvent(QGraphicsSceneDragDropEvent *event) + void dropEvent(QGraphicsSceneDragDropEvent *event) override { storeLastEvent(event); eventList << event->type(); diff --git a/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp index 4f2c310135..d875eb1db4 100644 --- a/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp @@ -228,9 +228,9 @@ class CustomShapeItem : public QGraphicsItem public: CustomShapeItem(const QPainterPath &shape) : QGraphicsItem(0), mShape(shape) {} - QPainterPath shape() const { return mShape; } - QRectF boundingRect() const { return mShape.boundingRect(); } - void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) {} + QPainterPath shape() const override { return mShape; } + QRectF boundingRect() const override { return mShape.boundingRect(); } + void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override {} private: QPainterPath mShape; }; @@ -281,7 +281,7 @@ public: { } - void paint(QPainter *painter, const QStyleOptionGraphicsItem * /* option */, QWidget * /* widget */) + void paint(QPainter *painter, const QStyleOptionGraphicsItem * /* option */, QWidget * /* widget */) override { painter->setBrush(brush); painter->drawRect(boundingRect()); @@ -336,8 +336,8 @@ void tst_QGraphicsSceneIndex::clear() MyItem(QGraphicsItem *parent = 0) : QGraphicsItem(parent), numPaints(0) {} int numPaints; protected: - QRectF boundingRect() const { return QRectF(0, 0, 10, 10); } - void paint(QPainter * /* painter */, const QStyleOptionGraphicsItem *, QWidget *) + QRectF boundingRect() const override { return QRectF(0, 0, 10, 10); } + void paint(QPainter * /* painter */, const QStyleOptionGraphicsItem *, QWidget *) override { ++numPaints; } }; diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index 2517d3bd5a..5f98902abd 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -196,13 +196,13 @@ class DialogItemDelegate : public QStyledItemDelegate { public: using QStyledItemDelegate::QStyledItemDelegate; - QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const + QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const override { openedEditor = new QDialog(parent); return openedEditor; } - void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const + void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override { Q_UNUSED(model); Q_UNUSED(index); diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp index 155b5389fc..16f8b97d49 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp +++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp @@ -77,7 +77,7 @@ public: void drawDisplay(QPainter *painter, const QStyleOptionViewItem &option, - const QRect &rect, const QString &text) const + const QRect &rect, const QString &text) const override { displayText = text; displayFont = option.font; @@ -86,7 +86,7 @@ public: void drawDecoration(QPainter *painter, const QStyleOptionViewItem &option, - const QRect &rect, const QPixmap &pixmap) const + const QRect &rect, const QPixmap &pixmap) const override { decorationPixmap = pixmap; decorationRect = rect; @@ -113,7 +113,7 @@ public: return QItemDelegate::rect(option, index, role); } - inline bool eventFilter(QObject *object, QEvent *event) + inline bool eventFilter(QObject *object, QEvent *event) override { return QItemDelegate::eventFilter(object, event); } @@ -121,7 +121,7 @@ public: inline bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, - const QModelIndex &index) + const QModelIndex &index) override { return QItemDelegate::editorEvent(event, model, option, index); } @@ -149,19 +149,19 @@ public: ~TestItemModel() {} - int rowCount(const QModelIndex &parent) const + int rowCount(const QModelIndex &parent) const override { Q_UNUSED(parent); return 1; } - int columnCount(const QModelIndex &parent) const + int columnCount(const QModelIndex &parent) const override { Q_UNUSED(parent); return 1; } - QVariant data(const QModelIndex& index, int role) const + QVariant data(const QModelIndex& index, int role) const override { Q_UNUSED(index); static QPixmap pixmap(size); @@ -812,7 +812,7 @@ void tst_QItemDelegate::dateTimeEditor() class ChooseEditorDelegate : public QItemDelegate { public: - virtual QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &o, const QModelIndex &i) const + virtual QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &o, const QModelIndex &i) const override { if (m_editor) { m_editor->setParent(parent); @@ -822,7 +822,7 @@ public: return m_editor; } - virtual void destroyEditor(QWidget *editor, const QModelIndex &i) const + virtual void destroyEditor(QWidget *editor, const QModelIndex &i) const override { // This is a reimplementation of QAbstractItemDelegate::destroyEditor just set the variable m_editor to 0 // The only reason we do this is to avoid the not recommended direct delete of editor (destroyEditor uses deleteLater) QItemDelegate::destroyEditor(editor, i); // Allow destroy @@ -1307,7 +1307,7 @@ void tst_QItemDelegate::enterKey() struct TestDelegate : public QItemDelegate { WidgetType widgetType; - virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& /*option*/, const QModelIndex& /*index*/) const + virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& /*option*/, const QModelIndex& /*index*/) const override { QWidget *editor = 0; switch(widgetType) { @@ -1456,7 +1456,7 @@ void tst_QItemDelegate::testLineEditValidation() struct TestDelegate : public QItemDelegate { - virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const + virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override { Q_UNUSED(option); Q_UNUSED(index); diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index e8fd5b49cd..3cb4c58513 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -1807,7 +1807,7 @@ class CustomStyle : public QProxyStyle public: CustomStyle() : QProxyStyle("Windows") { Q_ASSERT(!polished); } ~CustomStyle() { polished = 0; } - void polish(QPalette &palette) + void polish(QPalette &palette) override { polished++; palette.setColor(QPalette::Active, QPalette::Link, Qt::red); @@ -1822,7 +1822,7 @@ class CustomStylePlugin : public QStylePlugin Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QStyleFactoryInterface" FILE "customstyle.json") public: - QStyle *create(const QString &) { return new CustomStyle; } + QStyle *create(const QString &) override { return new CustomStyle; } }; Q_IMPORT_PLUGIN(CustomStylePlugin) diff --git a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp index cbfbefaf3c..00e82248d4 100644 --- a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp +++ b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp @@ -71,7 +71,7 @@ public: } virtual int pixelMetric(PixelMetric metric, const QStyleOption * option = 0, - const QWidget * widget = 0 ) const; + const QWidget * widget = 0 ) const override; int hspacing; int vspacing; @@ -245,7 +245,7 @@ public: } virtual QRect subElementRect(SubElement sr, const QStyleOption *opt, - const QWidget *widget) const + const QWidget *widget) const override { QRect rect = opt->rect; switch (sr) { @@ -411,14 +411,14 @@ class LayoutItem : public QLayoutItem public: LayoutItem(const Descr &descr) :m_descr(descr) {} - QSize sizeHint() const { return QSize(m_descr.sizeHint, 100); } - QSize minimumSize() const { return QSize(m_descr.minimumSize, 0); } - QSize maximumSize() const { return QSize(m_descr.maximumSize, QLAYOUTSIZE_MAX); } - Qt::Orientations expandingDirections() const + QSize sizeHint() const override { return QSize(m_descr.sizeHint, 100); } + QSize minimumSize() const override { return QSize(m_descr.minimumSize, 0); } + QSize maximumSize() const override { return QSize(m_descr.maximumSize, QLAYOUTSIZE_MAX); } + Qt::Orientations expandingDirections() const override { return m_descr.expanding ? Qt::Horizontal : Qt::Orientations{}; } - void setGeometry(const QRect &r) { m_pos = r.x(); m_size = r.width();} - QRect geometry() const { return QRect(m_pos, 0, m_size, 100); } - bool isEmpty() const { return m_descr.empty; } + void setGeometry(const QRect &r) override { m_pos = r.x(); m_size = r.width();} + QRect geometry() const override { return QRect(m_pos, 0, m_size, 100); } + bool isEmpty() const override { return m_descr.empty; } private: Descr m_descr; diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp index fd1751c5e7..06e82ecac8 100644 --- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp +++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp @@ -298,7 +298,7 @@ public: } virtual int pixelMetric(PixelMetric metric, const QStyleOption * option = 0, - const QWidget * widget = 0 ) const; + const QWidget * widget = 0 ) const override; int hspacing; int vspacing; @@ -391,7 +391,7 @@ void tst_QFormLayout::contentsRect() class DummyMacStyle : public QCommonStyle { public: - virtual int styleHint ( StyleHint hint, const QStyleOption * option = 0, const QWidget * widget = 0, QStyleHintReturn * returnData = 0 ) const + virtual int styleHint ( StyleHint hint, const QStyleOption * option = 0, const QWidget * widget = 0, QStyleHintReturn * returnData = 0 ) const override { switch(hint) { case SH_FormLayoutFormAlignment: @@ -411,7 +411,7 @@ public: class DummyQtopiaStyle : public QCommonStyle { public: - virtual int styleHint ( StyleHint hint, const QStyleOption * option = 0, const QWidget * widget = 0, QStyleHintReturn * returnData = 0 ) const + virtual int styleHint ( StyleHint hint, const QStyleOption * option = 0, const QWidget * widget = 0, QStyleHintReturn * returnData = 0 ) const override { switch(hint) { case SH_FormLayoutFormAlignment: diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp index 26dbab5e15..69d85df597 100644 --- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp +++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp @@ -386,7 +386,7 @@ public: SizeHinter(int w, int h, QWidget *parent = 0) : QWidget(parent), sh(QSize(w,h)) {} void setSizeHint(QSize s) { sh = s; } - QSize sizeHint() const { return sh; } + QSize sizeHint() const override { return sh; } private: QSize sh; }; @@ -452,7 +452,7 @@ public: } virtual int pixelMetric(PixelMetric metric, const QStyleOption * option = nullptr, - const QWidget * widget = nullptr ) const; + const QWidget * widget = nullptr ) const override; int spacing = 6; int margin = 9; @@ -508,11 +508,11 @@ public: } void setSizeHint(const QSize &s) { sh = s; } - QSize sizeHint() const { return sh; } + QSize sizeHint() const override { return sh; } void setMinimumSizeHint(const QSize &s) { msh = s; } - QSize minimumSizeHint() const { return msh; } + QSize minimumSizeHint() const override { return msh; } - virtual int heightForWidth(int width) const; + virtual int heightForWidth(int width) const override; void setNumberOfPixels(int numPixels) { m_numPixels = numPixels; @@ -901,9 +901,9 @@ public: } virtual int pixelMetric(PixelMetric metric, const QStyleOption * option = 0, - const QWidget * widget = 0 ) const; + const QWidget * widget = 0 ) const override; virtual QRect subElementRect(SubElement sr, const QStyleOption *opt, - const QWidget *widget) const; + const QWidget *widget) const override; int hspacing; int vspacing; @@ -913,7 +913,7 @@ public: QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option = 0, - const QWidget *widget = 0) const; + const QWidget *widget = 0) const override; }; diff --git a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp index e5e0a48503..dec332196b 100644 --- a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp +++ b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp @@ -104,8 +104,8 @@ public: void setSizeHint(const QSize &s) { sh = s; } - QSize sizeHint() const { return sh; } - QSize minimumSizeHint() const { return msh; } + QSize sizeHint() const override { return sh; } + QSize minimumSizeHint() const override { return msh; } private: QSize sh; @@ -221,13 +221,13 @@ class MyLayout : public QLayout { public: MyLayout() : invalidated(false) {} - virtual void invalidate() {invalidated = true;} + virtual void invalidate() override {invalidated = true;} bool invalidated; - QSize sizeHint() const {return QSize();} - void addItem(QLayoutItem*) {} - QLayoutItem* itemAt(int) const {return 0;} - QLayoutItem* takeAt(int) {return 0;} - int count() const {return 0;} + QSize sizeHint() const override {return QSize();} + void addItem(QLayoutItem*) override {} + QLayoutItem* itemAt(int) const override {return 0;} + QLayoutItem* takeAt(int) override {return 0;} + int count() const override {return 0;} }; void tst_QLayout::setContentsMargins() @@ -253,7 +253,7 @@ void tst_QLayout::setContentsMargins() class EventReceiver : public QObject { public: - bool eventFilter(QObject *watched, QEvent *event) + bool eventFilter(QObject *watched, QEvent *event) override { if (event->type() == QEvent::Show) { geom = static_cast<QWidget*>(watched)->geometry(); diff --git a/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp b/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp index 053dc03296..8721a7191a 100644 --- a/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp +++ b/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp @@ -284,13 +284,13 @@ protected: return true; } - void focusInEvent(QFocusEvent *event) + void focusInEvent(QFocusEvent *event) override { QLineEdit::focusInEvent(event); hasFakeEditFocus = isSingleFocusWidget(); } - void focusOutEvent(QFocusEvent *event) + void focusOutEvent(QFocusEvent *event) override { hasFakeEditFocus = false; QLineEdit::focusOutEvent(event); diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index b3a2323d3e..356b969055 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -6986,7 +6986,7 @@ public: } protected: - void paintEvent(QPaintEvent *) + void paintEvent(QPaintEvent *) override { if (ellipse) { QPainter painter(this); @@ -10142,7 +10142,7 @@ void tst_QWidget::focusProxy() int focusOutCount = 0; protected: - bool eventFilter(QObject *receiver, QEvent *event) + bool eventFilter(QObject *receiver, QEvent *event) override { if (receiver == edit) { switch (event->type()) { diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp index 890a53541a..17b119410f 100644 --- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp +++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp @@ -523,10 +523,10 @@ public: : QWidget(w), m_log(log), m_ignoreDragMove(ignoreDragMove) {} protected: - void dragEnterEvent(QDragEnterEvent *); - void dragMoveEvent(QDragMoveEvent *); - void dragLeaveEvent(QDragLeaveEvent *); - void dropEvent(QDropEvent *); + void dragEnterEvent(QDragEnterEvent *) override; + void dragMoveEvent(QDragMoveEvent *) override; + void dragLeaveEvent(QDragLeaveEvent *) override; + void dropEvent(QDropEvent *) override; private: void formatDropEvent(const char *function, const QDropEvent *e, QTextStream &str) const; @@ -700,7 +700,7 @@ public: DnDEventRecorder() { setAcceptDrops(true); } protected: - void mousePressEvent(QMouseEvent *) + void mousePressEvent(QMouseEvent *) override { QMimeData *mimeData = new QMimeData; mimeData->setData("application/x-dnditemdata", "some data"); @@ -709,23 +709,23 @@ protected: drag->exec(); } - void dragEnterEvent(QDragEnterEvent *e) + void dragEnterEvent(QDragEnterEvent *e) override { e->accept(); _dndEvents.append(QStringLiteral("DragEnter ")); } - void dragMoveEvent(QDragMoveEvent *e) + void dragMoveEvent(QDragMoveEvent *e) override { e->accept(); _dndEvents.append(QStringLiteral("DragMove ")); emit dragMoveReceived(); } - void dragLeaveEvent(QDragLeaveEvent *e) + void dragLeaveEvent(QDragLeaveEvent *e) override { e->accept(); _dndEvents.append(QStringLiteral("DragLeave ")); } - void dropEvent(QDropEvent *e) + void dropEvent(QDropEvent *e) override { e->accept(); _dndEvents.append(QStringLiteral("DropEvent ")); @@ -1055,7 +1055,7 @@ void tst_QWidget_window::tst_showhide_count() return count; } protected: - bool eventFilter(QObject *receiver, QEvent *event) + bool eventFilter(QObject *receiver, QEvent *event) override { if (QWidget *widget = qobject_cast<QWidget*>(receiver)) { const auto entry = Entry(widget, event->type()); @@ -1341,7 +1341,7 @@ void tst_QWidget_window::mouseMoveWithPopup() : QWidget(parent, flags|Qt::CustomizeWindowHint|Qt::FramelessWindowHint) {} - QSize sizeHint() const + QSize sizeHint() const override { if (parent()) return QSize(150, 100); @@ -1360,7 +1360,7 @@ void tst_QWidget_window::mouseMoveWithPopup() mouseReleaseCount = 0; } protected: - void mousePressEvent(QMouseEvent *event) + void mousePressEvent(QMouseEvent *event) override { ++mousePressCount; @@ -1378,12 +1378,12 @@ void tst_QWidget_window::mouseMoveWithPopup() QWidget::mousePressEvent(event); } } - void mouseReleaseEvent(QMouseEvent *event) + void mouseReleaseEvent(QMouseEvent *event) override { ++mouseReleaseCount; QWidget::mouseReleaseEvent(event); } - void mouseMoveEvent(QMouseEvent *event) + void mouseMoveEvent(QMouseEvent *event) override { ++mouseMoveCount; QWidget::mouseMoveEvent(event); diff --git a/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp b/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp index 28731223a9..ad91cf3031 100644 --- a/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp +++ b/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp @@ -212,7 +212,7 @@ public: QList<QWidget *> createdWidgets() const { return QWidgetAction::createdWidgets(); } protected: - virtual QWidget *createWidget(QWidget *parent); + virtual QWidget *createWidget(QWidget *parent) override; }; QWidget *ComboAction::createWidget(QWidget *parent) @@ -396,7 +396,7 @@ class CrashedAction : public QWidgetAction public: inline CrashedAction(QObject *parent) : QWidgetAction(parent) { } - virtual QWidget *createWidget(QWidget *parent) { + virtual QWidget *createWidget(QWidget *parent) override { return new QWidget(parent); } }; diff --git a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp index 2a8edaf1a2..ec646ccbe3 100644 --- a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp +++ b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp @@ -49,7 +49,8 @@ public: { } - void exposeEvent(QExposeEvent *) { + void exposeEvent(QExposeEvent *) override + { if (isExposed()) ++numberOfExposes; else diff --git a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp index 71b8867d09..7272e53dc9 100644 --- a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp +++ b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp @@ -52,7 +52,7 @@ public: receivedOvershoot = false; } - bool event(QEvent *e) + bool event(QEvent *e) override { switch (e->type()) { case QEvent::Gesture: diff --git a/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp b/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp index e5a891912f..3b2bc1d126 100644 --- a/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp +++ b/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp @@ -103,7 +103,7 @@ class MyButton : public QAbstractButton { public: MyButton(QWidget *p = 0) : QAbstractButton(p) {} - void paintEvent(QPaintEvent *) + void paintEvent(QPaintEvent *) override { QPainter p(this); QRect r = rect(); @@ -124,7 +124,7 @@ public: #endif } } - QSize sizeHint() const + QSize sizeHint() const override { QSize sh(8, 8); if (!text().isEmpty()) @@ -139,7 +139,7 @@ private: int timerEvents; - void timerEvent(QTimerEvent *event) + void timerEvent(QTimerEvent *event) override { ++timerEvents; QAbstractButton::timerEvent(event); diff --git a/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp b/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp index fd1e5c267d..86a5ebc114 100644 --- a/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp +++ b/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp @@ -291,7 +291,7 @@ public: startTimer(2000); } - void timerEvent(QTimerEvent * /* event */) + void timerEvent(QTimerEvent * /* event */) override { // should not crash. (void)new QScrollArea(this); diff --git a/tests/auto/widgets/widgets/qbuttongroup/tst_qbuttongroup.cpp b/tests/auto/widgets/widgets/qbuttongroup/tst_qbuttongroup.cpp index dd8a3e5839..e3448fa93d 100644 --- a/tests/auto/widgets/widgets/qbuttongroup/tst_qbuttongroup.cpp +++ b/tests/auto/widgets/widgets/qbuttongroup/tst_qbuttongroup.cpp @@ -51,7 +51,7 @@ public: { } protected: - void focusInEvent(QFocusEvent *) + void focusInEvent(QFocusEvent *) override { QCoreApplication::postEvent(this, new QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier)); diff --git a/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp b/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp index a164be8712..d9cd5ad136 100644 --- a/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp +++ b/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp @@ -523,17 +523,17 @@ public: } protected: - void mousePressEvent(QMouseEvent*) + void mousePressEvent(QMouseEvent*) override { mousePressed = true; } - void mouseReleaseEvent(QMouseEvent*) + void mouseReleaseEvent(QMouseEvent*) override { mouseReleased = true; } - void mouseMoveEvent(QMouseEvent*) + void mouseMoveEvent(QMouseEvent*) override { mouseMoved = true; } diff --git a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp index eb34a5ad4e..d4bc816ec0 100644 --- a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp +++ b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp @@ -391,7 +391,7 @@ void tst_QLabel::task226479_movieResize() { class Label : public QLabel { protected: - void paintEvent(QPaintEvent *e) + void paintEvent(QPaintEvent *e) override { paintedRegion += e->region(); QLabel::paintEvent(e); diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 2367d56dad..87be592e2b 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -906,7 +906,7 @@ public: : QValidator(parent) {} - QValidator::State validate(QString &str, int &) const + QValidator::State validate(QString &str, int &) const override { const int s = str.size(); if (s < chars) { @@ -917,7 +917,7 @@ public: return Acceptable; } - void fixup(QString &str) const + void fixup(QString &str) const override { str = str.leftJustified(chars, 'X', true); } @@ -1930,7 +1930,7 @@ void tst_QLineEdit::isReadOnly() class BlinkTestLineEdit : public QLineEdit { public: - void paintEvent(QPaintEvent *e) + void paintEvent(QPaintEvent *e) override { ++updates; QLineEdit::paintEvent(e); @@ -2431,7 +2431,7 @@ void tst_QLineEdit::returnPressed() class QIntFixValidator : public QIntValidator { public: QIntFixValidator(int min, int max, QObject *parent) : QIntValidator(min, max, parent) {} - void fixup (QString &input) const { + void fixup (QString &input) const override { for (int i=0; i<input.length(); ++i) if (!input.at(i).isNumber()) { input[(int)i] = QChar('0'); @@ -3149,7 +3149,7 @@ class InputMaskValidator : public QValidator { public: InputMaskValidator(QObject *parent, const char *name = 0) : QValidator(parent) { setObjectName(name); } - State validate(QString &text, int &pos) const + State validate(QString &text, int &pos) const override { InputMaskValidator *that = (InputMaskValidator *)this; that->validateText = text; @@ -3219,7 +3219,7 @@ class LineEdit : public QLineEdit public: LineEdit() { state = Other; } - void keyPressEvent(QKeyEvent *e) + void keyPressEvent(QKeyEvent *e) override { QLineEdit::keyPressEvent(e); if (e->key() == Qt::Key_Enter) { @@ -4048,7 +4048,7 @@ class UpdateRegionLineEdit : public QLineEdit public: QRegion updateRegion; protected: - void paintEvent(QPaintEvent *event) + void paintEvent(QPaintEvent *event) override { updateRegion = event->region(); } diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp index 8def1a11fc..53dbf2012f 100644 --- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp @@ -792,7 +792,7 @@ class MyChild : public QWidget { public: MyChild(QWidget *parent = 0) : QWidget(parent) {} - QSize sizeHint() const { return QSize(234, 123); } + QSize sizeHint() const override { return QSize(234, 123); } }; void tst_QMdiArea::childSize() @@ -866,8 +866,8 @@ class LargeWidget : public QWidget { public: LargeWidget(QWidget *parent = 0) : QWidget(parent) {} - QSize sizeHint() const { return QSize(1280, 1024); } - QSize minimumSizeHint() const { return QSize(300, 300); } + QSize sizeHint() const override { return QSize(1280, 1024); } + QSize minimumSizeHint() const override { return QSize(300, 300); } }; // New tests @@ -2051,7 +2051,7 @@ public: void clear() { _count = 0; } protected: - bool eventFilter(QObject *object, QEvent *event) + bool eventFilter(QObject *object, QEvent *event) override { if (event->type() == eventToSpy) ++_count; diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp index fd7775d944..8121a3637f 100644 --- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp @@ -260,7 +260,7 @@ void tst_QMdiSubWindow::minimumSizeHint() public: Widget() = default; - QSize minimumSizeHint() const + QSize minimumSizeHint() const override { return QSize(100, 100); } diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index 783476cf67..81ec5c77d0 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -979,7 +979,7 @@ class Menu258920 : public QMenu { Q_OBJECT public slots: - void paintEvent(QPaintEvent *e) + void paintEvent(QPaintEvent *e) override { QMenu::paintEvent(e); painted = true; @@ -1410,7 +1410,7 @@ void tst_QMenu::widgetActionTriggerClosesMenu() } protected: - QWidget *createWidget(QWidget *parent) + QWidget *createWidget(QWidget *parent) override { QPushButton *button = new QPushButton(QLatin1String("Button"), parent); connect(button, &QPushButton::clicked, this, &QAction::trigger); diff --git a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp index d3b3f72367..e3812f16d0 100644 --- a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp +++ b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp @@ -222,18 +222,18 @@ public: inline QtTestDocumentLayout(QPlainTextEdit *edit, QTextDocument *doc, int &itCount) : QAbstractTextDocumentLayout(doc), useBiggerSize(false), ed(edit), iterationCounter(itCount) {} - virtual void draw(QPainter *, const QAbstractTextDocumentLayout::PaintContext &) {} + virtual void draw(QPainter *, const QAbstractTextDocumentLayout::PaintContext &) override {} - virtual int hitTest(const QPointF &, Qt::HitTestAccuracy ) const { return 0; } + virtual int hitTest(const QPointF &, Qt::HitTestAccuracy ) const override { return 0; } - virtual void documentChanged(int, int, int) {} + virtual void documentChanged(int, int, int) override {} - virtual int pageCount() const { return 1; } + virtual int pageCount() const override { return 1; } - virtual QSizeF documentSize() const { return usedSize; } + virtual QSizeF documentSize() const override { return usedSize; } - virtual QRectF frameBoundingRect(QTextFrame *) const { return QRectF(); } - virtual QRectF blockBoundingRect(const QTextBlock &) const { return QRectF(); } + virtual QRectF frameBoundingRect(QTextFrame *) const override { return QRectF(); } + virtual QRectF blockBoundingRect(const QTextBlock &) const override { return QRectF(); } bool useBiggerSize; QSize usedSize; @@ -1104,15 +1104,15 @@ public: mutable int canInsertCallCount; mutable int insertCallCount; - virtual QMimeData *createMimeDataFromSelection() const { + virtual QMimeData *createMimeDataFromSelection() const override { createMimeDataCallCount++; return QPlainTextEdit::createMimeDataFromSelection(); } - virtual bool canInsertFromMimeData(const QMimeData *source) const { + virtual bool canInsertFromMimeData(const QMimeData *source) const override { canInsertCallCount++; return QPlainTextEdit::canInsertFromMimeData(source); } - virtual void insertFromMimeData(const QMimeData *source) { + virtual void insertFromMimeData(const QMimeData *source) override { insertCallCount++; QPlainTextEdit::insertFromMimeData(source); } @@ -1252,7 +1252,7 @@ public: bool resizeEventCalled; protected: - virtual void resizeEvent(QResizeEvent *e) + virtual void resizeEvent(QResizeEvent *e) override { QPlainTextEdit::resizeEvent(e); setPlainText("<img src=qtextbrowser-resizeevent.png width=" + QString::number(size().width()) + "><br>Size is " + QString::number(size().width()) + " x " + QString::number(size().height())); diff --git a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp index a1097fa433..eb80460311 100644 --- a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp +++ b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp @@ -145,7 +145,7 @@ void tst_QProgressBar::text() class ProgressBar : public QProgressBar { - void paintEvent(QPaintEvent *event) + void paintEvent(QPaintEvent *event) override { repainted = true; QProgressBar::paintEvent(event); |