diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2012-07-02 23:06:26 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-10 06:20:15 +0200 |
commit | 5db78a077b8f070b6e28431de6c3add6660ad1be (patch) | |
tree | 00c64d63b4cfd47aff3d7599f0f05154a9e21147 /src/corelib/statemachine | |
parent | ba87568655dad3e830e692109b5e571ae78b71a0 (diff) |
statemachine: Let QPropertyAssignment do the property write
This allows QPropertyAssignment to be smarter (caching the
property index, for example).
Change-Id: Ib6d302f46f784219b6b3f07784e5c31dd7288c6e
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'src/corelib/statemachine')
-rw-r--r-- | src/corelib/statemachine/qstate_p.h | 1 | ||||
-rw-r--r-- | src/corelib/statemachine/qstatemachine.cpp | 7 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/statemachine/qstate_p.h b/src/corelib/statemachine/qstate_p.h index 9558bd88a5..5999aca140 100644 --- a/src/corelib/statemachine/qstate_p.h +++ b/src/corelib/statemachine/qstate_p.h @@ -72,6 +72,7 @@ struct QPropertyAssignment {} bool objectDeleted() const { return !object; } + void write() const { Q_ASSERT(object != 0); object->setProperty(propertyName, value); } QPointer<QObject> object; QByteArray propertyName; diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 24da4e6937..ec93bb1b2d 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -751,7 +751,7 @@ void QStateMachinePrivate::applyProperties(const QList<QAbstractTransition*> &tr } } if (!found) { - assn.object->setProperty(assn.propertyName, assn.value); + assn.write(); } } } @@ -840,7 +840,7 @@ void QStateMachinePrivate::applyProperties(const QList<QAbstractTransition*> &tr const QList<QPropertyAssignment> &assignments = it.value(); for (int i = 0; i < assignments.size(); ++i) { const QPropertyAssignment &assn = assignments.at(i); - assn.object->setProperty(assn.propertyName, assn.value); + assn.write(); } } } @@ -1133,8 +1133,7 @@ void QStateMachinePrivate::_q_animationFinished() #ifndef QT_NO_PROPERTIES // Set the final property value. QPropertyAssignment assn = propertyForAnimation.take(anim); - Q_ASSERT(assn.object != 0); - assn.object->setProperty(assn.propertyName, assn.value); + assn.write(); if (!assn.explicitlySet) unregisterRestorable(assn.object, assn.propertyName); #endif |