summaryrefslogtreecommitdiffstats
path: root/src/corelib/statemachine
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2010-03-22 14:17:26 (GMT)
committerKent Hansen <kent.hansen@nokia.com>2010-03-22 14:58:30 (GMT)
commit1ad46d8cc9fa30ef26c3eb109c5d75937ec78aac (patch)
treeac1c48d07e211f2baf729e1856ca0a03535fb3bc /src/corelib/statemachine
parent9cfda3493ce4086313072a216d6a5b4f796c40d3 (diff)
downloadQt-1ad46d8cc9fa30ef26c3eb109c5d75937ec78aac.zip
Qt-1ad46d8cc9fa30ef26c3eb109c5d75937ec78aac.tar.gz
Qt-1ad46d8cc9fa30ef26c3eb109c5d75937ec78aac.tar.bz2
Add a function to get the transitions available from a state
For introspection purposes. It's nicer than having to qobject_cast the state's children(). Task-number: QTBUG-7741 Reviewed-by: Eskil Abrahamsen Blomfeldt
Diffstat (limited to 'src/corelib/statemachine')
-rw-r--r--src/corelib/statemachine/qstate.cpp18
-rw-r--r--src/corelib/statemachine/qstate.h3
2 files changed, 20 insertions, 1 deletions
diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp
index b6b3281..69cca06 100644
--- a/src/corelib/statemachine/qstate.cpp
+++ b/src/corelib/statemachine/qstate.cpp
@@ -66,7 +66,8 @@ QT_BEGIN_NAMESPACE
states. QState is part of \l{The State Machine Framework}.
The addTransition() function adds a transition. The removeTransition()
- function removes a transition.
+ function removes a transition. The transitions() function returns the
+ state's outgoing transitions.
The assignProperty() function is used for defining property assignments that
should be performed when a state is entered.
@@ -408,6 +409,21 @@ void QState::removeTransition(QAbstractTransition *transition)
}
/*!
+ \since 4.7
+
+ Returns this state's outgoing transitions (i.e. transitions where
+ this state is the \l{QAbstractTransition::sourceState()}{source
+ state}), or an empty list if this state has no outgoing transitions.
+
+ \sa addTransition()
+*/
+QList<QAbstractTransition*> QState::transitions() const
+{
+ Q_D(const QState);
+ return d->transitions();
+}
+
+/*!
\reimp
*/
void QState::onEntry(QEvent *event)
diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h
index 782a2a6..620104f 100644
--- a/src/corelib/statemachine/qstate.h
+++ b/src/corelib/statemachine/qstate.h
@@ -44,6 +44,8 @@
#include <QtCore/qabstractstate.h>
+#include <QtCore/qlist.h>
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -80,6 +82,7 @@ public:
QSignalTransition *addTransition(QObject *sender, const char *signal, QAbstractState *target);
QAbstractTransition *addTransition(QAbstractState *target);
void removeTransition(QAbstractTransition *transition);
+ QList<QAbstractTransition*> transitions() const;
QAbstractState *initialState() const;
void setInitialState(QAbstractState *state);