summaryrefslogtreecommitdiffstats
path: root/src/corelib/statemachine/qstate.cpp
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-04-28 11:29:37 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-04-29 06:29:47 (GMT)
commit4f6b9b1779fe33f876f96c196c3feef7e72992a0 (patch)
tree3131513d79437f85ba411a4c5fe12143b1d62504 /src/corelib/statemachine/qstate.cpp
parent9c28c75052a38eb3b317c2ac7ad2a26c73deeb2d (diff)
downloadQt-4f6b9b1779fe33f876f96c196c3feef7e72992a0.zip
Qt-4f6b9b1779fe33f876f96c196c3feef7e72992a0.tar.gz
Qt-4f6b9b1779fe33f876f96c196c3feef7e72992a0.tar.bz2
move assignProperty() to QState
Doesn't belong in the abstract base class.
Diffstat (limited to 'src/corelib/statemachine/qstate.cpp')
-rw-r--r--src/corelib/statemachine/qstate.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp
index 9bda250..5c3418b 100644
--- a/src/corelib/statemachine/qstate.cpp
+++ b/src/corelib/statemachine/qstate.cpp
@@ -65,6 +65,9 @@ QT_BEGIN_NAMESPACE
The addTransition() function adds a transition. The removeTransition()
function removes a transition.
+ The assignProperty() function is used for defining property assignments that
+ should be performed when a state is entered.
+
\section1 States with Child States
For non-parallel state groups, the setInitialState() function must be called
@@ -216,6 +219,24 @@ QList<QAbstractTransition*> QStatePrivate::transitions() const
}
/*!
+ Instructs this state to set the property with the given \a name of the given
+ \a object to the given \a value when the state is entered.
+*/
+void QState::assignProperty(QObject *object, const char *name,
+ const QVariant &value)
+{
+ Q_D(QState);
+ for (int i = 0; i < d->propertyAssignments.size(); ++i) {
+ QPropertyAssignment &assn = d->propertyAssignments[i];
+ if ((assn.object == object) && (assn.propertyName == name)) {
+ assn.value = value;
+ return;
+ }
+ }
+ d->propertyAssignments.append(QPropertyAssignment(object, name, value));
+}
+
+/*!
Returns this state group's error state.
\sa QStateMachine::errorState(), QStateMachine::setErrorState()