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:
parent
4d3ffae3d5
commit
40a54bf565
@ -65,15 +65,15 @@ public:
|
|||||||
MandelbrotWidget(QWidget *parent = 0);
|
MandelbrotWidget(QWidget *parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
|
void keyPressEvent(QKeyEvent *event) override;
|
||||||
#ifndef QT_NO_WHEELEVENT
|
#ifndef QT_NO_WHEELEVENT
|
||||||
void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
|
void wheelEvent(QWheelEvent *event) override;
|
||||||
#endif
|
#endif
|
||||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updatePixmap(const QImage &image, double scaleFactor);
|
void updatePixmap(const QImage &image, double scaleFactor);
|
||||||
|
@ -75,7 +75,7 @@ signals:
|
|||||||
void renderedImage(const QImage &image, double scaleFactor);
|
void renderedImage(const QImage &image, double scaleFactor);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void run() Q_DECL_OVERRIDE;
|
void run() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint rgbFromWaveLength(double wave);
|
uint rgbFromWaveLength(double wave);
|
||||||
|
@ -68,7 +68,7 @@ class Producer : public QThread
|
|||||||
//! [1] //! [2]
|
//! [1] //! [2]
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void run() Q_DECL_OVERRIDE
|
void run() override
|
||||||
{
|
{
|
||||||
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
|
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
|
||||||
for (int i = 0; i < DataSize; ++i) {
|
for (int i = 0; i < DataSize; ++i) {
|
||||||
@ -86,7 +86,7 @@ class Consumer : public QThread
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
void run() Q_DECL_OVERRIDE
|
void run() override
|
||||||
{
|
{
|
||||||
for (int i = 0; i < DataSize; ++i) {
|
for (int i = 0; i < DataSize; ++i) {
|
||||||
usedBytes.acquire();
|
usedBytes.acquire();
|
||||||
|
@ -74,7 +74,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void run() Q_DECL_OVERRIDE
|
void run() override
|
||||||
{
|
{
|
||||||
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
|
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) {
|
for (int i = 0; i < DataSize; ++i) {
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
|
@ -62,8 +62,8 @@ public:
|
|||||||
RandomListModel(QObject *parent = 0);
|
RandomListModel(QObject *parent = 0);
|
||||||
~RandomListModel();
|
~RandomListModel();
|
||||||
|
|
||||||
int rowCount(const QModelIndex & = QModelIndex()) const Q_DECL_OVERRIDE;
|
int rowCount(const QModelIndex & = QModelIndex()) const override;
|
||||||
QVariant data(const QModelIndex &, int) const Q_DECL_OVERRIDE;
|
QVariant data(const QModelIndex &, int) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void cacheRows(int, int) const;
|
void cacheRows(int, int) const;
|
||||||
|
@ -59,8 +59,8 @@ public:
|
|||||||
AnalogClockWindow();
|
AnalogClockWindow();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
|
void timerEvent(QTimerEvent *) override;
|
||||||
void render(QPainter *p) Q_DECL_OVERRIDE;
|
void render(QPainter *p) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_timerId;
|
int m_timerId;
|
||||||
|
@ -63,8 +63,8 @@ class TriangleWindow : public OpenGLWindow
|
|||||||
public:
|
public:
|
||||||
TriangleWindow();
|
TriangleWindow();
|
||||||
|
|
||||||
void initialize() Q_DECL_OVERRIDE;
|
void initialize() override;
|
||||||
void render() Q_DECL_OVERRIDE;
|
void render() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GLuint m_posAttr;
|
GLuint m_posAttr;
|
||||||
|
@ -77,9 +77,9 @@ public slots:
|
|||||||
void renderNow();
|
void renderNow();
|
||||||
|
|
||||||
protected:
|
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:
|
private:
|
||||||
bool m_update_pending;
|
bool m_update_pending;
|
||||||
|
@ -67,10 +67,10 @@ public slots:
|
|||||||
void renderNow();
|
void renderNow();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool event(QEvent *event) Q_DECL_OVERRIDE;
|
bool event(QEvent *event) override;
|
||||||
|
|
||||||
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
void exposeEvent(QExposeEvent *event) Q_DECL_OVERRIDE;
|
void exposeEvent(QExposeEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QBackingStore *m_backingStore;
|
QBackingStore *m_backingStore;
|
||||||
|
@ -65,7 +65,7 @@ public:
|
|||||||
explicit SessionWidget(const QNetworkConfiguration &config, QWidget *parent = 0);
|
explicit SessionWidget(const QNetworkConfiguration &config, QWidget *parent = 0);
|
||||||
~SessionWidget();
|
~SessionWidget();
|
||||||
|
|
||||||
void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
|
void timerEvent(QTimerEvent *) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateSessionState(QNetworkSession::State state);
|
void updateSessionState(QNetworkSession::State state);
|
||||||
|
@ -65,7 +65,7 @@ public:
|
|||||||
~FortuneThread();
|
~FortuneThread();
|
||||||
|
|
||||||
void requestNewFortune(const QString &hostName, quint16 port);
|
void requestNewFortune(const QString &hostName, quint16 port);
|
||||||
void run() Q_DECL_OVERRIDE;
|
void run() override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void newFortune(const QString &fortune);
|
void newFortune(const QString &fortune);
|
||||||
|
@ -70,7 +70,7 @@ class GSuggestCompletion : public QObject
|
|||||||
public:
|
public:
|
||||||
GSuggestCompletion(QLineEdit *parent = 0);
|
GSuggestCompletion(QLineEdit *parent = 0);
|
||||||
~GSuggestCompletion();
|
~GSuggestCompletion();
|
||||||
bool eventFilter(QObject *obj, QEvent *ev) Q_DECL_OVERRIDE;
|
bool eventFilter(QObject *obj, QEvent *ev) override;
|
||||||
void showCompletion(const QStringList &choices);
|
void showCompletion(const QStringList &choices);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -88,7 +88,7 @@ signals:
|
|||||||
void newMessage(const QString &from, const QString &message);
|
void newMessage(const QString &from, const QString &message);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void timerEvent(QTimerEvent *timerEvent) Q_DECL_OVERRIDE;
|
void timerEvent(QTimerEvent *timerEvent) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void processReadyRead();
|
void processReadyRead();
|
||||||
|
@ -66,7 +66,7 @@ signals:
|
|||||||
void newConnection(Connection *connection);
|
void newConnection(Connection *connection);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void incomingConnection(qintptr socketDescriptor) Q_DECL_OVERRIDE;
|
void incomingConnection(qintptr socketDescriptor) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -63,7 +63,7 @@ public:
|
|||||||
FortuneServer(QObject *parent = 0);
|
FortuneServer(QObject *parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void incomingConnection(qintptr socketDescriptor) Q_DECL_OVERRIDE;
|
void incomingConnection(qintptr socketDescriptor) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QStringList fortunes;
|
QStringList fortunes;
|
||||||
|
@ -62,7 +62,7 @@ class FortuneThread : public QThread
|
|||||||
public:
|
public:
|
||||||
FortuneThread(int socketDescriptor, const QString &fortune, QObject *parent);
|
FortuneThread(int socketDescriptor, const QString &fortune, QObject *parent);
|
||||||
|
|
||||||
void run() Q_DECL_OVERRIDE;
|
void run() override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void error(QTcpSocket::SocketError socketError);
|
void error(QTcpSocket::SocketError socketError);
|
||||||
|
@ -100,7 +100,7 @@ signals:
|
|||||||
void pieceVerified(int pieceIndex, bool verified);
|
void pieceVerified(int pieceIndex, bool verified);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void run() Q_DECL_OVERRIDE;
|
void run() override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
bool verifySinglePiece(int pieceIndex);
|
bool verifySinglePiece(int pieceIndex);
|
||||||
|
@ -67,8 +67,8 @@ signals:
|
|||||||
void fileDropped(const QString &fileName);
|
void fileDropped(const QString &fileName);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
|
void dragMoveEvent(QDragMoveEvent *event) override;
|
||||||
void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
|
void dropEvent(QDropEvent *event) override;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ public:
|
|||||||
inline TorrentViewDelegate(MainWindow *mainWindow) : QItemDelegate(mainWindow) {}
|
inline TorrentViewDelegate(MainWindow *mainWindow) : QItemDelegate(mainWindow) {}
|
||||||
|
|
||||||
void paint(QPainter *painter, const QStyleOptionViewItem &option,
|
void paint(QPainter *painter, const QStyleOptionViewItem &option,
|
||||||
const QModelIndex &index ) const Q_DECL_OVERRIDE
|
const QModelIndex &index ) const override
|
||||||
{
|
{
|
||||||
if (index.column() != 2) {
|
if (index.column() != 2) {
|
||||||
QItemDelegate::paint(painter, option, index);
|
QItemDelegate::paint(painter, option, index);
|
||||||
|
@ -73,11 +73,11 @@ class MainWindow : public QMainWindow
|
|||||||
public:
|
public:
|
||||||
MainWindow(QWidget *parent = 0);
|
MainWindow(QWidget *parent = 0);
|
||||||
|
|
||||||
QSize sizeHint() const Q_DECL_OVERRIDE;
|
QSize sizeHint() const override;
|
||||||
const TorrentClient *clientForRow(int row) const;
|
const TorrentClient *clientForRow(int row) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
|
void closeEvent(QCloseEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
|
@ -122,14 +122,14 @@ public:
|
|||||||
qint64 uploadSpeed() const;
|
qint64 uploadSpeed() const;
|
||||||
|
|
||||||
bool canTransferMore() 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 socketBytesAvailable() const { return socket.bytesAvailable(); }
|
||||||
qint64 socketBytesToWrite() const { return socket.bytesToWrite(); }
|
qint64 socketBytesToWrite() const { return socket.bytesToWrite(); }
|
||||||
|
|
||||||
void setReadBufferSize(qint64 size) Q_DECL_OVERRIDE;
|
void setReadBufferSize(qint64 size) override;
|
||||||
|
|
||||||
void connectToHost(const QHostAddress &address,
|
void connectToHost(const QHostAddress &address,
|
||||||
quint16 port, OpenMode openMode = ReadWrite) Q_DECL_OVERRIDE;
|
quint16 port, OpenMode openMode = ReadWrite) override;
|
||||||
void diconnectFromHost();
|
void diconnectFromHost();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -148,11 +148,11 @@ signals:
|
|||||||
void bytesReceived(qint64 size);
|
void bytesReceived(qint64 size);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
|
void timerEvent(QTimerEvent *event) override;
|
||||||
|
|
||||||
qint64 readData(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
|
qint64 readData(char *data, qint64 maxlen) override;
|
||||||
qint64 readLineData(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
|
qint64 readLineData(char *data, qint64 maxlen) override;
|
||||||
qint64 writeData(const char *data, qint64 len) Q_DECL_OVERRIDE;
|
qint64 writeData(const char *data, qint64 len) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void sendHandShake();
|
void sendHandShake();
|
||||||
|
@ -168,7 +168,7 @@ public slots:
|
|||||||
void setupIncomingConnection(PeerWireClient *client);
|
void setupIncomingConnection(PeerWireClient *client);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
|
void timerEvent(QTimerEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
// File management
|
// File management
|
||||||
|
@ -68,7 +68,7 @@ public:
|
|||||||
void removeClient(TorrentClient *client);
|
void removeClient(TorrentClient *client);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void incomingConnection(qintptr socketDescriptor) Q_DECL_OVERRIDE;
|
void incomingConnection(qintptr socketDescriptor) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void removeClient();
|
void removeClient();
|
||||||
|
@ -88,7 +88,7 @@ signals:
|
|||||||
void stopped();
|
void stopped();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
|
void timerEvent(QTimerEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void fetchPeerList();
|
void fetchPeerList();
|
||||||
|
@ -67,7 +67,7 @@ public slots:
|
|||||||
void animate();
|
void animate();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Helper *helper;
|
Helper *helper;
|
||||||
|
@ -67,7 +67,7 @@ public slots:
|
|||||||
void animate();
|
void animate();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Helper *helper;
|
Helper *helper;
|
||||||
|
@ -65,7 +65,7 @@ class RenderWindow : public QWindow
|
|||||||
public:
|
public:
|
||||||
RenderWindow(const QSurfaceFormat &format);
|
RenderWindow(const QSurfaceFormat &format);
|
||||||
QOpenGLContext *context() { return m_context; }
|
QOpenGLContext *context() { return m_context; }
|
||||||
void exposeEvent(QExposeEvent *) Q_DECL_OVERRIDE;
|
void exposeEvent(QExposeEvent *) override;
|
||||||
void setForceGLSL110(bool enable) { m_forceGLSL110 = enable; }
|
void setForceGLSL110(bool enable) { m_forceGLSL110 = enable; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -73,13 +73,13 @@ public:
|
|||||||
~MainWidget();
|
~MainWidget();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *e) override;
|
||||||
void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
|
void mouseReleaseEvent(QMouseEvent *e) override;
|
||||||
void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
|
void timerEvent(QTimerEvent *e) override;
|
||||||
|
|
||||||
void initializeGL() Q_DECL_OVERRIDE;
|
void initializeGL() override;
|
||||||
void resizeGL(int w, int h) Q_DECL_OVERRIDE;
|
void resizeGL(int w, int h) override;
|
||||||
void paintGL() Q_DECL_OVERRIDE;
|
void paintGL() override;
|
||||||
|
|
||||||
void initShaders();
|
void initShaders();
|
||||||
void initTextures();
|
void initTextures();
|
||||||
|
@ -68,8 +68,8 @@ public:
|
|||||||
GLWidget(QWidget *parent = 0);
|
GLWidget(QWidget *parent = 0);
|
||||||
~GLWidget();
|
~GLWidget();
|
||||||
|
|
||||||
QSize minimumSizeHint() const Q_DECL_OVERRIDE;
|
QSize minimumSizeHint() const override;
|
||||||
QSize sizeHint() const Q_DECL_OVERRIDE;
|
QSize sizeHint() const override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setXRotation(int angle);
|
void setXRotation(int angle);
|
||||||
@ -83,11 +83,11 @@ signals:
|
|||||||
void zRotationChanged(int angle);
|
void zRotationChanged(int angle);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initializeGL() Q_DECL_OVERRIDE;
|
void initializeGL() override;
|
||||||
void paintGL() Q_DECL_OVERRIDE;
|
void paintGL() override;
|
||||||
void resizeGL(int width, int height) Q_DECL_OVERRIDE;
|
void resizeGL(int width, int height) override;
|
||||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupVertexAttribs();
|
void setupVertexAttribs();
|
||||||
|
@ -69,7 +69,7 @@ public:
|
|||||||
Window(MainWindow *mw);
|
Window(MainWindow *mw);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
|
void keyPressEvent(QKeyEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void dockUndock();
|
void dockUndock();
|
||||||
|
@ -112,10 +112,10 @@ public:
|
|||||||
QColor color() const;
|
QColor color() const;
|
||||||
void updateColor();
|
void updateColor();
|
||||||
|
|
||||||
void exposeEvent(QExposeEvent *event) Q_DECL_OVERRIDE;
|
void exposeEvent(QExposeEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *) override;
|
||||||
|
|
||||||
int m_colorIndex;
|
int m_colorIndex;
|
||||||
QColor m_color;
|
QColor m_color;
|
||||||
|
@ -55,12 +55,12 @@ class GLWidget : public QGLWidget
|
|||||||
public:
|
public:
|
||||||
GLWidget(QWidget *parent);
|
GLWidget(QWidget *parent);
|
||||||
~GLWidget();
|
~GLWidget();
|
||||||
void initializeGL() Q_DECL_OVERRIDE;
|
void initializeGL() override;
|
||||||
void resizeGL(int w, int h) Q_DECL_OVERRIDE;
|
void resizeGL(int w, int h) override;
|
||||||
void paintGL() Q_DECL_OVERRIDE;
|
void paintGL() override;
|
||||||
void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE { update(); }
|
void timerEvent(QTimerEvent *) override { update(); }
|
||||||
void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE { killTimer(timerId); }
|
void mousePressEvent(QMouseEvent *) override { killTimer(timerId); }
|
||||||
void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE { timerId = startTimer(20); }
|
void mouseReleaseEvent(QMouseEvent *) override { timerId = startTimer(20); }
|
||||||
|
|
||||||
void drawCube(int i, GLfloat z, GLfloat ri, GLfloat jmp, GLfloat amp);
|
void drawCube(int i, GLfloat z, GLfloat ri, GLfloat jmp, GLfloat amp);
|
||||||
|
|
||||||
|
@ -76,11 +76,11 @@ signals:
|
|||||||
void zRotationChanged(int angle);
|
void zRotationChanged(int angle);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initializeGL() Q_DECL_OVERRIDE;
|
void initializeGL() override;
|
||||||
void paintGL() Q_DECL_OVERRIDE;
|
void paintGL() override;
|
||||||
void resizeGL(int width, int height) Q_DECL_OVERRIDE;
|
void resizeGL(int width, int height) override;
|
||||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void advanceGears();
|
void advanceGears();
|
||||||
|
@ -65,8 +65,8 @@ public:
|
|||||||
GLWidget(QWidget *parent = 0);
|
GLWidget(QWidget *parent = 0);
|
||||||
~GLWidget();
|
~GLWidget();
|
||||||
|
|
||||||
QSize minimumSizeHint() const Q_DECL_OVERRIDE;
|
QSize minimumSizeHint() const override;
|
||||||
QSize sizeHint() const Q_DECL_OVERRIDE;
|
QSize sizeHint() const override;
|
||||||
//! [0]
|
//! [0]
|
||||||
|
|
||||||
//! [1]
|
//! [1]
|
||||||
@ -83,11 +83,11 @@ signals:
|
|||||||
|
|
||||||
//! [2]
|
//! [2]
|
||||||
protected:
|
protected:
|
||||||
void initializeGL() Q_DECL_OVERRIDE;
|
void initializeGL() override;
|
||||||
void paintGL() Q_DECL_OVERRIDE;
|
void paintGL() override;
|
||||||
void resizeGL(int width, int height) Q_DECL_OVERRIDE;
|
void resizeGL(int width, int height) override;
|
||||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
//! [2]
|
//! [2]
|
||||||
|
|
||||||
//! [3]
|
//! [3]
|
||||||
|
@ -67,7 +67,7 @@ public:
|
|||||||
Window();
|
Window();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
|
void keyPressEvent(QKeyEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSlider *createSlider();
|
QSlider *createSlider();
|
||||||
|
@ -68,7 +68,7 @@ public:
|
|||||||
~GLWidget();
|
~GLWidget();
|
||||||
//! [0]
|
//! [0]
|
||||||
|
|
||||||
QSize sizeHint() const Q_DECL_OVERRIDE;
|
QSize sizeHint() const override;
|
||||||
int xRotation() const { return xRot; }
|
int xRotation() const { return xRot; }
|
||||||
int yRotation() const { return yRot; }
|
int yRotation() const { return yRot; }
|
||||||
int zRotation() const { return zRot; }
|
int zRotation() const { return zRot; }
|
||||||
@ -80,12 +80,12 @@ public slots:
|
|||||||
|
|
||||||
//! [1]
|
//! [1]
|
||||||
protected:
|
protected:
|
||||||
void initializeGL() Q_DECL_OVERRIDE;
|
void initializeGL() override;
|
||||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
void resizeGL(int width, int height) Q_DECL_OVERRIDE;
|
void resizeGL(int width, int height) override;
|
||||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
|
void showEvent(QShowEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void animate();
|
void animate();
|
||||||
|
@ -67,11 +67,11 @@ public:
|
|||||||
~GLWidget();
|
~GLWidget();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initializeGL() Q_DECL_OVERRIDE;
|
void initializeGL() override;
|
||||||
void paintGL() Q_DECL_OVERRIDE;
|
void paintGL() override;
|
||||||
void resizeGL(int width, int height) Q_DECL_OVERRIDE;
|
void resizeGL(int width, int height) override;
|
||||||
void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE { setAnimationPaused(true); }
|
void mousePressEvent(QMouseEvent *) override { setAnimationPaused(true); }
|
||||||
void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE { setAnimationPaused(false); }
|
void mouseReleaseEvent(QMouseEvent *) override { setAnimationPaused(false); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initializeGeometry();
|
void initializeGeometry();
|
||||||
|
@ -56,10 +56,10 @@ public:
|
|||||||
GLWidget(QWidget *parent);
|
GLWidget(QWidget *parent);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initializeGL() Q_DECL_OVERRIDE;
|
void initializeGL() override;
|
||||||
void resizeGL(int w, int h) Q_DECL_OVERRIDE;
|
void resizeGL(int w, int h) override;
|
||||||
void paintGL() Q_DECL_OVERRIDE;
|
void paintGL() override;
|
||||||
void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
|
void timerEvent(QTimerEvent *) override;
|
||||||
|
|
||||||
void makeObject();
|
void makeObject();
|
||||||
void quad(GLenum primitive, GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2,
|
void quad(GLenum primitive, GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2,
|
||||||
|
@ -84,8 +84,8 @@ private slots:
|
|||||||
void rotationDone();
|
void rotationDone();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void exposeEvent(QExposeEvent *) Q_DECL_OVERRIDE;
|
void exposeEvent(QExposeEvent *) override;
|
||||||
void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *) override;
|
||||||
|
|
||||||
void paint(QPainter *painter, const QRect &rect);
|
void paint(QPainter *painter, const QRect &rect);
|
||||||
|
|
||||||
|
@ -85,9 +85,9 @@ private slots:
|
|||||||
void handleButtonPress();
|
void handleButtonPress();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeGL(int w, int h) Q_DECL_OVERRIDE;
|
void resizeGL(int w, int h) override;
|
||||||
void paintGL() Q_DECL_OVERRIDE;
|
void paintGL() override;
|
||||||
void initializeGL() Q_DECL_OVERRIDE;
|
void initializeGL() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void paintTexturedCube();
|
void paintTexturedCube();
|
||||||
|
@ -79,9 +79,9 @@ public:
|
|||||||
OpenGLWindow();
|
OpenGLWindow();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintGL() Q_DECL_OVERRIDE;
|
void paintGL() override;
|
||||||
void resizeGL(int w, int h) Q_DECL_OVERRIDE;
|
void resizeGL(int w, int h) override;
|
||||||
void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setAnimating(bool enabled);
|
void setAnimating(bool enabled);
|
||||||
|
@ -66,8 +66,8 @@ public:
|
|||||||
explicit GLWidget(QWidget *parent = 0);
|
explicit GLWidget(QWidget *parent = 0);
|
||||||
~GLWidget();
|
~GLWidget();
|
||||||
|
|
||||||
QSize minimumSizeHint() const Q_DECL_OVERRIDE;
|
QSize minimumSizeHint() const override;
|
||||||
QSize sizeHint() const Q_DECL_OVERRIDE;
|
QSize sizeHint() const override;
|
||||||
void rotateBy(int xAngle, int yAngle, int zAngle);
|
void rotateBy(int xAngle, int yAngle, int zAngle);
|
||||||
void setClearColor(const QColor &color);
|
void setClearColor(const QColor &color);
|
||||||
|
|
||||||
@ -75,12 +75,12 @@ signals:
|
|||||||
void clicked();
|
void clicked();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initializeGL() Q_DECL_OVERRIDE;
|
void initializeGL() override;
|
||||||
void paintGL() Q_DECL_OVERRIDE;
|
void paintGL() override;
|
||||||
void resizeGL(int width, int height) Q_DECL_OVERRIDE;
|
void resizeGL(int width, int height) override;
|
||||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void makeObject();
|
void makeObject();
|
||||||
|
@ -114,7 +114,7 @@ public:
|
|||||||
~GLWidget();
|
~GLWidget();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE { }
|
void paintEvent(QPaintEvent *) override { }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void renderRequested();
|
void renderRequested();
|
||||||
|
@ -58,16 +58,16 @@ public:
|
|||||||
Window(QScreen *screen);
|
Window(QScreen *screen);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *) override;
|
||||||
void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
|
void mouseMoveEvent(QMouseEvent *) override;
|
||||||
void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
|
void mouseReleaseEvent(QMouseEvent *) override;
|
||||||
|
|
||||||
void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
|
void keyPressEvent(QKeyEvent *) override;
|
||||||
|
|
||||||
void exposeEvent(QExposeEvent *) Q_DECL_OVERRIDE;
|
void exposeEvent(QExposeEvent *) override;
|
||||||
void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
|
void resizeEvent(QResizeEvent *) override;
|
||||||
|
|
||||||
void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
|
void timerEvent(QTimerEvent *) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void render();
|
void render();
|
||||||
|
@ -64,16 +64,16 @@ public:
|
|||||||
BookDelegate(QObject *parent);
|
BookDelegate(QObject *parent);
|
||||||
|
|
||||||
void paint(QPainter *painter, const QStyleOptionViewItem &option,
|
void paint(QPainter *painter, const QStyleOptionViewItem &option,
|
||||||
const QModelIndex &index) const 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,
|
bool editorEvent(QEvent *event, QAbstractItemModel *model,
|
||||||
const QStyleOptionViewItem &option,
|
const QStyleOptionViewItem &option,
|
||||||
const QModelIndex &index) Q_DECL_OVERRIDE;
|
const QModelIndex &index) override;
|
||||||
|
|
||||||
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
||||||
const QModelIndex &index) const Q_DECL_OVERRIDE;
|
const QModelIndex &index) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPixmap star;
|
QPixmap star;
|
||||||
|
@ -66,8 +66,8 @@ public:
|
|||||||
int id();
|
int id();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
|
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
|
||||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void setFrame(int frame);
|
void setFrame(int frame);
|
||||||
|
@ -66,7 +66,7 @@ public:
|
|||||||
View(const QString &items, const QString &images, QWidget *parent = 0);
|
View(const QString &items, const QString &images, QWidget *parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||||
//! [0]
|
//! [0]
|
||||||
|
|
||||||
//! [1]
|
//! [1]
|
||||||
|
@ -61,7 +61,7 @@ class CustomSqlModel : public QSqlQueryModel
|
|||||||
public:
|
public:
|
||||||
CustomSqlModel(QObject *parent = 0);
|
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]
|
//! [0]
|
||||||
|
|
||||||
|
@ -60,8 +60,8 @@ class EditableSqlModel : public QSqlQueryModel
|
|||||||
public:
|
public:
|
||||||
EditableSqlModel(QObject *parent = 0);
|
EditableSqlModel(QObject *parent = 0);
|
||||||
|
|
||||||
Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||||
bool setData(const QModelIndex &index, const QVariant &value, int role) Q_DECL_OVERRIDE;
|
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool setFirstName(int personId, const QString &firstName);
|
bool setFirstName(int personId, const QString &firstName);
|
||||||
|
@ -117,7 +117,7 @@ class CustomModel: public QSqlTableModel
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit CustomModel(QObject *parent = 0, QSqlDatabase db = QSqlDatabase()):QSqlTableModel(parent, db) {}
|
explicit CustomModel(QObject *parent = 0, QSqlDatabase db = QSqlDatabase()):QSqlTableModel(parent, db) {}
|
||||||
QVariant data(const QModelIndex &idx, int role) const Q_DECL_OVERRIDE
|
QVariant data(const QModelIndex &idx, int role) const override
|
||||||
{
|
{
|
||||||
if (role == Qt::BackgroundRole && isDirty(idx))
|
if (role == Qt::BackgroundRole && isDirty(idx))
|
||||||
return QBrush(QColor(Qt::yellow));
|
return QBrush(QColor(Qt::yellow));
|
||||||
|
@ -65,7 +65,7 @@ public:
|
|||||||
MainWindow();
|
MainWindow();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
|
void closeEvent(QCloseEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void open();
|
void open();
|
||||||
|
@ -74,9 +74,9 @@ public slots:
|
|||||||
void print();
|
void print();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
bool event(QEvent *event) Q_DECL_OVERRIDE;
|
bool event(QEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void resizeImage(QImage *image, const QSize &newSize);
|
void resizeImage(QImage *image, const QSize &newSize);
|
||||||
|
@ -58,7 +58,7 @@ class Knob : public QGraphicsEllipseItem
|
|||||||
public:
|
public:
|
||||||
Knob();
|
Knob();
|
||||||
|
|
||||||
bool sceneEvent(QEvent *event) Q_DECL_OVERRIDE;
|
bool sceneEvent(QEvent *event) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KNOB_H
|
#endif // KNOB_H
|
||||||
|
@ -58,7 +58,7 @@ class GraphicsView : public QGraphicsView
|
|||||||
public:
|
public:
|
||||||
GraphicsView(QGraphicsScene *scene = 0, QWidget *parent = 0);
|
GraphicsView(QGraphicsScene *scene = 0, QWidget *parent = 0);
|
||||||
|
|
||||||
bool viewportEvent(QEvent *event) Q_DECL_OVERRIDE;
|
bool viewportEvent(QEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
qreal totalScaleFactor;
|
qreal totalScaleFactor;
|
||||||
|
@ -61,13 +61,13 @@ class Mouse : public QGraphicsObject
|
|||||||
public:
|
public:
|
||||||
Mouse();
|
Mouse();
|
||||||
|
|
||||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
QRectF boundingRect() const override;
|
||||||
QPainterPath shape() const Q_DECL_OVERRIDE;
|
QPainterPath shape() const override;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
QWidget *widget) Q_DECL_OVERRIDE;
|
QWidget *widget) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
|
void timerEvent(QTimerEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
qreal angle;
|
qreal angle;
|
||||||
|
@ -75,19 +75,19 @@ public:
|
|||||||
setCacheMode(DeviceCoordinateCache);
|
setCacheMode(DeviceCoordinateCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF boundingRect() const Q_DECL_OVERRIDE
|
QRectF boundingRect() const override
|
||||||
{
|
{
|
||||||
return QRectF(-65, -65, 130, 130);
|
return QRectF(-65, -65, 130, 130);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPainterPath shape() const Q_DECL_OVERRIDE
|
QPainterPath shape() const override
|
||||||
{
|
{
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
path.addEllipse(boundingRect());
|
path.addEllipse(boundingRect());
|
||||||
return path;
|
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;
|
bool down = option->state & QStyle::State_Sunken;
|
||||||
QRectF r = boundingRect();
|
QRectF r = boundingRect();
|
||||||
@ -112,13 +112,13 @@ signals:
|
|||||||
void pressed();
|
void pressed();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent *) Q_DECL_OVERRIDE
|
void mousePressEvent(QGraphicsSceneMouseEvent *) override
|
||||||
{
|
{
|
||||||
emit pressed();
|
emit pressed();
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *) Q_DECL_OVERRIDE
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent *) override
|
||||||
{
|
{
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
@ -133,7 +133,7 @@ public:
|
|||||||
View(QGraphicsScene *scene) : QGraphicsView(scene) { }
|
View(QGraphicsScene *scene) : QGraphicsView(scene) { }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE
|
void resizeEvent(QResizeEvent *event) override
|
||||||
{
|
{
|
||||||
QGraphicsView::resizeEvent(event);
|
QGraphicsView::resizeEvent(event);
|
||||||
fitInView(sceneRect(), Qt::KeepAspectRatio);
|
fitInView(sceneRect(), Qt::KeepAspectRatio);
|
||||||
|
@ -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);
|
painter->drawPixmap(QPointF(), p);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent * ) Q_DECL_OVERRIDE
|
virtual void mousePressEvent(QGraphicsSceneMouseEvent *) override
|
||||||
{
|
{
|
||||||
emit clicked();
|
emit clicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setGeometry(const QRectF &rect) Q_DECL_OVERRIDE
|
virtual void setGeometry(const QRectF &rect) override
|
||||||
{
|
{
|
||||||
QGraphicsWidget::setGeometry(rect);
|
QGraphicsWidget::setGeometry(rect);
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE
|
virtual void resizeEvent(QResizeEvent *) override
|
||||||
{
|
{
|
||||||
fitInView(sceneRect(), Qt::KeepAspectRatio);
|
fitInView(sceneRect(), Qt::KeepAspectRatio);
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ public:
|
|||||||
m_path = QPainterPath();
|
m_path = QPainterPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateCurrentTime(int currentTime) Q_DECL_OVERRIDE
|
void updateCurrentTime(int currentTime) override
|
||||||
{
|
{
|
||||||
if (m_pathType == CirclePath) {
|
if (m_pathType == CirclePath) {
|
||||||
if (m_path.isEmpty()) {
|
if (m_path.isEmpty()) {
|
||||||
|
@ -80,7 +80,7 @@ class QGraphicsRectWidget : public QGraphicsWidget
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *,
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *,
|
||||||
QWidget *) Q_DECL_OVERRIDE
|
QWidget *) override
|
||||||
{
|
{
|
||||||
painter->fillRect(rect(), Qt::blue);
|
painter->fillRect(rect(), Qt::blue);
|
||||||
}
|
}
|
||||||
@ -98,14 +98,14 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
//![14]
|
//![14]
|
||||||
virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE
|
virtual bool eventTest(QEvent *event) override
|
||||||
{
|
{
|
||||||
return (event->type() == QEvent::Type(StateSwitchEvent::StateSwitchType))
|
return (event->type() == QEvent::Type(StateSwitchEvent::StateSwitchType))
|
||||||
&& (static_cast<StateSwitchEvent *>(event)->rand() == m_rand);
|
&& (static_cast<StateSwitchEvent *>(event)->rand() == m_rand);
|
||||||
}
|
}
|
||||||
//![14]
|
//![14]
|
||||||
|
|
||||||
virtual void onTransition(QEvent *) Q_DECL_OVERRIDE {}
|
virtual void onTransition(QEvent *) override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_rand;
|
int m_rand;
|
||||||
@ -122,7 +122,7 @@ public:
|
|||||||
//![10]
|
//![10]
|
||||||
|
|
||||||
//![11]
|
//![11]
|
||||||
virtual void onEntry(QEvent *) Q_DECL_OVERRIDE
|
virtual void onEntry(QEvent *) override
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
while ((n = (qrand() % m_stateCount + 1)) == m_lastIndex)
|
while ((n = (qrand() % m_stateCount + 1)) == m_lastIndex)
|
||||||
@ -130,7 +130,7 @@ public:
|
|||||||
m_lastIndex = n;
|
m_lastIndex = n;
|
||||||
machine()->postEvent(new StateSwitchEvent(n));
|
machine()->postEvent(new StateSwitchEvent(n));
|
||||||
}
|
}
|
||||||
virtual void onExit(QEvent *) Q_DECL_OVERRIDE {}
|
virtual void onExit(QEvent *) override {}
|
||||||
//![11]
|
//![11]
|
||||||
|
|
||||||
//![12]
|
//![12]
|
||||||
@ -174,7 +174,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE
|
virtual void resizeEvent(QResizeEvent *event) override
|
||||||
{
|
{
|
||||||
fitInView(scene()->sceneRect());
|
fitInView(scene()->sceneRect());
|
||||||
QGraphicsView::resizeEvent(event);
|
QGraphicsView::resizeEvent(event);
|
||||||
|
@ -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);
|
painter->drawPixmap(QPointF(), p);
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF boundingRect() const Q_DECL_OVERRIDE
|
QRectF boundingRect() const override
|
||||||
{
|
{
|
||||||
return QRectF( QPointF(0, 0), p.size());
|
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);
|
fitInView(sceneRect(), Qt::KeepAspectRatio);
|
||||||
}
|
}
|
||||||
|
@ -61,8 +61,8 @@ public:
|
|||||||
GraphicsView(QWidget *parent = 0);
|
GraphicsView(QWidget *parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
virtual void resizeEvent(QResizeEvent *event) override;
|
||||||
void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
|
void keyPressEvent(QKeyEvent *) override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void keyPressed(int key);
|
void keyPressed(int key);
|
||||||
|
@ -70,7 +70,7 @@ public:
|
|||||||
setTargetState(target);
|
setTargetState(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool eventTest(QEvent *e) Q_DECL_OVERRIDE
|
virtual bool eventTest(QEvent *e) override
|
||||||
{
|
{
|
||||||
if (QSignalTransition::eventTest(e)) {
|
if (QSignalTransition::eventTest(e)) {
|
||||||
QVariant key = static_cast<QStateMachine::SignalEvent*>(e)->arguments().at(0);
|
QVariant key = static_cast<QStateMachine::SignalEvent*>(e)->arguments().at(0);
|
||||||
@ -95,7 +95,7 @@ public:
|
|||||||
startTimer(1000);
|
startTimer(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool eventTest(QEvent *e) Q_DECL_OVERRIDE
|
virtual bool eventTest(QEvent *e) override
|
||||||
{
|
{
|
||||||
return QEventTransition::eventTest(e) && ((qrand() % 50) == 0);
|
return QEventTransition::eventTest(e) && ((qrand() % 50) == 0);
|
||||||
}
|
}
|
||||||
|
@ -60,18 +60,18 @@ public:
|
|||||||
explicit Node(const QPointF &pos, QGraphicsItem *parent = 0);
|
explicit Node(const QPointF &pos, QGraphicsItem *parent = 0);
|
||||||
~Node();
|
~Node();
|
||||||
|
|
||||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
QRectF boundingRect() const override;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void positionChanged();
|
void positionChanged();
|
||||||
|
|
||||||
protected:
|
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 mousePressEvent(QGraphicsSceneMouseEvent *) override;
|
||||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *) Q_DECL_OVERRIDE;
|
void mouseMoveEvent(QGraphicsSceneMouseEvent *) override;
|
||||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *) Q_DECL_OVERRIDE;
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent *) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_dragging;
|
bool m_dragging;
|
||||||
|
@ -60,13 +60,13 @@ public:
|
|||||||
RectButton(QString buttonText);
|
RectButton(QString buttonText);
|
||||||
~RectButton();
|
~RectButton();
|
||||||
|
|
||||||
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
virtual QRectF boundingRect() const override;
|
||||||
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:
|
protected:
|
||||||
QString m_ButtonText;
|
QString m_ButtonText;
|
||||||
|
|
||||||
virtual void mousePressEvent (QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
virtual void mousePressEvent (QGraphicsSceneMouseEvent *event) override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void clicked();
|
void clicked();
|
||||||
|
@ -69,8 +69,8 @@ public:
|
|||||||
StickMan();
|
StickMan();
|
||||||
~StickMan();
|
~StickMan();
|
||||||
|
|
||||||
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
virtual QRectF boundingRect() const override;
|
||||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||||
|
|
||||||
int nodeCount() const;
|
int nodeCount() const;
|
||||||
Node *node(int idx) const;
|
Node *node(int idx) const;
|
||||||
@ -92,7 +92,7 @@ public slots:
|
|||||||
void childPositionChanged();
|
void childPositionChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
|
void timerEvent(QTimerEvent *e) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ public:
|
|||||||
|
|
||||||
void updateBoatMovement();
|
void updateBoatMovement();
|
||||||
|
|
||||||
virtual int type() const Q_DECL_OVERRIDE;
|
virtual int type() const override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void boatDestroyed();
|
void boatDestroyed();
|
||||||
|
@ -81,7 +81,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE
|
virtual bool eventTest(QEvent *event) override
|
||||||
{
|
{
|
||||||
if (!QKeyEventTransition::eventTest(event))
|
if (!QKeyEventTransition::eventTest(event))
|
||||||
return false;
|
return false;
|
||||||
@ -100,13 +100,13 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE
|
virtual bool eventTest(QEvent *event) override
|
||||||
{
|
{
|
||||||
if (!QKeyEventTransition::eventTest(event))
|
if (!QKeyEventTransition::eventTest(event))
|
||||||
return false;
|
return false;
|
||||||
return (boat->currentSpeed() >= 0);
|
return (boat->currentSpeed() >= 0);
|
||||||
}
|
}
|
||||||
void onTransition(QEvent *) Q_DECL_OVERRIDE
|
void onTransition(QEvent *) override
|
||||||
{
|
{
|
||||||
//We decrease the speed if needed
|
//We decrease the speed if needed
|
||||||
if (key == Qt::Key_Left && boat->currentDirection() == Boat::Right)
|
if (key == Qt::Key_Left && boat->currentDirection() == Boat::Right)
|
||||||
@ -131,7 +131,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE
|
virtual bool eventTest(QEvent *event) override
|
||||||
{
|
{
|
||||||
if (!QKeyEventTransition::eventTest(event))
|
if (!QKeyEventTransition::eventTest(event))
|
||||||
return false;
|
return false;
|
||||||
@ -150,7 +150,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
void onEntry(QEvent *) Q_DECL_OVERRIDE
|
void onEntry(QEvent *) override
|
||||||
{
|
{
|
||||||
boat->setCurrentDirection(Boat::Right);
|
boat->setCurrentDirection(Boat::Right);
|
||||||
boat->updateBoatMovement();
|
boat->updateBoatMovement();
|
||||||
@ -167,7 +167,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
void onEntry(QEvent *) Q_DECL_OVERRIDE
|
void onEntry(QEvent *) override
|
||||||
{
|
{
|
||||||
boat->setCurrentDirection(Boat::Left);
|
boat->setCurrentDirection(Boat::Left);
|
||||||
boat->updateBoatMovement();
|
boat->updateBoatMovement();
|
||||||
@ -184,7 +184,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
void onEntry(QEvent *) Q_DECL_OVERRIDE
|
void onEntry(QEvent *) override
|
||||||
{
|
{
|
||||||
boat->setCurrentSpeed(0);
|
boat->setCurrentSpeed(0);
|
||||||
boat->setCurrentDirection(Boat::None);
|
boat->setCurrentDirection(Boat::None);
|
||||||
@ -202,7 +202,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
void onEntry(QEvent *) Q_DECL_OVERRIDE
|
void onEntry(QEvent *) override
|
||||||
{
|
{
|
||||||
Bomb *b = new Bomb();
|
Bomb *b = new Bomb();
|
||||||
b->setPos(boat->x()+boat->size().width(),boat->y());
|
b->setPos(boat->x()+boat->size().width(),boat->y());
|
||||||
@ -223,7 +223,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
void onEntry(QEvent *) Q_DECL_OVERRIDE
|
void onEntry(QEvent *) override
|
||||||
{
|
{
|
||||||
Bomb *b = new Bomb();
|
Bomb *b = new Bomb();
|
||||||
b->setPos(boat->x() - b->size().width(), boat->y());
|
b->setPos(boat->x() - b->size().width(), boat->y());
|
||||||
|
@ -63,8 +63,8 @@ public:
|
|||||||
PixmapItem(const QString &fileName, GraphicsScene::Mode mode, QGraphicsItem * parent = 0);
|
PixmapItem(const QString &fileName, GraphicsScene::Mode mode, QGraphicsItem * parent = 0);
|
||||||
PixmapItem(const QString &fileName, QGraphicsScene *scene);
|
PixmapItem(const QString &fileName, QGraphicsScene *scene);
|
||||||
QSizeF size() const;
|
QSizeF size() const;
|
||||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
QRectF boundingRect() const override;
|
||||||
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) Q_DECL_OVERRIDE;
|
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override;
|
||||||
private:
|
private:
|
||||||
QPixmap pix;
|
QPixmap pix;
|
||||||
};
|
};
|
||||||
|
@ -80,9 +80,9 @@ signals:
|
|||||||
void animationFinished();
|
void animationFinished();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onEntry(QEvent *) Q_DECL_OVERRIDE;
|
void onEntry(QEvent *) override;
|
||||||
void onExit(QEvent *) Q_DECL_OVERRIDE;
|
void onExit(QEvent *) override;
|
||||||
bool event(QEvent *e) Q_DECL_OVERRIDE;
|
bool event(QEvent *e) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(QAnimationState)
|
Q_DISABLE_COPY(QAnimationState)
|
||||||
|
@ -72,7 +72,7 @@ public:
|
|||||||
~PlayState();
|
~PlayState();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onEntry(QEvent *) Q_DECL_OVERRIDE;
|
void onEntry(QEvent *) override;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
GraphicsScene *scene;
|
GraphicsScene *scene;
|
||||||
@ -94,7 +94,7 @@ class LevelState : public QState
|
|||||||
public:
|
public:
|
||||||
LevelState(GraphicsScene *scene, PlayState *game, QState *parent = 0);
|
LevelState(GraphicsScene *scene, PlayState *game, QState *parent = 0);
|
||||||
protected:
|
protected:
|
||||||
void onEntry(QEvent *) Q_DECL_OVERRIDE;
|
void onEntry(QEvent *) override;
|
||||||
private :
|
private :
|
||||||
void initializeLevel();
|
void initializeLevel();
|
||||||
GraphicsScene *scene;
|
GraphicsScene *scene;
|
||||||
@ -107,8 +107,8 @@ public:
|
|||||||
explicit PauseState(GraphicsScene *scene, QState *parent = 0);
|
explicit PauseState(GraphicsScene *scene, QState *parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onEntry(QEvent *) Q_DECL_OVERRIDE;
|
void onEntry(QEvent *) override;
|
||||||
void onExit(QEvent *) Q_DECL_OVERRIDE;
|
void onExit(QEvent *) override;
|
||||||
private :
|
private :
|
||||||
GraphicsScene *scene;
|
GraphicsScene *scene;
|
||||||
};
|
};
|
||||||
@ -119,8 +119,8 @@ public:
|
|||||||
LostState(GraphicsScene *scene, PlayState *game, QState *parent = 0);
|
LostState(GraphicsScene *scene, PlayState *game, QState *parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onEntry(QEvent *) Q_DECL_OVERRIDE;
|
void onEntry(QEvent *) override;
|
||||||
void onExit(QEvent *) Q_DECL_OVERRIDE;
|
void onExit(QEvent *) override;
|
||||||
private :
|
private :
|
||||||
GraphicsScene *scene;
|
GraphicsScene *scene;
|
||||||
PlayState *game;
|
PlayState *game;
|
||||||
@ -132,8 +132,8 @@ public:
|
|||||||
WinState(GraphicsScene *scene, PlayState *game, QState *parent = 0);
|
WinState(GraphicsScene *scene, PlayState *game, QState *parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onEntry(QEvent *) Q_DECL_OVERRIDE;
|
void onEntry(QEvent *) override;
|
||||||
void onExit(QEvent *) Q_DECL_OVERRIDE;
|
void onExit(QEvent *) override;
|
||||||
private :
|
private :
|
||||||
GraphicsScene *scene;
|
GraphicsScene *scene;
|
||||||
PlayState *game;
|
PlayState *game;
|
||||||
@ -152,7 +152,7 @@ class UpdateScoreTransition : public QSignalTransition
|
|||||||
public:
|
public:
|
||||||
UpdateScoreTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target);
|
UpdateScoreTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target);
|
||||||
protected:
|
protected:
|
||||||
virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
|
virtual bool eventTest(QEvent *event) override;
|
||||||
private:
|
private:
|
||||||
PlayState * game;
|
PlayState * game;
|
||||||
GraphicsScene *scene;
|
GraphicsScene *scene;
|
||||||
@ -164,7 +164,7 @@ class WinTransition : public QSignalTransition
|
|||||||
public:
|
public:
|
||||||
WinTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target);
|
WinTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target);
|
||||||
protected:
|
protected:
|
||||||
virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
|
virtual bool eventTest(QEvent *event) override;
|
||||||
private:
|
private:
|
||||||
PlayState * game;
|
PlayState * game;
|
||||||
GraphicsScene *scene;
|
GraphicsScene *scene;
|
||||||
@ -176,7 +176,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
CustomSpaceTransition(QWidget *widget, PlayState *game, QEvent::Type type, int key);
|
CustomSpaceTransition(QWidget *widget, PlayState *game, QEvent::Type type, int key);
|
||||||
protected:
|
protected:
|
||||||
virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
|
virtual bool eventTest(QEvent *event) override;
|
||||||
private:
|
private:
|
||||||
PlayState *game;
|
PlayState *game;
|
||||||
};
|
};
|
||||||
|
@ -81,7 +81,7 @@ public:
|
|||||||
void launchTorpedo(int speed);
|
void launchTorpedo(int speed);
|
||||||
void destroy();
|
void destroy();
|
||||||
|
|
||||||
virtual int type() const Q_DECL_OVERRIDE;
|
virtual int type() const override;
|
||||||
|
|
||||||
QGraphicsRotation *rotation() const { return graphicsRotation; }
|
QGraphicsRotation *rotation() const { return graphicsRotation; }
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ protected slots:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onEntry(QEvent *e) Q_DECL_OVERRIDE
|
void onEntry(QEvent *e) override
|
||||||
{
|
{
|
||||||
if (submarine->currentDirection() == SubMarine::Left) {
|
if (submarine->currentDirection() == SubMarine::Left) {
|
||||||
movementAnimation->setEndValue(QPointF(0,submarine->y()));
|
movementAnimation->setEndValue(QPointF(0,submarine->y()));
|
||||||
@ -125,14 +125,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onEntry(QEvent *e) Q_DECL_OVERRIDE
|
void onEntry(QEvent *e) override
|
||||||
{
|
{
|
||||||
returnAnimation->stop();
|
returnAnimation->stop();
|
||||||
returnAnimation->setEndValue(submarine->currentDirection() == SubMarine::Right ? 360. : 180.);
|
returnAnimation->setEndValue(submarine->currentDirection() == SubMarine::Right ? 360. : 180.);
|
||||||
QAnimationState::onEntry(e);
|
QAnimationState::onEntry(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onExit(QEvent *e) Q_DECL_OVERRIDE
|
void onExit(QEvent *e) override
|
||||||
{
|
{
|
||||||
submarine->currentDirection() == SubMarine::Right ? submarine->setCurrentDirection(SubMarine::Left) : submarine->setCurrentDirection(SubMarine::Right);
|
submarine->currentDirection() == SubMarine::Right ? submarine->setCurrentDirection(SubMarine::Left) : submarine->setCurrentDirection(SubMarine::Right);
|
||||||
QAnimationState::onExit(e);
|
QAnimationState::onExit(e);
|
||||||
|
@ -74,7 +74,7 @@ public:
|
|||||||
Screenshot();
|
Screenshot();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void newScreenshot();
|
void newScreenshot();
|
||||||
|
@ -78,10 +78,10 @@ class Window : public QDialog
|
|||||||
public:
|
public:
|
||||||
Window();
|
Window();
|
||||||
|
|
||||||
void setVisible(bool visible) Q_DECL_OVERRIDE;
|
void setVisible(bool visible) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
|
void closeEvent(QCloseEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void setIcon(int index);
|
void setIcon(int index);
|
||||||
|
@ -69,7 +69,7 @@ class ClassWizard : public QWizard
|
|||||||
public:
|
public:
|
||||||
ClassWizard(QWidget *parent = 0);
|
ClassWizard(QWidget *parent = 0);
|
||||||
|
|
||||||
void accept() Q_DECL_OVERRIDE;
|
void accept() override;
|
||||||
};
|
};
|
||||||
//! [0]
|
//! [0]
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ public:
|
|||||||
CodeStylePage(QWidget *parent = 0);
|
CodeStylePage(QWidget *parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initializePage() Q_DECL_OVERRIDE;
|
void initializePage() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QCheckBox *commentCheckBox;
|
QCheckBox *commentCheckBox;
|
||||||
@ -138,7 +138,7 @@ public:
|
|||||||
OutputFilesPage(QWidget *parent = 0);
|
OutputFilesPage(QWidget *parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initializePage() Q_DECL_OVERRIDE;
|
void initializePage() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel *outputDirLabel;
|
QLabel *outputDirLabel;
|
||||||
@ -157,7 +157,7 @@ public:
|
|||||||
ConclusionPage(QWidget *parent = 0);
|
ConclusionPage(QWidget *parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initializePage() Q_DECL_OVERRIDE;
|
void initializePage() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel *label;
|
QLabel *label;
|
||||||
|
@ -88,7 +88,7 @@ class IntroPage : public QWizardPage
|
|||||||
public:
|
public:
|
||||||
IntroPage(QWidget *parent = 0);
|
IntroPage(QWidget *parent = 0);
|
||||||
|
|
||||||
int nextId() const Q_DECL_OVERRIDE;
|
int nextId() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel *topLabel;
|
QLabel *topLabel;
|
||||||
@ -105,7 +105,7 @@ class EvaluatePage : public QWizardPage
|
|||||||
public:
|
public:
|
||||||
EvaluatePage(QWidget *parent = 0);
|
EvaluatePage(QWidget *parent = 0);
|
||||||
|
|
||||||
int nextId() const Q_DECL_OVERRIDE;
|
int nextId() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel *nameLabel;
|
QLabel *nameLabel;
|
||||||
@ -122,7 +122,7 @@ class RegisterPage : public QWizardPage
|
|||||||
public:
|
public:
|
||||||
RegisterPage(QWidget *parent = 0);
|
RegisterPage(QWidget *parent = 0);
|
||||||
|
|
||||||
int nextId() const Q_DECL_OVERRIDE;
|
int nextId() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel *nameLabel;
|
QLabel *nameLabel;
|
||||||
@ -138,7 +138,7 @@ class DetailsPage : public QWizardPage
|
|||||||
public:
|
public:
|
||||||
DetailsPage(QWidget *parent = 0);
|
DetailsPage(QWidget *parent = 0);
|
||||||
|
|
||||||
int nextId() const Q_DECL_OVERRIDE;
|
int nextId() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel *companyLabel;
|
QLabel *companyLabel;
|
||||||
@ -157,9 +157,9 @@ class ConclusionPage : public QWizardPage
|
|||||||
public:
|
public:
|
||||||
ConclusionPage(QWidget *parent = 0);
|
ConclusionPage(QWidget *parent = 0);
|
||||||
|
|
||||||
void initializePage() Q_DECL_OVERRIDE;
|
void initializePage() override;
|
||||||
int nextId() const Q_DECL_OVERRIDE;
|
int nextId() const override;
|
||||||
void setVisible(bool visible) Q_DECL_OVERRIDE;
|
void setVisible(bool visible) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void printButtonClicked();
|
void printButtonClicked();
|
||||||
|
@ -65,10 +65,10 @@ public:
|
|||||||
DragWidget(QWidget *parent = 0);
|
DragWidget(QWidget *parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||||
void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
|
void dragMoveEvent(QDragMoveEvent *event) override;
|
||||||
void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
|
void dropEvent(QDropEvent *event) override;
|
||||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
};
|
};
|
||||||
//! [0]
|
//! [0]
|
||||||
|
|
||||||
|
@ -64,9 +64,9 @@ public:
|
|||||||
DragWidget(QWidget *parent = 0);
|
DragWidget(QWidget *parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||||
void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
|
void dropEvent(QDropEvent *event) override;
|
||||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DRAGWIDGET_H
|
#endif // DRAGWIDGET_H
|
||||||
|
@ -74,10 +74,10 @@ signals:
|
|||||||
|
|
||||||
//! [DropArea header part2]
|
//! [DropArea header part2]
|
||||||
protected:
|
protected:
|
||||||
void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||||
void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
|
void dragMoveEvent(QDragMoveEvent *event) override;
|
||||||
void dragLeaveEvent(QDragLeaveEvent *event) Q_DECL_OVERRIDE;
|
void dragLeaveEvent(QDragLeaveEvent *event) override;
|
||||||
void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
|
void dropEvent(QDropEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel *label;
|
QLabel *label;
|
||||||
|
@ -65,10 +65,10 @@ public:
|
|||||||
DragWidget(QWidget *parent = 0);
|
DragWidget(QWidget *parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||||
void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
|
void dragMoveEvent(QDragMoveEvent *event) override;
|
||||||
void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
|
void dropEvent(QDropEvent *event) override;
|
||||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
};
|
};
|
||||||
//! [0]
|
//! [0]
|
||||||
|
|
||||||
|
@ -64,10 +64,10 @@ public:
|
|||||||
static QString puzzleMimeType() { return QStringLiteral("image/x-puzzle-piece"); }
|
static QString puzzleMimeType() { return QStringLiteral("image/x-puzzle-piece"); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||||
void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
|
void dragMoveEvent(QDragMoveEvent *event) override;
|
||||||
void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
|
void dropEvent(QDropEvent *event) override;
|
||||||
void startDrag(Qt::DropActions supportedActions) Q_DECL_OVERRIDE;
|
void startDrag(Qt::DropActions supportedActions) override;
|
||||||
|
|
||||||
int m_PieceSize;
|
int m_PieceSize;
|
||||||
};
|
};
|
||||||
|
@ -77,12 +77,12 @@ signals:
|
|||||||
void puzzleCompleted();
|
void puzzleCompleted();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||||
void dragLeaveEvent(QDragLeaveEvent *event) Q_DECL_OVERRIDE;
|
void dragLeaveEvent(QDragLeaveEvent *event) override;
|
||||||
void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
|
void dragMoveEvent(QDragMoveEvent *event) override;
|
||||||
void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
|
void dropEvent(QDropEvent *event) override;
|
||||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QRect targetSquare(const QPoint &position) const;
|
const QRect targetSquare(const QPoint &position) const;
|
||||||
|
@ -63,7 +63,7 @@ public:
|
|||||||
|
|
||||||
QRectF boundingRect() const;
|
QRectF boundingRect() const;
|
||||||
|
|
||||||
void draw(QPainter *painter) Q_DECL_OVERRIDE;
|
void draw(QPainter *painter) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void adjustForItem();
|
void adjustForItem();
|
||||||
|
@ -69,9 +69,9 @@ public:
|
|||||||
void setIndex(qreal);
|
void setIndex(qreal);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
|
void keyPressEvent(QKeyEvent *event) override;
|
||||||
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupScene();
|
void setupScene();
|
||||||
|
@ -68,7 +68,7 @@ private:
|
|||||||
void setupScene();
|
void setupScene();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
qreal angle;
|
qreal angle;
|
||||||
|
@ -75,10 +75,10 @@ public:
|
|||||||
void grabGestures(const QList<Qt::GestureType> &gestures);
|
void grabGestures(const QList<Qt::GestureType> &gestures);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool event(QEvent *event) Q_DECL_OVERRIDE;
|
bool event(QEvent *event) override;
|
||||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseDoubleClickEvent(QMouseEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool gestureEvent(QGestureEvent *event);
|
bool gestureEvent(QGestureEvent *event);
|
||||||
|
@ -61,12 +61,12 @@ public:
|
|||||||
LayoutItem(QGraphicsItem *parent = 0);
|
LayoutItem(QGraphicsItem *parent = 0);
|
||||||
~LayoutItem();
|
~LayoutItem();
|
||||||
// Inherited from QGraphicsLayoutItem
|
// Inherited from QGraphicsLayoutItem
|
||||||
void setGeometry(const QRectF &geom) Q_DECL_OVERRIDE;
|
void setGeometry(const QRectF &geom) override;
|
||||||
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const Q_DECL_OVERRIDE;
|
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override;
|
||||||
|
|
||||||
// Inherited from QGraphicsItem
|
// Inherited from QGraphicsItem
|
||||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
QRectF boundingRect() const override;
|
||||||
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:
|
private:
|
||||||
QPixmap *m_pix;
|
QPixmap *m_pix;
|
||||||
|
@ -110,8 +110,8 @@ public:
|
|||||||
GLTexture2D(int width, int height);
|
GLTexture2D(int width, int height);
|
||||||
explicit GLTexture2D(const QString& fileName, int width = 0, int height = 0);
|
explicit GLTexture2D(const QString& fileName, int width = 0, int height = 0);
|
||||||
void load(int width, int height, QRgb *data);
|
void load(int width, int height, QRgb *data);
|
||||||
virtual void bind() Q_DECL_OVERRIDE;
|
virtual void bind() override;
|
||||||
virtual void unbind() Q_DECL_OVERRIDE;
|
virtual void unbind() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GLTexture3D : public GLTexture
|
class GLTexture3D : public GLTexture
|
||||||
@ -121,8 +121,8 @@ public:
|
|||||||
// TODO: Implement function below
|
// TODO: Implement function below
|
||||||
//GLTexture3D(const QString& fileName, int width = 0, int height = 0);
|
//GLTexture3D(const QString& fileName, int width = 0, int height = 0);
|
||||||
void load(int width, int height, int depth, QRgb *data);
|
void load(int width, int height, int depth, QRgb *data);
|
||||||
virtual void bind() Q_DECL_OVERRIDE;
|
virtual void bind() override;
|
||||||
virtual void unbind() Q_DECL_OVERRIDE;
|
virtual void unbind() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GLTextureCube : public GLTexture
|
class GLTextureCube : public GLTexture
|
||||||
@ -131,8 +131,8 @@ public:
|
|||||||
GLTextureCube(int size);
|
GLTextureCube(int size);
|
||||||
explicit GLTextureCube(const QStringList& fileNames, int size = 0);
|
explicit GLTextureCube(const QStringList& fileNames, int size = 0);
|
||||||
void load(int size, int face, QRgb *data);
|
void load(int size, int face, QRgb *data);
|
||||||
virtual void bind() Q_DECL_OVERRIDE;
|
virtual void bind() override;
|
||||||
virtual void unbind() Q_DECL_OVERRIDE;
|
virtual void unbind() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: Define and implement class below
|
// TODO: Define and implement class below
|
||||||
@ -146,7 +146,7 @@ public:
|
|||||||
void begin(int face);
|
void begin(int face);
|
||||||
// end rendering
|
// end rendering
|
||||||
void end();
|
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 getViewMatrix(QMatrix4x4& mat, int face);
|
||||||
static void getProjectionMatrix(QMatrix4x4& mat, float nearZ, float farZ);
|
static void getProjectionMatrix(QMatrix4x4& mat, float nearZ, float farZ);
|
||||||
|
@ -67,7 +67,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE {
|
void resizeEvent(QResizeEvent *event) override {
|
||||||
if (scene())
|
if (scene())
|
||||||
scene()->setSceneRect(QRect(QPoint(0, 0), event->size()));
|
scene()->setSceneRect(QRect(QPoint(0, 0), event->size()));
|
||||||
QGraphicsView::resizeEvent(event);
|
QGraphicsView::resizeEvent(event);
|
||||||
|
@ -63,18 +63,18 @@ public:
|
|||||||
|
|
||||||
ItemBase(int size, int x, int y);
|
ItemBase(int size, int x, int y);
|
||||||
virtual ~ItemBase();
|
virtual ~ItemBase();
|
||||||
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
virtual QRectF boundingRect() const override;
|
||||||
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:
|
protected:
|
||||||
virtual ItemBase *createNew(int size, int x, int y) = 0;
|
virtual ItemBase *createNew(int size, int x, int y) = 0;
|
||||||
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) Q_DECL_OVERRIDE;
|
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
|
||||||
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
|
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event) override;
|
||||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
virtual void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
|
virtual void keyPressEvent(QKeyEvent *event) override;
|
||||||
virtual void wheelEvent(QGraphicsSceneWheelEvent *event) Q_DECL_OVERRIDE;
|
virtual void wheelEvent(QGraphicsSceneWheelEvent *event) override;
|
||||||
virtual int type() const Q_DECL_OVERRIDE;
|
virtual int type() const override;
|
||||||
bool isInResizeArea(const QPointF &pos);
|
bool isInResizeArea(const QPointF &pos);
|
||||||
|
|
||||||
static void duplicateSelectedItems(QGraphicsScene *scene);
|
static void duplicateSelectedItems(QGraphicsScene *scene);
|
||||||
@ -92,9 +92,9 @@ class QtBox : public ItemBase
|
|||||||
public:
|
public:
|
||||||
QtBox(int size, int x, int y);
|
QtBox(int size, int x, int y);
|
||||||
virtual ~QtBox();
|
virtual ~QtBox();
|
||||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||||
protected:
|
protected:
|
||||||
virtual ItemBase *createNew(int size, int x, int y) Q_DECL_OVERRIDE;
|
virtual ItemBase *createNew(int size, int x, int y) override;
|
||||||
private:
|
private:
|
||||||
QVector3D m_vertices[8];
|
QVector3D m_vertices[8];
|
||||||
QVector3D m_texCoords[4];
|
QVector3D m_texCoords[4];
|
||||||
@ -106,9 +106,9 @@ class CircleItem : public ItemBase
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CircleItem(int size, int x, int y);
|
CircleItem(int size, int x, int y);
|
||||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||||
protected:
|
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;
|
QColor m_color;
|
||||||
};
|
};
|
||||||
@ -117,9 +117,9 @@ class SquareItem : public ItemBase
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SquareItem(int size, int x, int y);
|
SquareItem(int size, int x, int y);
|
||||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||||
protected:
|
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;
|
QPixmap m_image;
|
||||||
};
|
};
|
||||||
|
@ -81,13 +81,13 @@ class ColorEdit : public ParameterEdit
|
|||||||
public:
|
public:
|
||||||
ColorEdit(QRgb initialColor, int id);
|
ColorEdit(QRgb initialColor, int id);
|
||||||
QRgb color() const {return m_color;}
|
QRgb color() const {return m_color;}
|
||||||
virtual void emitChange() Q_DECL_OVERRIDE {emit colorChanged(m_color, m_id);}
|
virtual void emitChange() override { emit colorChanged(m_color, m_id); }
|
||||||
public slots:
|
public slots:
|
||||||
void editDone();
|
void editDone();
|
||||||
signals:
|
signals:
|
||||||
void colorChanged(QRgb color, int id);
|
void colorChanged(QRgb color, int id);
|
||||||
protected:
|
protected:
|
||||||
virtual void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
virtual void mousePressEvent(QMouseEvent *event) override;
|
||||||
void setColor(QRgb color); // also emits colorChanged()
|
void setColor(QRgb color); // also emits colorChanged()
|
||||||
private:
|
private:
|
||||||
QGraphicsScene *m_dialogParentScene;
|
QGraphicsScene *m_dialogParentScene;
|
||||||
@ -103,7 +103,7 @@ class FloatEdit : public ParameterEdit
|
|||||||
public:
|
public:
|
||||||
FloatEdit(float initialValue, int id);
|
FloatEdit(float initialValue, int id);
|
||||||
float value() const {return m_value;}
|
float value() const {return m_value;}
|
||||||
virtual void emitChange() Q_DECL_OVERRIDE {emit valueChanged(m_value, m_id);}
|
virtual void emitChange() override { emit valueChanged(m_value, m_id); }
|
||||||
public slots:
|
public slots:
|
||||||
void editDone();
|
void editDone();
|
||||||
signals:
|
signals:
|
||||||
@ -120,9 +120,9 @@ class GraphicsWidget : public QGraphicsProxyWidget
|
|||||||
public:
|
public:
|
||||||
GraphicsWidget() : QGraphicsProxyWidget(0, Qt::Window) {}
|
GraphicsWidget() : QGraphicsProxyWidget(0, Qt::Window) {}
|
||||||
protected:
|
protected:
|
||||||
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
|
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
|
||||||
virtual void resizeEvent(QGraphicsSceneResizeEvent *event) Q_DECL_OVERRIDE;
|
virtual void resizeEvent(QGraphicsSceneResizeEvent *event) override;
|
||||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TwoSidedGraphicsWidget : public QObject
|
class TwoSidedGraphicsWidget : public QObject
|
||||||
@ -162,7 +162,7 @@ signals:
|
|||||||
void shaderChanged(int);
|
void shaderChanged(int);
|
||||||
void doubleClicked();
|
void doubleClicked();
|
||||||
protected:
|
protected:
|
||||||
virtual void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
virtual void mouseDoubleClickEvent(QMouseEvent *event) override;
|
||||||
|
|
||||||
QVector<QByteArray> m_parameterNames;
|
QVector<QByteArray> m_parameterNames;
|
||||||
QComboBox *m_textureCombo;
|
QComboBox *m_textureCombo;
|
||||||
@ -189,7 +189,7 @@ signals:
|
|||||||
void doubleClicked();
|
void doubleClicked();
|
||||||
void newItemTriggered(ItemDialog::ItemType type);
|
void newItemTriggered(ItemDialog::ItemType type);
|
||||||
protected:
|
protected:
|
||||||
virtual void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
virtual void mouseDoubleClickEvent(QMouseEvent *event) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Scene : public QGraphicsScene
|
class Scene : public QGraphicsScene
|
||||||
@ -198,7 +198,7 @@ class Scene : public QGraphicsScene
|
|||||||
public:
|
public:
|
||||||
Scene(int width, int height, int maxTextureSize);
|
Scene(int width, int height, int maxTextureSize);
|
||||||
~Scene();
|
~Scene();
|
||||||
virtual void drawBackground(QPainter *painter, const QRectF &rect) Q_DECL_OVERRIDE;
|
virtual void drawBackground(QPainter *painter, const QRectF &rect) override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setShader(int index);
|
void setShader(int index);
|
||||||
@ -214,10 +214,10 @@ protected:
|
|||||||
void defaultStates();
|
void defaultStates();
|
||||||
void renderCubemaps();
|
void renderCubemaps();
|
||||||
|
|
||||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
virtual void wheelEvent(QGraphicsSceneWheelEvent * event) Q_DECL_OVERRIDE;
|
virtual void wheelEvent(QGraphicsSceneWheelEvent * event) override;
|
||||||
private:
|
private:
|
||||||
void initGL();
|
void initGL();
|
||||||
QPointF pixelPosToViewPos(const QPointF& p);
|
QPointF pixelPosToViewPos(const QPointF& p);
|
||||||
|
@ -59,14 +59,14 @@ class Chip : public QGraphicsItem
|
|||||||
public:
|
public:
|
||||||
Chip(const QColor &color, int x, int y);
|
Chip(const QColor &color, int x, int y);
|
||||||
|
|
||||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
QRectF boundingRect() const override;
|
||||||
QPainterPath shape() const Q_DECL_OVERRIDE;
|
QPainterPath shape() const override;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget) Q_DECL_OVERRIDE;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int x;
|
int x;
|
||||||
|
@ -70,7 +70,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
#ifndef QT_NO_WHEELEVENT
|
#ifndef QT_NO_WHEELEVENT
|
||||||
void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE;
|
void wheelEvent(QWheelEvent *) override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -59,13 +59,13 @@ class Mouse : public QGraphicsItem
|
|||||||
public:
|
public:
|
||||||
Mouse();
|
Mouse();
|
||||||
|
|
||||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
QRectF boundingRect() const override;
|
||||||
QPainterPath shape() const Q_DECL_OVERRIDE;
|
QPainterPath shape() const override;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
QWidget *widget) Q_DECL_OVERRIDE;
|
QWidget *widget) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void advance(int step) Q_DECL_OVERRIDE;
|
void advance(int step) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
qreal angle;
|
qreal angle;
|
||||||
|
@ -73,9 +73,9 @@ public:
|
|||||||
Arrow(DiagramItem *startItem, DiagramItem *endItem,
|
Arrow(DiagramItem *startItem, DiagramItem *endItem,
|
||||||
QGraphicsItem *parent = 0);
|
QGraphicsItem *parent = 0);
|
||||||
|
|
||||||
int type() const Q_DECL_OVERRIDE { return Type; }
|
int type() const override { return Type; }
|
||||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
QRectF boundingRect() const override;
|
||||||
QPainterPath shape() const Q_DECL_OVERRIDE;
|
QPainterPath shape() const override;
|
||||||
void setColor(const QColor &color) { myColor = color; }
|
void setColor(const QColor &color) { myColor = color; }
|
||||||
DiagramItem *startItem() const { return myStartItem; }
|
DiagramItem *startItem() const { return myStartItem; }
|
||||||
DiagramItem *endItem() const { return myEndItem; }
|
DiagramItem *endItem() const { return myEndItem; }
|
||||||
@ -83,7 +83,7 @@ public:
|
|||||||
void updatePosition();
|
void updatePosition();
|
||||||
|
|
||||||
protected:
|
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:
|
private:
|
||||||
DiagramItem *myStartItem;
|
DiagramItem *myStartItem;
|
||||||
|
@ -85,11 +85,11 @@ public:
|
|||||||
QPolygonF polygon() const { return myPolygon; }
|
QPolygonF polygon() const { return myPolygon; }
|
||||||
void addArrow(Arrow *arrow);
|
void addArrow(Arrow *arrow);
|
||||||
QPixmap image() const;
|
QPixmap image() const;
|
||||||
int type() const Q_DECL_OVERRIDE { return Type;}
|
int type() const override { return Type;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) Q_DECL_OVERRIDE;
|
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
|
||||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
|
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DiagramType myDiagramType;
|
DiagramType myDiagramType;
|
||||||
|
@ -95,9 +95,9 @@ signals:
|
|||||||
void itemSelected(QGraphicsItem *item);
|
void itemSelected(QGraphicsItem *item);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
|
void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) override;
|
||||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
|
void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent) override;
|
||||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isItemChange(int type);
|
bool isItemChange(int type);
|
||||||
|
@ -71,16 +71,16 @@ public:
|
|||||||
|
|
||||||
DiagramTextItem(QGraphicsItem *parent = 0);
|
DiagramTextItem(QGraphicsItem *parent = 0);
|
||||||
|
|
||||||
int type() const Q_DECL_OVERRIDE { return Type; }
|
int type() const override { return Type; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void lostFocus(DiagramTextItem *item);
|
void lostFocus(DiagramTextItem *item);
|
||||||
void selectedChange(QGraphicsItem *item);
|
void selectedChange(QGraphicsItem *item);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
|
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
|
||||||
void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
|
void focusOutEvent(QFocusEvent *event) override;
|
||||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
};
|
};
|
||||||
//! [0]
|
//! [0]
|
||||||
|
|
||||||
|
@ -59,13 +59,13 @@ class ColorItem : public QGraphicsItem
|
|||||||
public:
|
public:
|
||||||
ColorItem();
|
ColorItem();
|
||||||
|
|
||||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
QRectF boundingRect() const override;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QColor color;
|
QColor color;
|
||||||
|
@ -63,7 +63,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE
|
virtual void resizeEvent(QResizeEvent *) override
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -65,9 +65,9 @@ public:
|
|||||||
RobotPart(QGraphicsItem *parent = 0);
|
RobotPart(QGraphicsItem *parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void dragEnterEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
|
void dragEnterEvent(QGraphicsSceneDragDropEvent *event) override;
|
||||||
void dragLeaveEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
|
void dragLeaveEvent(QGraphicsSceneDragDropEvent *event) override;
|
||||||
void dropEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
|
void dropEvent(QGraphicsSceneDragDropEvent *event) override;
|
||||||
|
|
||||||
QColor color;
|
QColor color;
|
||||||
bool dragOver;
|
bool dragOver;
|
||||||
@ -80,12 +80,12 @@ class RobotHead : public RobotPart
|
|||||||
public:
|
public:
|
||||||
RobotHead(QGraphicsItem *parent = 0);
|
RobotHead(QGraphicsItem *parent = 0);
|
||||||
|
|
||||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
QRectF boundingRect() const override;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void dragEnterEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
|
void dragEnterEvent(QGraphicsSceneDragDropEvent *event) override;
|
||||||
void dropEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
|
void dropEvent(QGraphicsSceneDragDropEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPixmap pixmap;
|
QPixmap pixmap;
|
||||||
@ -98,8 +98,8 @@ class RobotTorso : public RobotPart
|
|||||||
public:
|
public:
|
||||||
RobotTorso(QGraphicsItem *parent = 0);
|
RobotTorso(QGraphicsItem *parent = 0);
|
||||||
|
|
||||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
QRectF boundingRect() const override;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
|
||||||
};
|
};
|
||||||
//! [2]
|
//! [2]
|
||||||
|
|
||||||
@ -109,8 +109,8 @@ class RobotLimb : public RobotPart
|
|||||||
public:
|
public:
|
||||||
RobotLimb(QGraphicsItem *parent = 0);
|
RobotLimb(QGraphicsItem *parent = 0);
|
||||||
|
|
||||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
QRectF boundingRect() const override;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
|
||||||
};
|
};
|
||||||
//! [3]
|
//! [3]
|
||||||
|
|
||||||
@ -120,8 +120,8 @@ class Robot : public RobotPart
|
|||||||
public:
|
public:
|
||||||
Robot(QGraphicsItem *parent = 0);
|
Robot(QGraphicsItem *parent = 0);
|
||||||
|
|
||||||
QRectF boundingRect() const Q_DECL_OVERRIDE;
|
QRectF boundingRect() const override;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
|
||||||
};
|
};
|
||||||
//! [4]
|
//! [4]
|
||||||
|
|
||||||
|
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