diff options
author | hjk <hjk@theqtcompany.com> | 2016-06-15 10:12:35 +0200 |
---|---|---|
committer | hjk <hjk@theqtcompany.com> | 2016-06-15 09:32:30 +0000 |
commit | 40a54bf565079c007eada8755b9ff7224754949d (patch) | |
tree | ccd3bb45ca7369b79fc54d26955cf5b0dfc8ece1 /examples/widgets/tools | |
parent | 4d3ffae3d562e5b3b2748a2d92eb4ab2933422e7 (diff) |
Examples: Replace 'Q_DECL_OVERRIDE' by 'override'
Examples should demonstrate best practice, and we can use the keyword
directly nowadays.
Change-Id: I1f122e5caceca17290757ffbaf3d660e7daa9ae4
Reviewed-by: Topi Reiniƶ <topi.reinio@theqtcompany.com>
Diffstat (limited to 'examples/widgets/tools')
17 files changed, 58 insertions, 58 deletions
diff --git a/examples/widgets/tools/completer/fsmodel.h b/examples/widgets/tools/completer/fsmodel.h index a9b7db3849..a243c48b43 100644 --- a/examples/widgets/tools/completer/fsmodel.h +++ b/examples/widgets/tools/completer/fsmodel.h @@ -63,7 +63,7 @@ class FileSystemModel : public QFileSystemModel { public: FileSystemModel(QObject *parent = 0); - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; }; //! [0] diff --git a/examples/widgets/tools/customcompleter/textedit.h b/examples/widgets/tools/customcompleter/textedit.h index ce407cbf53..d0636ab670 100644 --- a/examples/widgets/tools/customcompleter/textedit.h +++ b/examples/widgets/tools/customcompleter/textedit.h @@ -70,8 +70,8 @@ public: QCompleter *completer() const; protected: - void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE; - void focusInEvent(QFocusEvent *e) Q_DECL_OVERRIDE; + void keyPressEvent(QKeyEvent *e) override; + void focusInEvent(QFocusEvent *e) override; private slots: void insertCompletion(const QString &completion); diff --git a/examples/widgets/tools/echoplugin/plugin/echoplugin.h b/examples/widgets/tools/echoplugin/plugin/echoplugin.h index 94feb1a2ea..f0f237099c 100644 --- a/examples/widgets/tools/echoplugin/plugin/echoplugin.h +++ b/examples/widgets/tools/echoplugin/plugin/echoplugin.h @@ -63,7 +63,7 @@ class EchoPlugin : public QObject, EchoInterface Q_INTERFACES(EchoInterface) public: - QString echo(const QString &message) Q_DECL_OVERRIDE; + QString echo(const QString &message) override; }; //! [0] diff --git a/examples/widgets/tools/i18n/languagechooser.h b/examples/widgets/tools/i18n/languagechooser.h index 8af7be6d71..13363c7111 100644 --- a/examples/widgets/tools/i18n/languagechooser.h +++ b/examples/widgets/tools/i18n/languagechooser.h @@ -71,8 +71,8 @@ public: explicit LanguageChooser(const QString& defaultLang = QString(), QWidget *parent = 0); protected: - bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE; - void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE; + bool eventFilter(QObject *object, QEvent *event) override; + void closeEvent(QCloseEvent *event) override; private slots: void checkBoxToggled(); diff --git a/examples/widgets/tools/plugandpaint/app/paintarea.h b/examples/widgets/tools/plugandpaint/app/paintarea.h index 415e4c0be4..1c8ee1ee1b 100644 --- a/examples/widgets/tools/plugandpaint/app/paintarea.h +++ b/examples/widgets/tools/plugandpaint/app/paintarea.h @@ -76,13 +76,13 @@ public: QImage image() const { return theImage; } QColor brushColor() const { return color; } int brushWidth() const { return thickness; } - QSize sizeHint() const Q_DECL_OVERRIDE; + QSize sizeHint() const override; protected: - void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; - void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void paintEvent(QPaintEvent *event) override; + void mousePressEvent(QMouseEvent *event) override; + void mouseMoveEvent(QMouseEvent *event) override; + void mouseReleaseEvent(QMouseEvent *event) override; private: void setupPainter(QPainter &painter); diff --git a/examples/widgets/tools/plugandpaint/plugins/basictools/basictoolsplugin.h b/examples/widgets/tools/plugandpaint/plugins/basictools/basictoolsplugin.h index 6e6d639d12..fd9bb9e5f3 100644 --- a/examples/widgets/tools/plugandpaint/plugins/basictools/basictoolsplugin.h +++ b/examples/widgets/tools/plugandpaint/plugins/basictools/basictoolsplugin.h @@ -78,22 +78,22 @@ class BasicToolsPlugin : public QObject, public: //! [1] // BrushInterface - QStringList brushes() const Q_DECL_OVERRIDE; + QStringList brushes() const override; QRect mousePress(const QString &brush, QPainter &painter, - const QPoint &pos) Q_DECL_OVERRIDE; + const QPoint &pos) override; QRect mouseMove(const QString &brush, QPainter &painter, - const QPoint &oldPos, const QPoint &newPos) Q_DECL_OVERRIDE; + const QPoint &oldPos, const QPoint &newPos) override; QRect mouseRelease(const QString &brush, QPainter &painter, - const QPoint &pos) Q_DECL_OVERRIDE; + const QPoint &pos) override; // ShapeInterface - QStringList shapes() const Q_DECL_OVERRIDE; - QPainterPath generateShape(const QString &shape, QWidget *parent) Q_DECL_OVERRIDE; + QStringList shapes() const override; + QPainterPath generateShape(const QString &shape, QWidget *parent) override; // FilterInterface - QStringList filters() const Q_DECL_OVERRIDE; + QStringList filters() const override; QImage filterImage(const QString &filter, const QImage &image, - QWidget *parent) Q_DECL_OVERRIDE; + QWidget *parent) override; //! [3] }; //! [2] //! [3] diff --git a/examples/widgets/tools/plugandpaint/plugins/extrafilters/extrafiltersplugin.h b/examples/widgets/tools/plugandpaint/plugins/extrafilters/extrafiltersplugin.h index 4beac9a7fb..dddde78caa 100644 --- a/examples/widgets/tools/plugandpaint/plugins/extrafilters/extrafiltersplugin.h +++ b/examples/widgets/tools/plugandpaint/plugins/extrafilters/extrafiltersplugin.h @@ -66,9 +66,9 @@ class ExtraFiltersPlugin : public QObject, public FilterInterface Q_INTERFACES(FilterInterface) public: - QStringList filters() const Q_DECL_OVERRIDE; + QStringList filters() const override; QImage filterImage(const QString &filter, const QImage &image, - QWidget *parent) Q_DECL_OVERRIDE; + QWidget *parent) override; }; //! [0] diff --git a/examples/widgets/tools/settingseditor/settingstree.h b/examples/widgets/tools/settingseditor/settingstree.h index b46a3d38da..15efa0e6aa 100644 --- a/examples/widgets/tools/settingseditor/settingstree.h +++ b/examples/widgets/tools/settingseditor/settingstree.h @@ -71,7 +71,7 @@ public: ~SettingsTree(); void setSettingsObject(const SettingsPtr &settings); - QSize sizeHint() const Q_DECL_OVERRIDE; + QSize sizeHint() const override; public slots: void setAutoRefresh(bool autoRefresh); @@ -80,7 +80,7 @@ public slots: void refresh(); protected: - bool event(QEvent *event) Q_DECL_OVERRIDE; + bool event(QEvent *event) override; private slots: void updateSetting(QTreeWidgetItem *item); diff --git a/examples/widgets/tools/settingseditor/variantdelegate.h b/examples/widgets/tools/settingseditor/variantdelegate.h index 3860ecb2f4..a15228fdf9 100644 --- a/examples/widgets/tools/settingseditor/variantdelegate.h +++ b/examples/widgets/tools/settingseditor/variantdelegate.h @@ -62,12 +62,12 @@ public: VariantDelegate(QObject *parent = 0); void paint(QPainter *painter, const QStyleOptionViewItem &option, - const QModelIndex &index) const Q_DECL_OVERRIDE; + const QModelIndex &index) const override; QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, - const QModelIndex &index) const Q_DECL_OVERRIDE; - void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE; + const QModelIndex &index) const override; + void setEditorData(QWidget *editor, const QModelIndex &index) const override; void setModelData(QWidget *editor, QAbstractItemModel *model, - const QModelIndex &index) const Q_DECL_OVERRIDE; + const QModelIndex &index) const override; static bool isSupportedType(QVariant::Type type); static QString displayText(const QVariant &value); diff --git a/examples/widgets/tools/styleplugin/plugin/simplestyle.h b/examples/widgets/tools/styleplugin/plugin/simplestyle.h index 05905cd87b..51d6d5b77e 100644 --- a/examples/widgets/tools/styleplugin/plugin/simplestyle.h +++ b/examples/widgets/tools/styleplugin/plugin/simplestyle.h @@ -64,7 +64,7 @@ class SimpleStyle : public QProxyStyle public: SimpleStyle() {}; - void polish(QPalette &palette) Q_DECL_OVERRIDE; + void polish(QPalette &palette) override; }; #endif diff --git a/examples/widgets/tools/styleplugin/plugin/simplestyleplugin.h b/examples/widgets/tools/styleplugin/plugin/simplestyleplugin.h index 980de4c1df..88805d4887 100644 --- a/examples/widgets/tools/styleplugin/plugin/simplestyleplugin.h +++ b/examples/widgets/tools/styleplugin/plugin/simplestyleplugin.h @@ -68,7 +68,7 @@ public: SimpleStylePlugin() {} QStringList keys() const; - QStyle *create(const QString &key) Q_DECL_OVERRIDE; + QStyle *create(const QString &key) override; }; //! [0] diff --git a/examples/widgets/tools/treemodelcompleter/treemodelcompleter.h b/examples/widgets/tools/treemodelcompleter/treemodelcompleter.h index 7e10f87f5b..1d28fddee0 100644 --- a/examples/widgets/tools/treemodelcompleter/treemodelcompleter.h +++ b/examples/widgets/tools/treemodelcompleter/treemodelcompleter.h @@ -68,8 +68,8 @@ public slots: void setSeparator(const QString &separator); protected: - QStringList splitPath(const QString &path) const Q_DECL_OVERRIDE; - QString pathFromIndex(const QModelIndex &index) const Q_DECL_OVERRIDE; + QStringList splitPath(const QString &path) const override; + QString pathFromIndex(const QModelIndex &index) const override; private: QString sep; diff --git a/examples/widgets/tools/undo/commands.h b/examples/widgets/tools/undo/commands.h index 1a14b3fa56..de3bebd740 100644 --- a/examples/widgets/tools/undo/commands.h +++ b/examples/widgets/tools/undo/commands.h @@ -58,8 +58,8 @@ class AddShapeCommand : public QUndoCommand { public: AddShapeCommand(Document *doc, const Shape &shape, QUndoCommand *parent = 0); - void undo() Q_DECL_OVERRIDE; - void redo() Q_DECL_OVERRIDE; + void undo() override; + void redo() override; private: Document *m_doc; @@ -71,8 +71,8 @@ class RemoveShapeCommand : public QUndoCommand { public: RemoveShapeCommand(Document *doc, const QString &shapeName, QUndoCommand *parent = 0); - void undo() Q_DECL_OVERRIDE; - void redo() Q_DECL_OVERRIDE; + void undo() override; + void redo() override; private: Document *m_doc; @@ -86,11 +86,11 @@ public: SetShapeColorCommand(Document *doc, const QString &shapeName, const QColor &color, QUndoCommand *parent = 0); - void undo() Q_DECL_OVERRIDE; - void redo() Q_DECL_OVERRIDE; + void undo() override; + void redo() override; - bool mergeWith(const QUndoCommand *command) Q_DECL_OVERRIDE; - int id() const Q_DECL_OVERRIDE; + bool mergeWith(const QUndoCommand *command) override; + int id() const override; private: Document *m_doc; @@ -105,11 +105,11 @@ public: SetShapeRectCommand(Document *doc, const QString &shapeName, const QRect &rect, QUndoCommand *parent = 0); - void undo() Q_DECL_OVERRIDE; - void redo() Q_DECL_OVERRIDE; + void undo() override; + void redo() override; - bool mergeWith(const QUndoCommand *command) Q_DECL_OVERRIDE; - int id() const Q_DECL_OVERRIDE; + bool mergeWith(const QUndoCommand *command) override; + int id() const override; private: Document *m_doc; diff --git a/examples/widgets/tools/undo/document.h b/examples/widgets/tools/undo/document.h index 41e53a9a04..8076d7185c 100644 --- a/examples/widgets/tools/undo/document.h +++ b/examples/widgets/tools/undo/document.h @@ -110,10 +110,10 @@ signals: void currentShapeChanged(const QString &shapeName); protected: - void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; - void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void paintEvent(QPaintEvent *event) override; + void mousePressEvent(QMouseEvent *event) override; + void mouseReleaseEvent(QMouseEvent *event) override; + void mouseMoveEvent(QMouseEvent *event) override; private: void setCurrentShape(int index); diff --git a/examples/widgets/tools/undoframework/commands.h b/examples/widgets/tools/undoframework/commands.h index 22c62fe9fd..dc53c14557 100644 --- a/examples/widgets/tools/undoframework/commands.h +++ b/examples/widgets/tools/undoframework/commands.h @@ -64,10 +64,10 @@ public: MoveCommand(DiagramItem *diagramItem, const QPointF &oldPos, QUndoCommand *parent = 0); - void undo() Q_DECL_OVERRIDE; - void redo() Q_DECL_OVERRIDE; - bool mergeWith(const QUndoCommand *command) Q_DECL_OVERRIDE; - int id() const Q_DECL_OVERRIDE { return Id; } + void undo() override; + void redo() override; + bool mergeWith(const QUndoCommand *command) override; + int id() const override { return Id; } private: DiagramItem *myDiagramItem; @@ -82,8 +82,8 @@ class DeleteCommand : public QUndoCommand public: explicit DeleteCommand(QGraphicsScene *graphicsScene, QUndoCommand *parent = 0); - void undo() Q_DECL_OVERRIDE; - void redo() Q_DECL_OVERRIDE; + void undo() override; + void redo() override; private: DiagramItem *myDiagramItem; @@ -99,8 +99,8 @@ public: QUndoCommand *parent = 0); ~AddCommand(); - void undo() Q_DECL_OVERRIDE; - void redo() Q_DECL_OVERRIDE; + void undo() override; + void redo() override; private: DiagramItem *myDiagramItem; diff --git a/examples/widgets/tools/undoframework/diagramitem.h b/examples/widgets/tools/undoframework/diagramitem.h index 246443b64d..1638dcbea8 100644 --- a/examples/widgets/tools/undoframework/diagramitem.h +++ b/examples/widgets/tools/undoframework/diagramitem.h @@ -71,7 +71,7 @@ public: DiagramType diagramType() const { return polygon() == boxPolygon ? Box : Triangle; } - int type() const Q_DECL_OVERRIDE { return Type; } + int type() const override { return Type; } private: QPolygonF boxPolygon; diff --git a/examples/widgets/tools/undoframework/diagramscene.h b/examples/widgets/tools/undoframework/diagramscene.h index 6b275ce5d3..b1e2804ba6 100644 --- a/examples/widgets/tools/undoframework/diagramscene.h +++ b/examples/widgets/tools/undoframework/diagramscene.h @@ -72,8 +72,8 @@ signals: void itemMoved(DiagramItem *movedItem, const QPointF &movedFromPosition); protected: - void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE; - void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE; + void mousePressEvent(QGraphicsSceneMouseEvent *event) override; + void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override; private: QGraphicsItem *movingItem; |