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>
This commit is contained in:
hjk 2016-06-15 10:12:35 +02:00
parent 4d3ffae3d5
commit 40a54bf565
199 changed files with 751 additions and 751 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -63,8 +63,8 @@ class TriangleWindow : public OpenGLWindow
public:
TriangleWindow();
void initialize() Q_DECL_OVERRIDE;
void render() Q_DECL_OVERRIDE;
void initialize() override;
void render() override;
private:
GLuint m_posAttr;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -65,7 +65,7 @@ class RenderWindow : public QWindow
public:
RenderWindow(const QSurfaceFormat &format);
QOpenGLContext *context() { return m_context; }
void exposeEvent(QExposeEvent *) Q_DECL_OVERRIDE;
void exposeEvent(QExposeEvent *) override;
void setForceGLSL110(bool enable) { m_forceGLSL110 = enable; }
signals:

View File

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

View File

@ -68,8 +68,8 @@ public:
GLWidget(QWidget *parent = 0);
~GLWidget();
QSize minimumSizeHint() const Q_DECL_OVERRIDE;
QSize sizeHint() const Q_DECL_OVERRIDE;
QSize minimumSizeHint() const override;
QSize sizeHint() const override;
public slots:
void setXRotation(int angle);
@ -83,11 +83,11 @@ signals:
void zRotationChanged(int angle);
protected:
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 initializeGL() override;
void paintGL() override;
void resizeGL(int width, int height) override;
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
private:
void setupVertexAttribs();

View File

@ -69,7 +69,7 @@ public:
Window(MainWindow *mw);
protected:
void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
void keyPressEvent(QKeyEvent *event) override;
private slots:
void dockUndock();

View File

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

View File

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

View File

@ -76,11 +76,11 @@ signals:
void zRotationChanged(int angle);
protected:
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 initializeGL() override;
void paintGL() override;
void resizeGL(int width, int height) override;
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
private slots:
void advanceGears();

View File

@ -65,8 +65,8 @@ public:
GLWidget(QWidget *parent = 0);
~GLWidget();
QSize minimumSizeHint() const Q_DECL_OVERRIDE;
QSize sizeHint() const Q_DECL_OVERRIDE;
QSize minimumSizeHint() const override;
QSize sizeHint() const override;
//! [0]
//! [1]
@ -83,11 +83,11 @@ signals:
//! [2]
protected:
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 initializeGL() override;
void paintGL() override;
void resizeGL(int width, int height) override;
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
//! [2]
//! [3]

View File

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

View File

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

View File

@ -67,11 +67,11 @@ public:
~GLWidget();
protected:
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); }
void initializeGL() override;
void paintGL() override;
void resizeGL(int width, int height) override;
void mousePressEvent(QMouseEvent *) override { setAnimationPaused(true); }
void mouseReleaseEvent(QMouseEvent *) override { setAnimationPaused(false); }
private:
void initializeGeometry();

View File

@ -56,10 +56,10 @@ public:
GLWidget(QWidget *parent);
protected:
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 initializeGL() override;
void resizeGL(int w, int h) override;
void paintGL() override;
void timerEvent(QTimerEvent *) override;
void makeObject();
void quad(GLenum primitive, GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2,

View File

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

View File

@ -85,9 +85,9 @@ private slots:
void handleButtonPress();
protected:
void resizeGL(int w, int h) Q_DECL_OVERRIDE;
void paintGL() Q_DECL_OVERRIDE;
void initializeGL() Q_DECL_OVERRIDE;
void resizeGL(int w, int h) override;
void paintGL() override;
void initializeGL() override;
private:
void paintTexturedCube();

View File

@ -79,9 +79,9 @@ public:
OpenGLWindow();
protected:
void paintGL() Q_DECL_OVERRIDE;
void resizeGL(int w, int h) Q_DECL_OVERRIDE;
void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
void paintGL() override;
void resizeGL(int w, int h) override;
void keyPressEvent(QKeyEvent *e) override;
private:
void setAnimating(bool enabled);

View File

@ -66,8 +66,8 @@ public:
explicit GLWidget(QWidget *parent = 0);
~GLWidget();
QSize minimumSizeHint() const Q_DECL_OVERRIDE;
QSize sizeHint() const Q_DECL_OVERRIDE;
QSize minimumSizeHint() const override;
QSize sizeHint() const override;
void rotateBy(int xAngle, int yAngle, int zAngle);
void setClearColor(const QColor &color);
@ -75,12 +75,12 @@ signals:
void clicked();
protected:
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;
void initializeGL() override;
void paintGL() override;
void resizeGL(int width, int height) override;
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
private:
void makeObject();

View File

@ -114,7 +114,7 @@ public:
~GLWidget();
protected:
void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE { }
void paintEvent(QPaintEvent *) override { }
signals:
void renderRequested();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -81,7 +81,7 @@ public:
{
}
protected:
virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE
virtual bool eventTest(QEvent *event) override
{
if (!QKeyEventTransition::eventTest(event))
return false;
@ -100,13 +100,13 @@ public:
{
}
protected:
virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE
virtual bool eventTest(QEvent *event) override
{
if (!QKeyEventTransition::eventTest(event))
return false;
return (boat->currentSpeed() >= 0);
}
void onTransition(QEvent *) Q_DECL_OVERRIDE
void onTransition(QEvent *) override
{
//We decrease the speed if needed
if (key == Qt::Key_Left && boat->currentDirection() == Boat::Right)
@ -131,7 +131,7 @@ public:
{
}
protected:
virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE
virtual bool eventTest(QEvent *event) override
{
if (!QKeyEventTransition::eventTest(event))
return false;
@ -150,7 +150,7 @@ public:
{
}
protected:
void onEntry(QEvent *) Q_DECL_OVERRIDE
void onEntry(QEvent *) override
{
boat->setCurrentDirection(Boat::Right);
boat->updateBoatMovement();
@ -167,7 +167,7 @@ public:
{
}
protected:
void onEntry(QEvent *) Q_DECL_OVERRIDE
void onEntry(QEvent *) override
{
boat->setCurrentDirection(Boat::Left);
boat->updateBoatMovement();
@ -184,7 +184,7 @@ public:
{
}
protected:
void onEntry(QEvent *) Q_DECL_OVERRIDE
void onEntry(QEvent *) override
{
boat->setCurrentSpeed(0);
boat->setCurrentDirection(Boat::None);
@ -202,7 +202,7 @@ public:
{
}
protected:
void onEntry(QEvent *) Q_DECL_OVERRIDE
void onEntry(QEvent *) override
{
Bomb *b = new Bomb();
b->setPos(boat->x()+boat->size().width(),boat->y());
@ -223,7 +223,7 @@ public:
{
}
protected:
void onEntry(QEvent *) Q_DECL_OVERRIDE
void onEntry(QEvent *) override
{
Bomb *b = new Bomb();
b->setPos(boat->x() - b->size().width(), boat->y());

View File

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

View File

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

View File

@ -72,7 +72,7 @@ public:
~PlayState();
protected:
void onEntry(QEvent *) Q_DECL_OVERRIDE;
void onEntry(QEvent *) override;
private :
GraphicsScene *scene;
@ -94,7 +94,7 @@ class LevelState : public QState
public:
LevelState(GraphicsScene *scene, PlayState *game, QState *parent = 0);
protected:
void onEntry(QEvent *) Q_DECL_OVERRIDE;
void onEntry(QEvent *) override;
private :
void initializeLevel();
GraphicsScene *scene;
@ -107,8 +107,8 @@ public:
explicit PauseState(GraphicsScene *scene, QState *parent = 0);
protected:
void onEntry(QEvent *) Q_DECL_OVERRIDE;
void onExit(QEvent *) Q_DECL_OVERRIDE;
void onEntry(QEvent *) override;
void onExit(QEvent *) override;
private :
GraphicsScene *scene;
};
@ -119,8 +119,8 @@ public:
LostState(GraphicsScene *scene, PlayState *game, QState *parent = 0);
protected:
void onEntry(QEvent *) Q_DECL_OVERRIDE;
void onExit(QEvent *) Q_DECL_OVERRIDE;
void onEntry(QEvent *) override;
void onExit(QEvent *) override;
private :
GraphicsScene *scene;
PlayState *game;
@ -132,8 +132,8 @@ public:
WinState(GraphicsScene *scene, PlayState *game, QState *parent = 0);
protected:
void onEntry(QEvent *) Q_DECL_OVERRIDE;
void onExit(QEvent *) Q_DECL_OVERRIDE;
void onEntry(QEvent *) override;
void onExit(QEvent *) override;
private :
GraphicsScene *scene;
PlayState *game;
@ -152,7 +152,7 @@ class UpdateScoreTransition : public QSignalTransition
public:
UpdateScoreTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target);
protected:
virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
virtual bool eventTest(QEvent *event) override;
private:
PlayState * game;
GraphicsScene *scene;
@ -164,7 +164,7 @@ class WinTransition : public QSignalTransition
public:
WinTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target);
protected:
virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
virtual bool eventTest(QEvent *event) override;
private:
PlayState * game;
GraphicsScene *scene;
@ -176,7 +176,7 @@ private:
public:
CustomSpaceTransition(QWidget *widget, PlayState *game, QEvent::Type type, int key);
protected:
virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
virtual bool eventTest(QEvent *event) override;
private:
PlayState *game;
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -88,7 +88,7 @@ class IntroPage : public QWizardPage
public:
IntroPage(QWidget *parent = 0);
int nextId() const Q_DECL_OVERRIDE;
int nextId() const override;
private:
QLabel *topLabel;
@ -105,7 +105,7 @@ class EvaluatePage : public QWizardPage
public:
EvaluatePage(QWidget *parent = 0);
int nextId() const Q_DECL_OVERRIDE;
int nextId() const override;
private:
QLabel *nameLabel;
@ -122,7 +122,7 @@ class RegisterPage : public QWizardPage
public:
RegisterPage(QWidget *parent = 0);
int nextId() const Q_DECL_OVERRIDE;
int nextId() const override;
private:
QLabel *nameLabel;
@ -138,7 +138,7 @@ class DetailsPage : public QWizardPage
public:
DetailsPage(QWidget *parent = 0);
int nextId() const Q_DECL_OVERRIDE;
int nextId() const override;
private:
QLabel *companyLabel;
@ -157,9 +157,9 @@ class ConclusionPage : public QWizardPage
public:
ConclusionPage(QWidget *parent = 0);
void initializePage() Q_DECL_OVERRIDE;
int nextId() const Q_DECL_OVERRIDE;
void setVisible(bool visible) Q_DECL_OVERRIDE;
void initializePage() override;
int nextId() const override;
void setVisible(bool visible) override;
private slots:
void printButtonClicked();

View File

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

View File

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

View File

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

View File

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

View File

@ -64,10 +64,10 @@ public:
static QString puzzleMimeType() { return QStringLiteral("image/x-puzzle-piece"); }
protected:
void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
void startDrag(Qt::DropActions supportedActions) Q_DECL_OVERRIDE;
void dragEnterEvent(QDragEnterEvent *event) override;
void dragMoveEvent(QDragMoveEvent *event) override;
void dropEvent(QDropEvent *event) override;
void startDrag(Qt::DropActions supportedActions) override;
int m_PieceSize;
};

View File

@ -77,12 +77,12 @@ signals:
void puzzleCompleted();
protected:
void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
void dragLeaveEvent(QDragLeaveEvent *event) Q_DECL_OVERRIDE;
void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
void dragEnterEvent(QDragEnterEvent *event) override;
void dragLeaveEvent(QDragLeaveEvent *event) override;
void dragMoveEvent(QDragMoveEvent *event) override;
void dropEvent(QDropEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
void paintEvent(QPaintEvent *event) override;
private:
const QRect targetSquare(const QPoint &position) const;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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