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>
This commit is contained in:
Kent Hansen 2012-07-02 23:06:26 +02:00 committed by Qt by Nokia
parent ba87568655
commit 5db78a077b
2 changed files with 4 additions and 4 deletions

View File

@ -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;

View File

@ -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