summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-05-14 13:08:03 (GMT)
committerEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-05-14 13:08:03 (GMT)
commit17d8f734c038705f7f8196dfe5e8902c808a4945 (patch)
treeb6ac1d09fbe41d4d486e4fe9fe7ecb58dc7c209a
parentededfad305258f9f450b314d9e2d53a6905bc6d0 (diff)
downloadQt-17d8f734c038705f7f8196dfe5e8902c808a4945.zip
Qt-17d8f734c038705f7f8196dfe5e8902c808a4945.tar.gz
Qt-17d8f734c038705f7f8196dfe5e8902c808a4945.tar.bz2
Make QAbstractTransition::eventTest() non-const
We decided to remove the const of the eventTest() since some transitions have dynamic conditions and need to update when eventTest() is called.
-rw-r--r--examples/animation/moveblocks/main.cpp2
-rw-r--r--examples/animation/stickman/lifecycle.cpp4
-rw-r--r--examples/animation/sub-attaq/boat_p.h6
-rw-r--r--examples/animation/sub-attaq/states.cpp6
-rw-r--r--examples/animation/sub-attaq/states.h6
-rw-r--r--examples/statemachine/factorial/main.cpp4
-rw-r--r--examples/statemachine/pingpong/main.cpp4
-rw-r--r--examples/statemachine/tankgame/gameovertransition.cpp2
-rw-r--r--examples/statemachine/tankgame/gameovertransition.h4
-rw-r--r--examples/statemachine/tankgameplugins/seek_ai/seek_ai.h6
-rw-r--r--src/corelib/statemachine/qabstracttransition.cpp4
-rw-r--r--src/corelib/statemachine/qabstracttransition.h2
-rw-r--r--src/corelib/statemachine/qabstracttransition_p.h2
-rw-r--r--src/corelib/statemachine/qeventtransition.cpp2
-rw-r--r--src/corelib/statemachine/qeventtransition.h2
-rw-r--r--src/corelib/statemachine/qsignaltransition.cpp2
-rw-r--r--src/corelib/statemachine/qsignaltransition.h2
-rw-r--r--src/corelib/statemachine/qstate.cpp2
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp2
-rw-r--r--src/gui/statemachine/qbasickeyeventtransition.cpp2
-rw-r--r--src/gui/statemachine/qbasickeyeventtransition_p.h2
-rw-r--r--src/gui/statemachine/qbasicmouseeventtransition.cpp2
-rw-r--r--src/gui/statemachine/qbasicmouseeventtransition_p.h2
-rw-r--r--src/gui/statemachine/qkeyeventtransition.cpp2
-rw-r--r--src/gui/statemachine/qkeyeventtransition.h2
-rw-r--r--src/gui/statemachine/qmouseeventtransition.cpp2
-rw-r--r--src/gui/statemachine/qmouseeventtransition.h2
-rw-r--r--tests/auto/qstate/tst_qstate.cpp2
-rw-r--r--tests/auto/qstatemachine/tst_qstatemachine.cpp8
29 files changed, 45 insertions, 45 deletions
diff --git a/examples/animation/moveblocks/main.cpp b/examples/animation/moveblocks/main.cpp
index 06ed3dd..0ce07fc 100644
--- a/examples/animation/moveblocks/main.cpp
+++ b/examples/animation/moveblocks/main.cpp
@@ -95,7 +95,7 @@ public:
}
protected:
- virtual bool eventTest(QEvent *event) const
+ virtual bool eventTest(QEvent *event)
{
return (event->type() == QEvent::Type(StateSwitchEvent::StateSwitchType))
&& (static_cast<StateSwitchEvent *>(event)->rand() == m_rand);
diff --git a/examples/animation/stickman/lifecycle.cpp b/examples/animation/stickman/lifecycle.cpp
index b22af55..423d7ad 100644
--- a/examples/animation/stickman/lifecycle.cpp
+++ b/examples/animation/stickman/lifecycle.cpp
@@ -69,7 +69,7 @@ public:
{
}
- virtual bool eventTest(QEvent *e) const
+ virtual bool eventTest(QEvent *e)
{
if (QSignalTransition::eventTest(e)) {
QVariant key = static_cast<QSignalEvent*>(e)->arguments().at(0);
@@ -92,7 +92,7 @@ public:
startTimer(1000);
}
- virtual bool eventTest(QEvent *e) const
+ virtual bool eventTest(QEvent *e)
{
return QEventTransition::eventTest(e) && ((qrand() % 50) == 0);
}
diff --git a/examples/animation/sub-attaq/boat_p.h b/examples/animation/sub-attaq/boat_p.h
index 17fbe5c..6f03e48 100644
--- a/examples/animation/sub-attaq/boat_p.h
+++ b/examples/animation/sub-attaq/boat_p.h
@@ -67,7 +67,7 @@ public:
this->key = key;
}
protected:
- virtual bool eventTest(QEvent *event) const
+ virtual bool eventTest(QEvent *event)
{
Q_UNUSED(event);
if (!QKeyEventTransition::eventTest(event))
@@ -93,7 +93,7 @@ public:
this->key = key;
}
protected:
- virtual bool eventTest(QEvent *event) const
+ virtual bool eventTest(QEvent *event)
{
Q_UNUSED(event);
if (!QKeyEventTransition::eventTest(event))
@@ -131,7 +131,7 @@ public:
this->key = key;
}
protected:
- virtual bool eventTest(QEvent *event) const
+ virtual bool eventTest(QEvent *event)
{
Q_UNUSED(event);
if (!QKeyEventTransition::eventTest(event))
diff --git a/examples/animation/sub-attaq/states.cpp b/examples/animation/sub-attaq/states.cpp
index c6af924..7650b0f 100644
--- a/examples/animation/sub-attaq/states.cpp
+++ b/examples/animation/sub-attaq/states.cpp
@@ -281,7 +281,7 @@ UpdateScoreTransition::UpdateScoreTransition(GraphicsScene *scene, PlayState *ga
{
}
-bool UpdateScoreTransition::eventTest(QEvent *event) const
+bool UpdateScoreTransition::eventTest(QEvent *event)
{
if (!QSignalTransition::eventTest(event))
return false;
@@ -300,7 +300,7 @@ WinTransition::WinTransition(GraphicsScene *scene, PlayState *game, QAbstractSta
{
}
-bool WinTransition::eventTest(QEvent *event) const
+bool WinTransition::eventTest(QEvent *event)
{
if (!QSignalTransition::eventTest(event))
return false;
@@ -319,7 +319,7 @@ CustomSpaceTransition::CustomSpaceTransition(QWidget *widget, PlayState *game, Q
{
}
-bool CustomSpaceTransition::eventTest(QEvent *event) const
+bool CustomSpaceTransition::eventTest(QEvent *event)
{
Q_UNUSED(event);
if (!QKeyEventTransition::eventTest(event))
diff --git a/examples/animation/sub-attaq/states.h b/examples/animation/sub-attaq/states.h
index 27beb71..a1cb5ff 100644
--- a/examples/animation/sub-attaq/states.h
+++ b/examples/animation/sub-attaq/states.h
@@ -152,7 +152,7 @@ class UpdateScoreTransition : public QSignalTransition
public:
UpdateScoreTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target);
protected:
- virtual bool eventTest(QEvent *event) const;
+ virtual bool eventTest(QEvent *event);
private:
PlayState * game;
GraphicsScene *scene;
@@ -164,7 +164,7 @@ class WinTransition : public QSignalTransition
public:
WinTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target);
protected:
- virtual bool eventTest(QEvent *event) const;
+ virtual bool eventTest(QEvent *event);
private:
PlayState * game;
GraphicsScene *scene;
@@ -176,7 +176,7 @@ private:
public:
CustomSpaceTransition(QWidget *widget, PlayState *game, QEvent::Type type, int key);
protected:
- virtual bool eventTest(QEvent *event) const;
+ virtual bool eventTest(QEvent *event);
private:
PlayState *game;
int key;
diff --git a/examples/statemachine/factorial/main.cpp b/examples/statemachine/factorial/main.cpp
index ae5928f..1065eb8 100644
--- a/examples/statemachine/factorial/main.cpp
+++ b/examples/statemachine/factorial/main.cpp
@@ -100,7 +100,7 @@ public:
: QSignalTransition(fact, SIGNAL(xChanged(int))), m_fact(fact)
{}
- virtual bool eventTest(QEvent *e) const
+ virtual bool eventTest(QEvent *e)
{
if (!QSignalTransition::eventTest(e))
return false;
@@ -130,7 +130,7 @@ public:
: QSignalTransition(fact, SIGNAL(xChanged(int))), m_fact(fact)
{}
- virtual bool eventTest(QEvent *e) const
+ virtual bool eventTest(QEvent *e)
{
if (!QSignalTransition::eventTest(e))
return false;
diff --git a/examples/statemachine/pingpong/main.cpp b/examples/statemachine/pingpong/main.cpp
index db66bfd..331627e 100644
--- a/examples/statemachine/pingpong/main.cpp
+++ b/examples/statemachine/pingpong/main.cpp
@@ -86,7 +86,7 @@ public:
PongTransition() {}
protected:
- virtual bool eventTest(QEvent *e) const {
+ virtual bool eventTest(QEvent *e) {
return (e->type() == QEvent::User+3);
}
virtual void onTransition(QEvent *)
@@ -104,7 +104,7 @@ public:
PingTransition() {}
protected:
- virtual bool eventTest(QEvent *e) const {
+ virtual bool eventTest(QEvent *e) {
return (e->type() == QEvent::User+2);
}
virtual void onTransition(QEvent *)
diff --git a/examples/statemachine/tankgame/gameovertransition.cpp b/examples/statemachine/tankgame/gameovertransition.cpp
index 21c3510..cec786e 100644
--- a/examples/statemachine/tankgame/gameovertransition.cpp
+++ b/examples/statemachine/tankgame/gameovertransition.cpp
@@ -22,7 +22,7 @@ void GameOverTransition::addTankItem(TankItem *tankItem)
connect(tankItem, SIGNAL(aboutToBeDestroyed()), mapper, SLOT(map()));
}
-bool GameOverTransition::eventTest(QEvent *e) const
+bool GameOverTransition::eventTest(QEvent *e)
{
bool ret = QSignalTransition::eventTest(e);
diff --git a/examples/statemachine/tankgame/gameovertransition.h b/examples/statemachine/tankgame/gameovertransition.h
index 53c9b86..9a86b83 100644
--- a/examples/statemachine/tankgame/gameovertransition.h
+++ b/examples/statemachine/tankgame/gameovertransition.h
@@ -13,10 +13,10 @@ public:
void addTankItem(TankItem *tankItem);
protected:
- bool eventTest(QEvent *event) const;
+ bool eventTest(QEvent *event);
private:
- mutable QList<TankItem *> m_tankItems;
+ QList<TankItem *> m_tankItems;
};
#endif
diff --git a/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h b/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h
index 597f8595..9d4aabc 100644
--- a/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h
+++ b/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h
@@ -81,7 +81,7 @@ public:
}
protected:
- bool eventTest(QEvent *event) const
+ bool eventTest(QEvent *event)
{
bool b = QSignalTransition::eventTest(event);
if (b) {
@@ -105,7 +105,7 @@ protected:
}
private:
- mutable QLineF m_lastLine;
+ QLineF m_lastLine;
QObject *m_tank;
QState *m_turnTo;
};
@@ -180,7 +180,7 @@ public:
}
protected:
- bool eventTest(QEvent *event) const
+ bool eventTest(QEvent *event)
{
bool b = QSignalTransition::eventTest(event);
if (b) {
diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp
index f7a7d34..a930581 100644
--- a/src/corelib/statemachine/qabstracttransition.cpp
+++ b/src/corelib/statemachine/qabstracttransition.cpp
@@ -125,9 +125,9 @@ QStateMachine *QAbstractTransitionPrivate::machine() const
return 0;
}
-bool QAbstractTransitionPrivate::callEventTest(QEvent *e) const
+bool QAbstractTransitionPrivate::callEventTest(QEvent *e)
{
- Q_Q(const QAbstractTransition);
+ Q_Q(QAbstractTransition);
return q->eventTest(e);
}
diff --git a/src/corelib/statemachine/qabstracttransition.h b/src/corelib/statemachine/qabstracttransition.h
index 8f0cefa..c63d55a 100644
--- a/src/corelib/statemachine/qabstracttransition.h
+++ b/src/corelib/statemachine/qabstracttransition.h
@@ -88,7 +88,7 @@ public:
#endif
protected:
- virtual bool eventTest(QEvent *event) const = 0;
+ virtual bool eventTest(QEvent *event) = 0;
virtual void onTransition(QEvent *event) = 0;
diff --git a/src/corelib/statemachine/qabstracttransition_p.h b/src/corelib/statemachine/qabstracttransition_p.h
index 156e70e..a6db220 100644
--- a/src/corelib/statemachine/qabstracttransition_p.h
+++ b/src/corelib/statemachine/qabstracttransition_p.h
@@ -75,7 +75,7 @@ public:
static QAbstractTransitionPrivate *get(QAbstractTransition *q);
static const QAbstractTransitionPrivate *get(const QAbstractTransition *q);
- bool callEventTest(QEvent *e) const;
+ bool callEventTest(QEvent *e);
void callOnTransition(QEvent *e);
QState *sourceState() const;
QStateMachine *machine() const;
diff --git a/src/corelib/statemachine/qeventtransition.cpp b/src/corelib/statemachine/qeventtransition.cpp
index 3ae3ed9..74eb577 100644
--- a/src/corelib/statemachine/qeventtransition.cpp
+++ b/src/corelib/statemachine/qeventtransition.cpp
@@ -252,7 +252,7 @@ void QEventTransition::setEventObject(QObject *object)
/*!
\reimp
*/
-bool QEventTransition::eventTest(QEvent *event) const
+bool QEventTransition::eventTest(QEvent *event)
{
Q_D(const QEventTransition);
if (event->type() == QEvent::Wrapped) {
diff --git a/src/corelib/statemachine/qeventtransition.h b/src/corelib/statemachine/qeventtransition.h
index 68ee4fc..3530bdd 100644
--- a/src/corelib/statemachine/qeventtransition.h
+++ b/src/corelib/statemachine/qeventtransition.h
@@ -71,7 +71,7 @@ public:
void setEventType(QEvent::Type type);
protected:
- bool eventTest(QEvent *event) const;
+ bool eventTest(QEvent *event);
void onTransition(QEvent *event);
bool event(QEvent *e);
diff --git a/src/corelib/statemachine/qsignaltransition.cpp b/src/corelib/statemachine/qsignaltransition.cpp
index fd17292..4caa917 100644
--- a/src/corelib/statemachine/qsignaltransition.cpp
+++ b/src/corelib/statemachine/qsignaltransition.cpp
@@ -225,7 +225,7 @@ void QSignalTransition::setSignal(const QByteArray &signal)
true if the event's sender and signal index match this transition, and
returns false otherwise.
*/
-bool QSignalTransition::eventTest(QEvent *event) const
+bool QSignalTransition::eventTest(QEvent *event)
{
Q_D(const QSignalTransition);
if (event->type() == QEvent::Signal) {
diff --git a/src/corelib/statemachine/qsignaltransition.h b/src/corelib/statemachine/qsignaltransition.h
index 7f457b8..b485785 100644
--- a/src/corelib/statemachine/qsignaltransition.h
+++ b/src/corelib/statemachine/qsignaltransition.h
@@ -72,7 +72,7 @@ public:
void setSignal(const QByteArray &signal);
protected:
- bool eventTest(QEvent *event) const;
+ bool eventTest(QEvent *event);
void onTransition(QEvent *event);
bool event(QEvent *e);
diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp
index 8893bfe..e42e463 100644
--- a/src/corelib/statemachine/qstate.cpp
+++ b/src/corelib/statemachine/qstate.cpp
@@ -363,7 +363,7 @@ public:
: QAbstractTransition(QList<QAbstractState*>() << target) {}
protected:
void onTransition(QEvent *) {}
- bool eventTest(QEvent *) const { return true; }
+ bool eventTest(QEvent *) { return true; }
};
} // namespace
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index 046fbb4..65f49ae 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -1124,7 +1124,7 @@ public:
InitialTransition(QAbstractState *target)
: QAbstractTransition(QList<QAbstractState*>() << target) {}
protected:
- virtual bool eventTest(QEvent *) const { return true; }
+ virtual bool eventTest(QEvent *) { return true; }
virtual void onTransition(QEvent *) {}
};
diff --git a/src/gui/statemachine/qbasickeyeventtransition.cpp b/src/gui/statemachine/qbasickeyeventtransition.cpp
index 7821feb..7336612 100644
--- a/src/gui/statemachine/qbasickeyeventtransition.cpp
+++ b/src/gui/statemachine/qbasickeyeventtransition.cpp
@@ -156,7 +156,7 @@ void QBasicKeyEventTransition::setModifiersMask(Qt::KeyboardModifiers modifiersM
/*!
\reimp
*/
-bool QBasicKeyEventTransition::eventTest(QEvent *event) const
+bool QBasicKeyEventTransition::eventTest(QEvent *event)
{
Q_D(const QBasicKeyEventTransition);
if (event->type() == d->eventType) {
diff --git a/src/gui/statemachine/qbasickeyeventtransition_p.h b/src/gui/statemachine/qbasickeyeventtransition_p.h
index 0d08da0..7506747 100644
--- a/src/gui/statemachine/qbasickeyeventtransition_p.h
+++ b/src/gui/statemachine/qbasickeyeventtransition_p.h
@@ -55,7 +55,7 @@ public:
void setModifiersMask(Qt::KeyboardModifiers modifiers);
protected:
- bool eventTest(QEvent *event) const;
+ bool eventTest(QEvent *event);
void onTransition(QEvent *);
private:
diff --git a/src/gui/statemachine/qbasicmouseeventtransition.cpp b/src/gui/statemachine/qbasicmouseeventtransition.cpp
index 0cb727e..c4c2302 100644
--- a/src/gui/statemachine/qbasicmouseeventtransition.cpp
+++ b/src/gui/statemachine/qbasicmouseeventtransition.cpp
@@ -159,7 +159,7 @@ void QBasicMouseEventTransition::setPath(const QPainterPath &path)
/*!
\reimp
*/
-bool QBasicMouseEventTransition::eventTest(QEvent *event) const
+bool QBasicMouseEventTransition::eventTest(QEvent *event)
{
Q_D(const QBasicMouseEventTransition);
if (event->type() == d->eventType) {
diff --git a/src/gui/statemachine/qbasicmouseeventtransition_p.h b/src/gui/statemachine/qbasicmouseeventtransition_p.h
index 20c7f8f..57f83c6 100644
--- a/src/gui/statemachine/qbasicmouseeventtransition_p.h
+++ b/src/gui/statemachine/qbasicmouseeventtransition_p.h
@@ -58,7 +58,7 @@ public:
void setPath(const QPainterPath &path);
protected:
- bool eventTest(QEvent *event) const;
+ bool eventTest(QEvent *event);
void onTransition(QEvent *);
private:
diff --git a/src/gui/statemachine/qkeyeventtransition.cpp b/src/gui/statemachine/qkeyeventtransition.cpp
index e6ab11b..3cf51a3 100644
--- a/src/gui/statemachine/qkeyeventtransition.cpp
+++ b/src/gui/statemachine/qkeyeventtransition.cpp
@@ -140,7 +140,7 @@ void QKeyEventTransition::setModifiersMask(Qt::KeyboardModifiers modifiersMask)
/*!
\reimp
*/
-bool QKeyEventTransition::eventTest(QEvent *event) const
+bool QKeyEventTransition::eventTest(QEvent *event)
{
Q_D(const QKeyEventTransition);
if (!QEventTransition::eventTest(event))
diff --git a/src/gui/statemachine/qkeyeventtransition.h b/src/gui/statemachine/qkeyeventtransition.h
index 3f797f1..08595e8 100644
--- a/src/gui/statemachine/qkeyeventtransition.h
+++ b/src/gui/statemachine/qkeyeventtransition.h
@@ -46,7 +46,7 @@ public:
protected:
void onTransition(QEvent *event);
- bool eventTest(QEvent *event) const;
+ bool eventTest(QEvent *event);
private:
Q_DISABLE_COPY(QKeyEventTransition)
diff --git a/src/gui/statemachine/qmouseeventtransition.cpp b/src/gui/statemachine/qmouseeventtransition.cpp
index 3191a2f..5ffdab0 100644
--- a/src/gui/statemachine/qmouseeventtransition.cpp
+++ b/src/gui/statemachine/qmouseeventtransition.cpp
@@ -170,7 +170,7 @@ void QMouseEventTransition::setPath(const QPainterPath &path)
/*!
\reimp
*/
-bool QMouseEventTransition::eventTest(QEvent *event) const
+bool QMouseEventTransition::eventTest(QEvent *event)
{
Q_D(const QMouseEventTransition);
if (!QEventTransition::eventTest(event))
diff --git a/src/gui/statemachine/qmouseeventtransition.h b/src/gui/statemachine/qmouseeventtransition.h
index eee971e..e878a58 100644
--- a/src/gui/statemachine/qmouseeventtransition.h
+++ b/src/gui/statemachine/qmouseeventtransition.h
@@ -52,7 +52,7 @@ public:
protected:
void onTransition(QEvent *event);
- bool eventTest(QEvent *event) const;
+ bool eventTest(QEvent *event);
private:
Q_DISABLE_COPY(QMouseEventTransition)
diff --git a/tests/auto/qstate/tst_qstate.cpp b/tests/auto/qstate/tst_qstate.cpp
index bb7de20..75b1905 100644
--- a/tests/auto/qstate/tst_qstate.cpp
+++ b/tests/auto/qstate/tst_qstate.cpp
@@ -255,7 +255,7 @@ public:
}
protected:
- bool eventTest(QEvent *e) const
+ bool eventTest(QEvent *e)
{
return e->type() == m_type;
}
diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp
index f8a778a..7476831 100644
--- a/tests/auto/qstatemachine/tst_qstatemachine.cpp
+++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp
@@ -204,7 +204,7 @@ public:
: QAbstractTransition(QList<QAbstractState*>() << target) {}
QList<int> triggers;
protected:
- virtual bool eventTest(QEvent *) const {
+ virtual bool eventTest(QEvent *) {
return true;
}
virtual void onTransition(QEvent *) {
@@ -246,7 +246,7 @@ public:
EventTransition(QEvent::Type type, QAbstractState *target, QState *parent = 0)
: QAbstractTransition(QList<QAbstractState*>() << target, parent), m_type(type) {}
protected:
- virtual bool eventTest(QEvent *e) const {
+ virtual bool eventTest(QEvent *e) {
return (e->type() == m_type);
}
virtual void onTransition(QEvent *) {}
@@ -1394,7 +1394,7 @@ public:
: QAbstractTransition(QList<QAbstractState*>() << target), m_value(value) {}
protected:
- virtual bool eventTest(QEvent *e) const
+ virtual bool eventTest(QEvent *e)
{
if (e->type() != QEvent::Type(QEvent::User+2))
return false;
@@ -1596,7 +1596,7 @@ public:
return m_args;
}
protected:
- bool eventTest(QEvent *e) const {
+ bool eventTest(QEvent *e) {
if (!QSignalTransition::eventTest(e))
return false;
QSignalEvent *se = static_cast<QSignalEvent*>(e);