diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-09-11 13:05:27 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-09-13 21:03:31 +0200 |
commit | 2c698a6d07c1e8fb1cca417892c017f9591852c3 (patch) | |
tree | 9860cefbcdd1237b85dfabea95ff0060b7b950b6 /tests/auto/other | |
parent | 6a37ca39ec7cfc2f4392784fd31936526d55e941 (diff) |
Fix compiler warnings about missing overrides
Change-Id: I52bf9fe45607f4a99cafa441bd78dfe5f7adb0e1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/other')
-rw-r--r-- | tests/auto/other/gestures/tst_gestures.cpp | 42 | ||||
-rw-r--r-- | tests/auto/other/languagechange/tst_languagechange.cpp | 4 | ||||
-rw-r--r-- | tests/auto/other/qfocusevent/tst_qfocusevent.cpp | 6 |
3 files changed, 29 insertions, 23 deletions
diff --git a/tests/auto/other/gestures/tst_gestures.cpp b/tests/auto/other/gestures/tst_gestures.cpp index a4017047ea..fe95120656 100644 --- a/tests/auto/other/gestures/tst_gestures.cpp +++ b/tests/auto/other/gestures/tst_gestures.cpp @@ -98,12 +98,12 @@ public: CustomEvent::EventType = QEvent::registerEventType(); } - QGesture* create(QObject *) + QGesture* create(QObject *) override { return new CustomGesture; } - QGestureRecognizer::Result recognize(QGesture *state, QObject*, QEvent *event) + QGestureRecognizer::Result recognize(QGesture *state, QObject*, QEvent *event) override { if (event->type() == CustomEvent::EventType) { QGestureRecognizer::Result result; @@ -127,7 +127,7 @@ public: return QGestureRecognizer::Ignore; } - void reset(QGesture *state) + void reset(QGesture *state) override { CustomGesture *g = static_cast<CustomGesture *>(state); g->serial = 0; @@ -146,12 +146,12 @@ public: CustomEvent::EventType = QEvent::registerEventType(); } - QGesture* create(QObject *) + QGesture* create(QObject *) override { return new CustomGesture; } - QGestureRecognizer::Result recognize(QGesture *state, QObject*, QEvent *event) + QGestureRecognizer::Result recognize(QGesture *state, QObject*, QEvent *event) override { if (event->type() == CustomEvent::EventType) { QGestureRecognizer::Result result = QGestureRecognizer::ConsumeEventHint; @@ -171,7 +171,7 @@ public: return QGestureRecognizer::Ignore; } - void reset(QGesture *state) + void reset(QGesture *state) override { CustomGesture *g = static_cast<CustomGesture *>(state); g->serial = 0; @@ -226,7 +226,7 @@ public: QSet<Qt::GestureType> ignoredGestures; protected: - bool event(QEvent *event) + bool event(QEvent *event) override { Events *eventsPtr = 0; if (event->type() == QEvent::Gesture) { @@ -720,17 +720,17 @@ public: ignoredFinishedGestures.clear(); } - QRectF boundingRect() const + QRectF boundingRect() const override { return size; } - void paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) + void paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) override { QColor color = InstanceColors[instanceNumber % (sizeof(InstanceColors)/sizeof(InstanceColors[0]))]; p->fillRect(boundingRect(), color); } - bool event(QEvent *event) + bool event(QEvent *event) override { Events *eventsPtr = 0; if (event->type() == QEvent::Gesture) { @@ -1483,7 +1483,7 @@ void tst_Gestures::autoCancelGestures() public: MockWidget(const char *name) : GestureWidget(name), badGestureEvents(0) { } - bool event(QEvent *event) + bool event(QEvent *event) override { if (event->type() == QEvent::Gesture) { QGestureEvent *ge = static_cast<QGestureEvent*>(event); @@ -1538,7 +1538,8 @@ void tst_Gestures::autoCancelGestures2() public: MockItem(const char *name) : GestureItem(name), badGestureEvents(0) { } - bool event(QEvent *event) { + bool event(QEvent *event) override + { if (event->type() == QEvent::Gesture) { QGestureEvent *ge = static_cast<QGestureEvent*>(event); if (ge->gestures().count() != 1) @@ -2029,7 +2030,8 @@ public: enum PanType { Platform, Default, Custom }; PanRecognizer(int id) : m_id(id) {} - QGesture *create(QObject *) { + QGesture *create(QObject *) override + { switch(m_id) { case Platform: return new WinNativePan(); case Default: return new Pan(); @@ -2037,7 +2039,7 @@ public: } } - Result recognize(QGesture *, QObject *, QEvent *) { return QGestureRecognizer::Ignore; } + Result recognize(QGesture *, QObject *, QEvent *) override { return QGestureRecognizer::Ignore; } const int m_id; }; @@ -2087,12 +2089,14 @@ public: ReuseCanceledGesturesRecognizer(Type type) : m_type(type) {} - QGesture *create(QObject *) { + QGesture *create(QObject *) override + { QGesture *g = new QGesture; return g; } - Result recognize(QGesture *gesture, QObject *, QEvent *event) { + Result recognize(QGesture *gesture, QObject *, QEvent *event) override + { QMouseEvent *me = static_cast<QMouseEvent *>(event); Qt::MouseButton mouseButton(m_type == LmbType ? Qt::LeftButton : Qt::RightButton); @@ -2127,7 +2131,8 @@ class ReuseCanceledGesturesWidget : public QGraphicsWidget { } - bool event(QEvent *event) { + bool event(QEvent *event) override + { if (event->type() == QEvent::Gesture) { QGesture *gesture = static_cast<QGestureEvent*>(event)->gesture(m_gestureType); if (gesture) { @@ -2310,7 +2315,8 @@ class NoConsumeWidgetBug13501 :public QWidget { Q_OBJECT protected: - bool event(QEvent *e) { + bool event(QEvent *e) override + { if(e->type() == QEvent::Gesture) { return false; } diff --git a/tests/auto/other/languagechange/tst_languagechange.cpp b/tests/auto/other/languagechange/tst_languagechange.cpp index d0510c4b98..44eaa2e46f 100644 --- a/tests/auto/other/languagechange/tst_languagechange.cpp +++ b/tests/auto/other/languagechange/tst_languagechange.cpp @@ -84,7 +84,7 @@ public: TransformTranslator() : QTranslator() {} TransformTranslator(QObject *parent) : QTranslator(parent) {} QString translate(const char *context, const char *sourceText, - const char *disambiguation = 0, int = -1) const + const char *disambiguation = 0, int = -1) const override { QByteArray total(context); total.append("::"); @@ -108,7 +108,7 @@ public: return res; } - virtual bool isEmpty() const { return false; } + virtual bool isEmpty() const override { return false; } public: mutable QSet<QByteArray> m_translations; diff --git a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp index 0242f8a36e..5c025c8c4e 100644 --- a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp +++ b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp @@ -54,19 +54,19 @@ public: bool focusOutEventRecieved; bool focusOutEventLostFocus; protected: - virtual void keyPressEvent( QKeyEvent *e ) + virtual void keyPressEvent( QKeyEvent *e ) override { // qDebug( QString("keyPressEvent: %1").arg(e->key()) ); QLineEdit::keyPressEvent( e ); } - void focusInEvent( QFocusEvent* e ) + void focusInEvent( QFocusEvent* e ) override { QLineEdit::focusInEvent( e ); focusInEventReason = e->reason(); focusInEventGotFocus = e->gotFocus(); focusInEventRecieved = true; } - void focusOutEvent( QFocusEvent* e ) + void focusOutEvent( QFocusEvent* e ) override { QLineEdit::focusOutEvent( e ); focusOutEventReason = e->reason(); |