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/scroller/graphicsview/main.cpp | |
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/scroller/graphicsview/main.cpp')
-rw-r--r-- | examples/widgets/scroller/graphicsview/main.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/examples/widgets/scroller/graphicsview/main.cpp b/examples/widgets/scroller/graphicsview/main.cpp index 4009041cd8..c33a3091ed 100644 --- a/examples/widgets/scroller/graphicsview/main.cpp +++ b/examples/widgets/scroller/graphicsview/main.cpp @@ -74,7 +74,7 @@ public: setFlag(QGraphicsItem::ItemClipsToShape, true); } - QRectF boundingRect() const Q_DECL_OVERRIDE + QRectF boundingRect() const override { // here we only want the size of the children and not the size of the children of the children... qreal halfpw = m_pen.widthF() / 2; @@ -85,7 +85,7 @@ public: return rect; } - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override { Q_UNUSED(option); Q_UNUSED(widget); @@ -114,7 +114,7 @@ public: : QGraphicsObject(parent) { } - QRectF boundingRect() const Q_DECL_OVERRIDE + QRectF boundingRect() const override { QRectF rect; foreach (QGraphicsItem *item, childItems()) @@ -122,7 +122,7 @@ public: return rect; } - void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) Q_DECL_OVERRIDE + void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override { } }; @@ -150,7 +150,7 @@ public: return m_viewport; } - bool event(QEvent *e) Q_DECL_OVERRIDE + bool event(QEvent *e) override { switch (e->type()) { // ![2] @@ -179,7 +179,7 @@ public: return QGraphicsObject::event(e); } - bool sceneEvent(QEvent *e) Q_DECL_OVERRIDE + bool sceneEvent(QEvent *e) override { switch (e->type()) { case QEvent::TouchBegin: { @@ -204,12 +204,12 @@ public: return QGraphicsObject::sceneEvent(e); } - QRectF boundingRect() const Q_DECL_OVERRIDE + QRectF boundingRect() const override { return QRectF(0, 0, m_size.width() + 3, m_size.height()); } - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override { Q_UNUSED(option); Q_UNUSED(widget); @@ -275,7 +275,7 @@ public: protected: - void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE + void resizeEvent(QResizeEvent *e) override { // resize the scene according to our own size to prevent scrolling m_scene->setSceneRect(0, 0, m_view->viewport()->width(), m_view->viewport()->height()); |