summaryrefslogtreecommitdiffstats
path: root/src/corelib/statemachine/qstate.cpp
diff options
context:
space:
mode:
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()