From 47c92fbb0b588b443cead18a5aad5a2b5ad9e4d7 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Mon, 18 Sep 2017 10:36:49 +0200 Subject: Replace Q_DECL_OVERRIDE with override where possible Remaining uses of Q_DECL_OVERRIDE are in: src/corelib/global/qcompilerdetection.h src/corelib/global/qglobal.cpp doc/global/qt-cpp-defines.qdocconf (definition and documentation of Q_DECL_OVERRIDE) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: Ib9b05d829add69e98a86238274b6a1fcb19b49ba Reviewed-by: Lars Knoll Reviewed-by: Ville Voutilainen Reviewed-by: Olivier Goffart (Woboq GmbH) --- tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp | 2 +- tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp | 8 ++++---- .../widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp | 16 ++++++++-------- tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp | 2 +- tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) (limited to 'tests/auto/widgets/widgets') diff --git a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp index 6363d0c673..500ec2e1fa 100644 --- a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp +++ b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp @@ -47,7 +47,7 @@ public: QList events; protected: - bool event(QEvent *ev) Q_DECL_OVERRIDE { + bool event(QEvent *ev) override { events.append(ev->type()); return QWidget::event(ev); } diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index da37a9a968..b0ec4a55f4 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -819,7 +819,7 @@ public: } protected: - void showEvent(QShowEvent *e) Q_DECL_OVERRIDE + void showEvent(QShowEvent *e) override { QVERIFY(m_subMenu->isVisible()); QVERIFY2(m_subMenu->x() > x(), @@ -828,7 +828,7 @@ protected: QMenu::showEvent(e); } - void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE + void timerEvent(QTimerEvent *e) override { if (e->timerId() == m_timerId) { switch (m_timerTick++) { @@ -1217,7 +1217,7 @@ public: setMouseTracking(true); } - bool event(QEvent *e) Q_DECL_OVERRIDE + bool event(QEvent *e) override { switch (e->type()) { case QEvent::MouseMove: @@ -1525,7 +1525,7 @@ void tst_QMenu::menuSize_Scrolling() ~TestMenu() {} private: - void showEvent(QShowEvent *e) Q_DECL_OVERRIDE + void showEvent(QShowEvent *e) override { QVERIFY(actions().length() == m_numItems); diff --git a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp index e10c7591d5..7bb0de7e17 100644 --- a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp +++ b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp @@ -100,16 +100,16 @@ public: m_w(expectedWidth), m_h(expectedHeight), r(1.0f), g(0.0f), b(0.0f) { } - void initializeGL() Q_DECL_OVERRIDE { + void initializeGL() override { m_initCalled = true; initializeOpenGLFunctions(); } - void paintGL() Q_DECL_OVERRIDE { + void paintGL() override { m_paintCalled = true; glClearColor(r, g, b, 1.0f); glClear(GL_COLOR_BUFFER_BIT); } - void resizeGL(int w, int h) Q_DECL_OVERRIDE { + void resizeGL(int w, int h) override { m_resizeCalled = true; m_resizeOk = w == m_w && h == m_h; } @@ -203,10 +203,10 @@ public: PainterWidget(QWidget *parent) : QOpenGLWidget(parent), m_clear(false) { } - void initializeGL() Q_DECL_OVERRIDE { + void initializeGL() override { initializeOpenGLFunctions(); } - void paintGL() Q_DECL_OVERRIDE { + void paintGL() override { QPainter p(this); QCOMPARE(p.device()->width(), width()); QCOMPARE(p.device()->height(), height()); @@ -322,7 +322,7 @@ public: void resetPaintCount() { m_count = 0; } protected: - void drawForeground(QPainter *, const QRectF &) Q_DECL_OVERRIDE; + void drawForeground(QPainter *, const QRectF &) override; int m_count; }; @@ -372,7 +372,7 @@ class PaintCountWidget : public QOpenGLWidget public: PaintCountWidget() : m_count(0) { } void reset() { m_count = 0; } - void paintGL() Q_DECL_OVERRIDE { ++m_count; } + void paintGL() override { ++m_count; } int m_count; }; @@ -393,7 +393,7 @@ void tst_QOpenGLWidget::requestUpdate() class FboCheckWidget : public QOpenGLWidget { public: - void paintGL() Q_DECL_OVERRIDE { + void paintGL() override { GLuint reportedDefaultFbo = QOpenGLContext::currentContext()->defaultFramebufferObject(); GLuint expectedDefaultFbo = defaultFramebufferObject(); QCOMPARE(reportedDefaultFbo, expectedDefaultFbo); diff --git a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp index 72e6ffdeb5..9050ad4486 100644 --- a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp +++ b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp @@ -299,7 +299,7 @@ class TestSplitterStyle : public QProxyStyle { public: TestSplitterStyle() : handleWidth(5) {} - int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const Q_DECL_OVERRIDE + int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const override { if (metric == QStyle::PM_SplitterWidth) return handleWidth; diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp index 55ef44f4e0..4e1d93dbbb 100644 --- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp @@ -2622,7 +2622,7 @@ namespace { { } - void drawTextItem(const QPointF &, const QTextItem &textItem) Q_DECL_OVERRIDE + void drawTextItem(const QPointF &, const QTextItem &textItem) override { itemFonts.append(qMakePair(textItem.text(), textItem.font())); } -- cgit v1.2.3