summaryrefslogtreecommitdiffstats
path: root/examples/touch
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2014-07-14 09:13:02 +0200
committerOlivier Goffart <ogoffart@woboq.com>2014-07-15 08:44:44 +0200
commit3b0c2b7c1b3ccdfe6867884a7e210bfc63e10f84 (patch)
tree4c75a4fa9f023c4bfc6746a4412922a8efe3b017 /examples/touch
parent6d87e3ed40173eac8c275d5926266359d53c74c7 (diff)
Examples: Add Q_DECL_OVERRIDE to overridden functions
Q_DECL_OVERRIDE (which expands to 'override' for supported compiler) helps to declare the intent (that it is an overridden function) and force compilation error when there is no such virtual function in the base class. The examples should show the best practice of having it, as it may save the programmer quite some time in case of change of API or typo in the function name or arguments. This change was done automatically with clang-modernize -add-override -override-macros And fixed MSVC compilation by removing inline for TorrentViewDelegate::paint Change-Id: Ice66ae93fae571266f908703d5b8892b2c1ebb1a Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Diffstat (limited to 'examples/touch')
-rw-r--r--examples/touch/fingerpaint/mainwindow.h2
-rw-r--r--examples/touch/fingerpaint/scribblearea.h6
-rw-r--r--examples/touch/knobs/knob.h2
-rw-r--r--examples/touch/pinchzoom/graphicsview.h2
-rw-r--r--examples/touch/pinchzoom/mouse.h8
5 files changed, 10 insertions, 10 deletions
diff --git a/examples/touch/fingerpaint/mainwindow.h b/examples/touch/fingerpaint/mainwindow.h
index 4d97f7e13f..997ea064f2 100644
--- a/examples/touch/fingerpaint/mainwindow.h
+++ b/examples/touch/fingerpaint/mainwindow.h
@@ -55,7 +55,7 @@ public:
MainWindow();
protected:
- void closeEvent(QCloseEvent *event);
+ void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
private slots:
void open();
diff --git a/examples/touch/fingerpaint/scribblearea.h b/examples/touch/fingerpaint/scribblearea.h
index e6c8e8d155..2019bfc58f 100644
--- a/examples/touch/fingerpaint/scribblearea.h
+++ b/examples/touch/fingerpaint/scribblearea.h
@@ -64,9 +64,9 @@ public slots:
void print();
protected:
- void paintEvent(QPaintEvent *event);
- void resizeEvent(QResizeEvent *event);
- bool event(QEvent *event);
+ void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
private:
void resizeImage(QImage *image, const QSize &newSize);
diff --git a/examples/touch/knobs/knob.h b/examples/touch/knobs/knob.h
index 645e2174a8..a3315a9b1d 100644
--- a/examples/touch/knobs/knob.h
+++ b/examples/touch/knobs/knob.h
@@ -48,7 +48,7 @@ class Knob : public QGraphicsEllipseItem
public:
Knob();
- bool sceneEvent(QEvent *event);
+ bool sceneEvent(QEvent *event) Q_DECL_OVERRIDE;
};
#endif // KNOB_H
diff --git a/examples/touch/pinchzoom/graphicsview.h b/examples/touch/pinchzoom/graphicsview.h
index 5553f4b6d6..63728acaf6 100644
--- a/examples/touch/pinchzoom/graphicsview.h
+++ b/examples/touch/pinchzoom/graphicsview.h
@@ -48,7 +48,7 @@ class GraphicsView : public QGraphicsView
public:
GraphicsView(QGraphicsScene *scene = 0, QWidget *parent = 0);
- bool viewportEvent(QEvent *event);
+ bool viewportEvent(QEvent *event) Q_DECL_OVERRIDE;
private:
qreal totalScaleFactor;
diff --git a/examples/touch/pinchzoom/mouse.h b/examples/touch/pinchzoom/mouse.h
index 22b571b692..9a705e5062 100644
--- a/examples/touch/pinchzoom/mouse.h
+++ b/examples/touch/pinchzoom/mouse.h
@@ -51,13 +51,13 @@ class Mouse : public QGraphicsObject
public:
Mouse();
- QRectF boundingRect() const;
- QPainterPath shape() const;
+ QRectF boundingRect() const Q_DECL_OVERRIDE;
+ QPainterPath shape() const Q_DECL_OVERRIDE;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
- QWidget *widget);
+ QWidget *widget) Q_DECL_OVERRIDE;
protected:
- void timerEvent(QTimerEvent *event);
+ void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
private:
qreal angle;