From 17c0eff69de7a7a88b6df8e3c7ce03de9e27e56e Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 17 Mar 2021 12:03:11 +0100 Subject: Add override keyword in tests to silence compiler warnings Change-Id: Ib18e8aa7acf2c5abd68578f4f4405a977d19d286 Reviewed-by: Fabian Kosmale Reviewed-by: Maximilian Goldstein (cherry picked from commit 799495cb7da2aa47c6442f035b4e6a8a3efc5ae8) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/qml/qqmlincubator/testtypes.h | 8 ++++---- tests/auto/qml/qqmlparser/tst_qqmlparser.cpp | 8 ++++---- tests/auto/qml/qqmltypeloader/SlowImport/plugin.h | 2 +- tests/auto/quick/qquicklistview/incrementalmodel.h | 8 ++++---- tests/auto/quick/qquicklistview/proxytestinnermodel.h | 10 +++++----- tests/auto/quick/qquicklistview/randomsortmodel.h | 6 +++--- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/tests/auto/qml/qqmlincubator/testtypes.h b/tests/auto/qml/qqmlincubator/testtypes.h index 42c57258d6..cea45919a3 100644 --- a/tests/auto/qml/qqmlincubator/testtypes.h +++ b/tests/auto/qml/qqmlincubator/testtypes.h @@ -99,8 +99,8 @@ class CompletionRegisteringType : public QObject, public QQmlParserStatus public: CompletionRegisteringType(); - virtual void classBegin(); - virtual void componentComplete(); + void classBegin() override; + void componentComplete() override; static CompletionRegisteringType *me(); static void clearMe(); @@ -116,8 +116,8 @@ class CompletionCallbackType : public QObject, public QQmlParserStatus public: CompletionCallbackType(); - virtual void classBegin(); - virtual void componentComplete(); + void classBegin() override; + void componentComplete() override; typedef void (*callback)(CompletionCallbackType *, void *); static void clearCallback(); diff --git a/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp index 02e11f156f..622dd62f2c 100644 --- a/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp +++ b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp @@ -113,14 +113,14 @@ public: } } - virtual bool preVisit(AST::Node *node) + bool preVisit(AST::Node *node) override { checkNode(node); nodeStack.append(node); return true; } - virtual void postVisit(AST::Node *) + void postVisit(AST::Node *) override { nodeStack.removeLast(); } @@ -162,7 +162,7 @@ struct ExpressionStatementObserver: public AST::Visitor AST::Node::accept(node, this); } - virtual bool visit(AST::ExpressionStatement *statement) + bool visit(AST::ExpressionStatement *statement) override { ++expressionsSeen; endsWithSemicolon = endsWithSemicolon @@ -184,7 +184,7 @@ public: m_code = code.split('\u000A'); } - void checkNode(AST::Node *node) + void checkNode(AST::Node *node) override { SourceLocation first = node->firstSourceLocation(); SourceLocation last = node->lastSourceLocation(); diff --git a/tests/auto/qml/qqmltypeloader/SlowImport/plugin.h b/tests/auto/qml/qqmltypeloader/SlowImport/plugin.h index 34b3920a38..9cdd190963 100644 --- a/tests/auto/qml/qqmltypeloader/SlowImport/plugin.h +++ b/tests/auto/qml/qqmltypeloader/SlowImport/plugin.h @@ -38,7 +38,7 @@ class SlowPlugin : public QQmlExtensionPlugin Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - void registerTypes(const char *uri); + void registerTypes(const char *uri) override; }; #endif diff --git a/tests/auto/quick/qquicklistview/incrementalmodel.h b/tests/auto/quick/qquicklistview/incrementalmodel.h index 1494575edc..85f3b9263f 100644 --- a/tests/auto/quick/qquicklistview/incrementalmodel.h +++ b/tests/auto/quick/qquicklistview/incrementalmodel.h @@ -40,12 +40,12 @@ class IncrementalModel : public QAbstractListModel public: IncrementalModel(QObject *parent = 0); - int rowCount(const QModelIndex &parent = QModelIndex()) const; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; protected: - bool canFetchMore(const QModelIndex &parent) const; - void fetchMore(const QModelIndex &parent); + bool canFetchMore(const QModelIndex &parent) const override; + void fetchMore(const QModelIndex &parent) override; private: QStringList list; diff --git a/tests/auto/quick/qquicklistview/proxytestinnermodel.h b/tests/auto/quick/qquicklistview/proxytestinnermodel.h index 8599db4c87..b21fd88306 100644 --- a/tests/auto/quick/qquicklistview/proxytestinnermodel.h +++ b/tests/auto/quick/qquicklistview/proxytestinnermodel.h @@ -36,11 +36,11 @@ class ProxyTestInnerModel : public QAbstractItemModel Q_OBJECT public: ProxyTestInnerModel(); - virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; - virtual QModelIndex parent(const QModelIndex & /*parent*/) const; - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; - virtual int columnCount(const QModelIndex &parent) const; - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; + QModelIndex parent(const QModelIndex & /*parent*/) const override; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + int columnCount(const QModelIndex &parent) const override; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; Q_INVOKABLE void doStuff(); diff --git a/tests/auto/quick/qquicklistview/randomsortmodel.h b/tests/auto/quick/qquicklistview/randomsortmodel.h index 2430e87f20..06c065bf3a 100644 --- a/tests/auto/quick/qquicklistview/randomsortmodel.h +++ b/tests/auto/quick/qquicklistview/randomsortmodel.h @@ -37,10 +37,10 @@ class RandomSortModel : public QAbstractListModel public: explicit RandomSortModel(QObject* parent = 0); - QHash roleNames() const; + QHash roleNames() const override; - QVariant data(const QModelIndex& index, int role) const; - int rowCount(const QModelIndex& parent = QModelIndex()) const; + QVariant data(const QModelIndex& index, int role) const override; + int rowCount(const QModelIndex& parent = QModelIndex()) const override; void randomize(); -- cgit v1.2.3