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:
parent
6d87e3ed40
commit
3b0c2b7c1b
@ -49,8 +49,8 @@ public:
|
||||
AnalogClockWindow();
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent *);
|
||||
void render(QPainter *p);
|
||||
void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
|
||||
void render(QPainter *p) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
int m_timerId;
|
||||
|
@ -53,8 +53,8 @@ class TriangleWindow : public OpenGLWindow
|
||||
public:
|
||||
TriangleWindow();
|
||||
|
||||
void initialize();
|
||||
void render();
|
||||
void initialize() Q_DECL_OVERRIDE;
|
||||
void render() Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
GLuint loadShader(GLenum type, const char *source);
|
||||
|
@ -67,9 +67,9 @@ public slots:
|
||||
void renderNow();
|
||||
|
||||
protected:
|
||||
bool event(QEvent *event);
|
||||
bool event(QEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
void exposeEvent(QExposeEvent *event);
|
||||
void exposeEvent(QExposeEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
bool m_update_pending;
|
||||
|
@ -57,10 +57,10 @@ public slots:
|
||||
void renderNow();
|
||||
|
||||
protected:
|
||||
bool event(QEvent *event);
|
||||
bool event(QEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void exposeEvent(QExposeEvent *event);
|
||||
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
||||
void exposeEvent(QExposeEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QBackingStore *m_backingStore;
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
explicit SessionWidget(const QNetworkConfiguration &config, QWidget *parent = 0);
|
||||
~SessionWidget();
|
||||
|
||||
void timerEvent(QTimerEvent *);
|
||||
void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
void updateSessionState(QNetworkSession::State state);
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
~FortuneThread();
|
||||
|
||||
void requestNewFortune(const QString &hostName, quint16 port);
|
||||
void run();
|
||||
void run() Q_DECL_OVERRIDE;
|
||||
|
||||
signals:
|
||||
void newFortune(const QString &fortune);
|
||||
|
@ -60,7 +60,7 @@ class GSuggestCompletion : public QObject
|
||||
public:
|
||||
GSuggestCompletion(QLineEdit *parent = 0);
|
||||
~GSuggestCompletion();
|
||||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
bool eventFilter(QObject *obj, QEvent *ev) Q_DECL_OVERRIDE;
|
||||
void showCompletion(const QStringList &choices, const QStringList &hits);
|
||||
|
||||
public slots:
|
||||
|
@ -78,7 +78,7 @@ signals:
|
||||
void newMessage(const QString &from, const QString &message);
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent *timerEvent);
|
||||
void timerEvent(QTimerEvent *timerEvent) Q_DECL_OVERRIDE;
|
||||
|
||||
private slots:
|
||||
void processReadyRead();
|
||||
|
@ -56,7 +56,7 @@ signals:
|
||||
void newConnection(Connection *connection);
|
||||
|
||||
protected:
|
||||
void incomingConnection(qintptr socketDescriptor);
|
||||
void incomingConnection(qintptr socketDescriptor) Q_DECL_OVERRIDE;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
FortuneServer(QObject *parent = 0);
|
||||
|
||||
protected:
|
||||
void incomingConnection(qintptr socketDescriptor);
|
||||
void incomingConnection(qintptr socketDescriptor) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QStringList fortunes;
|
||||
|
@ -52,7 +52,7 @@ class FortuneThread : public QThread
|
||||
public:
|
||||
FortuneThread(int socketDescriptor, const QString &fortune, QObject *parent);
|
||||
|
||||
void run();
|
||||
void run() Q_DECL_OVERRIDE;
|
||||
|
||||
signals:
|
||||
void error(QTcpSocket::SocketError socketError);
|
||||
|
@ -90,7 +90,7 @@ signals:
|
||||
void pieceVerified(int pieceIndex, bool verified);
|
||||
|
||||
protected:
|
||||
void run();
|
||||
void run() Q_DECL_OVERRIDE;
|
||||
|
||||
private slots:
|
||||
bool verifySinglePiece(int pieceIndex);
|
||||
|
@ -57,8 +57,8 @@ signals:
|
||||
void fileDropped(const QString &fileName);
|
||||
|
||||
protected:
|
||||
void dragMoveEvent(QDragMoveEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
|
||||
void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -69,8 +69,8 @@ class TorrentViewDelegate : public QItemDelegate
|
||||
public:
|
||||
inline TorrentViewDelegate(MainWindow *mainWindow) : QItemDelegate(mainWindow) {}
|
||||
|
||||
inline void paint(QPainter *painter, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index ) const
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index ) const Q_DECL_OVERRIDE
|
||||
{
|
||||
if (index.column() != 2) {
|
||||
QItemDelegate::paint(painter, option, index);
|
||||
|
@ -63,11 +63,11 @@ class MainWindow : public QMainWindow
|
||||
public:
|
||||
MainWindow(QWidget *parent = 0);
|
||||
|
||||
QSize sizeHint() const;
|
||||
QSize sizeHint() const Q_DECL_OVERRIDE;
|
||||
const TorrentClient *clientForRow(int row) const;
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private slots:
|
||||
void loadSettings();
|
||||
|
@ -112,14 +112,14 @@ public:
|
||||
qint64 uploadSpeed() 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 socketBytesToWrite() const { return socket.bytesToWrite(); }
|
||||
|
||||
void setReadBufferSize(qint64 size);
|
||||
void setReadBufferSize(qint64 size) Q_DECL_OVERRIDE;
|
||||
|
||||
void connectToHost(const QHostAddress &address,
|
||||
quint16 port, OpenMode openMode = ReadWrite);
|
||||
quint16 port, OpenMode openMode = ReadWrite) Q_DECL_OVERRIDE;
|
||||
void diconnectFromHost();
|
||||
|
||||
signals:
|
||||
@ -138,11 +138,11 @@ signals:
|
||||
void bytesReceived(qint64 size);
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent *event);
|
||||
void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
qint64 readData(char *data, qint64 maxlen);
|
||||
qint64 readLineData(char *data, qint64 maxlen);
|
||||
qint64 writeData(const char *data, qint64 len);
|
||||
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;
|
||||
|
||||
private slots:
|
||||
void sendHandShake();
|
||||
|
@ -158,7 +158,7 @@ public slots:
|
||||
void setupIncomingConnection(PeerWireClient *client);
|
||||
|
||||
protected slots:
|
||||
void timerEvent(QTimerEvent *event);
|
||||
void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private slots:
|
||||
// File management
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
void removeClient(TorrentClient *client);
|
||||
|
||||
protected:
|
||||
void incomingConnection(qintptr socketDescriptor);
|
||||
void incomingConnection(qintptr socketDescriptor) Q_DECL_OVERRIDE;
|
||||
|
||||
private slots:
|
||||
void removeClient();
|
||||
|
@ -78,7 +78,7 @@ signals:
|
||||
void stopped();
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent *event);
|
||||
void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private slots:
|
||||
void fetchPeerList();
|
||||
|
@ -57,7 +57,7 @@ public slots:
|
||||
void animate();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
Helper *helper;
|
||||
|
@ -57,7 +57,7 @@ public slots:
|
||||
void animate();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
Helper *helper;
|
||||
|
@ -63,13 +63,13 @@ public:
|
||||
~MainWidget();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *e);
|
||||
void mouseReleaseEvent(QMouseEvent *e);
|
||||
void timerEvent(QTimerEvent *e);
|
||||
void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
|
||||
void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
|
||||
void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
|
||||
|
||||
void initializeGL();
|
||||
void resizeGL(int w, int h);
|
||||
void paintGL();
|
||||
void initializeGL() Q_DECL_OVERRIDE;
|
||||
void resizeGL(int w, int h) Q_DECL_OVERRIDE;
|
||||
void paintGL() Q_DECL_OVERRIDE;
|
||||
|
||||
void initShaders();
|
||||
void initTextures();
|
||||
|
@ -45,12 +45,12 @@ class GLWidget : public QGLWidget
|
||||
public:
|
||||
GLWidget(QWidget *parent);
|
||||
~GLWidget();
|
||||
void initializeGL();
|
||||
void resizeGL(int w, int h);
|
||||
void paintGL();
|
||||
void timerEvent(QTimerEvent *) { update(); }
|
||||
void mousePressEvent(QMouseEvent *) { killTimer(timerId); }
|
||||
void mouseReleaseEvent(QMouseEvent *) { timerId = startTimer(20); }
|
||||
void initializeGL() Q_DECL_OVERRIDE;
|
||||
void resizeGL(int w, int h) Q_DECL_OVERRIDE;
|
||||
void paintGL() Q_DECL_OVERRIDE;
|
||||
void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE { update(); }
|
||||
void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE { killTimer(timerId); }
|
||||
void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE { timerId = startTimer(20); }
|
||||
|
||||
void drawCube(int i, GLfloat z, GLfloat ri, GLfloat jmp, GLfloat amp);
|
||||
|
||||
|
@ -66,11 +66,11 @@ signals:
|
||||
void zRotationChanged(int angle);
|
||||
|
||||
protected:
|
||||
void initializeGL();
|
||||
void paintGL();
|
||||
void resizeGL(int width, int height);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void initializeGL() Q_DECL_OVERRIDE;
|
||||
void paintGL() Q_DECL_OVERRIDE;
|
||||
void resizeGL(int width, int height) Q_DECL_OVERRIDE;
|
||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private slots:
|
||||
void advanceGears();
|
||||
|
@ -54,8 +54,8 @@ public:
|
||||
GLWidget(QWidget *parent = 0);
|
||||
~GLWidget();
|
||||
|
||||
QSize minimumSizeHint() const;
|
||||
QSize sizeHint() const;
|
||||
QSize minimumSizeHint() const Q_DECL_OVERRIDE;
|
||||
QSize sizeHint() const Q_DECL_OVERRIDE;
|
||||
//! [0]
|
||||
|
||||
//! [1]
|
||||
@ -72,11 +72,11 @@ signals:
|
||||
|
||||
//! [2]
|
||||
protected:
|
||||
void initializeGL();
|
||||
void paintGL();
|
||||
void resizeGL(int width, int height);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void initializeGL() Q_DECL_OVERRIDE;
|
||||
void paintGL() Q_DECL_OVERRIDE;
|
||||
void resizeGL(int width, int height) Q_DECL_OVERRIDE;
|
||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
//! [2]
|
||||
|
||||
//! [3]
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
Window();
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QSlider *createSlider();
|
||||
|
@ -98,10 +98,10 @@ public:
|
||||
QColor color() const;
|
||||
void updateColor();
|
||||
|
||||
void exposeEvent(QExposeEvent *event);
|
||||
void exposeEvent(QExposeEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
void mousePressEvent(QMouseEvent *);
|
||||
void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
|
||||
|
||||
int m_colorIndex;
|
||||
QColor m_color;
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
~GLWidget();
|
||||
//! [0]
|
||||
|
||||
QSize sizeHint() const;
|
||||
QSize sizeHint() const Q_DECL_OVERRIDE;
|
||||
int xRotation() const { return xRot; }
|
||||
int yRotation() const { return yRot; }
|
||||
int zRotation() const { return zRot; }
|
||||
@ -69,12 +69,12 @@ public slots:
|
||||
|
||||
//! [1]
|
||||
protected:
|
||||
void initializeGL();
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void resizeGL(int width, int height);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void showEvent(QShowEvent *event);
|
||||
void initializeGL() Q_DECL_OVERRIDE;
|
||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
||||
void resizeGL(int width, int height) Q_DECL_OVERRIDE;
|
||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private slots:
|
||||
void animate();
|
||||
|
@ -74,8 +74,8 @@ private slots:
|
||||
void rotationDone();
|
||||
|
||||
private:
|
||||
void exposeEvent(QExposeEvent *);
|
||||
void mousePressEvent(QMouseEvent *);
|
||||
void exposeEvent(QExposeEvent *) Q_DECL_OVERRIDE;
|
||||
void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
|
||||
|
||||
void paint(QPainter *painter, const QRect &rect);
|
||||
|
||||
|
@ -57,11 +57,11 @@ public:
|
||||
~GLWidget();
|
||||
|
||||
protected:
|
||||
void initializeGL();
|
||||
void paintGL();
|
||||
void resizeGL(int width, int height);
|
||||
void mousePressEvent(QMouseEvent *) { setAnimationPaused(true); }
|
||||
void mouseReleaseEvent(QMouseEvent *) { setAnimationPaused(false); }
|
||||
void initializeGL() Q_DECL_OVERRIDE;
|
||||
void paintGL() Q_DECL_OVERRIDE;
|
||||
void resizeGL(int width, int height) Q_DECL_OVERRIDE;
|
||||
void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE { setAnimationPaused(true); }
|
||||
void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE { setAnimationPaused(false); }
|
||||
|
||||
private:
|
||||
void initializeGeometry();
|
||||
|
@ -46,10 +46,10 @@ public:
|
||||
GLWidget(QWidget *parent);
|
||||
|
||||
protected:
|
||||
void initializeGL();
|
||||
void resizeGL(int w, int h);
|
||||
void paintGL();
|
||||
void timerEvent(QTimerEvent *);
|
||||
void initializeGL() Q_DECL_OVERRIDE;
|
||||
void resizeGL(int w, int h) Q_DECL_OVERRIDE;
|
||||
void paintGL() Q_DECL_OVERRIDE;
|
||||
void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
|
||||
|
||||
void makeObject();
|
||||
void quad(GLenum primitive, GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2,
|
||||
|
@ -55,8 +55,8 @@ public:
|
||||
explicit GLWidget(QWidget *parent = 0, QGLWidget *shareWidget = 0);
|
||||
~GLWidget();
|
||||
|
||||
QSize minimumSizeHint() const;
|
||||
QSize sizeHint() const;
|
||||
QSize minimumSizeHint() const Q_DECL_OVERRIDE;
|
||||
QSize sizeHint() const Q_DECL_OVERRIDE;
|
||||
void rotateBy(int xAngle, int yAngle, int zAngle);
|
||||
void setClearColor(const QColor &color);
|
||||
|
||||
@ -64,12 +64,12 @@ signals:
|
||||
void clicked();
|
||||
|
||||
protected:
|
||||
void initializeGL();
|
||||
void paintGL();
|
||||
void resizeGL(int width, int height);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void initializeGL() Q_DECL_OVERRIDE;
|
||||
void paintGL() Q_DECL_OVERRIDE;
|
||||
void resizeGL(int width, int height) Q_DECL_OVERRIDE;
|
||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
void makeObject();
|
||||
|
@ -48,16 +48,16 @@ public:
|
||||
Window(QScreen *screen);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *);
|
||||
void mouseMoveEvent(QMouseEvent *);
|
||||
void mouseReleaseEvent(QMouseEvent *);
|
||||
void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
|
||||
void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
|
||||
void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
|
||||
|
||||
void keyPressEvent(QKeyEvent *);
|
||||
void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
|
||||
|
||||
void exposeEvent(QExposeEvent *);
|
||||
void resizeEvent(QResizeEvent *);
|
||||
void exposeEvent(QExposeEvent *) Q_DECL_OVERRIDE;
|
||||
void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
|
||||
|
||||
void timerEvent(QTimerEvent *);
|
||||
void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
void render();
|
||||
|
@ -55,16 +55,16 @@ public:
|
||||
BookDelegate(QObject *parent);
|
||||
|
||||
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,
|
||||
const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index);
|
||||
const QModelIndex &index) Q_DECL_OVERRIDE;
|
||||
|
||||
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const;
|
||||
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QPixmap star;
|
||||
|
@ -56,8 +56,8 @@ public:
|
||||
int id();
|
||||
|
||||
protected:
|
||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private slots:
|
||||
void setFrame(int frame);
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
View(const QString &items, const QString &images, QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
//! [0]
|
||||
|
||||
//! [1]
|
||||
|
@ -51,7 +51,7 @@ class CustomSqlModel : public QSqlQueryModel
|
||||
public:
|
||||
CustomSqlModel(QObject *parent = 0);
|
||||
|
||||
QVariant data(const QModelIndex &item, int role) const;
|
||||
QVariant data(const QModelIndex &item, int role) const Q_DECL_OVERRIDE;
|
||||
};
|
||||
//! [0]
|
||||
|
||||
|
@ -50,8 +50,8 @@ class EditableSqlModel : public QSqlQueryModel
|
||||
public:
|
||||
EditableSqlModel(QObject *parent = 0);
|
||||
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role);
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
bool setFirstName(int personId, const QString &firstName);
|
||||
|
@ -108,7 +108,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
|
||||
QVariant data(const QModelIndex &idx, int role) const Q_DECL_OVERRIDE
|
||||
{
|
||||
if (role == Qt::BackgroundRole && isDirty(idx))
|
||||
return QBrush(QColor(Qt::yellow));
|
||||
|
@ -55,15 +55,15 @@ public:
|
||||
MandelbrotWidget(QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
||||
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
||||
void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
|
||||
#ifndef QT_NO_WHEELEVENT
|
||||
void wheelEvent(QWheelEvent *event);
|
||||
void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
|
||||
#endif
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private slots:
|
||||
void updatePixmap(const QImage &image, double scaleFactor);
|
||||
|
@ -65,7 +65,7 @@ signals:
|
||||
void renderedImage(const QImage &image, double scaleFactor);
|
||||
|
||||
protected:
|
||||
void run();
|
||||
void run() Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
uint rgbFromWaveLength(double wave);
|
||||
|
@ -58,7 +58,7 @@ class Producer : public QThread
|
||||
//! [1] //! [2]
|
||||
{
|
||||
public:
|
||||
void run()
|
||||
void run() Q_DECL_OVERRIDE
|
||||
{
|
||||
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
|
||||
for (int i = 0; i < DataSize; ++i) {
|
||||
@ -76,7 +76,7 @@ class Consumer : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
void run()
|
||||
void run() Q_DECL_OVERRIDE
|
||||
{
|
||||
for (int i = 0; i < DataSize; ++i) {
|
||||
usedBytes.acquire();
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void run()
|
||||
void run() Q_DECL_OVERRIDE
|
||||
{
|
||||
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) {
|
||||
mutex.lock();
|
||||
|
@ -52,8 +52,8 @@ public:
|
||||
RandomListModel(QObject *parent = 0);
|
||||
~RandomListModel();
|
||||
|
||||
int rowCount(const QModelIndex & = QModelIndex()) const;
|
||||
QVariant data(const QModelIndex &, int) const;
|
||||
int rowCount(const QModelIndex & = QModelIndex()) const Q_DECL_OVERRIDE;
|
||||
QVariant data(const QModelIndex &, int) const Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
void cacheRows(int, int) const;
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
MainWindow();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private slots:
|
||||
void open();
|
||||
|
@ -64,9 +64,9 @@ public slots:
|
||||
void print();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
bool event(QEvent *event);
|
||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
||||
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
||||
bool event(QEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
void resizeImage(QImage *image, const QSize &newSize);
|
||||
|
@ -48,7 +48,7 @@ class Knob : public QGraphicsEllipseItem
|
||||
public:
|
||||
Knob();
|
||||
|
||||
bool sceneEvent(QEvent *event);
|
||||
bool sceneEvent(QEvent *event) Q_DECL_OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // KNOB_H
|
||||
|
@ -48,7 +48,7 @@ class GraphicsView : public QGraphicsView
|
||||
public:
|
||||
GraphicsView(QGraphicsScene *scene = 0, QWidget *parent = 0);
|
||||
|
||||
bool viewportEvent(QEvent *event);
|
||||
bool viewportEvent(QEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
qreal totalScaleFactor;
|
||||
|
@ -51,13 +51,13 @@ class Mouse : public QGraphicsObject
|
||||
public:
|
||||
Mouse();
|
||||
|
||||
QRectF boundingRect() const;
|
||||
QPainterPath shape() const;
|
||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||
QPainterPath shape() const Q_DECL_OVERRIDE;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget);
|
||||
QWidget *widget) Q_DECL_OVERRIDE;
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent *event);
|
||||
void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
qreal angle;
|
||||
|
@ -64,19 +64,19 @@ public:
|
||||
setCacheMode(DeviceCoordinateCache);
|
||||
}
|
||||
|
||||
QRectF boundingRect() const
|
||||
QRectF boundingRect() const Q_DECL_OVERRIDE
|
||||
{
|
||||
return QRectF(-65, -65, 130, 130);
|
||||
}
|
||||
|
||||
QPainterPath shape() const
|
||||
QPainterPath shape() const Q_DECL_OVERRIDE
|
||||
{
|
||||
QPainterPath path;
|
||||
path.addEllipse(boundingRect());
|
||||
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;
|
||||
QRectF r = boundingRect();
|
||||
@ -101,13 +101,13 @@ signals:
|
||||
void pressed();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *)
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *) Q_DECL_OVERRIDE
|
||||
{
|
||||
emit pressed();
|
||||
update();
|
||||
}
|
||||
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *)
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *) Q_DECL_OVERRIDE
|
||||
{
|
||||
update();
|
||||
}
|
||||
@ -122,7 +122,7 @@ public:
|
||||
View(QGraphicsScene *scene) : QGraphicsView(scene) { }
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event)
|
||||
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE
|
||||
{
|
||||
QGraphicsView::resizeEvent(event);
|
||||
fitInView(sceneRect(), Qt::KeepAspectRatio);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent * )
|
||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent * ) Q_DECL_OVERRIDE
|
||||
{
|
||||
emit clicked();
|
||||
}
|
||||
|
||||
virtual void setGeometry(const QRectF &rect)
|
||||
virtual void setGeometry(const QRectF &rect) Q_DECL_OVERRIDE
|
||||
{
|
||||
QGraphicsWidget::setGeometry(rect);
|
||||
|
||||
@ -88,7 +88,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual void resizeEvent(QResizeEvent *)
|
||||
virtual void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE
|
||||
{
|
||||
fitInView(sceneRect(), Qt::KeepAspectRatio);
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
m_path = QPainterPath();
|
||||
}
|
||||
|
||||
void updateCurrentTime(int currentTime)
|
||||
void updateCurrentTime(int currentTime) Q_DECL_OVERRIDE
|
||||
{
|
||||
if (m_pathType == CirclePath) {
|
||||
if (m_path.isEmpty()) {
|
||||
|
@ -70,7 +70,7 @@ class QGraphicsRectWidget : public QGraphicsWidget
|
||||
{
|
||||
public:
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *,
|
||||
QWidget *)
|
||||
QWidget *) Q_DECL_OVERRIDE
|
||||
{
|
||||
painter->fillRect(rect(), Qt::blue);
|
||||
}
|
||||
@ -88,14 +88,14 @@ public:
|
||||
|
||||
protected:
|
||||
//![14]
|
||||
virtual bool eventTest(QEvent *event)
|
||||
virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE
|
||||
{
|
||||
return (event->type() == QEvent::Type(StateSwitchEvent::StateSwitchType))
|
||||
&& (static_cast<StateSwitchEvent *>(event)->rand() == m_rand);
|
||||
}
|
||||
//![14]
|
||||
|
||||
virtual void onTransition(QEvent *) {}
|
||||
virtual void onTransition(QEvent *) Q_DECL_OVERRIDE {}
|
||||
|
||||
private:
|
||||
int m_rand;
|
||||
@ -112,7 +112,7 @@ public:
|
||||
//![10]
|
||||
|
||||
//![11]
|
||||
virtual void onEntry(QEvent *)
|
||||
virtual void onEntry(QEvent *) Q_DECL_OVERRIDE
|
||||
{
|
||||
int n;
|
||||
while ((n = (qrand() % m_stateCount + 1)) == m_lastIndex)
|
||||
@ -120,7 +120,7 @@ public:
|
||||
m_lastIndex = n;
|
||||
machine()->postEvent(new StateSwitchEvent(n));
|
||||
}
|
||||
virtual void onExit(QEvent *) {}
|
||||
virtual void onExit(QEvent *) Q_DECL_OVERRIDE {}
|
||||
//![11]
|
||||
|
||||
//![12]
|
||||
@ -164,7 +164,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void resizeEvent(QResizeEvent *event)
|
||||
virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE
|
||||
{
|
||||
fitInView(scene()->sceneRect());
|
||||
QGraphicsView::resizeEvent(event);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
QRectF boundingRect() const
|
||||
QRectF boundingRect() const Q_DECL_OVERRIDE
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
@ -51,8 +51,8 @@ public:
|
||||
GraphicsView(QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
virtual void resizeEvent(QResizeEvent *event);
|
||||
void keyPressEvent(QKeyEvent *);
|
||||
virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
||||
void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
|
||||
|
||||
signals:
|
||||
void keyPressed(int key);
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
setTargetState(target);
|
||||
}
|
||||
|
||||
virtual bool eventTest(QEvent *e)
|
||||
virtual bool eventTest(QEvent *e) Q_DECL_OVERRIDE
|
||||
{
|
||||
if (QSignalTransition::eventTest(e)) {
|
||||
QVariant key = static_cast<QStateMachine::SignalEvent*>(e)->arguments().at(0);
|
||||
@ -85,7 +85,7 @@ public:
|
||||
startTimer(1000);
|
||||
}
|
||||
|
||||
virtual bool eventTest(QEvent *e)
|
||||
virtual bool eventTest(QEvent *e) Q_DECL_OVERRIDE
|
||||
{
|
||||
return QEventTransition::eventTest(e) && ((qrand() % 50) == 0);
|
||||
}
|
||||
|
@ -50,18 +50,18 @@ public:
|
||||
explicit Node(const QPointF &pos, QGraphicsItem *parent = 0);
|
||||
~Node();
|
||||
|
||||
QRectF boundingRect() const;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
|
||||
|
||||
signals:
|
||||
void positionChanged();
|
||||
|
||||
protected:
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
|
||||
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *);
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *);
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *) Q_DECL_OVERRIDE;
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *) Q_DECL_OVERRIDE;
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
bool m_dragging;
|
||||
|
@ -50,13 +50,13 @@ public:
|
||||
RectButton(QString buttonText);
|
||||
~RectButton();
|
||||
|
||||
virtual QRectF boundingRect() const;
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
|
||||
|
||||
protected:
|
||||
QString m_ButtonText;
|
||||
|
||||
virtual void mousePressEvent (QGraphicsSceneMouseEvent *event);
|
||||
virtual void mousePressEvent (QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
signals:
|
||||
void clicked();
|
||||
|
@ -59,8 +59,8 @@ public:
|
||||
StickMan();
|
||||
~StickMan();
|
||||
|
||||
virtual QRectF boundingRect() const;
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
|
||||
|
||||
int nodeCount() const;
|
||||
Node *node(int idx) const;
|
||||
@ -82,7 +82,7 @@ public slots:
|
||||
void childPositionChanged();
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent *e);
|
||||
void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -77,7 +77,7 @@ public:
|
||||
|
||||
void updateBoatMovement();
|
||||
|
||||
virtual int type() const;
|
||||
virtual int type() const Q_DECL_OVERRIDE;
|
||||
|
||||
signals:
|
||||
void boatDestroyed();
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
{
|
||||
}
|
||||
protected:
|
||||
virtual bool eventTest(QEvent *event)
|
||||
virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE
|
||||
{
|
||||
if (!QKeyEventTransition::eventTest(event))
|
||||
return false;
|
||||
@ -91,13 +91,13 @@ public:
|
||||
{
|
||||
}
|
||||
protected:
|
||||
virtual bool eventTest(QEvent *event)
|
||||
virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE
|
||||
{
|
||||
if (!QKeyEventTransition::eventTest(event))
|
||||
return false;
|
||||
return (boat->currentSpeed() >= 0);
|
||||
}
|
||||
void onTransition(QEvent *)
|
||||
void onTransition(QEvent *) Q_DECL_OVERRIDE
|
||||
{
|
||||
//We decrease the speed if needed
|
||||
if (key == Qt::Key_Left && boat->currentDirection() == Boat::Right)
|
||||
@ -122,7 +122,7 @@ public:
|
||||
{
|
||||
}
|
||||
protected:
|
||||
virtual bool eventTest(QEvent *event)
|
||||
virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE
|
||||
{
|
||||
if (!QKeyEventTransition::eventTest(event))
|
||||
return false;
|
||||
@ -141,7 +141,7 @@ public:
|
||||
{
|
||||
}
|
||||
protected:
|
||||
void onEntry(QEvent *)
|
||||
void onEntry(QEvent *) Q_DECL_OVERRIDE
|
||||
{
|
||||
boat->setCurrentDirection(Boat::Right);
|
||||
boat->updateBoatMovement();
|
||||
@ -158,7 +158,7 @@ public:
|
||||
{
|
||||
}
|
||||
protected:
|
||||
void onEntry(QEvent *)
|
||||
void onEntry(QEvent *) Q_DECL_OVERRIDE
|
||||
{
|
||||
boat->setCurrentDirection(Boat::Left);
|
||||
boat->updateBoatMovement();
|
||||
@ -175,7 +175,7 @@ public:
|
||||
{
|
||||
}
|
||||
protected:
|
||||
void onEntry(QEvent *)
|
||||
void onEntry(QEvent *) Q_DECL_OVERRIDE
|
||||
{
|
||||
boat->setCurrentSpeed(0);
|
||||
boat->setCurrentDirection(Boat::None);
|
||||
@ -193,7 +193,7 @@ public:
|
||||
{
|
||||
}
|
||||
protected:
|
||||
void onEntry(QEvent *)
|
||||
void onEntry(QEvent *) Q_DECL_OVERRIDE
|
||||
{
|
||||
Bomb *b = new Bomb();
|
||||
b->setPos(boat->x()+boat->size().width(),boat->y());
|
||||
@ -214,7 +214,7 @@ public:
|
||||
{
|
||||
}
|
||||
protected:
|
||||
void onEntry(QEvent *)
|
||||
void onEntry(QEvent *) Q_DECL_OVERRIDE
|
||||
{
|
||||
Bomb *b = new Bomb();
|
||||
b->setPos(boat->x() - b->size().width(), boat->y());
|
||||
|
@ -54,8 +54,8 @@ public:
|
||||
PixmapItem(const QString &fileName, GraphicsScene::Mode mode, QGraphicsItem * parent = 0);
|
||||
PixmapItem(const QString &fileName, QGraphicsScene *scene);
|
||||
QSizeF size() const;
|
||||
QRectF boundingRect() const;
|
||||
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
|
||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) Q_DECL_OVERRIDE;
|
||||
private:
|
||||
QPixmap pix;
|
||||
};
|
||||
|
@ -71,9 +71,9 @@ signals:
|
||||
void animationFinished();
|
||||
|
||||
protected:
|
||||
void onEntry(QEvent *);
|
||||
void onExit(QEvent *);
|
||||
bool event(QEvent *e);
|
||||
void onEntry(QEvent *) Q_DECL_OVERRIDE;
|
||||
void onExit(QEvent *) Q_DECL_OVERRIDE;
|
||||
bool event(QEvent *e) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(QAnimationState)
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
~PlayState();
|
||||
|
||||
protected:
|
||||
void onEntry(QEvent *);
|
||||
void onEntry(QEvent *) Q_DECL_OVERRIDE;
|
||||
|
||||
private :
|
||||
GraphicsScene *scene;
|
||||
@ -85,7 +85,7 @@ class LevelState : public QState
|
||||
public:
|
||||
LevelState(GraphicsScene *scene, PlayState *game, QState *parent = 0);
|
||||
protected:
|
||||
void onEntry(QEvent *);
|
||||
void onEntry(QEvent *) Q_DECL_OVERRIDE;
|
||||
private :
|
||||
void initializeLevel();
|
||||
GraphicsScene *scene;
|
||||
@ -98,8 +98,8 @@ public:
|
||||
explicit PauseState(GraphicsScene *scene, QState *parent = 0);
|
||||
|
||||
protected:
|
||||
void onEntry(QEvent *);
|
||||
void onExit(QEvent *);
|
||||
void onEntry(QEvent *) Q_DECL_OVERRIDE;
|
||||
void onExit(QEvent *) Q_DECL_OVERRIDE;
|
||||
private :
|
||||
GraphicsScene *scene;
|
||||
};
|
||||
@ -110,8 +110,8 @@ public:
|
||||
LostState(GraphicsScene *scene, PlayState *game, QState *parent = 0);
|
||||
|
||||
protected:
|
||||
void onEntry(QEvent *);
|
||||
void onExit(QEvent *);
|
||||
void onEntry(QEvent *) Q_DECL_OVERRIDE;
|
||||
void onExit(QEvent *) Q_DECL_OVERRIDE;
|
||||
private :
|
||||
GraphicsScene *scene;
|
||||
PlayState *game;
|
||||
@ -123,8 +123,8 @@ public:
|
||||
WinState(GraphicsScene *scene, PlayState *game, QState *parent = 0);
|
||||
|
||||
protected:
|
||||
void onEntry(QEvent *);
|
||||
void onExit(QEvent *);
|
||||
void onEntry(QEvent *) Q_DECL_OVERRIDE;
|
||||
void onExit(QEvent *) Q_DECL_OVERRIDE;
|
||||
private :
|
||||
GraphicsScene *scene;
|
||||
PlayState *game;
|
||||
@ -143,7 +143,7 @@ class UpdateScoreTransition : public QSignalTransition
|
||||
public:
|
||||
UpdateScoreTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target);
|
||||
protected:
|
||||
virtual bool eventTest(QEvent *event);
|
||||
virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
|
||||
private:
|
||||
PlayState * game;
|
||||
GraphicsScene *scene;
|
||||
@ -155,7 +155,7 @@ class WinTransition : public QSignalTransition
|
||||
public:
|
||||
WinTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target);
|
||||
protected:
|
||||
virtual bool eventTest(QEvent *event);
|
||||
virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
|
||||
private:
|
||||
PlayState * game;
|
||||
GraphicsScene *scene;
|
||||
@ -167,7 +167,7 @@ private:
|
||||
public:
|
||||
CustomSpaceTransition(QWidget *widget, PlayState *game, QEvent::Type type, int key);
|
||||
protected:
|
||||
virtual bool eventTest(QEvent *event);
|
||||
virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
|
||||
private:
|
||||
PlayState *game;
|
||||
};
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
void launchTorpedo(int speed);
|
||||
void destroy();
|
||||
|
||||
virtual int type() const;
|
||||
virtual int type() const Q_DECL_OVERRIDE;
|
||||
|
||||
QGraphicsRotation *rotation() const { return graphicsRotation; }
|
||||
|
||||
|
@ -84,7 +84,7 @@ protected slots:
|
||||
}
|
||||
|
||||
protected:
|
||||
void onEntry(QEvent *e)
|
||||
void onEntry(QEvent *e) Q_DECL_OVERRIDE
|
||||
{
|
||||
if (submarine->currentDirection() == SubMarine::Left) {
|
||||
movementAnimation->setEndValue(QPointF(0,submarine->y()));
|
||||
@ -116,14 +116,14 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
void onEntry(QEvent *e)
|
||||
void onEntry(QEvent *e) Q_DECL_OVERRIDE
|
||||
{
|
||||
returnAnimation->stop();
|
||||
returnAnimation->setEndValue(submarine->currentDirection() == SubMarine::Right ? 360. : 180.);
|
||||
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);
|
||||
QAnimationState::onExit(e);
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
Screenshot();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private slots:
|
||||
void newScreenshot();
|
||||
|
@ -68,10 +68,10 @@ class Window : public QDialog
|
||||
public:
|
||||
Window();
|
||||
|
||||
void setVisible(bool visible);
|
||||
void setVisible(bool visible) Q_DECL_OVERRIDE;
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private slots:
|
||||
void setIcon(int index);
|
||||
|
@ -59,7 +59,7 @@ class ClassWizard : public QWizard
|
||||
public:
|
||||
ClassWizard(QWidget *parent = 0);
|
||||
|
||||
void accept();
|
||||
void accept() Q_DECL_OVERRIDE;
|
||||
};
|
||||
//! [0]
|
||||
|
||||
@ -107,7 +107,7 @@ public:
|
||||
CodeStylePage(QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
void initializePage();
|
||||
void initializePage() Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QCheckBox *commentCheckBox;
|
||||
@ -128,7 +128,7 @@ public:
|
||||
OutputFilesPage(QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
void initializePage();
|
||||
void initializePage() Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QLabel *outputDirLabel;
|
||||
@ -147,7 +147,7 @@ public:
|
||||
ConclusionPage(QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
void initializePage();
|
||||
void initializePage() Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QLabel *label;
|
||||
|
@ -78,7 +78,7 @@ class IntroPage : public QWizardPage
|
||||
public:
|
||||
IntroPage(QWidget *parent = 0);
|
||||
|
||||
int nextId() const;
|
||||
int nextId() const Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QLabel *topLabel;
|
||||
@ -95,7 +95,7 @@ class EvaluatePage : public QWizardPage
|
||||
public:
|
||||
EvaluatePage(QWidget *parent = 0);
|
||||
|
||||
int nextId() const;
|
||||
int nextId() const Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QLabel *nameLabel;
|
||||
@ -112,7 +112,7 @@ class RegisterPage : public QWizardPage
|
||||
public:
|
||||
RegisterPage(QWidget *parent = 0);
|
||||
|
||||
int nextId() const;
|
||||
int nextId() const Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QLabel *nameLabel;
|
||||
@ -128,7 +128,7 @@ class DetailsPage : public QWizardPage
|
||||
public:
|
||||
DetailsPage(QWidget *parent = 0);
|
||||
|
||||
int nextId() const;
|
||||
int nextId() const Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QLabel *companyLabel;
|
||||
@ -147,9 +147,9 @@ class ConclusionPage : public QWizardPage
|
||||
public:
|
||||
ConclusionPage(QWidget *parent = 0);
|
||||
|
||||
void initializePage();
|
||||
int nextId() const;
|
||||
void setVisible(bool visible);
|
||||
void initializePage() Q_DECL_OVERRIDE;
|
||||
int nextId() const Q_DECL_OVERRIDE;
|
||||
void setVisible(bool visible) Q_DECL_OVERRIDE;
|
||||
|
||||
private slots:
|
||||
void printButtonClicked();
|
||||
|
@ -55,10 +55,10 @@ public:
|
||||
DragWidget(QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dragMoveEvent(QDragMoveEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
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;
|
||||
};
|
||||
//! [0]
|
||||
|
||||
|
@ -54,9 +54,9 @@ public:
|
||||
DragWidget(QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
|
||||
void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
|
||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // DRAGWIDGET_H
|
||||
|
@ -64,10 +64,10 @@ signals:
|
||||
|
||||
//! [DropArea header part2]
|
||||
protected:
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dragMoveEvent(QDragMoveEvent *event);
|
||||
void dragLeaveEvent(QDragLeaveEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
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;
|
||||
|
||||
private:
|
||||
QLabel *label;
|
||||
|
@ -55,10 +55,10 @@ public:
|
||||
DragWidget(QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dragMoveEvent(QDragMoveEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
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;
|
||||
};
|
||||
//! [0]
|
||||
|
||||
|
@ -52,10 +52,10 @@ public:
|
||||
void addPiece(QPixmap pixmap, QPoint location);
|
||||
|
||||
protected:
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dragMoveEvent(QDragMoveEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
void startDrag(Qt::DropActions supportedActions);
|
||||
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;
|
||||
|
||||
int m_PieceSize;
|
||||
};
|
||||
|
@ -67,12 +67,12 @@ signals:
|
||||
void puzzleCompleted();
|
||||
|
||||
protected:
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dragLeaveEvent(QDragLeaveEvent *event);
|
||||
void dragMoveEvent(QDragMoveEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void paintEvent(QPaintEvent *event);
|
||||
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;
|
||||
|
||||
private:
|
||||
int findPiece(const QRect &pieceRect) const;
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
|
||||
QRectF boundingRect() const;
|
||||
|
||||
void draw(QPainter *painter);
|
||||
void draw(QPainter *painter) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
void adjustForItem();
|
||||
|
@ -59,9 +59,9 @@ public:
|
||||
void setIndex(qreal);
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
|
||||
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
void setupScene();
|
||||
|
@ -58,7 +58,7 @@ private:
|
||||
void setupScene();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
qreal angle;
|
||||
|
@ -65,10 +65,10 @@ public:
|
||||
void grabGestures(const QList<Qt::GestureType> &gestures);
|
||||
|
||||
protected:
|
||||
bool event(QEvent *event);
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void mouseDoubleClickEvent(QMouseEvent *event);
|
||||
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;
|
||||
|
||||
private:
|
||||
bool gestureEvent(QGestureEvent *event);
|
||||
|
@ -51,12 +51,12 @@ public:
|
||||
LayoutItem(QGraphicsItem *parent = 0);
|
||||
~LayoutItem();
|
||||
// Inherited from QGraphicsLayoutItem
|
||||
void setGeometry(const QRectF &geom);
|
||||
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
|
||||
void setGeometry(const QRectF &geom) Q_DECL_OVERRIDE;
|
||||
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const Q_DECL_OVERRIDE;
|
||||
|
||||
// Inherited from QGraphicsItem
|
||||
QRectF boundingRect() const;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QPixmap *m_pix;
|
||||
|
@ -101,8 +101,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();
|
||||
virtual void unbind();
|
||||
virtual void bind() Q_DECL_OVERRIDE;
|
||||
virtual void unbind() Q_DECL_OVERRIDE;
|
||||
};
|
||||
|
||||
class GLTexture3D : public GLTexture
|
||||
@ -112,8 +112,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();
|
||||
virtual void unbind();
|
||||
virtual void bind() Q_DECL_OVERRIDE;
|
||||
virtual void unbind() Q_DECL_OVERRIDE;
|
||||
};
|
||||
|
||||
class GLTextureCube : public GLTexture
|
||||
@ -122,8 +122,8 @@ public:
|
||||
GLTextureCube(int size);
|
||||
explicit GLTextureCube(const QStringList& fileNames, int size = 0);
|
||||
void load(int size, int face, QRgb *data);
|
||||
virtual void bind();
|
||||
virtual void unbind();
|
||||
virtual void bind() Q_DECL_OVERRIDE;
|
||||
virtual void unbind() Q_DECL_OVERRIDE;
|
||||
};
|
||||
|
||||
// TODO: Define and implement class below
|
||||
@ -137,7 +137,7 @@ public:
|
||||
void begin(int face);
|
||||
// end rendering
|
||||
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 getProjectionMatrix(QMatrix4x4& mat, float nearZ, float farZ);
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event) {
|
||||
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE {
|
||||
if (scene())
|
||||
scene()->setSceneRect(QRect(QPoint(0, 0), event->size()));
|
||||
QGraphicsView::resizeEvent(event);
|
||||
|
@ -54,18 +54,18 @@ public:
|
||||
|
||||
ItemBase(int size, int x, int y);
|
||||
virtual ~ItemBase();
|
||||
virtual QRectF boundingRect() const;
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
|
||||
protected:
|
||||
virtual ItemBase *createNew(int size, int x, int y) = 0;
|
||||
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
|
||||
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
||||
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
|
||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||||
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
||||
virtual void keyPressEvent(QKeyEvent *event);
|
||||
virtual void wheelEvent(QGraphicsSceneWheelEvent *event);
|
||||
virtual int type() const;
|
||||
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;
|
||||
bool isInResizeArea(const QPointF &pos);
|
||||
|
||||
static void duplicateSelectedItems(QGraphicsScene *scene);
|
||||
@ -83,9 +83,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);
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
|
||||
protected:
|
||||
virtual ItemBase *createNew(int size, int x, int y);
|
||||
virtual ItemBase *createNew(int size, int x, int y) Q_DECL_OVERRIDE;
|
||||
private:
|
||||
QVector3D m_vertices[8];
|
||||
QVector3D m_texCoords[4];
|
||||
@ -97,9 +97,9 @@ class CircleItem : public ItemBase
|
||||
{
|
||||
public:
|
||||
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:
|
||||
virtual ItemBase *createNew(int size, int x, int y);
|
||||
virtual ItemBase *createNew(int size, int x, int y) Q_DECL_OVERRIDE;
|
||||
|
||||
QColor m_color;
|
||||
};
|
||||
@ -108,9 +108,9 @@ class SquareItem : public ItemBase
|
||||
{
|
||||
public:
|
||||
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:
|
||||
virtual ItemBase *createNew(int size, int x, int y);
|
||||
virtual ItemBase *createNew(int size, int x, int y) Q_DECL_OVERRIDE;
|
||||
|
||||
QPixmap m_image;
|
||||
};
|
||||
|
@ -72,13 +72,13 @@ class ColorEdit : public ParameterEdit
|
||||
public:
|
||||
ColorEdit(QRgb initialColor, int id);
|
||||
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:
|
||||
void editDone();
|
||||
signals:
|
||||
void colorChanged(QRgb color, int id);
|
||||
protected:
|
||||
virtual void mousePressEvent(QMouseEvent *event);
|
||||
virtual void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
void setColor(QRgb color); // also emits colorChanged()
|
||||
private:
|
||||
QGraphicsScene *m_dialogParentScene;
|
||||
@ -94,7 +94,7 @@ class FloatEdit : public ParameterEdit
|
||||
public:
|
||||
FloatEdit(float initialValue, int id);
|
||||
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:
|
||||
void editDone();
|
||||
signals:
|
||||
@ -111,9 +111,9 @@ class GraphicsWidget : public QGraphicsProxyWidget
|
||||
public:
|
||||
GraphicsWidget() : QGraphicsProxyWidget(0, Qt::Window) {}
|
||||
protected:
|
||||
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||
virtual void resizeEvent(QGraphicsSceneResizeEvent *event);
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
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;
|
||||
};
|
||||
|
||||
class TwoSidedGraphicsWidget : public QObject
|
||||
@ -153,7 +153,7 @@ signals:
|
||||
void shaderChanged(int);
|
||||
void doubleClicked();
|
||||
protected:
|
||||
virtual void mouseDoubleClickEvent(QMouseEvent *event);
|
||||
virtual void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
QVector<QByteArray> m_parameterNames;
|
||||
QComboBox *m_textureCombo;
|
||||
@ -180,7 +180,7 @@ signals:
|
||||
void doubleClicked();
|
||||
void newItemTriggered(ItemDialog::ItemType type);
|
||||
protected:
|
||||
virtual void mouseDoubleClickEvent(QMouseEvent *event);
|
||||
virtual void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
};
|
||||
|
||||
class Scene : public QGraphicsScene
|
||||
@ -189,7 +189,7 @@ class Scene : public QGraphicsScene
|
||||
public:
|
||||
Scene(int width, int height, int maxTextureSize);
|
||||
~Scene();
|
||||
virtual void drawBackground(QPainter *painter, const QRectF &rect);
|
||||
virtual void drawBackground(QPainter *painter, const QRectF &rect) Q_DECL_OVERRIDE;
|
||||
|
||||
public slots:
|
||||
void setShader(int index);
|
||||
@ -205,10 +205,10 @@ protected:
|
||||
void defaultStates();
|
||||
void renderCubemaps();
|
||||
|
||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||||
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
||||
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
||||
virtual void wheelEvent(QGraphicsSceneWheelEvent * event);
|
||||
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;
|
||||
private:
|
||||
void initGL();
|
||||
QPointF pixelPosToViewPos(const QPointF& p);
|
||||
|
@ -50,14 +50,14 @@ class Chip : public QGraphicsItem
|
||||
public:
|
||||
Chip(const QColor &color, int x, int y);
|
||||
|
||||
QRectF boundingRect() const;
|
||||
QPainterPath shape() const;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget);
|
||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||
QPainterPath shape() const Q_DECL_OVERRIDE;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget) Q_DECL_OVERRIDE;
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
int x;
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
|
||||
protected:
|
||||
#ifndef QT_NO_WHEELEVENT
|
||||
void wheelEvent(QWheelEvent *);
|
||||
void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -49,13 +49,13 @@ class Mouse : public QGraphicsItem
|
||||
public:
|
||||
Mouse();
|
||||
|
||||
QRectF boundingRect() const;
|
||||
QPainterPath shape() const;
|
||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||
QPainterPath shape() const Q_DECL_OVERRIDE;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget);
|
||||
QWidget *widget) Q_DECL_OVERRIDE;
|
||||
|
||||
protected:
|
||||
void advance(int step);
|
||||
void advance(int step) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
qreal angle;
|
||||
|
@ -63,9 +63,9 @@ public:
|
||||
Arrow(DiagramItem *startItem, DiagramItem *endItem,
|
||||
QGraphicsItem *parent = 0);
|
||||
|
||||
int type() const { return Type; }
|
||||
QRectF boundingRect() const;
|
||||
QPainterPath shape() const;
|
||||
int type() const Q_DECL_OVERRIDE { return Type; }
|
||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||
QPainterPath shape() const Q_DECL_OVERRIDE;
|
||||
void setColor(const QColor &color) { myColor = color; }
|
||||
DiagramItem *startItem() const { return myStartItem; }
|
||||
DiagramItem *endItem() const { return myEndItem; }
|
||||
@ -73,7 +73,7 @@ public:
|
||||
void updatePosition();
|
||||
|
||||
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:
|
||||
DiagramItem *myStartItem;
|
||||
|
@ -75,11 +75,11 @@ public:
|
||||
QPolygonF polygon() const { return myPolygon; }
|
||||
void addArrow(Arrow *arrow);
|
||||
QPixmap image() const;
|
||||
int type() const { return Type;}
|
||||
int type() const Q_DECL_OVERRIDE { return Type;}
|
||||
|
||||
protected:
|
||||
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) Q_DECL_OVERRIDE;
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
DiagramType myDiagramType;
|
||||
|
@ -85,9 +85,9 @@ signals:
|
||||
void itemSelected(QGraphicsItem *item);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent);
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent);
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
bool isItemChange(int type);
|
||||
|
@ -61,16 +61,16 @@ public:
|
||||
|
||||
DiagramTextItem(QGraphicsItem *parent = 0);
|
||||
|
||||
int type() const { return Type; }
|
||||
int type() const Q_DECL_OVERRIDE { return Type; }
|
||||
|
||||
signals:
|
||||
void lostFocus(DiagramTextItem *item);
|
||||
void selectedChange(QGraphicsItem *item);
|
||||
|
||||
protected:
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||
void focusOutEvent(QFocusEvent *event);
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
|
||||
void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
};
|
||||
//! [0]
|
||||
|
||||
|
@ -49,13 +49,13 @@ class ColorItem : public QGraphicsItem
|
||||
public:
|
||||
ColorItem();
|
||||
|
||||
QRectF boundingRect() const;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QColor color;
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void resizeEvent(QResizeEvent *)
|
||||
virtual void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE
|
||||
{
|
||||
}
|
||||
};
|
||||
|
@ -55,9 +55,9 @@ public:
|
||||
RobotPart(QGraphicsItem *parent = 0);
|
||||
|
||||
protected:
|
||||
void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
|
||||
void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
|
||||
void dropEvent(QGraphicsSceneDragDropEvent *event);
|
||||
void dragEnterEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
|
||||
void dragLeaveEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
|
||||
void dropEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
QColor color;
|
||||
bool dragOver;
|
||||
@ -70,12 +70,12 @@ class RobotHead : public RobotPart
|
||||
public:
|
||||
RobotHead(QGraphicsItem *parent = 0);
|
||||
|
||||
QRectF boundingRect() const;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
|
||||
|
||||
protected:
|
||||
void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
|
||||
void dropEvent(QGraphicsSceneDragDropEvent *event);
|
||||
void dragEnterEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
|
||||
void dropEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QPixmap pixmap;
|
||||
@ -88,8 +88,8 @@ class RobotTorso : public RobotPart
|
||||
public:
|
||||
RobotTorso(QGraphicsItem *parent = 0);
|
||||
|
||||
QRectF boundingRect() const;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
|
||||
};
|
||||
//! [2]
|
||||
|
||||
@ -99,8 +99,8 @@ class RobotLimb : public RobotPart
|
||||
public:
|
||||
RobotLimb(QGraphicsItem *parent = 0);
|
||||
|
||||
QRectF boundingRect() const;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
|
||||
};
|
||||
//! [3]
|
||||
|
||||
@ -110,8 +110,8 @@ class Robot : public RobotPart
|
||||
public:
|
||||
Robot(QGraphicsItem *parent = 0);
|
||||
|
||||
QRectF boundingRect() const;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
|
||||
};
|
||||
//! [4]
|
||||
|
||||
|
@ -57,11 +57,11 @@ public:
|
||||
void adjust();
|
||||
|
||||
enum { Type = UserType + 2 };
|
||||
int type() const { return Type; }
|
||||
int type() const Q_DECL_OVERRIDE { return Type; }
|
||||
|
||||
protected:
|
||||
QRectF boundingRect() const;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
Node *source, *dest;
|
||||
|
@ -61,12 +61,12 @@ public slots:
|
||||
void zoomOut();
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
void timerEvent(QTimerEvent *event);
|
||||
void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
|
||||
void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
|
||||
#ifndef QT_NO_WHEELEVENT
|
||||
void wheelEvent(QWheelEvent *event);
|
||||
void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
|
||||
#endif
|
||||
void drawBackground(QPainter *painter, const QRectF &rect);
|
||||
void drawBackground(QPainter *painter, const QRectF &rect) Q_DECL_OVERRIDE;
|
||||
|
||||
void scaleView(qreal scaleFactor);
|
||||
|
||||
|
@ -60,20 +60,20 @@ public:
|
||||
QList<Edge *> edges() const;
|
||||
|
||||
enum { Type = UserType + 1 };
|
||||
int type() const { return Type; }
|
||||
int type() const Q_DECL_OVERRIDE { return Type; }
|
||||
|
||||
void calculateForces();
|
||||
bool advance();
|
||||
|
||||
QRectF boundingRect() const;
|
||||
QPainterPath shape() const;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||
QPainterPath shape() const Q_DECL_OVERRIDE;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
|
||||
|
||||
protected:
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
|
||||
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QList<Edge *> edgeList;
|
||||
|
@ -52,15 +52,15 @@ class CustomProxy : public QGraphicsProxyWidget
|
||||
public:
|
||||
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,
|
||||
QWidget *widget);
|
||||
QWidget *widget) Q_DECL_OVERRIDE;
|
||||
|
||||
protected:
|
||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
||||
bool sceneEventFilter(QGraphicsItem *watched, QEvent *event);
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
|
||||
bool sceneEventFilter(QGraphicsItem *watched, QEvent *event) Q_DECL_OVERRIDE;
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
|
||||
|
||||
private slots:
|
||||
void updateStep(qreal step);
|
||||
|
@ -50,14 +50,14 @@ public:
|
||||
qreal spacing(Qt::Orientation o) const;
|
||||
|
||||
// inherited functions
|
||||
void setGeometry(const QRectF &geom);
|
||||
void setGeometry(const QRectF &geom) Q_DECL_OVERRIDE;
|
||||
|
||||
int count() const;
|
||||
QGraphicsLayoutItem *itemAt(int index) const;
|
||||
void removeAt(int index);
|
||||
int count() const Q_DECL_OVERRIDE;
|
||||
QGraphicsLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
|
||||
void removeAt(int index) Q_DECL_OVERRIDE;
|
||||
|
||||
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:
|
||||
qreal doLayout(const QRectF &geom, bool applyNewGeometry) const;
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
explicit PadNavigator(const QSize &size, QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
Ui::Form form;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user