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/animation/sub-attaq | |
parent | 4d3ffae3d562e5b3b2748a2d92eb4ab2933422e7 (diff) | |
download | qtbase-40a54bf565079c007eada8755b9ff7224754949d.tar.gz |
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/animation/sub-attaq')
-rw-r--r-- | examples/widgets/animation/sub-attaq/boat.h | 2 | ||||
-rw-r--r-- | examples/widgets/animation/sub-attaq/boat_p.h | 18 | ||||
-rw-r--r-- | examples/widgets/animation/sub-attaq/pixmapitem.h | 4 | ||||
-rw-r--r-- | examples/widgets/animation/sub-attaq/qanimationstate.h | 6 | ||||
-rw-r--r-- | examples/widgets/animation/sub-attaq/states.h | 22 | ||||
-rw-r--r-- | examples/widgets/animation/sub-attaq/submarine.h | 2 | ||||
-rw-r--r-- | examples/widgets/animation/sub-attaq/submarine_p.h | 6 |
7 files changed, 30 insertions, 30 deletions
diff --git a/examples/widgets/animation/sub-attaq/boat.h b/examples/widgets/animation/sub-attaq/boat.h index 4b7b20c390..24b004a108 100644 --- a/examples/widgets/animation/sub-attaq/boat.h +++ b/examples/widgets/animation/sub-attaq/boat.h @@ -86,7 +86,7 @@ public: void updateBoatMovement(); - virtual int type() const Q_DECL_OVERRIDE; + virtual int type() const override; signals: void boatDestroyed(); diff --git a/examples/widgets/animation/sub-attaq/boat_p.h b/examples/widgets/animation/sub-attaq/boat_p.h index 6d3c3f69f8..5cad6bde96 100644 --- a/examples/widgets/animation/sub-attaq/boat_p.h +++ b/examples/widgets/animation/sub-attaq/boat_p.h @@ -81,7 +81,7 @@ public: { } protected: - virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE + virtual bool eventTest(QEvent *event) override { if (!QKeyEventTransition::eventTest(event)) return false; @@ -100,13 +100,13 @@ public: { } protected: - virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE + virtual bool eventTest(QEvent *event) override { if (!QKeyEventTransition::eventTest(event)) return false; return (boat->currentSpeed() >= 0); } - void onTransition(QEvent *) Q_DECL_OVERRIDE + void onTransition(QEvent *) override { //We decrease the speed if needed if (key == Qt::Key_Left && boat->currentDirection() == Boat::Right) @@ -131,7 +131,7 @@ public: { } protected: - virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE + virtual bool eventTest(QEvent *event) override { if (!QKeyEventTransition::eventTest(event)) return false; @@ -150,7 +150,7 @@ public: { } protected: - void onEntry(QEvent *) Q_DECL_OVERRIDE + void onEntry(QEvent *) override { boat->setCurrentDirection(Boat::Right); boat->updateBoatMovement(); @@ -167,7 +167,7 @@ public: { } protected: - void onEntry(QEvent *) Q_DECL_OVERRIDE + void onEntry(QEvent *) override { boat->setCurrentDirection(Boat::Left); boat->updateBoatMovement(); @@ -184,7 +184,7 @@ public: { } protected: - void onEntry(QEvent *) Q_DECL_OVERRIDE + void onEntry(QEvent *) override { boat->setCurrentSpeed(0); boat->setCurrentDirection(Boat::None); @@ -202,7 +202,7 @@ public: { } protected: - void onEntry(QEvent *) Q_DECL_OVERRIDE + void onEntry(QEvent *) override { Bomb *b = new Bomb(); b->setPos(boat->x()+boat->size().width(),boat->y()); @@ -223,7 +223,7 @@ public: { } protected: - void onEntry(QEvent *) Q_DECL_OVERRIDE + void onEntry(QEvent *) override { Bomb *b = new Bomb(); b->setPos(boat->x() - b->size().width(), boat->y()); diff --git a/examples/widgets/animation/sub-attaq/pixmapitem.h b/examples/widgets/animation/sub-attaq/pixmapitem.h index 139537bcc9..de8ed67a38 100644 --- a/examples/widgets/animation/sub-attaq/pixmapitem.h +++ b/examples/widgets/animation/sub-attaq/pixmapitem.h @@ -63,8 +63,8 @@ public: PixmapItem(const QString &fileName, GraphicsScene::Mode mode, QGraphicsItem * parent = 0); PixmapItem(const QString &fileName, QGraphicsScene *scene); QSizeF size() const; - QRectF boundingRect() const Q_DECL_OVERRIDE; - void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) Q_DECL_OVERRIDE; + QRectF boundingRect() const override; + void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override; private: QPixmap pix; }; diff --git a/examples/widgets/animation/sub-attaq/qanimationstate.h b/examples/widgets/animation/sub-attaq/qanimationstate.h index b4afdd699d..06ab4dfbcf 100644 --- a/examples/widgets/animation/sub-attaq/qanimationstate.h +++ b/examples/widgets/animation/sub-attaq/qanimationstate.h @@ -80,9 +80,9 @@ signals: void animationFinished(); protected: - void onEntry(QEvent *) Q_DECL_OVERRIDE; - void onExit(QEvent *) Q_DECL_OVERRIDE; - bool event(QEvent *e) Q_DECL_OVERRIDE; + void onEntry(QEvent *) override; + void onExit(QEvent *) override; + bool event(QEvent *e) override; private: Q_DISABLE_COPY(QAnimationState) diff --git a/examples/widgets/animation/sub-attaq/states.h b/examples/widgets/animation/sub-attaq/states.h index 5b6b38bee7..1d50abbf02 100644 --- a/examples/widgets/animation/sub-attaq/states.h +++ b/examples/widgets/animation/sub-attaq/states.h @@ -72,7 +72,7 @@ public: ~PlayState(); protected: - void onEntry(QEvent *) Q_DECL_OVERRIDE; + void onEntry(QEvent *) override; private : GraphicsScene *scene; @@ -94,7 +94,7 @@ class LevelState : public QState public: LevelState(GraphicsScene *scene, PlayState *game, QState *parent = 0); protected: - void onEntry(QEvent *) Q_DECL_OVERRIDE; + void onEntry(QEvent *) override; private : void initializeLevel(); GraphicsScene *scene; @@ -107,8 +107,8 @@ public: explicit PauseState(GraphicsScene *scene, QState *parent = 0); protected: - void onEntry(QEvent *) Q_DECL_OVERRIDE; - void onExit(QEvent *) Q_DECL_OVERRIDE; + void onEntry(QEvent *) override; + void onExit(QEvent *) override; private : GraphicsScene *scene; }; @@ -119,8 +119,8 @@ public: LostState(GraphicsScene *scene, PlayState *game, QState *parent = 0); protected: - void onEntry(QEvent *) Q_DECL_OVERRIDE; - void onExit(QEvent *) Q_DECL_OVERRIDE; + void onEntry(QEvent *) override; + void onExit(QEvent *) override; private : GraphicsScene *scene; PlayState *game; @@ -132,8 +132,8 @@ public: WinState(GraphicsScene *scene, PlayState *game, QState *parent = 0); protected: - void onEntry(QEvent *) Q_DECL_OVERRIDE; - void onExit(QEvent *) Q_DECL_OVERRIDE; + void onEntry(QEvent *) override; + void onExit(QEvent *) override; private : GraphicsScene *scene; PlayState *game; @@ -152,7 +152,7 @@ class UpdateScoreTransition : public QSignalTransition public: UpdateScoreTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target); protected: - virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE; + virtual bool eventTest(QEvent *event) override; private: PlayState * game; GraphicsScene *scene; @@ -164,7 +164,7 @@ class WinTransition : public QSignalTransition public: WinTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target); protected: - virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE; + virtual bool eventTest(QEvent *event) override; private: PlayState * game; GraphicsScene *scene; @@ -176,7 +176,7 @@ private: public: CustomSpaceTransition(QWidget *widget, PlayState *game, QEvent::Type type, int key); protected: - virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE; + virtual bool eventTest(QEvent *event) override; private: PlayState *game; }; diff --git a/examples/widgets/animation/sub-attaq/submarine.h b/examples/widgets/animation/sub-attaq/submarine.h index 179fe62ed0..abfdca6195 100644 --- a/examples/widgets/animation/sub-attaq/submarine.h +++ b/examples/widgets/animation/sub-attaq/submarine.h @@ -81,7 +81,7 @@ public: void launchTorpedo(int speed); void destroy(); - virtual int type() const Q_DECL_OVERRIDE; + virtual int type() const override; QGraphicsRotation *rotation() const { return graphicsRotation; } diff --git a/examples/widgets/animation/sub-attaq/submarine_p.h b/examples/widgets/animation/sub-attaq/submarine_p.h index 72aa761ed4..b8d5532962 100644 --- a/examples/widgets/animation/sub-attaq/submarine_p.h +++ b/examples/widgets/animation/sub-attaq/submarine_p.h @@ -93,7 +93,7 @@ protected slots: } protected: - void onEntry(QEvent *e) Q_DECL_OVERRIDE + void onEntry(QEvent *e) override { if (submarine->currentDirection() == SubMarine::Left) { movementAnimation->setEndValue(QPointF(0,submarine->y())); @@ -125,14 +125,14 @@ public: } protected: - void onEntry(QEvent *e) Q_DECL_OVERRIDE + void onEntry(QEvent *e) override { returnAnimation->stop(); returnAnimation->setEndValue(submarine->currentDirection() == SubMarine::Right ? 360. : 180.); QAnimationState::onEntry(e); } - void onExit(QEvent *e) Q_DECL_OVERRIDE + void onExit(QEvent *e) override { submarine->currentDirection() == SubMarine::Right ? submarine->setCurrentDirection(SubMarine::Left) : submarine->setCurrentDirection(SubMarine::Right); QAnimationState::onExit(e); |