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>
This commit is contained in:
Olivier Goffart 2014-07-14 09:13:02 +02:00
parent 6d87e3ed40
commit 3b0c2b7c1b
195 changed files with 739 additions and 739 deletions

View File

@ -49,8 +49,8 @@ public:
AnalogClockWindow(); AnalogClockWindow();
protected: protected:
void timerEvent(QTimerEvent *); void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
void render(QPainter *p); void render(QPainter *p) Q_DECL_OVERRIDE;
private: private:
int m_timerId; int m_timerId;

View File

@ -53,8 +53,8 @@ class TriangleWindow : public OpenGLWindow
public: public:
TriangleWindow(); TriangleWindow();
void initialize(); void initialize() Q_DECL_OVERRIDE;
void render(); void render() Q_DECL_OVERRIDE;
private: private:
GLuint loadShader(GLenum type, const char *source); GLuint loadShader(GLenum type, const char *source);

View File

@ -67,9 +67,9 @@ public slots:
void renderNow(); void renderNow();
protected: protected:
bool event(QEvent *event); bool event(QEvent *event) Q_DECL_OVERRIDE;
void exposeEvent(QExposeEvent *event); void exposeEvent(QExposeEvent *event) Q_DECL_OVERRIDE;
private: private:
bool m_update_pending; bool m_update_pending;

View File

@ -57,10 +57,10 @@ public slots:
void renderNow(); void renderNow();
protected: protected:
bool event(QEvent *event); bool event(QEvent *event) Q_DECL_OVERRIDE;
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
void exposeEvent(QExposeEvent *event); void exposeEvent(QExposeEvent *event) Q_DECL_OVERRIDE;
private: private:
QBackingStore *m_backingStore; QBackingStore *m_backingStore;

View File

@ -59,7 +59,7 @@ public:
explicit SessionWidget(const QNetworkConfiguration &config, QWidget *parent = 0); explicit SessionWidget(const QNetworkConfiguration &config, QWidget *parent = 0);
~SessionWidget(); ~SessionWidget();
void timerEvent(QTimerEvent *); void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
private: private:
void updateSessionState(QNetworkSession::State state); void updateSessionState(QNetworkSession::State state);

View File

@ -55,7 +55,7 @@ public:
~FortuneThread(); ~FortuneThread();
void requestNewFortune(const QString &hostName, quint16 port); void requestNewFortune(const QString &hostName, quint16 port);
void run(); void run() Q_DECL_OVERRIDE;
signals: signals:
void newFortune(const QString &fortune); void newFortune(const QString &fortune);

View File

@ -60,7 +60,7 @@ class GSuggestCompletion : public QObject
public: public:
GSuggestCompletion(QLineEdit *parent = 0); GSuggestCompletion(QLineEdit *parent = 0);
~GSuggestCompletion(); ~GSuggestCompletion();
bool eventFilter(QObject *obj, QEvent *ev); bool eventFilter(QObject *obj, QEvent *ev) Q_DECL_OVERRIDE;
void showCompletion(const QStringList &choices, const QStringList &hits); void showCompletion(const QStringList &choices, const QStringList &hits);
public slots: public slots:

View File

@ -78,7 +78,7 @@ signals:
void newMessage(const QString &from, const QString &message); void newMessage(const QString &from, const QString &message);
protected: protected:
void timerEvent(QTimerEvent *timerEvent); void timerEvent(QTimerEvent *timerEvent) Q_DECL_OVERRIDE;
private slots: private slots:
void processReadyRead(); void processReadyRead();

View File

@ -56,7 +56,7 @@ signals:
void newConnection(Connection *connection); void newConnection(Connection *connection);
protected: protected:
void incomingConnection(qintptr socketDescriptor); void incomingConnection(qintptr socketDescriptor) Q_DECL_OVERRIDE;
}; };
#endif #endif

View File

@ -53,7 +53,7 @@ public:
FortuneServer(QObject *parent = 0); FortuneServer(QObject *parent = 0);
protected: protected:
void incomingConnection(qintptr socketDescriptor); void incomingConnection(qintptr socketDescriptor) Q_DECL_OVERRIDE;
private: private:
QStringList fortunes; QStringList fortunes;

View File

@ -52,7 +52,7 @@ class FortuneThread : public QThread
public: public:
FortuneThread(int socketDescriptor, const QString &fortune, QObject *parent); FortuneThread(int socketDescriptor, const QString &fortune, QObject *parent);
void run(); void run() Q_DECL_OVERRIDE;
signals: signals:
void error(QTcpSocket::SocketError socketError); void error(QTcpSocket::SocketError socketError);

View File

@ -90,7 +90,7 @@ signals:
void pieceVerified(int pieceIndex, bool verified); void pieceVerified(int pieceIndex, bool verified);
protected: protected:
void run(); void run() Q_DECL_OVERRIDE;
private slots: private slots:
bool verifySinglePiece(int pieceIndex); bool verifySinglePiece(int pieceIndex);

View File

@ -57,8 +57,8 @@ signals:
void fileDropped(const QString &fileName); void fileDropped(const QString &fileName);
protected: protected:
void dragMoveEvent(QDragMoveEvent *event); void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
void dropEvent(QDropEvent *event); void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
#endif #endif
}; };
@ -69,8 +69,8 @@ class TorrentViewDelegate : public QItemDelegate
public: public:
inline TorrentViewDelegate(MainWindow *mainWindow) : QItemDelegate(mainWindow) {} inline TorrentViewDelegate(MainWindow *mainWindow) : QItemDelegate(mainWindow) {}
inline void paint(QPainter *painter, const QStyleOptionViewItem &option, void paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index ) const const QModelIndex &index ) const Q_DECL_OVERRIDE
{ {
if (index.column() != 2) { if (index.column() != 2) {
QItemDelegate::paint(painter, option, index); QItemDelegate::paint(painter, option, index);

View File

@ -63,11 +63,11 @@ class MainWindow : public QMainWindow
public: public:
MainWindow(QWidget *parent = 0); MainWindow(QWidget *parent = 0);
QSize sizeHint() const; QSize sizeHint() const Q_DECL_OVERRIDE;
const TorrentClient *clientForRow(int row) const; const TorrentClient *clientForRow(int row) const;
protected: protected:
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
private slots: private slots:
void loadSettings(); void loadSettings();

View File

@ -112,14 +112,14 @@ public:
qint64 uploadSpeed() const; qint64 uploadSpeed() const;
bool canTransferMore() const; bool canTransferMore() const;
qint64 bytesAvailable() const { return incomingBuffer.size() + QTcpSocket::bytesAvailable(); } qint64 bytesAvailable() const Q_DECL_OVERRIDE { return incomingBuffer.size() + QTcpSocket::bytesAvailable(); }
qint64 socketBytesAvailable() const { return socket.bytesAvailable(); } qint64 socketBytesAvailable() const { return socket.bytesAvailable(); }
qint64 socketBytesToWrite() const { return socket.bytesToWrite(); } qint64 socketBytesToWrite() const { return socket.bytesToWrite(); }
void setReadBufferSize(qint64 size); void setReadBufferSize(qint64 size) Q_DECL_OVERRIDE;
void connectToHost(const QHostAddress &address, void connectToHost(const QHostAddress &address,
quint16 port, OpenMode openMode = ReadWrite); quint16 port, OpenMode openMode = ReadWrite) Q_DECL_OVERRIDE;
void diconnectFromHost(); void diconnectFromHost();
signals: signals:
@ -138,11 +138,11 @@ signals:
void bytesReceived(qint64 size); void bytesReceived(qint64 size);
protected: protected:
void timerEvent(QTimerEvent *event); void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
qint64 readData(char *data, qint64 maxlen); qint64 readData(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
qint64 readLineData(char *data, qint64 maxlen); qint64 readLineData(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
qint64 writeData(const char *data, qint64 len); qint64 writeData(const char *data, qint64 len) Q_DECL_OVERRIDE;
private slots: private slots:
void sendHandShake(); void sendHandShake();

View File

@ -158,7 +158,7 @@ public slots:
void setupIncomingConnection(PeerWireClient *client); void setupIncomingConnection(PeerWireClient *client);
protected slots: protected slots:
void timerEvent(QTimerEvent *event); void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
private slots: private slots:
// File management // File management

View File

@ -58,7 +58,7 @@ public:
void removeClient(TorrentClient *client); void removeClient(TorrentClient *client);
protected: protected:
void incomingConnection(qintptr socketDescriptor); void incomingConnection(qintptr socketDescriptor) Q_DECL_OVERRIDE;
private slots: private slots:
void removeClient(); void removeClient();

View File

@ -78,7 +78,7 @@ signals:
void stopped(); void stopped();
protected: protected:
void timerEvent(QTimerEvent *event); void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
private slots: private slots:
void fetchPeerList(); void fetchPeerList();

View File

@ -57,7 +57,7 @@ public slots:
void animate(); void animate();
protected: protected:
void paintEvent(QPaintEvent *event); void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
private: private:
Helper *helper; Helper *helper;

View File

@ -57,7 +57,7 @@ public slots:
void animate(); void animate();
protected: protected:
void paintEvent(QPaintEvent *event); void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
private: private:
Helper *helper; Helper *helper;

View File

@ -63,13 +63,13 @@ public:
~MainWidget(); ~MainWidget();
protected: protected:
void mousePressEvent(QMouseEvent *e); void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QMouseEvent *e); void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
void timerEvent(QTimerEvent *e); void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
void initializeGL(); void initializeGL() Q_DECL_OVERRIDE;
void resizeGL(int w, int h); void resizeGL(int w, int h) Q_DECL_OVERRIDE;
void paintGL(); void paintGL() Q_DECL_OVERRIDE;
void initShaders(); void initShaders();
void initTextures(); void initTextures();

View File

@ -45,12 +45,12 @@ class GLWidget : public QGLWidget
public: public:
GLWidget(QWidget *parent); GLWidget(QWidget *parent);
~GLWidget(); ~GLWidget();
void initializeGL(); void initializeGL() Q_DECL_OVERRIDE;
void resizeGL(int w, int h); void resizeGL(int w, int h) Q_DECL_OVERRIDE;
void paintGL(); void paintGL() Q_DECL_OVERRIDE;
void timerEvent(QTimerEvent *) { update(); } void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE { update(); }
void mousePressEvent(QMouseEvent *) { killTimer(timerId); } void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE { killTimer(timerId); }
void mouseReleaseEvent(QMouseEvent *) { timerId = startTimer(20); } void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE { timerId = startTimer(20); }
void drawCube(int i, GLfloat z, GLfloat ri, GLfloat jmp, GLfloat amp); void drawCube(int i, GLfloat z, GLfloat ri, GLfloat jmp, GLfloat amp);

View File

@ -66,11 +66,11 @@ signals:
void zRotationChanged(int angle); void zRotationChanged(int angle);
protected: protected:
void initializeGL(); void initializeGL() Q_DECL_OVERRIDE;
void paintGL(); void paintGL() Q_DECL_OVERRIDE;
void resizeGL(int width, int height); void resizeGL(int width, int height) Q_DECL_OVERRIDE;
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseMoveEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
private slots: private slots:
void advanceGears(); void advanceGears();

View File

@ -54,8 +54,8 @@ public:
GLWidget(QWidget *parent = 0); GLWidget(QWidget *parent = 0);
~GLWidget(); ~GLWidget();
QSize minimumSizeHint() const; QSize minimumSizeHint() const Q_DECL_OVERRIDE;
QSize sizeHint() const; QSize sizeHint() const Q_DECL_OVERRIDE;
//! [0] //! [0]
//! [1] //! [1]
@ -72,11 +72,11 @@ signals:
//! [2] //! [2]
protected: protected:
void initializeGL(); void initializeGL() Q_DECL_OVERRIDE;
void paintGL(); void paintGL() Q_DECL_OVERRIDE;
void resizeGL(int width, int height); void resizeGL(int width, int height) Q_DECL_OVERRIDE;
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseMoveEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
//! [2] //! [2]
//! [3] //! [3]

View File

@ -57,7 +57,7 @@ public:
Window(); Window();
protected: protected:
void keyPressEvent(QKeyEvent *event); void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
private: private:
QSlider *createSlider(); QSlider *createSlider();

View File

@ -98,10 +98,10 @@ public:
QColor color() const; QColor color() const;
void updateColor(); void updateColor();
void exposeEvent(QExposeEvent *event); void exposeEvent(QExposeEvent *event) Q_DECL_OVERRIDE;
private: private:
void mousePressEvent(QMouseEvent *); void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
int m_colorIndex; int m_colorIndex;
QColor m_color; QColor m_color;

View File

@ -57,7 +57,7 @@ public:
~GLWidget(); ~GLWidget();
//! [0] //! [0]
QSize sizeHint() const; QSize sizeHint() const Q_DECL_OVERRIDE;
int xRotation() const { return xRot; } int xRotation() const { return xRot; }
int yRotation() const { return yRot; } int yRotation() const { return yRot; }
int zRotation() const { return zRot; } int zRotation() const { return zRot; }
@ -69,12 +69,12 @@ public slots:
//! [1] //! [1]
protected: protected:
void initializeGL(); void initializeGL() Q_DECL_OVERRIDE;
void paintEvent(QPaintEvent *event); void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
void resizeGL(int width, int height); void resizeGL(int width, int height) Q_DECL_OVERRIDE;
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseMoveEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void showEvent(QShowEvent *event); void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
private slots: private slots:
void animate(); void animate();

View File

@ -74,8 +74,8 @@ private slots:
void rotationDone(); void rotationDone();
private: private:
void exposeEvent(QExposeEvent *); void exposeEvent(QExposeEvent *) Q_DECL_OVERRIDE;
void mousePressEvent(QMouseEvent *); void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
void paint(QPainter *painter, const QRect &rect); void paint(QPainter *painter, const QRect &rect);

View File

@ -57,11 +57,11 @@ public:
~GLWidget(); ~GLWidget();
protected: protected:
void initializeGL(); void initializeGL() Q_DECL_OVERRIDE;
void paintGL(); void paintGL() Q_DECL_OVERRIDE;
void resizeGL(int width, int height); void resizeGL(int width, int height) Q_DECL_OVERRIDE;
void mousePressEvent(QMouseEvent *) { setAnimationPaused(true); } void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE { setAnimationPaused(true); }
void mouseReleaseEvent(QMouseEvent *) { setAnimationPaused(false); } void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE { setAnimationPaused(false); }
private: private:
void initializeGeometry(); void initializeGeometry();

View File

@ -46,10 +46,10 @@ public:
GLWidget(QWidget *parent); GLWidget(QWidget *parent);
protected: protected:
void initializeGL(); void initializeGL() Q_DECL_OVERRIDE;
void resizeGL(int w, int h); void resizeGL(int w, int h) Q_DECL_OVERRIDE;
void paintGL(); void paintGL() Q_DECL_OVERRIDE;
void timerEvent(QTimerEvent *); void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
void makeObject(); void makeObject();
void quad(GLenum primitive, GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2, void quad(GLenum primitive, GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2,

View File

@ -55,8 +55,8 @@ public:
explicit GLWidget(QWidget *parent = 0, QGLWidget *shareWidget = 0); explicit GLWidget(QWidget *parent = 0, QGLWidget *shareWidget = 0);
~GLWidget(); ~GLWidget();
QSize minimumSizeHint() const; QSize minimumSizeHint() const Q_DECL_OVERRIDE;
QSize sizeHint() const; QSize sizeHint() const Q_DECL_OVERRIDE;
void rotateBy(int xAngle, int yAngle, int zAngle); void rotateBy(int xAngle, int yAngle, int zAngle);
void setClearColor(const QColor &color); void setClearColor(const QColor &color);
@ -64,12 +64,12 @@ signals:
void clicked(); void clicked();
protected: protected:
void initializeGL(); void initializeGL() Q_DECL_OVERRIDE;
void paintGL(); void paintGL() Q_DECL_OVERRIDE;
void resizeGL(int width, int height); void resizeGL(int width, int height) Q_DECL_OVERRIDE;
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseMoveEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
private: private:
void makeObject(); void makeObject();

View File

@ -48,16 +48,16 @@ public:
Window(QScreen *screen); Window(QScreen *screen);
protected: protected:
void mousePressEvent(QMouseEvent *); void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
void mouseMoveEvent(QMouseEvent *); void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QMouseEvent *); void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
void keyPressEvent(QKeyEvent *); void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
void exposeEvent(QExposeEvent *); void exposeEvent(QExposeEvent *) Q_DECL_OVERRIDE;
void resizeEvent(QResizeEvent *); void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
void timerEvent(QTimerEvent *); void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
private: private:
void render(); void render();

View File

@ -55,16 +55,16 @@ public:
BookDelegate(QObject *parent); BookDelegate(QObject *parent);
void paint(QPainter *painter, const QStyleOptionViewItem &option, void paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const; const QModelIndex &index) const Q_DECL_OVERRIDE;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE;
bool editorEvent(QEvent *event, QAbstractItemModel *model, bool editorEvent(QEvent *event, QAbstractItemModel *model,
const QStyleOptionViewItem &option, const QStyleOptionViewItem &option,
const QModelIndex &index); const QModelIndex &index) Q_DECL_OVERRIDE;
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index) const; const QModelIndex &index) const Q_DECL_OVERRIDE;
private: private:
QPixmap star; QPixmap star;

View File

@ -56,8 +56,8 @@ public:
int id(); int id();
protected: protected:
void hoverEnterEvent(QGraphicsSceneHoverEvent *event); void hoverEnterEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
private slots: private slots:
void setFrame(int frame); void setFrame(int frame);

View File

@ -56,7 +56,7 @@ public:
View(const QString &items, const QString &images, QWidget *parent = 0); View(const QString &items, const QString &images, QWidget *parent = 0);
protected: protected:
void mouseReleaseEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
//! [0] //! [0]
//! [1] //! [1]

View File

@ -51,7 +51,7 @@ class CustomSqlModel : public QSqlQueryModel
public: public:
CustomSqlModel(QObject *parent = 0); CustomSqlModel(QObject *parent = 0);
QVariant data(const QModelIndex &item, int role) const; QVariant data(const QModelIndex &item, int role) const Q_DECL_OVERRIDE;
}; };
//! [0] //! [0]

View File

@ -50,8 +50,8 @@ class EditableSqlModel : public QSqlQueryModel
public: public:
EditableSqlModel(QObject *parent = 0); EditableSqlModel(QObject *parent = 0);
Qt::ItemFlags flags(const QModelIndex &index) const; Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
bool setData(const QModelIndex &index, const QVariant &value, int role); bool setData(const QModelIndex &index, const QVariant &value, int role) Q_DECL_OVERRIDE;
private: private:
bool setFirstName(int personId, const QString &firstName); bool setFirstName(int personId, const QString &firstName);

View File

@ -108,7 +108,7 @@ class CustomModel: public QSqlTableModel
Q_OBJECT Q_OBJECT
public: public:
explicit CustomModel(QObject *parent = 0, QSqlDatabase db = QSqlDatabase()):QSqlTableModel(parent, db) {} explicit CustomModel(QObject *parent = 0, QSqlDatabase db = QSqlDatabase()):QSqlTableModel(parent, db) {}
QVariant data(const QModelIndex &idx, int role) const QVariant data(const QModelIndex &idx, int role) const Q_DECL_OVERRIDE
{ {
if (role == Qt::BackgroundRole && isDirty(idx)) if (role == Qt::BackgroundRole && isDirty(idx))
return QBrush(QColor(Qt::yellow)); return QBrush(QColor(Qt::yellow));

View File

@ -55,15 +55,15 @@ public:
MandelbrotWidget(QWidget *parent = 0); MandelbrotWidget(QWidget *parent = 0);
protected: protected:
void paintEvent(QPaintEvent *event); void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
void keyPressEvent(QKeyEvent *event); void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
#ifndef QT_NO_WHEELEVENT #ifndef QT_NO_WHEELEVENT
void wheelEvent(QWheelEvent *event); void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
#endif #endif
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseMoveEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
private slots: private slots:
void updatePixmap(const QImage &image, double scaleFactor); void updatePixmap(const QImage &image, double scaleFactor);

View File

@ -65,7 +65,7 @@ signals:
void renderedImage(const QImage &image, double scaleFactor); void renderedImage(const QImage &image, double scaleFactor);
protected: protected:
void run(); void run() Q_DECL_OVERRIDE;
private: private:
uint rgbFromWaveLength(double wave); uint rgbFromWaveLength(double wave);

View File

@ -58,7 +58,7 @@ class Producer : public QThread
//! [1] //! [2] //! [1] //! [2]
{ {
public: public:
void run() void run() Q_DECL_OVERRIDE
{ {
qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
for (int i = 0; i < DataSize; ++i) { for (int i = 0; i < DataSize; ++i) {
@ -76,7 +76,7 @@ class Consumer : public QThread
{ {
Q_OBJECT Q_OBJECT
public: public:
void run() void run() Q_DECL_OVERRIDE
{ {
for (int i = 0; i < DataSize; ++i) { for (int i = 0; i < DataSize; ++i) {
usedBytes.acquire(); usedBytes.acquire();

View File

@ -64,7 +64,7 @@ public:
{ {
} }
void run() void run() Q_DECL_OVERRIDE
{ {
qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
@ -95,7 +95,7 @@ public:
{ {
} }
void run() void run() Q_DECL_OVERRIDE
{ {
for (int i = 0; i < DataSize; ++i) { for (int i = 0; i < DataSize; ++i) {
mutex.lock(); mutex.lock();

View File

@ -52,8 +52,8 @@ public:
RandomListModel(QObject *parent = 0); RandomListModel(QObject *parent = 0);
~RandomListModel(); ~RandomListModel();
int rowCount(const QModelIndex & = QModelIndex()) const; int rowCount(const QModelIndex & = QModelIndex()) const Q_DECL_OVERRIDE;
QVariant data(const QModelIndex &, int) const; QVariant data(const QModelIndex &, int) const Q_DECL_OVERRIDE;
private: private:
void cacheRows(int, int) const; void cacheRows(int, int) const;

View File

@ -55,7 +55,7 @@ public:
MainWindow(); MainWindow();
protected: protected:
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
private slots: private slots:
void open(); void open();

View File

@ -64,9 +64,9 @@ public slots:
void print(); void print();
protected: protected:
void paintEvent(QPaintEvent *event); void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
bool event(QEvent *event); bool event(QEvent *event) Q_DECL_OVERRIDE;
private: private:
void resizeImage(QImage *image, const QSize &newSize); void resizeImage(QImage *image, const QSize &newSize);

View File

@ -48,7 +48,7 @@ class Knob : public QGraphicsEllipseItem
public: public:
Knob(); Knob();
bool sceneEvent(QEvent *event); bool sceneEvent(QEvent *event) Q_DECL_OVERRIDE;
}; };
#endif // KNOB_H #endif // KNOB_H

View File

@ -48,7 +48,7 @@ class GraphicsView : public QGraphicsView
public: public:
GraphicsView(QGraphicsScene *scene = 0, QWidget *parent = 0); GraphicsView(QGraphicsScene *scene = 0, QWidget *parent = 0);
bool viewportEvent(QEvent *event); bool viewportEvent(QEvent *event) Q_DECL_OVERRIDE;
private: private:
qreal totalScaleFactor; qreal totalScaleFactor;

View File

@ -51,13 +51,13 @@ class Mouse : public QGraphicsObject
public: public:
Mouse(); Mouse();
QRectF boundingRect() const; QRectF boundingRect() const Q_DECL_OVERRIDE;
QPainterPath shape() const; QPainterPath shape() const Q_DECL_OVERRIDE;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget); QWidget *widget) Q_DECL_OVERRIDE;
protected: protected:
void timerEvent(QTimerEvent *event); void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
private: private:
qreal angle; qreal angle;

View File

@ -64,19 +64,19 @@ public:
setCacheMode(DeviceCoordinateCache); setCacheMode(DeviceCoordinateCache);
} }
QRectF boundingRect() const QRectF boundingRect() const Q_DECL_OVERRIDE
{ {
return QRectF(-65, -65, 130, 130); return QRectF(-65, -65, 130, 130);
} }
QPainterPath shape() const QPainterPath shape() const Q_DECL_OVERRIDE
{ {
QPainterPath path; QPainterPath path;
path.addEllipse(boundingRect()); path.addEllipse(boundingRect());
return path; return path;
} }
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *) void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *) Q_DECL_OVERRIDE
{ {
bool down = option->state & QStyle::State_Sunken; bool down = option->state & QStyle::State_Sunken;
QRectF r = boundingRect(); QRectF r = boundingRect();
@ -101,13 +101,13 @@ signals:
void pressed(); void pressed();
protected: protected:
void mousePressEvent(QGraphicsSceneMouseEvent *) void mousePressEvent(QGraphicsSceneMouseEvent *) Q_DECL_OVERRIDE
{ {
emit pressed(); emit pressed();
update(); update();
} }
void mouseReleaseEvent(QGraphicsSceneMouseEvent *) void mouseReleaseEvent(QGraphicsSceneMouseEvent *) Q_DECL_OVERRIDE
{ {
update(); update();
} }
@ -122,7 +122,7 @@ public:
View(QGraphicsScene *scene) : QGraphicsView(scene) { } View(QGraphicsScene *scene) : QGraphicsView(scene) { }
protected: protected:
void resizeEvent(QResizeEvent *event) void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE
{ {
QGraphicsView::resizeEvent(event); QGraphicsView::resizeEvent(event);
fitInView(sceneRect(), Qt::KeepAspectRatio); fitInView(sceneRect(), Qt::KeepAspectRatio);

View File

@ -52,17 +52,17 @@ public:
{ {
} }
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) Q_DECL_OVERRIDE
{ {
painter->drawPixmap(QPointF(), p); painter->drawPixmap(QPointF(), p);
} }
virtual void mousePressEvent(QGraphicsSceneMouseEvent * ) virtual void mousePressEvent(QGraphicsSceneMouseEvent * ) Q_DECL_OVERRIDE
{ {
emit clicked(); emit clicked();
} }
virtual void setGeometry(const QRectF &rect) virtual void setGeometry(const QRectF &rect) Q_DECL_OVERRIDE
{ {
QGraphicsWidget::setGeometry(rect); QGraphicsWidget::setGeometry(rect);
@ -88,7 +88,7 @@ public:
{ {
} }
virtual void resizeEvent(QResizeEvent *) virtual void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE
{ {
fitInView(sceneRect(), Qt::KeepAspectRatio); fitInView(sceneRect(), Qt::KeepAspectRatio);
} }

View File

@ -67,7 +67,7 @@ public:
m_path = QPainterPath(); m_path = QPainterPath();
} }
void updateCurrentTime(int currentTime) void updateCurrentTime(int currentTime) Q_DECL_OVERRIDE
{ {
if (m_pathType == CirclePath) { if (m_pathType == CirclePath) {
if (m_path.isEmpty()) { if (m_path.isEmpty()) {

View File

@ -70,7 +70,7 @@ class QGraphicsRectWidget : public QGraphicsWidget
{ {
public: public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, void paint(QPainter *painter, const QStyleOptionGraphicsItem *,
QWidget *) QWidget *) Q_DECL_OVERRIDE
{ {
painter->fillRect(rect(), Qt::blue); painter->fillRect(rect(), Qt::blue);
} }
@ -88,14 +88,14 @@ public:
protected: protected:
//![14] //![14]
virtual bool eventTest(QEvent *event) virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE
{ {
return (event->type() == QEvent::Type(StateSwitchEvent::StateSwitchType)) return (event->type() == QEvent::Type(StateSwitchEvent::StateSwitchType))
&& (static_cast<StateSwitchEvent *>(event)->rand() == m_rand); && (static_cast<StateSwitchEvent *>(event)->rand() == m_rand);
} }
//![14] //![14]
virtual void onTransition(QEvent *) {} virtual void onTransition(QEvent *) Q_DECL_OVERRIDE {}
private: private:
int m_rand; int m_rand;
@ -112,7 +112,7 @@ public:
//![10] //![10]
//![11] //![11]
virtual void onEntry(QEvent *) virtual void onEntry(QEvent *) Q_DECL_OVERRIDE
{ {
int n; int n;
while ((n = (qrand() % m_stateCount + 1)) == m_lastIndex) while ((n = (qrand() % m_stateCount + 1)) == m_lastIndex)
@ -120,7 +120,7 @@ public:
m_lastIndex = n; m_lastIndex = n;
machine()->postEvent(new StateSwitchEvent(n)); machine()->postEvent(new StateSwitchEvent(n));
} }
virtual void onExit(QEvent *) {} virtual void onExit(QEvent *) Q_DECL_OVERRIDE {}
//![11] //![11]
//![12] //![12]
@ -164,7 +164,7 @@ public:
} }
protected: protected:
virtual void resizeEvent(QResizeEvent *event) virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE
{ {
fitInView(scene()->sceneRect()); fitInView(scene()->sceneRect());
QGraphicsView::resizeEvent(event); QGraphicsView::resizeEvent(event);

View File

@ -48,12 +48,12 @@ public:
{ {
} }
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) Q_DECL_OVERRIDE
{ {
painter->drawPixmap(QPointF(), p); painter->drawPixmap(QPointF(), p);
} }
QRectF boundingRect() const QRectF boundingRect() const Q_DECL_OVERRIDE
{ {
return QRectF( QPointF(0, 0), p.size()); return QRectF( QPointF(0, 0), p.size());
} }
@ -69,7 +69,7 @@ public:
{ {
} }
virtual void resizeEvent(QResizeEvent *) virtual void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE
{ {
fitInView(sceneRect(), Qt::KeepAspectRatio); fitInView(sceneRect(), Qt::KeepAspectRatio);
} }

View File

@ -51,8 +51,8 @@ public:
GraphicsView(QWidget *parent = 0); GraphicsView(QWidget *parent = 0);
protected: protected:
virtual void resizeEvent(QResizeEvent *event); virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
void keyPressEvent(QKeyEvent *); void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
signals: signals:
void keyPressed(int key); void keyPressed(int key);

View File

@ -60,7 +60,7 @@ public:
setTargetState(target); setTargetState(target);
} }
virtual bool eventTest(QEvent *e) virtual bool eventTest(QEvent *e) Q_DECL_OVERRIDE
{ {
if (QSignalTransition::eventTest(e)) { if (QSignalTransition::eventTest(e)) {
QVariant key = static_cast<QStateMachine::SignalEvent*>(e)->arguments().at(0); QVariant key = static_cast<QStateMachine::SignalEvent*>(e)->arguments().at(0);
@ -85,7 +85,7 @@ public:
startTimer(1000); startTimer(1000);
} }
virtual bool eventTest(QEvent *e) virtual bool eventTest(QEvent *e) Q_DECL_OVERRIDE
{ {
return QEventTransition::eventTest(e) && ((qrand() % 50) == 0); return QEventTransition::eventTest(e) && ((qrand() % 50) == 0);
} }

View File

@ -50,18 +50,18 @@ public:
explicit Node(const QPointF &pos, QGraphicsItem *parent = 0); explicit Node(const QPointF &pos, QGraphicsItem *parent = 0);
~Node(); ~Node();
QRectF boundingRect() const; QRectF boundingRect() const Q_DECL_OVERRIDE;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
signals: signals:
void positionChanged(); void positionChanged();
protected: protected:
QVariant itemChange(GraphicsItemChange change, const QVariant &value); QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
void mousePressEvent(QGraphicsSceneMouseEvent *); void mousePressEvent(QGraphicsSceneMouseEvent *) Q_DECL_OVERRIDE;
void mouseMoveEvent(QGraphicsSceneMouseEvent *); void mouseMoveEvent(QGraphicsSceneMouseEvent *) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *); void mouseReleaseEvent(QGraphicsSceneMouseEvent *) Q_DECL_OVERRIDE;
private: private:
bool m_dragging; bool m_dragging;

View File

@ -50,13 +50,13 @@ public:
RectButton(QString buttonText); RectButton(QString buttonText);
~RectButton(); ~RectButton();
virtual QRectF boundingRect() const; virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
protected: protected:
QString m_ButtonText; QString m_ButtonText;
virtual void mousePressEvent (QGraphicsSceneMouseEvent *event); virtual void mousePressEvent (QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
signals: signals:
void clicked(); void clicked();

View File

@ -59,8 +59,8 @@ public:
StickMan(); StickMan();
~StickMan(); ~StickMan();
virtual QRectF boundingRect() const; virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
int nodeCount() const; int nodeCount() const;
Node *node(int idx) const; Node *node(int idx) const;
@ -82,7 +82,7 @@ public slots:
void childPositionChanged(); void childPositionChanged();
protected: protected:
void timerEvent(QTimerEvent *e); void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
private: private:

View File

@ -77,7 +77,7 @@ public:
void updateBoatMovement(); void updateBoatMovement();
virtual int type() const; virtual int type() const Q_DECL_OVERRIDE;
signals: signals:
void boatDestroyed(); void boatDestroyed();

View File

@ -72,7 +72,7 @@ public:
{ {
} }
protected: protected:
virtual bool eventTest(QEvent *event) virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE
{ {
if (!QKeyEventTransition::eventTest(event)) if (!QKeyEventTransition::eventTest(event))
return false; return false;
@ -91,13 +91,13 @@ public:
{ {
} }
protected: protected:
virtual bool eventTest(QEvent *event) virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE
{ {
if (!QKeyEventTransition::eventTest(event)) if (!QKeyEventTransition::eventTest(event))
return false; return false;
return (boat->currentSpeed() >= 0); return (boat->currentSpeed() >= 0);
} }
void onTransition(QEvent *) void onTransition(QEvent *) Q_DECL_OVERRIDE
{ {
//We decrease the speed if needed //We decrease the speed if needed
if (key == Qt::Key_Left && boat->currentDirection() == Boat::Right) if (key == Qt::Key_Left && boat->currentDirection() == Boat::Right)
@ -122,7 +122,7 @@ public:
{ {
} }
protected: protected:
virtual bool eventTest(QEvent *event) virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE
{ {
if (!QKeyEventTransition::eventTest(event)) if (!QKeyEventTransition::eventTest(event))
return false; return false;
@ -141,7 +141,7 @@ public:
{ {
} }
protected: protected:
void onEntry(QEvent *) void onEntry(QEvent *) Q_DECL_OVERRIDE
{ {
boat->setCurrentDirection(Boat::Right); boat->setCurrentDirection(Boat::Right);
boat->updateBoatMovement(); boat->updateBoatMovement();
@ -158,7 +158,7 @@ public:
{ {
} }
protected: protected:
void onEntry(QEvent *) void onEntry(QEvent *) Q_DECL_OVERRIDE
{ {
boat->setCurrentDirection(Boat::Left); boat->setCurrentDirection(Boat::Left);
boat->updateBoatMovement(); boat->updateBoatMovement();
@ -175,7 +175,7 @@ public:
{ {
} }
protected: protected:
void onEntry(QEvent *) void onEntry(QEvent *) Q_DECL_OVERRIDE
{ {
boat->setCurrentSpeed(0); boat->setCurrentSpeed(0);
boat->setCurrentDirection(Boat::None); boat->setCurrentDirection(Boat::None);
@ -193,7 +193,7 @@ public:
{ {
} }
protected: protected:
void onEntry(QEvent *) void onEntry(QEvent *) Q_DECL_OVERRIDE
{ {
Bomb *b = new Bomb(); Bomb *b = new Bomb();
b->setPos(boat->x()+boat->size().width(),boat->y()); b->setPos(boat->x()+boat->size().width(),boat->y());
@ -214,7 +214,7 @@ public:
{ {
} }
protected: protected:
void onEntry(QEvent *) void onEntry(QEvent *) Q_DECL_OVERRIDE
{ {
Bomb *b = new Bomb(); Bomb *b = new Bomb();
b->setPos(boat->x() - b->size().width(), boat->y()); b->setPos(boat->x() - b->size().width(), boat->y());

View File

@ -54,8 +54,8 @@ public:
PixmapItem(const QString &fileName, GraphicsScene::Mode mode, QGraphicsItem * parent = 0); PixmapItem(const QString &fileName, GraphicsScene::Mode mode, QGraphicsItem * parent = 0);
PixmapItem(const QString &fileName, QGraphicsScene *scene); PixmapItem(const QString &fileName, QGraphicsScene *scene);
QSizeF size() const; QSizeF size() const;
QRectF boundingRect() const; QRectF boundingRect() const Q_DECL_OVERRIDE;
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) Q_DECL_OVERRIDE;
private: private:
QPixmap pix; QPixmap pix;
}; };

View File

@ -71,9 +71,9 @@ signals:
void animationFinished(); void animationFinished();
protected: protected:
void onEntry(QEvent *); void onEntry(QEvent *) Q_DECL_OVERRIDE;
void onExit(QEvent *); void onExit(QEvent *) Q_DECL_OVERRIDE;
bool event(QEvent *e); bool event(QEvent *e) Q_DECL_OVERRIDE;
private: private:
Q_DISABLE_COPY(QAnimationState) Q_DISABLE_COPY(QAnimationState)

View File

@ -63,7 +63,7 @@ public:
~PlayState(); ~PlayState();
protected: protected:
void onEntry(QEvent *); void onEntry(QEvent *) Q_DECL_OVERRIDE;
private : private :
GraphicsScene *scene; GraphicsScene *scene;
@ -85,7 +85,7 @@ class LevelState : public QState
public: public:
LevelState(GraphicsScene *scene, PlayState *game, QState *parent = 0); LevelState(GraphicsScene *scene, PlayState *game, QState *parent = 0);
protected: protected:
void onEntry(QEvent *); void onEntry(QEvent *) Q_DECL_OVERRIDE;
private : private :
void initializeLevel(); void initializeLevel();
GraphicsScene *scene; GraphicsScene *scene;
@ -98,8 +98,8 @@ public:
explicit PauseState(GraphicsScene *scene, QState *parent = 0); explicit PauseState(GraphicsScene *scene, QState *parent = 0);
protected: protected:
void onEntry(QEvent *); void onEntry(QEvent *) Q_DECL_OVERRIDE;
void onExit(QEvent *); void onExit(QEvent *) Q_DECL_OVERRIDE;
private : private :
GraphicsScene *scene; GraphicsScene *scene;
}; };
@ -110,8 +110,8 @@ public:
LostState(GraphicsScene *scene, PlayState *game, QState *parent = 0); LostState(GraphicsScene *scene, PlayState *game, QState *parent = 0);
protected: protected:
void onEntry(QEvent *); void onEntry(QEvent *) Q_DECL_OVERRIDE;
void onExit(QEvent *); void onExit(QEvent *) Q_DECL_OVERRIDE;
private : private :
GraphicsScene *scene; GraphicsScene *scene;
PlayState *game; PlayState *game;
@ -123,8 +123,8 @@ public:
WinState(GraphicsScene *scene, PlayState *game, QState *parent = 0); WinState(GraphicsScene *scene, PlayState *game, QState *parent = 0);
protected: protected:
void onEntry(QEvent *); void onEntry(QEvent *) Q_DECL_OVERRIDE;
void onExit(QEvent *); void onExit(QEvent *) Q_DECL_OVERRIDE;
private : private :
GraphicsScene *scene; GraphicsScene *scene;
PlayState *game; PlayState *game;
@ -143,7 +143,7 @@ class UpdateScoreTransition : public QSignalTransition
public: public:
UpdateScoreTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target); UpdateScoreTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target);
protected: protected:
virtual bool eventTest(QEvent *event); virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
private: private:
PlayState * game; PlayState * game;
GraphicsScene *scene; GraphicsScene *scene;
@ -155,7 +155,7 @@ class WinTransition : public QSignalTransition
public: public:
WinTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target); WinTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target);
protected: protected:
virtual bool eventTest(QEvent *event); virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
private: private:
PlayState * game; PlayState * game;
GraphicsScene *scene; GraphicsScene *scene;
@ -167,7 +167,7 @@ private:
public: public:
CustomSpaceTransition(QWidget *widget, PlayState *game, QEvent::Type type, int key); CustomSpaceTransition(QWidget *widget, PlayState *game, QEvent::Type type, int key);
protected: protected:
virtual bool eventTest(QEvent *event); virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
private: private:
PlayState *game; PlayState *game;
}; };

View File

@ -72,7 +72,7 @@ public:
void launchTorpedo(int speed); void launchTorpedo(int speed);
void destroy(); void destroy();
virtual int type() const; virtual int type() const Q_DECL_OVERRIDE;
QGraphicsRotation *rotation() const { return graphicsRotation; } QGraphicsRotation *rotation() const { return graphicsRotation; }

View File

@ -84,7 +84,7 @@ protected slots:
} }
protected: protected:
void onEntry(QEvent *e) void onEntry(QEvent *e) Q_DECL_OVERRIDE
{ {
if (submarine->currentDirection() == SubMarine::Left) { if (submarine->currentDirection() == SubMarine::Left) {
movementAnimation->setEndValue(QPointF(0,submarine->y())); movementAnimation->setEndValue(QPointF(0,submarine->y()));
@ -116,14 +116,14 @@ public:
} }
protected: protected:
void onEntry(QEvent *e) void onEntry(QEvent *e) Q_DECL_OVERRIDE
{ {
returnAnimation->stop(); returnAnimation->stop();
returnAnimation->setEndValue(submarine->currentDirection() == SubMarine::Right ? 360. : 180.); returnAnimation->setEndValue(submarine->currentDirection() == SubMarine::Right ? 360. : 180.);
QAnimationState::onEntry(e); QAnimationState::onEntry(e);
} }
void onExit(QEvent *e) void onExit(QEvent *e) Q_DECL_OVERRIDE
{ {
submarine->currentDirection() == SubMarine::Right ? submarine->setCurrentDirection(SubMarine::Left) : submarine->setCurrentDirection(SubMarine::Right); submarine->currentDirection() == SubMarine::Right ? submarine->setCurrentDirection(SubMarine::Left) : submarine->setCurrentDirection(SubMarine::Right);
QAnimationState::onExit(e); QAnimationState::onExit(e);

View File

@ -64,7 +64,7 @@ public:
Screenshot(); Screenshot();
protected: protected:
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
private slots: private slots:
void newScreenshot(); void newScreenshot();

View File

@ -68,10 +68,10 @@ class Window : public QDialog
public: public:
Window(); Window();
void setVisible(bool visible); void setVisible(bool visible) Q_DECL_OVERRIDE;
protected: protected:
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
private slots: private slots:
void setIcon(int index); void setIcon(int index);

View File

@ -59,7 +59,7 @@ class ClassWizard : public QWizard
public: public:
ClassWizard(QWidget *parent = 0); ClassWizard(QWidget *parent = 0);
void accept(); void accept() Q_DECL_OVERRIDE;
}; };
//! [0] //! [0]
@ -107,7 +107,7 @@ public:
CodeStylePage(QWidget *parent = 0); CodeStylePage(QWidget *parent = 0);
protected: protected:
void initializePage(); void initializePage() Q_DECL_OVERRIDE;
private: private:
QCheckBox *commentCheckBox; QCheckBox *commentCheckBox;
@ -128,7 +128,7 @@ public:
OutputFilesPage(QWidget *parent = 0); OutputFilesPage(QWidget *parent = 0);
protected: protected:
void initializePage(); void initializePage() Q_DECL_OVERRIDE;
private: private:
QLabel *outputDirLabel; QLabel *outputDirLabel;
@ -147,7 +147,7 @@ public:
ConclusionPage(QWidget *parent = 0); ConclusionPage(QWidget *parent = 0);
protected: protected:
void initializePage(); void initializePage() Q_DECL_OVERRIDE;
private: private:
QLabel *label; QLabel *label;

View File

@ -78,7 +78,7 @@ class IntroPage : public QWizardPage
public: public:
IntroPage(QWidget *parent = 0); IntroPage(QWidget *parent = 0);
int nextId() const; int nextId() const Q_DECL_OVERRIDE;
private: private:
QLabel *topLabel; QLabel *topLabel;
@ -95,7 +95,7 @@ class EvaluatePage : public QWizardPage
public: public:
EvaluatePage(QWidget *parent = 0); EvaluatePage(QWidget *parent = 0);
int nextId() const; int nextId() const Q_DECL_OVERRIDE;
private: private:
QLabel *nameLabel; QLabel *nameLabel;
@ -112,7 +112,7 @@ class RegisterPage : public QWizardPage
public: public:
RegisterPage(QWidget *parent = 0); RegisterPage(QWidget *parent = 0);
int nextId() const; int nextId() const Q_DECL_OVERRIDE;
private: private:
QLabel *nameLabel; QLabel *nameLabel;
@ -128,7 +128,7 @@ class DetailsPage : public QWizardPage
public: public:
DetailsPage(QWidget *parent = 0); DetailsPage(QWidget *parent = 0);
int nextId() const; int nextId() const Q_DECL_OVERRIDE;
private: private:
QLabel *companyLabel; QLabel *companyLabel;
@ -147,9 +147,9 @@ class ConclusionPage : public QWizardPage
public: public:
ConclusionPage(QWidget *parent = 0); ConclusionPage(QWidget *parent = 0);
void initializePage(); void initializePage() Q_DECL_OVERRIDE;
int nextId() const; int nextId() const Q_DECL_OVERRIDE;
void setVisible(bool visible); void setVisible(bool visible) Q_DECL_OVERRIDE;
private slots: private slots:
void printButtonClicked(); void printButtonClicked();

View File

@ -55,10 +55,10 @@ public:
DragWidget(QWidget *parent = 0); DragWidget(QWidget *parent = 0);
protected: protected:
void dragEnterEvent(QDragEnterEvent *event); void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
void dragMoveEvent(QDragMoveEvent *event); void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
void dropEvent(QDropEvent *event); void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
}; };
//! [0] //! [0]

View File

@ -54,9 +54,9 @@ public:
DragWidget(QWidget *parent = 0); DragWidget(QWidget *parent = 0);
protected: protected:
void dragEnterEvent(QDragEnterEvent *event); void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
void dropEvent(QDropEvent *event); void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
}; };
#endif // DRAGWIDGET_H #endif // DRAGWIDGET_H

View File

@ -64,10 +64,10 @@ signals:
//! [DropArea header part2] //! [DropArea header part2]
protected: protected:
void dragEnterEvent(QDragEnterEvent *event); void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
void dragMoveEvent(QDragMoveEvent *event); void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
void dragLeaveEvent(QDragLeaveEvent *event); void dragLeaveEvent(QDragLeaveEvent *event) Q_DECL_OVERRIDE;
void dropEvent(QDropEvent *event); void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
private: private:
QLabel *label; QLabel *label;

View File

@ -55,10 +55,10 @@ public:
DragWidget(QWidget *parent = 0); DragWidget(QWidget *parent = 0);
protected: protected:
void dragEnterEvent(QDragEnterEvent *event); void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
void dragMoveEvent(QDragMoveEvent *event); void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
void dropEvent(QDropEvent *event); void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
}; };
//! [0] //! [0]

View File

@ -52,10 +52,10 @@ public:
void addPiece(QPixmap pixmap, QPoint location); void addPiece(QPixmap pixmap, QPoint location);
protected: protected:
void dragEnterEvent(QDragEnterEvent *event); void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
void dragMoveEvent(QDragMoveEvent *event); void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
void dropEvent(QDropEvent *event); void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
void startDrag(Qt::DropActions supportedActions); void startDrag(Qt::DropActions supportedActions) Q_DECL_OVERRIDE;
int m_PieceSize; int m_PieceSize;
}; };

View File

@ -67,12 +67,12 @@ signals:
void puzzleCompleted(); void puzzleCompleted();
protected: protected:
void dragEnterEvent(QDragEnterEvent *event); void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
void dragLeaveEvent(QDragLeaveEvent *event); void dragLeaveEvent(QDragLeaveEvent *event) Q_DECL_OVERRIDE;
void dragMoveEvent(QDragMoveEvent *event); void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
void dropEvent(QDropEvent *event); void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void paintEvent(QPaintEvent *event); void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
private: private:
int findPiece(const QRect &pieceRect) const; int findPiece(const QRect &pieceRect) const;

View File

@ -53,7 +53,7 @@ public:
QRectF boundingRect() const; QRectF boundingRect() const;
void draw(QPainter *painter); void draw(QPainter *painter) Q_DECL_OVERRIDE;
private: private:
void adjustForItem(); void adjustForItem();

View File

@ -59,9 +59,9 @@ public:
void setIndex(qreal); void setIndex(qreal);
protected: protected:
void keyPressEvent(QKeyEvent *event); void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
private: private:
void setupScene(); void setupScene();

View File

@ -58,7 +58,7 @@ private:
void setupScene(); void setupScene();
protected: protected:
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
private: private:
qreal angle; qreal angle;

View File

@ -65,10 +65,10 @@ public:
void grabGestures(const QList<Qt::GestureType> &gestures); void grabGestures(const QList<Qt::GestureType> &gestures);
protected: protected:
bool event(QEvent *event); bool event(QEvent *event) Q_DECL_OVERRIDE;
void paintEvent(QPaintEvent *event); void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
void mouseDoubleClickEvent(QMouseEvent *event); void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
private: private:
bool gestureEvent(QGestureEvent *event); bool gestureEvent(QGestureEvent *event);

View File

@ -51,12 +51,12 @@ public:
LayoutItem(QGraphicsItem *parent = 0); LayoutItem(QGraphicsItem *parent = 0);
~LayoutItem(); ~LayoutItem();
// Inherited from QGraphicsLayoutItem // Inherited from QGraphicsLayoutItem
void setGeometry(const QRectF &geom); void setGeometry(const QRectF &geom) Q_DECL_OVERRIDE;
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const Q_DECL_OVERRIDE;
// Inherited from QGraphicsItem // Inherited from QGraphicsItem
QRectF boundingRect() const; QRectF boundingRect() const Q_DECL_OVERRIDE;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
private: private:
QPixmap *m_pix; QPixmap *m_pix;

View File

@ -101,8 +101,8 @@ public:
GLTexture2D(int width, int height); GLTexture2D(int width, int height);
explicit GLTexture2D(const QString& fileName, int width = 0, int height = 0); explicit GLTexture2D(const QString& fileName, int width = 0, int height = 0);
void load(int width, int height, QRgb *data); void load(int width, int height, QRgb *data);
virtual void bind(); virtual void bind() Q_DECL_OVERRIDE;
virtual void unbind(); virtual void unbind() Q_DECL_OVERRIDE;
}; };
class GLTexture3D : public GLTexture class GLTexture3D : public GLTexture
@ -112,8 +112,8 @@ public:
// TODO: Implement function below // TODO: Implement function below
//GLTexture3D(const QString& fileName, int width = 0, int height = 0); //GLTexture3D(const QString& fileName, int width = 0, int height = 0);
void load(int width, int height, int depth, QRgb *data); void load(int width, int height, int depth, QRgb *data);
virtual void bind(); virtual void bind() Q_DECL_OVERRIDE;
virtual void unbind(); virtual void unbind() Q_DECL_OVERRIDE;
}; };
class GLTextureCube : public GLTexture class GLTextureCube : public GLTexture
@ -122,8 +122,8 @@ public:
GLTextureCube(int size); GLTextureCube(int size);
explicit GLTextureCube(const QStringList& fileNames, int size = 0); explicit GLTextureCube(const QStringList& fileNames, int size = 0);
void load(int size, int face, QRgb *data); void load(int size, int face, QRgb *data);
virtual void bind(); virtual void bind() Q_DECL_OVERRIDE;
virtual void unbind(); virtual void unbind() Q_DECL_OVERRIDE;
}; };
// TODO: Define and implement class below // TODO: Define and implement class below
@ -137,7 +137,7 @@ public:
void begin(int face); void begin(int face);
// end rendering // end rendering
void end(); void end();
virtual bool failed() const {return m_failed || m_fbo.failed();} virtual bool failed() const Q_DECL_OVERRIDE {return m_failed || m_fbo.failed();}
static void getViewMatrix(QMatrix4x4& mat, int face); static void getViewMatrix(QMatrix4x4& mat, int face);
static void getProjectionMatrix(QMatrix4x4& mat, float nearZ, float farZ); static void getProjectionMatrix(QMatrix4x4& mat, float nearZ, float farZ);

View File

@ -58,7 +58,7 @@ public:
} }
protected: protected:
void resizeEvent(QResizeEvent *event) { void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE {
if (scene()) if (scene())
scene()->setSceneRect(QRect(QPoint(0, 0), event->size())); scene()->setSceneRect(QRect(QPoint(0, 0), event->size()));
QGraphicsView::resizeEvent(event); QGraphicsView::resizeEvent(event);

View File

@ -54,18 +54,18 @@ public:
ItemBase(int size, int x, int y); ItemBase(int size, int x, int y);
virtual ~ItemBase(); virtual ~ItemBase();
virtual QRectF boundingRect() const; virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
protected: protected:
virtual ItemBase *createNew(int size, int x, int y) = 0; virtual ItemBase *createNew(int size, int x, int y) = 0;
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) Q_DECL_OVERRIDE;
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event); virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
virtual void keyPressEvent(QKeyEvent *event); virtual void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
virtual void wheelEvent(QGraphicsSceneWheelEvent *event); virtual void wheelEvent(QGraphicsSceneWheelEvent *event) Q_DECL_OVERRIDE;
virtual int type() const; virtual int type() const Q_DECL_OVERRIDE;
bool isInResizeArea(const QPointF &pos); bool isInResizeArea(const QPointF &pos);
static void duplicateSelectedItems(QGraphicsScene *scene); static void duplicateSelectedItems(QGraphicsScene *scene);
@ -83,9 +83,9 @@ class QtBox : public ItemBase
public: public:
QtBox(int size, int x, int y); QtBox(int size, int x, int y);
virtual ~QtBox(); virtual ~QtBox();
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
protected: protected:
virtual ItemBase *createNew(int size, int x, int y); virtual ItemBase *createNew(int size, int x, int y) Q_DECL_OVERRIDE;
private: private:
QVector3D m_vertices[8]; QVector3D m_vertices[8];
QVector3D m_texCoords[4]; QVector3D m_texCoords[4];
@ -97,9 +97,9 @@ class CircleItem : public ItemBase
{ {
public: public:
CircleItem(int size, int x, int y); CircleItem(int size, int x, int y);
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
protected: protected:
virtual ItemBase *createNew(int size, int x, int y); virtual ItemBase *createNew(int size, int x, int y) Q_DECL_OVERRIDE;
QColor m_color; QColor m_color;
}; };
@ -108,9 +108,9 @@ class SquareItem : public ItemBase
{ {
public: public:
SquareItem(int size, int x, int y); SquareItem(int size, int x, int y);
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
protected: protected:
virtual ItemBase *createNew(int size, int x, int y); virtual ItemBase *createNew(int size, int x, int y) Q_DECL_OVERRIDE;
QPixmap m_image; QPixmap m_image;
}; };

View File

@ -72,13 +72,13 @@ class ColorEdit : public ParameterEdit
public: public:
ColorEdit(QRgb initialColor, int id); ColorEdit(QRgb initialColor, int id);
QRgb color() const {return m_color;} QRgb color() const {return m_color;}
virtual void emitChange() {emit colorChanged(m_color, m_id);} virtual void emitChange() Q_DECL_OVERRIDE {emit colorChanged(m_color, m_id);}
public slots: public slots:
void editDone(); void editDone();
signals: signals:
void colorChanged(QRgb color, int id); void colorChanged(QRgb color, int id);
protected: protected:
virtual void mousePressEvent(QMouseEvent *event); virtual void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void setColor(QRgb color); // also emits colorChanged() void setColor(QRgb color); // also emits colorChanged()
private: private:
QGraphicsScene *m_dialogParentScene; QGraphicsScene *m_dialogParentScene;
@ -94,7 +94,7 @@ class FloatEdit : public ParameterEdit
public: public:
FloatEdit(float initialValue, int id); FloatEdit(float initialValue, int id);
float value() const {return m_value;} float value() const {return m_value;}
virtual void emitChange() {emit valueChanged(m_value, m_id);} virtual void emitChange() Q_DECL_OVERRIDE {emit valueChanged(m_value, m_id);}
public slots: public slots:
void editDone(); void editDone();
signals: signals:
@ -111,9 +111,9 @@ class GraphicsWidget : public QGraphicsProxyWidget
public: public:
GraphicsWidget() : QGraphicsProxyWidget(0, Qt::Window) {} GraphicsWidget() : QGraphicsProxyWidget(0, Qt::Window) {}
protected: protected:
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value); virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
virtual void resizeEvent(QGraphicsSceneResizeEvent *event); virtual void resizeEvent(QGraphicsSceneResizeEvent *event) Q_DECL_OVERRIDE;
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
}; };
class TwoSidedGraphicsWidget : public QObject class TwoSidedGraphicsWidget : public QObject
@ -153,7 +153,7 @@ signals:
void shaderChanged(int); void shaderChanged(int);
void doubleClicked(); void doubleClicked();
protected: protected:
virtual void mouseDoubleClickEvent(QMouseEvent *event); virtual void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
QVector<QByteArray> m_parameterNames; QVector<QByteArray> m_parameterNames;
QComboBox *m_textureCombo; QComboBox *m_textureCombo;
@ -180,7 +180,7 @@ signals:
void doubleClicked(); void doubleClicked();
void newItemTriggered(ItemDialog::ItemType type); void newItemTriggered(ItemDialog::ItemType type);
protected: protected:
virtual void mouseDoubleClickEvent(QMouseEvent *event); virtual void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
}; };
class Scene : public QGraphicsScene class Scene : public QGraphicsScene
@ -189,7 +189,7 @@ class Scene : public QGraphicsScene
public: public:
Scene(int width, int height, int maxTextureSize); Scene(int width, int height, int maxTextureSize);
~Scene(); ~Scene();
virtual void drawBackground(QPainter *painter, const QRectF &rect); virtual void drawBackground(QPainter *painter, const QRectF &rect) Q_DECL_OVERRIDE;
public slots: public slots:
void setShader(int index); void setShader(int index);
@ -205,10 +205,10 @@ protected:
void defaultStates(); void defaultStates();
void renderCubemaps(); void renderCubemaps();
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
virtual void wheelEvent(QGraphicsSceneWheelEvent * event); virtual void wheelEvent(QGraphicsSceneWheelEvent * event) Q_DECL_OVERRIDE;
private: private:
void initGL(); void initGL();
QPointF pixelPosToViewPos(const QPointF& p); QPointF pixelPosToViewPos(const QPointF& p);

View File

@ -50,14 +50,14 @@ class Chip : public QGraphicsItem
public: public:
Chip(const QColor &color, int x, int y); Chip(const QColor &color, int x, int y);
QRectF boundingRect() const; QRectF boundingRect() const Q_DECL_OVERRIDE;
QPainterPath shape() const; QPainterPath shape() const Q_DECL_OVERRIDE;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget) Q_DECL_OVERRIDE;
protected: protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event); void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
private: private:
int x; int x;

View File

@ -61,7 +61,7 @@ public:
protected: protected:
#ifndef QT_NO_WHEELEVENT #ifndef QT_NO_WHEELEVENT
void wheelEvent(QWheelEvent *); void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE;
#endif #endif
private: private:

View File

@ -49,13 +49,13 @@ class Mouse : public QGraphicsItem
public: public:
Mouse(); Mouse();
QRectF boundingRect() const; QRectF boundingRect() const Q_DECL_OVERRIDE;
QPainterPath shape() const; QPainterPath shape() const Q_DECL_OVERRIDE;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget); QWidget *widget) Q_DECL_OVERRIDE;
protected: protected:
void advance(int step); void advance(int step) Q_DECL_OVERRIDE;
private: private:
qreal angle; qreal angle;

View File

@ -63,9 +63,9 @@ public:
Arrow(DiagramItem *startItem, DiagramItem *endItem, Arrow(DiagramItem *startItem, DiagramItem *endItem,
QGraphicsItem *parent = 0); QGraphicsItem *parent = 0);
int type() const { return Type; } int type() const Q_DECL_OVERRIDE { return Type; }
QRectF boundingRect() const; QRectF boundingRect() const Q_DECL_OVERRIDE;
QPainterPath shape() const; QPainterPath shape() const Q_DECL_OVERRIDE;
void setColor(const QColor &color) { myColor = color; } void setColor(const QColor &color) { myColor = color; }
DiagramItem *startItem() const { return myStartItem; } DiagramItem *startItem() const { return myStartItem; }
DiagramItem *endItem() const { return myEndItem; } DiagramItem *endItem() const { return myEndItem; }
@ -73,7 +73,7 @@ public:
void updatePosition(); void updatePosition();
protected: protected:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
private: private:
DiagramItem *myStartItem; DiagramItem *myStartItem;

View File

@ -75,11 +75,11 @@ public:
QPolygonF polygon() const { return myPolygon; } QPolygonF polygon() const { return myPolygon; }
void addArrow(Arrow *arrow); void addArrow(Arrow *arrow);
QPixmap image() const; QPixmap image() const;
int type() const { return Type;} int type() const Q_DECL_OVERRIDE { return Type;}
protected: protected:
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) Q_DECL_OVERRIDE;
QVariant itemChange(GraphicsItemChange change, const QVariant &value); QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
private: private:
DiagramType myDiagramType; DiagramType myDiagramType;

View File

@ -85,9 +85,9 @@ signals:
void itemSelected(QGraphicsItem *item); void itemSelected(QGraphicsItem *item);
protected: protected:
void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent); void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent); void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent); void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
private: private:
bool isItemChange(int type); bool isItemChange(int type);

View File

@ -61,16 +61,16 @@ public:
DiagramTextItem(QGraphicsItem *parent = 0); DiagramTextItem(QGraphicsItem *parent = 0);
int type() const { return Type; } int type() const Q_DECL_OVERRIDE { return Type; }
signals: signals:
void lostFocus(DiagramTextItem *item); void lostFocus(DiagramTextItem *item);
void selectedChange(QGraphicsItem *item); void selectedChange(QGraphicsItem *item);
protected: protected:
QVariant itemChange(GraphicsItemChange change, const QVariant &value); QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
void focusOutEvent(QFocusEvent *event); void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
}; };
//! [0] //! [0]

View File

@ -49,13 +49,13 @@ class ColorItem : public QGraphicsItem
public: public:
ColorItem(); ColorItem();
QRectF boundingRect() const; QRectF boundingRect() const Q_DECL_OVERRIDE;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
protected: protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event); void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
private: private:
QColor color; QColor color;

View File

@ -53,7 +53,7 @@ public:
} }
protected: protected:
virtual void resizeEvent(QResizeEvent *) virtual void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE
{ {
} }
}; };

View File

@ -55,9 +55,9 @@ public:
RobotPart(QGraphicsItem *parent = 0); RobotPart(QGraphicsItem *parent = 0);
protected: protected:
void dragEnterEvent(QGraphicsSceneDragDropEvent *event); void dragEnterEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
void dragLeaveEvent(QGraphicsSceneDragDropEvent *event); void dragLeaveEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
void dropEvent(QGraphicsSceneDragDropEvent *event); void dropEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
QColor color; QColor color;
bool dragOver; bool dragOver;
@ -70,12 +70,12 @@ class RobotHead : public RobotPart
public: public:
RobotHead(QGraphicsItem *parent = 0); RobotHead(QGraphicsItem *parent = 0);
QRectF boundingRect() const; QRectF boundingRect() const Q_DECL_OVERRIDE;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
protected: protected:
void dragEnterEvent(QGraphicsSceneDragDropEvent *event); void dragEnterEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
void dropEvent(QGraphicsSceneDragDropEvent *event); void dropEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
private: private:
QPixmap pixmap; QPixmap pixmap;
@ -88,8 +88,8 @@ class RobotTorso : public RobotPart
public: public:
RobotTorso(QGraphicsItem *parent = 0); RobotTorso(QGraphicsItem *parent = 0);
QRectF boundingRect() const; QRectF boundingRect() const Q_DECL_OVERRIDE;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
}; };
//! [2] //! [2]
@ -99,8 +99,8 @@ class RobotLimb : public RobotPart
public: public:
RobotLimb(QGraphicsItem *parent = 0); RobotLimb(QGraphicsItem *parent = 0);
QRectF boundingRect() const; QRectF boundingRect() const Q_DECL_OVERRIDE;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
}; };
//! [3] //! [3]
@ -110,8 +110,8 @@ class Robot : public RobotPart
public: public:
Robot(QGraphicsItem *parent = 0); Robot(QGraphicsItem *parent = 0);
QRectF boundingRect() const; QRectF boundingRect() const Q_DECL_OVERRIDE;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
}; };
//! [4] //! [4]

View File

@ -57,11 +57,11 @@ public:
void adjust(); void adjust();
enum { Type = UserType + 2 }; enum { Type = UserType + 2 };
int type() const { return Type; } int type() const Q_DECL_OVERRIDE { return Type; }
protected: protected:
QRectF boundingRect() const; QRectF boundingRect() const Q_DECL_OVERRIDE;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
private: private:
Node *source, *dest; Node *source, *dest;

View File

@ -61,12 +61,12 @@ public slots:
void zoomOut(); void zoomOut();
protected: protected:
void keyPressEvent(QKeyEvent *event); void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
void timerEvent(QTimerEvent *event); void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
#ifndef QT_NO_WHEELEVENT #ifndef QT_NO_WHEELEVENT
void wheelEvent(QWheelEvent *event); void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
#endif #endif
void drawBackground(QPainter *painter, const QRectF &rect); void drawBackground(QPainter *painter, const QRectF &rect) Q_DECL_OVERRIDE;
void scaleView(qreal scaleFactor); void scaleView(qreal scaleFactor);

View File

@ -60,20 +60,20 @@ public:
QList<Edge *> edges() const; QList<Edge *> edges() const;
enum { Type = UserType + 1 }; enum { Type = UserType + 1 };
int type() const { return Type; } int type() const Q_DECL_OVERRIDE { return Type; }
void calculateForces(); void calculateForces();
bool advance(); bool advance();
QRectF boundingRect() const; QRectF boundingRect() const Q_DECL_OVERRIDE;
QPainterPath shape() const; QPainterPath shape() const Q_DECL_OVERRIDE;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
protected: protected:
QVariant itemChange(GraphicsItemChange change, const QVariant &value); QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
void mousePressEvent(QGraphicsSceneMouseEvent *event); void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
private: private:
QList<Edge *> edgeList; QList<Edge *> edgeList;

View File

@ -52,15 +52,15 @@ class CustomProxy : public QGraphicsProxyWidget
public: public:
explicit CustomProxy(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0); explicit CustomProxy(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
QRectF boundingRect() const; QRectF boundingRect() const Q_DECL_OVERRIDE;
void paintWindowFrame(QPainter *painter, const QStyleOptionGraphicsItem *option, void paintWindowFrame(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget); QWidget *widget) Q_DECL_OVERRIDE;
protected: protected:
void hoverEnterEvent(QGraphicsSceneHoverEvent *event); void hoverEnterEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
bool sceneEventFilter(QGraphicsItem *watched, QEvent *event); bool sceneEventFilter(QGraphicsItem *watched, QEvent *event) Q_DECL_OVERRIDE;
QVariant itemChange(GraphicsItemChange change, const QVariant &value); QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
private slots: private slots:
void updateStep(qreal step); void updateStep(qreal step);

View File

@ -50,14 +50,14 @@ public:
qreal spacing(Qt::Orientation o) const; qreal spacing(Qt::Orientation o) const;
// inherited functions // inherited functions
void setGeometry(const QRectF &geom); void setGeometry(const QRectF &geom) Q_DECL_OVERRIDE;
int count() const; int count() const Q_DECL_OVERRIDE;
QGraphicsLayoutItem *itemAt(int index) const; QGraphicsLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
void removeAt(int index); void removeAt(int index) Q_DECL_OVERRIDE;
protected: protected:
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const Q_DECL_OVERRIDE;
private: private:
qreal doLayout(const QRectF &geom, bool applyNewGeometry) const; qreal doLayout(const QRectF &geom, bool applyNewGeometry) const;

View File

@ -57,7 +57,7 @@ public:
explicit PadNavigator(const QSize &size, QWidget *parent = 0); explicit PadNavigator(const QSize &size, QWidget *parent = 0);
protected: protected:
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
private: private:
Ui::Form form; Ui::Form form;

Some files were not shown because too many files have changed in this diff Show More