summaryrefslogtreecommitdiffstats
path: root/src/corelib/statemachine/qeventtransition.cpp
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-04-29 12:20:11 +0200
committerKent Hansen <khansen@trolltech.com>2009-04-29 12:20:11 +0200
commit6ca9c87235b057bc635576b0c414ca789afaf592 (patch)
tree3ba290fc3edabbb1372dba253cbe5d3526f80f14 /src/corelib/statemachine/qeventtransition.cpp
parent35f353f16f696a7362d3e899c9a7e2066dc09c65 (diff)
rename QBoundEvent to QWrappedEvent and make it public
Result of API review.
Diffstat (limited to 'src/corelib/statemachine/qeventtransition.cpp')
-rw-r--r--src/corelib/statemachine/qeventtransition.cpp34
1 files changed, 10 insertions, 24 deletions
diff --git a/src/corelib/statemachine/qeventtransition.cpp b/src/corelib/statemachine/qeventtransition.cpp
index 2126373c16..cbd03bdf38 100644
--- a/src/corelib/statemachine/qeventtransition.cpp
+++ b/src/corelib/statemachine/qeventtransition.cpp
@@ -41,7 +41,7 @@
#include "qeventtransition.h"
#include "qeventtransition_p.h"
-#include "qboundevent_p.h"
+#include "qwrappedevent.h"
#include "qstate.h"
#include "qstate_p.h"
#include "qstatemachine.h"
@@ -79,10 +79,11 @@ QT_BEGIN_NAMESPACE
\section1 Subclassing
- Many event classes have attributes in addition to the event type itself.
- The testEventCondition() function can be reimplemented to check attributes
- of an event instance in order to determine whether the transition should be
- triggered or not.
+ When reimplementing the eventTest() function, you should first call the base
+ implementation to verify that the event is a QWrappedEvent for the proper
+ object and event type. You may then cast the event to a QWrappedEvent and
+ get the original event by calling QWrappedEvent::event(), and perform
+ additional checks on that object.
\sa QState::addTransition()
*/
@@ -257,12 +258,11 @@ bool QEventTransition::eventTest(QEvent *event) const
#ifdef QT_STATEMACHINE_SOLUTION
if (event->type() == QEvent::Type(QEvent::User-3)) {
#else
- if (event->type() == QEvent::Bound) {
+ if (event->type() == QEvent::Wrapped) {
#endif
- QBoundEvent *oe = static_cast<QBoundEvent*>(event);
- return (oe->object() == d->object)
- && (oe->event()->type() == d->eventType)
- && testEventCondition(oe->event());
+ QWrappedEvent *we = static_cast<QWrappedEvent*>(event);
+ return (we->object() == d->object)
+ && (we->event()->type() == d->eventType);
}
return false;
}
@@ -275,20 +275,6 @@ void QEventTransition::onTransition()
}
/*!
- Tests an instance of an event associated with this event transition and
- returns true if the transition should be taken, otherwise returns false.
- The type of the given \a event will be eventType().
-
- Reimplement this function if you have custom conditions associated with
- the transition. The default implementation always returns true.
-*/
-bool QEventTransition::testEventCondition(QEvent *event) const
-{
- Q_UNUSED(event);
- return true;
-}
-
-/*!
\reimp
*/
bool QEventTransition::event(QEvent *e)