diff options
author | Volker Hilsheimer <[email protected]> | 2021-03-25 14:44:04 +0100 |
---|---|---|
committer | Volker Hilsheimer <[email protected]> | 2021-04-01 10:14:16 +0200 |
commit | 4a77e2593f281456d25c9b2dd5df400c3e588e4c (patch) | |
tree | a21a70166688d1a76f31bace9265e95c700cee05 | |
parent | da68a8431a2cc0fdea7482750ad4e1abf3f7a85d (diff) |
Mark overrides in tests, fix compiler warnings
Change-Id: If753558d911e50a73e351a93eed2e4df3e6592c7
Reviewed-by: David Skoland <[email protected]>
Reviewed-by: Fabian Kosmale <[email protected]>
26 files changed, 129 insertions, 117 deletions
diff --git a/tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp b/tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp index 7e19e925b6..f5090a2756 100644 --- a/tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp +++ b/tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp @@ -54,10 +54,10 @@ class TestableQAbstractAnimation : public QAbstractAnimationJob { public: TestableQAbstractAnimation() {} - virtual ~TestableQAbstractAnimation() {}; + ~TestableQAbstractAnimation() override {}; - int duration() const { return m_duration; } - virtual void updateCurrentTime(int) {} + int duration() const override { return m_duration; } + void updateCurrentTime(int) override {} void setDuration(int duration) { m_duration = duration; } private: @@ -67,8 +67,8 @@ private: class DummyQAnimationGroup : public QAnimationGroupJob { public: - int duration() const { return 10; } - virtual void updateCurrentTime(int) {} + int duration() const override { return 10; } + void updateCurrentTime(int) override {} }; void tst_QAbstractAnimationJob::construction() diff --git a/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp b/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp index ceb8cc707f..ac1f484b96 100644 --- a/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp +++ b/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp @@ -61,7 +61,7 @@ class TestableGenericAnimation : public QAbstractAnimationJob { public: TestableGenericAnimation(int duration = 250) : m_duration(duration) {} - int duration() const { return m_duration; } + int duration() const override { return m_duration; } private: int m_duration; @@ -73,10 +73,10 @@ class UncontrolledAnimation : public QObject, public QAbstractAnimationJob public: UncontrolledAnimation() { } - 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(); @@ -99,7 +99,7 @@ private: class StateChangeListener: public QAnimationJobChangeListener { public: - virtual void animationStateChanged(QAbstractAnimationJob *, QAbstractAnimationJob::State newState, QAbstractAnimationJob::State) + void animationStateChanged(QAbstractAnimationJob *, QAbstractAnimationJob::State newState, QAbstractAnimationJob::State) override { states << newState; } diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp index 46bbe30c8e..6b5b281fdd 100644 --- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp +++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp @@ -1800,8 +1800,8 @@ class Klazz : public QWidget, Q_OBJECT public: Klazz(QWidget *parent = nullptr) : QWidget(parent) { } - virtual QRectF boundingRect() const { return QRectF(); } - virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) { } + QRectF boundingRect() const override { return QRectF(); } + void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override { } }; Q_DECLARE_METATYPE(Klazz*) @@ -3476,7 +3476,7 @@ public: ThreadedTestEngine() {} - void run() { + void run() override { QJSEngine firstEngine; QJSEngine secondEngine; QJSValue value = firstEngine.evaluate("1"); diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp index 5c8e3e80e5..4ba224fa8b 100644 --- a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp +++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp @@ -51,7 +51,7 @@ class MyIC : public QObject, public QQmlIncubationController public: MyIC() { startTimer(5); } protected: - virtual void timerEvent(QTimerEvent*) { + void timerEvent(QTimerEvent*) override { incubateFor(5); } }; diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp index ac7e39862c..b478d43cb5 100644 --- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp +++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp @@ -159,10 +159,10 @@ public: ImmediateReply() { setFinished(true); } - virtual qint64 readData(char* , qint64 ) { + qint64 readData(char* , qint64 ) override { return 0; } - virtual void abort() { } + void abort() override { } }; class ImmediateManager : public QNetworkAccessManager { @@ -433,7 +433,7 @@ public: } private: - virtual void timerEvent(QTimerEvent *) + void timerEvent(QTimerEvent *) override { incubateFor(1000); } @@ -768,7 +768,7 @@ class CustomSelector : public QQmlAbstractUrlInterceptor { public: CustomSelector(const QUrl &base):m_base(base){} - virtual QUrl intercept(const QUrl &url, QQmlAbstractUrlInterceptor::DataType d) + QUrl intercept(const QUrl &url, QQmlAbstractUrlInterceptor::DataType d) override { if ((url.scheme() != QStringLiteral("file") && url.scheme() != QStringLiteral("qrc")) || url.path().contains("QtQml")) diff --git a/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp b/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp index 9ee874f355..7784afd35b 100644 --- a/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp +++ b/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp @@ -368,7 +368,7 @@ void tst_qqmlincubator::setInitialState() MyIncubator(QQmlIncubator::IncubationMode mode) : QQmlIncubator(mode) {} - virtual void setInitialState(QObject *o) { + void setInitialState(QObject *o) override { QQmlProperty::write(o, "test2", 19); QQmlProperty::write(o, "testData1", 201); } @@ -442,7 +442,7 @@ void tst_qqmlincubator::objectDeletionAfterInit() MyIncubator(QQmlIncubator::IncubationMode mode) : QQmlIncubator(mode), obj(nullptr) {} - virtual void setInitialState(QObject *o) { + void setInitialState(QObject *o) override { obj = o; } @@ -487,7 +487,7 @@ public: MyIncubator(QQmlIncubator::IncubationMode mode, QObject *s) : QQmlIncubator(mode), switcher(s) {} - virtual void setInitialState(QObject *o) { + void setInitialState(QObject *o) override { if (o->objectName() == "switchMe") connect(o, SIGNAL(switchMe()), switcher, SLOT(switchIt())); } @@ -531,8 +531,8 @@ void tst_qqmlincubator::statusChanged() QList<int> statuses; protected: - virtual void statusChanged(Status s) { statuses << s; } - virtual void setInitialState(QObject *) { statuses << -1; } + void statusChanged(Status s) override { statuses << s; } + void setInitialState(QObject *) override { statuses << -1; } }; { @@ -762,7 +762,7 @@ void tst_qqmlincubator::chainedAsynchronousIfNested() : QQmlIncubator(AsynchronousIfNested), next(next), component(component), ctxt(ctxt) {} protected: - virtual void statusChanged(Status s) { + void statusChanged(Status s) override { if (s == Ready && next) component->create(*next, nullptr, ctxt); } @@ -836,7 +836,7 @@ void tst_qqmlincubator::chainedAsynchronousIfNestedOnCompleted() : QQmlIncubator(AsynchronousIfNested), next(next), component(component), ctxt(ctxt) {} protected: - virtual void statusChanged(Status s) { + void statusChanged(Status s) override { if (s == Ready && next) { component->create(*next, nullptr, ctxt); } @@ -969,7 +969,7 @@ void tst_qqmlincubator::chainedAsynchronousClear() : QQmlIncubator(AsynchronousIfNested), next(next), component(component), ctxt(ctxt) {} protected: - virtual void statusChanged(Status s) { + void statusChanged(Status s) override { if (s == Ready && next) { component->create(*next, nullptr, ctxt); } @@ -1079,7 +1079,7 @@ void tst_qqmlincubator::selfDelete() : QQmlIncubator(mode), done(done), status(status) {} protected: - virtual void statusChanged(Status s) { + void statusChanged(Status s) override { if (s == status) { *done = true; if (s == Ready) delete object(); diff --git a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp index 892f6bb770..515f61a545 100644 --- a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp +++ b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp @@ -128,7 +128,7 @@ class ValueSourceTestType : public QObject, public QQmlPropertyValueSource Q_OBJECT Q_INTERFACES(QQmlPropertyValueSource) public: - virtual void setTarget(const QQmlProperty &) {} + void setTarget(const QQmlProperty &) override {} }; QML_DECLARE_TYPE(ValueSourceTestType); @@ -137,8 +137,8 @@ class ValueInterceptorTestType : public QObject, public QQmlPropertyValueInterce Q_OBJECT Q_INTERFACES(QQmlPropertyValueInterceptor) public: - virtual void setTarget(const QQmlProperty &) {} - virtual void write(const QVariant &) {} + void setTarget(const QQmlProperty &) override {} + void write(const QVariant &) override {} }; QML_DECLARE_TYPE(ValueInterceptorTestType); diff --git a/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp index b2406dd2cd..2f4a1e47b7 100644 --- a/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp +++ b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp @@ -140,7 +140,7 @@ struct TypeAnnotationObserver: public AST::Visitor AST::Node::accept(node, this); } - virtual bool visit(AST::TypeAnnotation *) + bool visit(AST::TypeAnnotation *) override { typeAnnotationSeen = true; return true; diff --git a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp index f76249ffad..07afc69a6d 100644 --- a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp +++ b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp @@ -77,8 +77,8 @@ public: : QQmlPropertyMap(this, /*parent*/nullptr) {} - virtual void classBegin() {} - virtual void componentComplete() { + void classBegin() override {} + void componentComplete() override { insert(QStringLiteral("lateProperty"), QStringLiteral("lateValue")); } @@ -308,7 +308,7 @@ class MyPropertyMap : public QQmlPropertyMap { Q_OBJECT protected: - virtual QVariant updateValue(const QString &key, const QVariant &src) + QVariant updateValue(const QString &key, const QVariant &src) override { if (key == QLatin1String("key1")) { // 'key1' must be all uppercase diff --git a/tests/auto/quick/drawingmodes/tst_drawingmodes.cpp b/tests/auto/quick/drawingmodes/tst_drawingmodes.cpp index e982410f89..2419d8ca25 100644 --- a/tests/auto/quick/drawingmodes/tst_drawingmodes.cpp +++ b/tests/auto/quick/drawingmodes/tst_drawingmodes.cpp @@ -92,7 +92,7 @@ protected: QSGGeometry second; QSGFlatColorMaterial material; - virtual QSGNode *updatePaintNode(QSGNode *node, UpdatePaintNodeData *) + QSGNode *updatePaintNode(QSGNode *node, UpdatePaintNodeData *) override { if (!node) { QRect bounds(0, 0, 200, 200); diff --git a/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp b/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp index 6b0f574178..8b83972967 100644 --- a/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp @@ -103,45 +103,45 @@ public: return (accept && (state != QEventPoint::State::Released)) ? (int)QPointingDevice::GrabExclusive : (int)NoGrab; } - void touchEvent(QTouchEvent *event) + void touchEvent(QTouchEvent *event) override { qCDebug(lcPointerTests) << event << "will accept?" << acceptTouch; for (auto &tp : event->points()) eventList.append(Event(Event::TouchDestination, event->type(), tp.state(), grabTransition(acceptTouch, tp.state()), tp.position(), tp.scenePosition())); event->setAccepted(acceptTouch); } - void mousePressEvent(QMouseEvent *event) + void mousePressEvent(QMouseEvent *event) override { qCDebug(lcPointerTests) << event << "will accept?" << acceptMouse; eventList.append(Event(Event::MouseDestination, event->type(), QEventPoint::State::Pressed, grabTransition(acceptMouse, QEventPoint::State::Pressed), event->position().toPoint(), event->scenePosition())); event->setAccepted(acceptMouse); } - void mouseMoveEvent(QMouseEvent *event) + void mouseMoveEvent(QMouseEvent *event) override { qCDebug(lcPointerTests) << event << "will accept?" << acceptMouse; eventList.append(Event(Event::MouseDestination, event->type(), QEventPoint::State::Updated, grabTransition(acceptMouse, QEventPoint::State::Updated), event->position().toPoint(), event->scenePosition())); event->setAccepted(acceptMouse); } - void mouseReleaseEvent(QMouseEvent *event) + void mouseReleaseEvent(QMouseEvent *event) override { qCDebug(lcPointerTests) << event << "will accept?" << acceptMouse; eventList.append(Event(Event::MouseDestination, event->type(), QEventPoint::State::Released, grabTransition(acceptMouse, QEventPoint::State::Released), event->position().toPoint(), event->scenePosition())); event->setAccepted(acceptMouse); } - void mouseDoubleClickEvent(QMouseEvent *event) + void mouseDoubleClickEvent(QMouseEvent *event) override { qCDebug(lcPointerTests) << event << "will accept?" << acceptMouse; eventList.append(Event(Event::MouseDestination, event->type(), QEventPoint::State::Pressed, grabTransition(acceptMouse, QEventPoint::State::Pressed), event->position().toPoint(), event->scenePosition())); event->setAccepted(acceptMouse); } - void mouseUngrabEvent() + void mouseUngrabEvent() override { qCDebug(lcPointerTests); eventList.append(Event(Event::MouseDestination, QEvent::UngrabMouse, QEventPoint::State::Released, QPointingDevice::UngrabExclusive, QPoint(0,0), QPoint(0,0))); } - bool event(QEvent *event) + bool event(QEvent *event) override { qCDebug(lcPointerTests) << event; return QQuickItem::event(event); @@ -154,7 +154,7 @@ public: bool acceptTouch; bool filterTouch; // when used as event filter - bool eventFilter(QObject *o, QEvent *event) + bool eventFilter(QObject *o, QEvent *event) override { qCDebug(lcPointerTests) << event << o; if (event->type() == QEvent::TouchBegin || @@ -249,7 +249,7 @@ private slots: void dynamicCreationInWindow(); protected: - bool eventFilter(QObject *, QEvent *event) + bool eventFilter(QObject *, QEvent *event) override { QEventPoint::State tpState; switch (event->type()) { diff --git a/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp b/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp index dd61fd717d..3e9069d522 100644 --- a/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp +++ b/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp @@ -74,7 +74,7 @@ public: supportedActions = Qt::IgnoreAction; } - void dragEnterEvent(QDragEnterEvent *event) + void dragEnterEvent(QDragEnterEvent *event) override { ++enterEvents; position = event->position().toPoint(); @@ -84,7 +84,7 @@ public: event->setAccepted(accept); } - void dragMoveEvent(QDragMoveEvent *event) + void dragMoveEvent(QDragMoveEvent *event) override { ++moveEvents; position = event->position().toPoint(); @@ -94,13 +94,13 @@ public: event->setAccepted(accept); } - void dragLeaveEvent(QDragLeaveEvent *event) + void dragLeaveEvent(QDragLeaveEvent *event) override { ++leaveEvents; event->setAccepted(accept); } - void dropEvent(QDropEvent *event) + void dropEvent(QDropEvent *event) override { ++dropEvents; position = event->position().toPoint(); @@ -1044,28 +1044,28 @@ public: void setItem(QQuickItem *i) { item = i; } protected: - void dragEnterEvent(QDragEnterEvent *event) + void dragEnterEvent(QDragEnterEvent *event) override { TestDropTarget::dragEnterEvent(event); if (type == QEvent::DragEnter && enterEvents < 2) evaluate<void>(item, script); } - void dragMoveEvent(QDragMoveEvent *event) + void dragMoveEvent(QDragMoveEvent *event) override { TestDropTarget::dragMoveEvent(event); if (type == QEvent::DragMove && moveEvents < 2) evaluate<void>(item, script); } - void dragLeaveEvent(QDragLeaveEvent *event) + void dragLeaveEvent(QDragLeaveEvent *event) override { TestDropTarget::dragLeaveEvent(event); if (type == QEvent::DragLeave && leaveEvents < 2) evaluate<void>(item, script); } - void dropEvent(QDropEvent *event) + void dropEvent(QDropEvent *event) override { TestDropTarget::dropEvent(event); if (type == QEvent::Drop && dropEvents < 2) diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp index c7007cf997..16f742f0aa 100644 --- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp +++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp @@ -1018,7 +1018,7 @@ class TestQImageProvider : public QQuickImageProvider public: TestQImageProvider() : QQuickImageProvider(Image) {} - QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize) + QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize) override { Q_UNUSED(requestedSize); if (id == QLatin1String("first-image.png")) { @@ -1186,7 +1186,7 @@ class MyInterceptor : public QQmlAbstractUrlInterceptor { public: MyInterceptor(QUrl url) : QQmlAbstractUrlInterceptor(), m_url(url) {} - QUrl intercept(const QUrl &url, QQmlAbstractUrlInterceptor::DataType) + QUrl intercept(const QUrl &url, QQmlAbstractUrlInterceptor::DataType) override { if (url.scheme() == "interceptthis") return m_url; diff --git a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp index 9dc9ad53ea..49e94432e4 100644 --- a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp +++ b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp @@ -92,7 +92,7 @@ public: *deleteWatch = true; } - QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize) + QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize) override { lastImageId = id; @@ -129,7 +129,7 @@ public: *deleteWatch = true; } - QPixmap requestPixmap(const QString &id, QSize *size, const QSize& requestedSize) + QPixmap requestPixmap(const QString &id, QSize *size, const QSize& requestedSize) override { lastImageId = id; @@ -401,7 +401,7 @@ class TestThreadProvider : public QQuickImageProvider ~TestThreadProvider() {} - QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize) + QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize) override { mutex.lock(); if (!ok) @@ -470,7 +470,7 @@ public: Q_SIGNAL void finished(QQuickTextureFactory *texture); TestImageResponseRunner(QMutex *lock, QWaitCondition *condition, bool *ok, const QString &id, const QSize &requestedSize) : m_lock(lock), m_condition(condition), m_ok(ok), m_id(id), m_requestedSize(requestedSize) {} - void run() + void run() override { m_lock->lock(); if (!(*m_ok)) { @@ -503,7 +503,7 @@ class TestImageResponse : public QQuickImageResponse pool->start(runnable); } - QQuickTextureFactory *textureFactory() const + QQuickTextureFactory *textureFactory() const override { return m_texture; } @@ -531,7 +531,7 @@ class TestAsyncProvider : public QQuickAsyncImageProvider ~TestAsyncProvider() {} - QQuickImageResponse *requestImageResponse(const QString &id, const QSize &requestedSize) + QQuickImageResponse *requestImageResponse(const QString &id, const QSize &requestedSize) override { TestImageResponse *response = new TestImageResponse(&lock, &condition, &ok, id, requestedSize, &pool); return response; @@ -594,7 +594,7 @@ class InstantAsyncImageResponse : public QQuickImageResponse emit finished(); } - QQuickTextureFactory *textureFactory() const + QQuickTextureFactory *textureFactory() const override { return m_texture; } @@ -611,7 +611,7 @@ class InstancAsyncProvider : public QQuickAsyncImageProvider ~InstancAsyncProvider() {} - QQuickImageResponse *requestImageResponse(const QString &id, const QSize &requestedSize) + QQuickImageResponse *requestImageResponse(const QString &id, const QSize &requestedSize) override { return new InstantAsyncImageResponse(id, requestedSize); } @@ -696,7 +696,7 @@ public: ~WaitingAsyncProvider() {} - QQuickImageResponse *requestImageResponse(const QString & /* id */, const QSize & /* requestedSize */) + QQuickImageResponse *requestImageResponse(const QString & /* id */, const QSize & /* requestedSize */) override { auto response = new WaitingAsyncImageResponse(m_providerRemovedMutex, m_providerRemovedCond, m_providerRemoved, m_imageRequestedMutex, m_imageRequestedCondition, m_imageRequested); pool.start(response); diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp index 40eeccbd00..aecaadd65d 100644 --- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp @@ -142,7 +142,7 @@ public: int repolishLoopCount = 0; protected: - virtual void updatePolish() { + void updatePolish() override { wasPolished = true; if (repolishLoopCount > 0) { --repolishLoopCount; @@ -164,8 +164,8 @@ public: bool focused; protected: - virtual void focusInEvent(QFocusEvent *) { Q_ASSERT(!focused); focused = true; } - virtual void focusOutEvent(QFocusEvent *) { Q_ASSERT(focused); focused = false; } + void focusInEvent(QFocusEvent *) override { Q_ASSERT(!focused); focused = true; } + void focusOutEvent(QFocusEvent *) override { Q_ASSERT(focused); focused = false; } }; class tst_qquickitem : public QQmlDataTest @@ -1560,15 +1560,15 @@ public: int hoverMoveCount; int hoverLeaveCount; protected: - virtual void hoverEnterEvent(QHoverEvent *event) { + void hoverEnterEvent(QHoverEvent *event) override { event->accept(); ++hoverEnterCount; } - virtual void hoverMoveEvent(QHoverEvent *event) { + void hoverMoveEvent(QHoverEvent *event) override { event->accept(); ++hoverMoveCount; } - virtual void hoverLeaveEvent(QHoverEvent *event) { + void hoverLeaveEvent(QHoverEvent *event) override { event->accept(); ++hoverLeaveCount; } diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp index 7147cb9b9d..211306c2a5 100644 --- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp @@ -202,7 +202,7 @@ public: KeyTestItem(QQuickItem *parent=nullptr) : QQuickItem(parent), mKey(0) {} protected: - void keyPressEvent(QKeyEvent *e) { + void keyPressEvent(QKeyEvent *e) override { mKey = e->key(); if (e->key() == Qt::Key_A) @@ -211,7 +211,7 @@ protected: e->ignore(); } - void keyReleaseEvent(QKeyEvent *e) { + void keyReleaseEvent(QKeyEvent *e) override { if (e->key() == Qt::Key_B) e->accept(); else @@ -225,7 +225,7 @@ public: class FocusEventFilter : public QObject { protected: - bool eventFilter(QObject *watched, QEvent *event) { + bool eventFilter(QObject *watched, QEvent *event) override { if ((event->type() == QEvent::FocusIn) || (event->type() == QEvent::FocusOut)) { QFocusEvent *focusEvent = static_cast<QFocusEvent *>(event); lastFocusReason = focusEvent->reason(); @@ -266,7 +266,7 @@ public: qreal holeRadius() const { return m_holeRadius; } void setHoleRadius(qreal radius) { m_holeRadius = radius; } - bool contains(const QPointF &point) const { + bool contains(const QPointF &point) const override { const qreal w = width(); const qreal h = height(); const qreal r = m_holeRadius; @@ -288,10 +288,10 @@ public: } protected: - void hoverEnterEvent(QHoverEvent *) { m_isHovered = true; } - void hoverLeaveEvent(QHoverEvent *) { m_isHovered = false; } - void mousePressEvent(QMouseEvent *) { m_isPressed = true; } - void mouseReleaseEvent(QMouseEvent *) { m_isPressed = false; } + void hoverEnterEvent(QHoverEvent *) override { m_isHovered = true; } + void hoverLeaveEvent(QHoverEvent *) override { m_isHovered = false; } + void mousePressEvent(QMouseEvent *) override { m_isPressed = true; } + void mouseReleaseEvent(QMouseEvent *) override { m_isPressed = false; } private: bool m_isPressed; diff --git a/tests/auto/quick/qquickloader/tst_qquickloader.cpp b/tests/auto/quick/qquickloader/tst_qquickloader.cpp index 7a945c8c5c..4a2c7b0af0 100644 --- a/tests/auto/quick/qquickloader/tst_qquickloader.cpp +++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp @@ -63,11 +63,11 @@ public: bool incubated = false; protected: - virtual void timerEvent(QTimerEvent *) { + void timerEvent(QTimerEvent *) override { incubateFor(15); } - virtual void incubatingObjectCountChanged(int count) { + void incubatingObjectCountChanged(int count) override { if (count) incubated = true; } diff --git a/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp b/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp index 2661762669..ef43a13ba7 100644 --- a/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp +++ b/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp @@ -68,13 +68,13 @@ public: { } - void paint(QPainter *painter) + void paint(QPainter *painter) override { ++paintRequests; clipRect = painter->clipBoundingRect(); } #if QT_CONFIG(opengl) - QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) + QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) override { paintNode = static_cast<QSGDefaultPainterNode *>(QQuickPaintedItem::updatePaintNode(oldNode, data)); return paintNode; diff --git a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp index 32e4a1a05a..3634a3ea3c 100644 --- a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp +++ b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp @@ -804,8 +804,8 @@ public: endResetModel(); } - QVariant data(const QModelIndex &, int) const { return QVariant(); } - int rowCount(const QModelIndex &) const { return 0; } + QVariant data(const QModelIndex &, int) const override { return QVariant(); } + int rowCount(const QModelIndex &) const override { return 0; } }; diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index d0e5425c0f..2f71ca9dc3 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -3672,7 +3672,7 @@ public: { nbPaint = 0; } - virtual QSGNode *updatePaintNode(QSGNode *node, UpdatePaintNodeData *data) + QSGNode *updatePaintNode(QSGNode *node, UpdatePaintNodeData *data) override { nbPaint++; return QQuickTextInput::updatePaintNode(node, data); @@ -6713,8 +6713,8 @@ class TestValidator : public QValidator public: TestValidator(QObject *parent = nullptr) : QValidator(parent) { } - State validate(QString &input, int &) const { return input == QStringLiteral("ok") ? Acceptable : Intermediate; } - void fixup(QString &input) const { input = QStringLiteral("ok"); } + State validate(QString &input, int &) const override { return input == QStringLiteral("ok") ? Acceptable : Intermediate; } + void fixup(QString &input) const override { input = QStringLiteral("ok"); } }; void tst_qquicktextinput::fixup() diff --git a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp index 49ed29e88f..0037747043 100644 --- a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp +++ b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp @@ -105,7 +105,7 @@ public: } ~SingleRoleModel() {} - QHash<int,QByteArray> roleNames() const + QHash<int,QByteArray> roleNames() const override { QHash<int,QByteArray> roles; roles.insert(Qt::DisplayRole, m_role); @@ -130,7 +130,7 @@ public: } } - QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const { + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override { if (row < 0 || column != 0) return QModelIndex(); Branch * const branch = branchForIndex(parent); @@ -139,24 +139,24 @@ public: : QModelIndex(); } - QModelIndex parent(const QModelIndex &child) const { + QModelIndex parent(const QModelIndex &child) const override { Branch * const branch = static_cast<Branch *>(child.internalPointer()); return branch->parent ? createIndex(branch->parent->indexOf(branch), 0, branch->parent) : QModelIndex(); } - int rowCount(const QModelIndex &parent) const { + int rowCount(const QModelIndex &parent) const override { Branch * const branch = branchForIndex(parent); return branch ? branch->children.count() : 0; } - int columnCount(const QModelIndex &parent) const { + int columnCount(const QModelIndex &parent) const override { Branch * const branch = branchForIndex(parent); return branch ? 1 : 0; } - QVariant data(const QModelIndex &index, int role) const { + QVariant data(const QModelIndex &index, int role) const override { return index.isValid() && role == Qt::DisplayRole ? static_cast<Branch *>(index.internalPointer())->children.at(index.row()).display : QVariant(); diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp index 05fda64654..1a04d317ce 100644 --- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp +++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp @@ -211,7 +211,8 @@ public: QPointF lastMousePos; QInputDevice::Capabilities lastMouseCapabilityFlags; - void touchEvent(QTouchEvent *event) { + void touchEvent(QTouchEvent *event) override + { if (!acceptTouchEvents) { event->ignore(); return; @@ -229,7 +230,8 @@ public: } } - void mousePressEvent(QMouseEvent *e) { + void mousePressEvent(QMouseEvent *e) override + { if (!acceptMouseEvents) { e->ignore(); return; @@ -239,7 +241,8 @@ public: lastMouseCapabilityFlags = e->device()->capabilities(); } - void mouseMoveEvent(QMouseEvent *e) { + void mouseMoveEvent(QMouseEvent *e) override + { if (!acceptMouseEvents) { e->ignore(); return; @@ -250,7 +253,8 @@ public: lastMousePos = e->position().toPoint(); } - void mouseReleaseEvent(QMouseEvent *e) { + void mouseReleaseEvent(QMouseEvent *e) override + { if (!acceptMouseEvents) { e->ignore(); return; @@ -260,12 +264,14 @@ public: lastMouseCapabilityFlags = e->device()->capabilities(); } - void mouseUngrabEvent() { + void mouseUngrabEvent() override + { qCDebug(lcTests) << objectName(); ++mouseUngrabEventCount; } - bool childMouseEventFilter(QQuickItem *item, QEvent *e) { + bool childMouseEventFilter(QQuickItem *item, QEvent *e) override + { qCDebug(lcTests) << objectName() << "filtering" << e << "ahead of delivery to" << item->metaObject()->className() << item->objectName(); switch (e->type()) { case QEvent::MouseButtonPress: @@ -295,7 +301,8 @@ int TestTouchItem::mouseReleaseNum = 0; class EventFilter : public QObject { public: - bool eventFilter(QObject *watched, QEvent *event) { + bool eventFilter(QObject *watched, QEvent *event) override + { Q_UNUSED(watched); events.append(event->type()); return false; @@ -312,7 +319,8 @@ public: int iterations; protected: - QSGNode* updatePaintNode(QSGNode *, UpdatePaintNodeData *){ + QSGNode* updatePaintNode(QSGNode *, UpdatePaintNodeData *) override + { iterations++; update(); return nullptr; @@ -2513,7 +2521,8 @@ public: ~RenderJob() { ++deleted; } QQuickWindow::RenderStage stage; QList<QQuickWindow::RenderStage> *list; - void run() { + void run() override + { list->append(stage); } static int deleted; @@ -2697,9 +2706,12 @@ public: setAcceptHoverEvents(true); } - void hoverEnterEvent(QHoverEvent *event) { hoverTimestamps << event->timestamp(); } - void hoverLeaveEvent(QHoverEvent *event) { hoverTimestamps << event->timestamp(); } - void hoverMoveEvent(QHoverEvent *event) { hoverTimestamps << event->timestamp(); } + void hoverEnterEvent(QHoverEvent *event) override + { hoverTimestamps << event->timestamp(); } + void hoverLeaveEvent(QHoverEvent *event) override + { hoverTimestamps << event->timestamp(); } + void hoverMoveEvent(QHoverEvent *event) override + { hoverTimestamps << event->timestamp(); } QList<ulong> hoverTimestamps; }; @@ -2892,19 +2904,19 @@ public: dropAccept = true; } - void dragEnterEvent(QDragEnterEvent *event) + void dragEnterEvent(QDragEnterEvent *event) override { event->setAccepted(enterAccept); event->setDropAction(enterDropAction); } - void dragMoveEvent(QDragMoveEvent *event) + void dragMoveEvent(QDragMoveEvent *event) override { event->setAccepted(moveAccept); event->setDropAction(moveDropAction); } - void dropEvent(QDropEvent *event) + void dropEvent(QDropEvent *event) override { event->setAccepted(dropAccept); event->setDropAction(dropDropAction); diff --git a/tests/auto/quick/rendernode/tst_rendernode.cpp b/tests/auto/quick/rendernode/tst_rendernode.cpp index 87d710ee47..46f9af7510 100644 --- a/tests/auto/quick/rendernode/tst_rendernode.cpp +++ b/tests/auto/quick/rendernode/tst_rendernode.cpp @@ -103,7 +103,7 @@ public: } protected: - virtual QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) + QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override { ClearNode *node = static_cast<ClearNode *>(oldNode); if (!node) @@ -172,7 +172,7 @@ public: } protected: - virtual QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) + QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override { MessUpNode *node = static_cast<MessUpNode *>(oldNode); if (!node) diff --git a/tests/auto/quick/scenegraph/tst_scenegraph.cpp b/tests/auto/quick/scenegraph/tst_scenegraph.cpp index 959ef33ee4..4f34ed9fae 100644 --- a/tests/auto/quick/scenegraph/tst_scenegraph.cpp +++ b/tests/auto/quick/scenegraph/tst_scenegraph.cpp @@ -71,7 +71,7 @@ public: QColor color() const { return m_color; } - QSGNode *updatePaintNode(QSGNode *node, UpdatePaintNodeData *) + QSGNode *updatePaintNode(QSGNode *node, UpdatePaintNodeData *) override { delete node; node = new QSGNode; diff --git a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp index 5d653d4b1a..6ae0dc12ac 100644 --- a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp +++ b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp @@ -687,7 +687,7 @@ public: } private: - virtual void itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &/*oldGeometry*/) override + void itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &/*oldGeometry*/) override { auto window = QQuickItemPrivate::get(this)->window; if (!window) diff --git a/tests/auto/shared/platforminputcontext.h b/tests/auto/shared/platforminputcontext.h index 13ab6e96d7..bcb6f52c15 100644 --- a/tests/auto/shared/platforminputcontext.h +++ b/tests/auto/shared/platforminputcontext.h @@ -39,32 +39,32 @@ public: { } - virtual void showInputPanel() + void showInputPanel() override { m_visible = true; m_showInputPanelCallCount++; } - virtual void hideInputPanel() + void hideInputPanel() override { m_visible = false; m_hideInputPanelCallCount++; } - virtual bool isInputPanelVisible() const + bool isInputPanelVisible() const override { return m_visible; } - virtual void invokeAction(QInputMethod::Action action, int cursorPosition) + void invokeAction(QInputMethod::Action action, int cursorPosition) override { m_invokeActionCallCount++; m_action = action; m_cursorPosition = cursorPosition; } - virtual void update(Qt::InputMethodQueries) + void update(Qt::InputMethodQueries) override { m_updateCallCount++; } - virtual QLocale locale() const + QLocale locale() const override { if (m_direction == Qt::RightToLeft) return QLocale(QLocale::Arabic); @@ -72,7 +72,7 @@ public: return QLocale(QLocale::English); } - virtual Qt::LayoutDirection inputDirection() const + Qt::LayoutDirection inputDirection() const override { return m_direction; } |