summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-04-28 12:05:15 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-04-29 06:29:47 (GMT)
commit2c22f8748f62db3cd4c2782abcd19c273f4a4426 (patch)
tree7042ed9d22fc694aca7651d938496a16c369a58e /src
parent6293521a6e5ee0ce010180a40e6fda3ef3a8b245 (diff)
downloadQt-2c22f8748f62db3cd4c2782abcd19c273f4a4426.zip
Qt-2c22f8748f62db3cd4c2782abcd19c273f4a4426.tar.gz
Qt-2c22f8748f62db3cd4c2782abcd19c273f4a4426.tar.bz2
say hello (again) to QAbstract{State,Transition}::machine()
It's useful and it's simple for us to expose, so let's.
Diffstat (limited to 'src')
-rw-r--r--src/corelib/statemachine/qabstractstate.cpp13
-rw-r--r--src/corelib/statemachine/qabstractstate.h2
-rw-r--r--src/corelib/statemachine/qabstracttransition.cpp13
-rw-r--r--src/corelib/statemachine/qabstracttransition.h3
4 files changed, 29 insertions, 2 deletions
diff --git a/src/corelib/statemachine/qabstractstate.cpp b/src/corelib/statemachine/qabstractstate.cpp
index 12f14d7..cc6f0f9 100644
--- a/src/corelib/statemachine/qabstractstate.cpp
+++ b/src/corelib/statemachine/qabstractstate.cpp
@@ -63,7 +63,8 @@ QT_BEGIN_NAMESPACE
The entered() signal is emitted when the state has been entered. The
exited() signal is emitted when the state has been exited.
- The parentState() function returns the state's parent state.
+ The parentState() function returns the state's parent state. The machine()
+ function returns the state machine that the state is part of.
\section1 Subclassing
@@ -179,6 +180,16 @@ QState *QAbstractState::parentState() const
}
/*!
+ Returns the state machine that this state is part of, or 0 if the state is
+ not part of a state machine.
+*/
+QStateMachine *QAbstractState::machine() const
+{
+ Q_D(const QAbstractState);
+ return d->machine();
+}
+
+/*!
\fn QAbstractState::onExit()
This function is called when the state is exited. Reimplement this function
diff --git a/src/corelib/statemachine/qabstractstate.h b/src/corelib/statemachine/qabstractstate.h
index a5f1440..30a68ff 100644
--- a/src/corelib/statemachine/qabstractstate.h
+++ b/src/corelib/statemachine/qabstractstate.h
@@ -51,6 +51,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
class QState;
+class QStateMachine;
class QAbstractStatePrivate;
class Q_CORE_EXPORT QAbstractState : public QObject
@@ -60,6 +61,7 @@ public:
~QAbstractState();
QState *parentState() const;
+ QStateMachine *machine() const;
Q_SIGNALS:
void entered();
diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp
index dfce310..731871c 100644
--- a/src/corelib/statemachine/qabstracttransition.cpp
+++ b/src/corelib/statemachine/qabstracttransition.cpp
@@ -61,7 +61,8 @@ QT_BEGIN_NAMESPACE
Framework}.
The sourceState() function returns the source of the transition. The
- targetStates() function returns the targets of the transition.
+ targetStates() function returns the targets of the transition. The machine()
+ function returns the state machine that the transition is part of.
Transitions can cause animations to be played. Use the addAnimation()
function to add an animation to the transition.
@@ -286,6 +287,16 @@ void QAbstractTransition::setTargetStates(const QList<QAbstractState*> &targets)
d->targetStates = targets;
}
+/*!
+ Returns the state machine that this transition is part of, or 0 if the
+ transition is not part of a state machine.
+*/
+QStateMachine *QAbstractTransition::machine() const
+{
+ Q_D(const QAbstractTransition);
+ return d->machine();
+}
+
#ifndef QT_NO_ANIMATION
/*!
diff --git a/src/corelib/statemachine/qabstracttransition.h b/src/corelib/statemachine/qabstracttransition.h
index c49731f..37365c5 100644
--- a/src/corelib/statemachine/qabstracttransition.h
+++ b/src/corelib/statemachine/qabstracttransition.h
@@ -55,6 +55,7 @@ QT_MODULE(Core)
class QEvent;
class QAbstractState;
class QState;
+class QStateMachine;
#ifndef QT_NO_ANIMATION
class QAbstractAnimation;
@@ -78,6 +79,8 @@ public:
QList<QAbstractState*> targetStates() const;
void setTargetStates(const QList<QAbstractState*> &targets);
+ QStateMachine *machine() const;
+
#ifndef QT_NO_ANIMATION
void addAnimation(QAbstractAnimation *animation);
void removeAnimation(QAbstractAnimation *animation);