summaryrefslogtreecommitdiffstats
path: root/examples/opengl
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/opengl
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/opengl')
-rw-r--r--examples/opengl/2dpainting/glwidget.h2
-rw-r--r--examples/opengl/2dpainting/widget.h2
-rw-r--r--examples/opengl/cube/mainwidget.h12
-rw-r--r--examples/opengl/framebufferobject2/glwidget.h12
-rw-r--r--examples/opengl/grabber/glwidget.h10
-rw-r--r--examples/opengl/hellogl/glwidget.h14
-rw-r--r--examples/opengl/hellogl/window.h2
-rw-r--r--examples/opengl/hellowindow/hellowindow.h4
-rw-r--r--examples/opengl/overpainting/glwidget.h14
-rw-r--r--examples/opengl/paintedwindow/paintedwindow.h4
-rw-r--r--examples/opengl/pbuffers/glwidget.h10
-rw-r--r--examples/opengl/samplebuffers/glwidget.h8
-rw-r--r--examples/opengl/textures/glwidget.h16
13 files changed, 55 insertions, 55 deletions
diff --git a/examples/opengl/2dpainting/glwidget.h b/examples/opengl/2dpainting/glwidget.h
index 0e6786a308..fec1be12f7 100644
--- a/examples/opengl/2dpainting/glwidget.h
+++ b/examples/opengl/2dpainting/glwidget.h
@@ -57,7 +57,7 @@ public slots:
void animate();
protected:
- void paintEvent(QPaintEvent *event);
+ void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
private:
Helper *helper;
diff --git a/examples/opengl/2dpainting/widget.h b/examples/opengl/2dpainting/widget.h
index 474ce2be3d..9e2602e73c 100644
--- a/examples/opengl/2dpainting/widget.h
+++ b/examples/opengl/2dpainting/widget.h
@@ -57,7 +57,7 @@ public slots:
void animate();
protected:
- void paintEvent(QPaintEvent *event);
+ void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
private:
Helper *helper;
diff --git a/examples/opengl/cube/mainwidget.h b/examples/opengl/cube/mainwidget.h
index 2e6b6bcc77..92b3aabf46 100644
--- a/examples/opengl/cube/mainwidget.h
+++ b/examples/opengl/cube/mainwidget.h
@@ -63,13 +63,13 @@ public:
~MainWidget();
protected:
- void mousePressEvent(QMouseEvent *e);
- void mouseReleaseEvent(QMouseEvent *e);
- void timerEvent(QTimerEvent *e);
+ void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
- void initializeGL();
- void resizeGL(int w, int h);
- void paintGL();
+ void initializeGL() Q_DECL_OVERRIDE;
+ void resizeGL(int w, int h) Q_DECL_OVERRIDE;
+ void paintGL() Q_DECL_OVERRIDE;
void initShaders();
void initTextures();
diff --git a/examples/opengl/framebufferobject2/glwidget.h b/examples/opengl/framebufferobject2/glwidget.h
index f3f7640d28..2991a4fdf2 100644
--- a/examples/opengl/framebufferobject2/glwidget.h
+++ b/examples/opengl/framebufferobject2/glwidget.h
@@ -45,12 +45,12 @@ class GLWidget : public QGLWidget
public:
GLWidget(QWidget *parent);
~GLWidget();
- void initializeGL();
- void resizeGL(int w, int h);
- void paintGL();
- void timerEvent(QTimerEvent *) { update(); }
- void mousePressEvent(QMouseEvent *) { killTimer(timerId); }
- void mouseReleaseEvent(QMouseEvent *) { timerId = startTimer(20); }
+ void initializeGL() Q_DECL_OVERRIDE;
+ void resizeGL(int w, int h) Q_DECL_OVERRIDE;
+ void paintGL() Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE { update(); }
+ void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE { killTimer(timerId); }
+ void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE { timerId = startTimer(20); }
void drawCube(int i, GLfloat z, GLfloat ri, GLfloat jmp, GLfloat amp);
diff --git a/examples/opengl/grabber/glwidget.h b/examples/opengl/grabber/glwidget.h
index 976d22a421..12071be173 100644
--- a/examples/opengl/grabber/glwidget.h
+++ b/examples/opengl/grabber/glwidget.h
@@ -66,11 +66,11 @@ signals:
void zRotationChanged(int angle);
protected:
- void initializeGL();
- void paintGL();
- void resizeGL(int width, int height);
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
+ void initializeGL() Q_DECL_OVERRIDE;
+ void paintGL() Q_DECL_OVERRIDE;
+ void resizeGL(int width, int height) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
private slots:
void advanceGears();
diff --git a/examples/opengl/hellogl/glwidget.h b/examples/opengl/hellogl/glwidget.h
index 3344e931e7..0989be1dc6 100644
--- a/examples/opengl/hellogl/glwidget.h
+++ b/examples/opengl/hellogl/glwidget.h
@@ -54,8 +54,8 @@ public:
GLWidget(QWidget *parent = 0);
~GLWidget();
- QSize minimumSizeHint() const;
- QSize sizeHint() const;
+ QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
//! [0]
//! [1]
@@ -72,11 +72,11 @@ signals:
//! [2]
protected:
- void initializeGL();
- void paintGL();
- void resizeGL(int width, int height);
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
+ void initializeGL() Q_DECL_OVERRIDE;
+ void paintGL() Q_DECL_OVERRIDE;
+ void resizeGL(int width, int height) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
//! [2]
//! [3]
diff --git a/examples/opengl/hellogl/window.h b/examples/opengl/hellogl/window.h
index 68862fbcfe..900e6b13fc 100644
--- a/examples/opengl/hellogl/window.h
+++ b/examples/opengl/hellogl/window.h
@@ -57,7 +57,7 @@ public:
Window();
protected:
- void keyPressEvent(QKeyEvent *event);
+ void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
private:
QSlider *createSlider();
diff --git a/examples/opengl/hellowindow/hellowindow.h b/examples/opengl/hellowindow/hellowindow.h
index 6d66f0204a..9fb7d109b9 100644
--- a/examples/opengl/hellowindow/hellowindow.h
+++ b/examples/opengl/hellowindow/hellowindow.h
@@ -98,10 +98,10 @@ public:
QColor color() const;
void updateColor();
- void exposeEvent(QExposeEvent *event);
+ void exposeEvent(QExposeEvent *event) Q_DECL_OVERRIDE;
private:
- void mousePressEvent(QMouseEvent *);
+ void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
int m_colorIndex;
QColor m_color;
diff --git a/examples/opengl/overpainting/glwidget.h b/examples/opengl/overpainting/glwidget.h
index cd3a125b38..1d1d48458d 100644
--- a/examples/opengl/overpainting/glwidget.h
+++ b/examples/opengl/overpainting/glwidget.h
@@ -57,7 +57,7 @@ public:
~GLWidget();
//! [0]
- QSize sizeHint() const;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
int xRotation() const { return xRot; }
int yRotation() const { return yRot; }
int zRotation() const { return zRot; }
@@ -69,12 +69,12 @@ public slots:
//! [1]
protected:
- void initializeGL();
- void paintEvent(QPaintEvent *event);
- void resizeGL(int width, int height);
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void showEvent(QShowEvent *event);
+ void initializeGL() Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ void resizeGL(int width, int height) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
private slots:
void animate();
diff --git a/examples/opengl/paintedwindow/paintedwindow.h b/examples/opengl/paintedwindow/paintedwindow.h
index f185cd3733..140af6db4d 100644
--- a/examples/opengl/paintedwindow/paintedwindow.h
+++ b/examples/opengl/paintedwindow/paintedwindow.h
@@ -74,8 +74,8 @@ private slots:
void rotationDone();
private:
- void exposeEvent(QExposeEvent *);
- void mousePressEvent(QMouseEvent *);
+ void exposeEvent(QExposeEvent *) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
void paint(QPainter *painter, const QRect &rect);
diff --git a/examples/opengl/pbuffers/glwidget.h b/examples/opengl/pbuffers/glwidget.h
index c4d71c0b76..1d23b7772a 100644
--- a/examples/opengl/pbuffers/glwidget.h
+++ b/examples/opengl/pbuffers/glwidget.h
@@ -57,11 +57,11 @@ public:
~GLWidget();
protected:
- void initializeGL();
- void paintGL();
- void resizeGL(int width, int height);
- void mousePressEvent(QMouseEvent *) { setAnimationPaused(true); }
- void mouseReleaseEvent(QMouseEvent *) { setAnimationPaused(false); }
+ void initializeGL() Q_DECL_OVERRIDE;
+ void paintGL() Q_DECL_OVERRIDE;
+ void resizeGL(int width, int height) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE { setAnimationPaused(true); }
+ void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE { setAnimationPaused(false); }
private:
void initializeGeometry();
diff --git a/examples/opengl/samplebuffers/glwidget.h b/examples/opengl/samplebuffers/glwidget.h
index 0e20b4dd4d..494c5861df 100644
--- a/examples/opengl/samplebuffers/glwidget.h
+++ b/examples/opengl/samplebuffers/glwidget.h
@@ -46,10 +46,10 @@ public:
GLWidget(QWidget *parent);
protected:
- void initializeGL();
- void resizeGL(int w, int h);
- void paintGL();
- void timerEvent(QTimerEvent *);
+ void initializeGL() Q_DECL_OVERRIDE;
+ void resizeGL(int w, int h) Q_DECL_OVERRIDE;
+ void paintGL() Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
void makeObject();
void quad(GLenum primitive, GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2,
diff --git a/examples/opengl/textures/glwidget.h b/examples/opengl/textures/glwidget.h
index b210b0fd8f..959dfdd5e7 100644
--- a/examples/opengl/textures/glwidget.h
+++ b/examples/opengl/textures/glwidget.h
@@ -55,8 +55,8 @@ public:
explicit GLWidget(QWidget *parent = 0, QGLWidget *shareWidget = 0);
~GLWidget();
- QSize minimumSizeHint() const;
- QSize sizeHint() const;
+ QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const Q_DECL_OVERRIDE;
void rotateBy(int xAngle, int yAngle, int zAngle);
void setClearColor(const QColor &color);
@@ -64,12 +64,12 @@ signals:
void clicked();
protected:
- void initializeGL();
- void paintGL();
- void resizeGL(int width, int height);
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
+ void initializeGL() Q_DECL_OVERRIDE;
+ void paintGL() Q_DECL_OVERRIDE;
+ void resizeGL(int width, int height) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
private:
void makeObject();