Examples: Remove a redundant virtual specifier for overriders
It's a good practice to use override without virtual: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rh-override Change-Id: I5c2d73600e6c706424589c0487133c03a4ef3629 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
f91bbd2438
commit
011aeb131e
@ -67,12 +67,12 @@ public:
|
|||||||
painter->drawPixmap(QPointF(), p);
|
painter->drawPixmap(QPointF(), p);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent *) override
|
void mousePressEvent(QGraphicsSceneMouseEvent *) override
|
||||||
{
|
{
|
||||||
emit clicked();
|
emit clicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setGeometry(const QRectF &rect) override
|
void setGeometry(const QRectF &rect) override
|
||||||
{
|
{
|
||||||
QGraphicsWidget::setGeometry(rect);
|
QGraphicsWidget::setGeometry(rect);
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void resizeEvent(QResizeEvent *) override
|
void resizeEvent(QResizeEvent *) override
|
||||||
{
|
{
|
||||||
fitInView(sceneRect(), Qt::KeepAspectRatio);
|
fitInView(sceneRect(), Qt::KeepAspectRatio);
|
||||||
}
|
}
|
||||||
|
@ -98,14 +98,14 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
//![14]
|
//![14]
|
||||||
virtual bool eventTest(QEvent *event) override
|
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 *) override {}
|
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 *) override
|
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 *) override {}
|
void onExit(QEvent *) override {}
|
||||||
//![11]
|
//![11]
|
||||||
|
|
||||||
//![12]
|
//![12]
|
||||||
@ -174,7 +174,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void resizeEvent(QResizeEvent *event) override
|
void resizeEvent(QResizeEvent *event) override
|
||||||
{
|
{
|
||||||
fitInView(scene()->sceneRect());
|
fitInView(scene()->sceneRect());
|
||||||
QGraphicsView::resizeEvent(event);
|
QGraphicsView::resizeEvent(event);
|
||||||
|
@ -79,7 +79,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void resizeEvent(QResizeEvent *) override
|
void resizeEvent(QResizeEvent *) override
|
||||||
{
|
{
|
||||||
fitInView(sceneRect(), Qt::KeepAspectRatio);
|
fitInView(sceneRect(), Qt::KeepAspectRatio);
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ public:
|
|||||||
GraphicsView(QWidget *parent = 0);
|
GraphicsView(QWidget *parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
void keyPressEvent(QKeyEvent *) override;
|
void keyPressEvent(QKeyEvent *) override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -70,7 +70,7 @@ public:
|
|||||||
setTargetState(target);
|
setTargetState(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool eventTest(QEvent *e) override
|
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) override
|
bool eventTest(QEvent *e) override
|
||||||
{
|
{
|
||||||
return QEventTransition::eventTest(e) && ((qrand() % 50) == 0);
|
return QEventTransition::eventTest(e) && ((qrand() % 50) == 0);
|
||||||
}
|
}
|
||||||
|
@ -60,13 +60,13 @@ public:
|
|||||||
RectButton(QString buttonText);
|
RectButton(QString buttonText);
|
||||||
~RectButton();
|
~RectButton();
|
||||||
|
|
||||||
virtual QRectF boundingRect() const override;
|
QRectF boundingRect() const override;
|
||||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QString m_ButtonText;
|
QString m_ButtonText;
|
||||||
|
|
||||||
virtual void mousePressEvent (QGraphicsSceneMouseEvent *event) override;
|
void mousePressEvent (QGraphicsSceneMouseEvent *event) override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void clicked();
|
void clicked();
|
||||||
|
@ -69,8 +69,8 @@ public:
|
|||||||
StickMan();
|
StickMan();
|
||||||
~StickMan();
|
~StickMan();
|
||||||
|
|
||||||
virtual QRectF boundingRect() const override;
|
QRectF boundingRect() const override;
|
||||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
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;
|
||||||
|
@ -86,7 +86,7 @@ public:
|
|||||||
|
|
||||||
void updateBoatMovement();
|
void updateBoatMovement();
|
||||||
|
|
||||||
virtual int type() const override;
|
int type() const override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void boatDestroyed();
|
void boatDestroyed();
|
||||||
|
@ -81,7 +81,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
virtual bool eventTest(QEvent *event) override
|
bool eventTest(QEvent *event) override
|
||||||
{
|
{
|
||||||
if (!QKeyEventTransition::eventTest(event))
|
if (!QKeyEventTransition::eventTest(event))
|
||||||
return false;
|
return false;
|
||||||
@ -100,7 +100,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
virtual bool eventTest(QEvent *event) override
|
bool eventTest(QEvent *event) override
|
||||||
{
|
{
|
||||||
if (!QKeyEventTransition::eventTest(event))
|
if (!QKeyEventTransition::eventTest(event))
|
||||||
return false;
|
return false;
|
||||||
@ -131,7 +131,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
virtual bool eventTest(QEvent *event) override
|
bool eventTest(QEvent *event) override
|
||||||
{
|
{
|
||||||
if (!QKeyEventTransition::eventTest(event))
|
if (!QKeyEventTransition::eventTest(event))
|
||||||
return false;
|
return false;
|
||||||
|
@ -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) override;
|
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) override;
|
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) override;
|
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 override;
|
int type() const override;
|
||||||
|
|
||||||
QGraphicsRotation *rotation() const { return graphicsRotation; }
|
QGraphicsRotation *rotation() const { return graphicsRotation; }
|
||||||
|
|
||||||
|
@ -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() override;
|
void bind() override;
|
||||||
virtual void unbind() override;
|
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() override;
|
void bind() override;
|
||||||
virtual void unbind() override;
|
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() override;
|
void bind() override;
|
||||||
virtual void unbind() override;
|
void unbind() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: Define and implement class below
|
// TODO: Define and implement class below
|
||||||
|
@ -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 override;
|
QRectF boundingRect() const override;
|
||||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
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) override;
|
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
|
||||||
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event) override;
|
void hoverMoveEvent(QGraphicsSceneHoverEvent *event) override;
|
||||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
virtual void keyPressEvent(QKeyEvent *event) override;
|
void keyPressEvent(QKeyEvent *event) override;
|
||||||
virtual void wheelEvent(QGraphicsSceneWheelEvent *event) override;
|
void wheelEvent(QGraphicsSceneWheelEvent *event) override;
|
||||||
virtual int type() const override;
|
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) override;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||||
protected:
|
protected:
|
||||||
virtual ItemBase *createNew(int size, int x, int y) override;
|
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) override;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||||
protected:
|
protected:
|
||||||
virtual ItemBase *createNew(int size, int x, int y) override;
|
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) override;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||||
protected:
|
protected:
|
||||||
virtual ItemBase *createNew(int size, int x, int y) override;
|
ItemBase *createNew(int size, int x, int y) override;
|
||||||
|
|
||||||
QPixmap m_image;
|
QPixmap m_image;
|
||||||
};
|
};
|
||||||
|
@ -87,7 +87,7 @@ public slots:
|
|||||||
signals:
|
signals:
|
||||||
void colorChanged(QRgb color, int id);
|
void colorChanged(QRgb color, int id);
|
||||||
protected:
|
protected:
|
||||||
virtual void mousePressEvent(QMouseEvent *event) override;
|
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;
|
||||||
@ -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) override;
|
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
|
||||||
virtual void resizeEvent(QGraphicsSceneResizeEvent *event) override;
|
void resizeEvent(QGraphicsSceneResizeEvent *event) override;
|
||||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
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) override;
|
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) override;
|
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) override;
|
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) override;
|
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
virtual void wheelEvent(QGraphicsSceneWheelEvent * event) override;
|
void wheelEvent(QGraphicsSceneWheelEvent * event) override;
|
||||||
private:
|
private:
|
||||||
void initGL();
|
void initGL();
|
||||||
QPointF pixelPosToViewPos(const QPointF& p);
|
QPointF pixelPosToViewPos(const QPointF& p);
|
||||||
|
@ -63,7 +63,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void resizeEvent(QResizeEvent *) override
|
void resizeEvent(QResizeEvent *) override
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -69,7 +69,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void resizeEvent(QResizeEvent *event) override
|
void resizeEvent(QResizeEvent *event) override
|
||||||
{
|
{
|
||||||
w->setGeometry(0, 0, event->size().width(), event->size().height());
|
w->setGeometry(0, 0, event->size().width(), event->size().height());
|
||||||
}
|
}
|
||||||
|
@ -63,8 +63,8 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override;
|
QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override;
|
||||||
void scrollTo (const QModelIndex & index, ScrollHint hint = EnsureVisible) override;
|
void scrollTo (const QModelIndex & index, ScrollHint hint = EnsureVisible) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -78,7 +78,7 @@ public slots:
|
|||||||
void fileNew();
|
void fileNew();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void closeEvent(QCloseEvent *e) override;
|
void closeEvent(QCloseEvent *e) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void fileOpen();
|
void fileOpen();
|
||||||
|
@ -103,7 +103,7 @@ public:
|
|||||||
: QSignalTransition(fact, SIGNAL(xChanged(int))), m_fact(fact)
|
: QSignalTransition(fact, SIGNAL(xChanged(int))), m_fact(fact)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual bool eventTest(QEvent *e) override
|
bool eventTest(QEvent *e) override
|
||||||
{
|
{
|
||||||
if (!QSignalTransition::eventTest(e))
|
if (!QSignalTransition::eventTest(e))
|
||||||
return false;
|
return false;
|
||||||
@ -111,7 +111,7 @@ public:
|
|||||||
return se->arguments().at(0).toInt() > 1;
|
return se->arguments().at(0).toInt() > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void onTransition(QEvent *e) override
|
void onTransition(QEvent *e) override
|
||||||
{
|
{
|
||||||
QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(e);
|
QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(e);
|
||||||
int x = se->arguments().at(0).toInt();
|
int x = se->arguments().at(0).toInt();
|
||||||
@ -133,7 +133,7 @@ public:
|
|||||||
: QSignalTransition(fact, SIGNAL(xChanged(int))), m_fact(fact)
|
: QSignalTransition(fact, SIGNAL(xChanged(int))), m_fact(fact)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual bool eventTest(QEvent *e) override
|
bool eventTest(QEvent *e) override
|
||||||
{
|
{
|
||||||
if (!QSignalTransition::eventTest(e))
|
if (!QSignalTransition::eventTest(e))
|
||||||
return false;
|
return false;
|
||||||
@ -141,7 +141,7 @@ public:
|
|||||||
return se->arguments().at(0).toInt() <= 1;
|
return se->arguments().at(0).toInt() <= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void onTransition(QEvent *) override
|
void onTransition(QEvent *) override
|
||||||
{
|
{
|
||||||
fprintf(stdout, "%d\n", m_fact->property("fac").toInt());
|
fprintf(stdout, "%d\n", m_fact->property("fac").toInt());
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ public:
|
|||||||
: QState(parent) {}
|
: QState(parent) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void onEntry(QEvent *) override
|
void onEntry(QEvent *) override
|
||||||
{
|
{
|
||||||
machine()->postEvent(new PingEvent());
|
machine()->postEvent(new PingEvent());
|
||||||
fprintf(stdout, "ping?\n");
|
fprintf(stdout, "ping?\n");
|
||||||
@ -93,7 +93,7 @@ protected:
|
|||||||
virtual bool eventTest(QEvent *e) override {
|
virtual bool eventTest(QEvent *e) override {
|
||||||
return (e->type() == QEvent::User+3);
|
return (e->type() == QEvent::User+3);
|
||||||
}
|
}
|
||||||
virtual void onTransition(QEvent *) override
|
void onTransition(QEvent *) override
|
||||||
{
|
{
|
||||||
machine()->postDelayedEvent(new PingEvent(), 500);
|
machine()->postDelayedEvent(new PingEvent(), 500);
|
||||||
fprintf(stdout, "ping?\n");
|
fprintf(stdout, "ping?\n");
|
||||||
@ -111,7 +111,7 @@ protected:
|
|||||||
virtual bool eventTest(QEvent *e) override {
|
virtual bool eventTest(QEvent *e) override {
|
||||||
return (e->type() == QEvent::User+2);
|
return (e->type() == QEvent::User+2);
|
||||||
}
|
}
|
||||||
virtual void onTransition(QEvent *) override
|
void onTransition(QEvent *) override
|
||||||
{
|
{
|
||||||
machine()->postDelayedEvent(new PongEvent(), 500);
|
machine()->postDelayedEvent(new PongEvent(), 500);
|
||||||
fprintf(stdout, "pong!\n");
|
fprintf(stdout, "pong!\n");
|
||||||
|
@ -74,7 +74,7 @@ public slots:
|
|||||||
void turnOn() { setOn(true); }
|
void turnOn() { setOn(true); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paintEvent(QPaintEvent *) override
|
void paintEvent(QPaintEvent *) override
|
||||||
{
|
{
|
||||||
if (!m_on)
|
if (!m_on)
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user