axisData->transitionToSet = true;
actions.clear();
- actions << QQuickAction(fp->contentItem, propName, toPos);
+ actions << QQuickStateAction(fp->contentItem, propName, toPos);
QQuickTransitionManager::transition(actions, fp->rebound, fp->contentItem);
return true;
}
virtual void doAction()
{
for (int ii = 0; ii < actions.count(); ++ii) {
- const QQuickAction &action = actions.at(ii);
+ const QQuickStateAction &action = actions.at(ii);
if (reverse)
action.event->reverse();
else
bool hasExplicit = false;
if (d->target && d->newParent) {
data->reverse = false;
- QQuickAction myAction;
+ QQuickStateAction myAction;
QQuickParentChange *pc = new QQuickParentChange;
pc->setObject(d->target);
pc->setParent(d->newParent);
hasExplicit = true;
if (d->via) {
viaData->reverse = false;
- QQuickAction myVAction;
+ QQuickStateAction myVAction;
QQuickParentChange *vpc = new QQuickParentChange;
vpc->setObject(d->target);
vpc->setParent(d->via);
if (!hasExplicit)
for (int i = 0; i < actions.size(); ++i) {
- QQuickAction &action = actions[i];
- if (action.event && action.event->type() == QQuickActionEvent::ParentChange
+ QQuickStateAction &action = actions[i];
+ if (action.event && action.event->type() == QQuickStateActionEvent::ParentChange
&& (!d->target || static_cast<QQuickParentChange*>(action.event)->object() == d->target)) {
QQuickParentChange *pc = static_cast<QQuickParentChange*>(action.event);
- QQuickAction myAction = action;
+ QQuickStateAction myAction = action;
data->reverse = action.reverseEvent;
//### this logic differs from PropertyAnimation
if (d->via) {
viaData->reverse = false;
- QQuickAction myAction;
+ QQuickStateAction myAction;
QQuickParentChange *vpc = new QQuickParentChange;
vpc->setObject(pc->object());
vpc->setParent(d->via);
myAction.event = vpc;
viaData->pc << vpc;
viaData->actions << myAction;
- QQuickAction dummyAction;
- QQuickAction &xAction = pc->xIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction;
- QQuickAction &yAction = pc->yIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction;
- QQuickAction &sAction = pc->scaleIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction;
- QQuickAction &rAction = pc->rotationIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction;
+ QQuickStateAction dummyAction;
+ QQuickStateAction &xAction = pc->xIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction;
+ QQuickStateAction &yAction = pc->yIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction;
+ QQuickStateAction &sAction = pc->scaleIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction;
+ QQuickStateAction &rAction = pc->rotationIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction;
QQuickItem *target = pc->object();
QQuickItem *targetParent = action.reverseEvent ? pc->originalParent() : pc->parent();
data->fromDefined = false;
for (int ii = 0; ii < actions.count(); ++ii) {
- QQuickAction &action = actions[ii];
- if (action.event && action.event->type() == QQuickActionEvent::AnchorChanges
+ QQuickStateAction &action = actions[ii];
+ if (action.event && action.event->type() == QQuickStateActionEvent::AnchorChanges
&& (d->targets.isEmpty() || d->targets.contains(static_cast<QQuickAnchorChanges*>(action.event)->object()))) {
data->actions << static_cast<QQuickAnchorChanges*>(action.event)->additionalActions();
}
int origModifiedSize = modified.count();
for (int i = 0; i < actions.count(); ++i) {
- QQuickAction &action = actions[i];
+ QQuickStateAction &action = actions[i];
if (action.event)
continue;
if (action.specifiedObject == target && action.property.name() == QLatin1String("x")) {
}
QQuickStateOperation::ActionList actions;
- actions << QQuickAction(item->item, QLatin1String("x"), QVariant(to.x()));
- actions << QQuickAction(item->item, QLatin1String("y"), QVariant(to.y()));
+ actions << QQuickStateAction(item->item, QLatin1String("x"), QVariant(to.x()));
+ actions << QQuickStateAction(item->item, QLatin1String("y"), QVariant(to.y()));
m_transitioner->runningJobs << this;
QQuickTransitionManager::transition(actions, trans, item->item);
ActionList actions;
- QQuickAction a;
+ QQuickStateAction a;
a.event = this;
actions << a;
bool ok = false;
qreal x = d->xString.value.numberLiteral(&ok);
if (ok) {
- QQuickAction xa(d->target, QLatin1String("x"), x);
+ QQuickStateAction xa(d->target, QLatin1String("x"), x);
actions << xa;
} else {
QQmlBinding *newBinding = new QQmlBinding(d->xString.value, d->target, qmlContext(this));
QQmlProperty property(d->target, QLatin1String("x"));
newBinding->setTarget(property);
- QQuickAction xa;
+ QQuickStateAction xa;
xa.property = property;
xa.toBinding = QQmlAbstractBinding::getPointer(newBinding);
xa.fromValue = xa.property.read();
bool ok = false;
qreal y = d->yString.value.numberLiteral(&ok);
if (ok) {
- QQuickAction ya(d->target, QLatin1String("y"), y);
+ QQuickStateAction ya(d->target, QLatin1String("y"), y);
actions << ya;
} else {
QQmlBinding *newBinding = new QQmlBinding(d->yString.value, d->target, qmlContext(this));
QQmlProperty property(d->target, QLatin1String("y"));
newBinding->setTarget(property);
- QQuickAction ya;
+ QQuickStateAction ya;
ya.property = property;
ya.toBinding = QQmlAbstractBinding::getPointer(newBinding);
ya.fromValue = ya.property.read();
bool ok = false;
qreal scale = d->scaleString.value.numberLiteral(&ok);
if (ok) {
- QQuickAction sa(d->target, QLatin1String("scale"), scale);
+ QQuickStateAction sa(d->target, QLatin1String("scale"), scale);
actions << sa;
} else {
QQmlBinding *newBinding = new QQmlBinding(d->scaleString.value, d->target, qmlContext(this));
QQmlProperty property(d->target, QLatin1String("scale"));
newBinding->setTarget(property);
- QQuickAction sa;
+ QQuickStateAction sa;
sa.property = property;
sa.toBinding = QQmlAbstractBinding::getPointer(newBinding);
sa.fromValue = sa.property.read();
bool ok = false;
qreal rotation = d->rotationString.value.numberLiteral(&ok);
if (ok) {
- QQuickAction ra(d->target, QLatin1String("rotation"), rotation);
+ QQuickStateAction ra(d->target, QLatin1String("rotation"), rotation);
actions << ra;
} else {
QQmlBinding *newBinding = new QQmlBinding(d->rotationString.value, d->target, qmlContext(this));
QQmlProperty property(d->target, QLatin1String("rotation"));
newBinding->setTarget(property);
- QQuickAction ra;
+ QQuickStateAction ra;
ra.property = property;
ra.toBinding = QQmlAbstractBinding::getPointer(newBinding);
ra.fromValue = ra.property.read();
bool ok = false;
qreal width = d->widthString.value.numberLiteral(&ok);
if (ok) {
- QQuickAction wa(d->target, QLatin1String("width"), width);
+ QQuickStateAction wa(d->target, QLatin1String("width"), width);
actions << wa;
} else {
QQmlBinding *newBinding = new QQmlBinding(d->widthString.value, d->target, qmlContext(this));
QQmlProperty property(d->target, QLatin1String("width"));
newBinding->setTarget(property);
- QQuickAction wa;
+ QQuickStateAction wa;
wa.property = property;
wa.toBinding = QQmlAbstractBinding::getPointer(newBinding);
wa.fromValue = wa.property.read();
bool ok = false;
qreal height = d->heightString.value.numberLiteral(&ok);
if (ok) {
- QQuickAction ha(d->target, QLatin1String("height"), height);
+ QQuickStateAction ha(d->target, QLatin1String("height"), height);
actions << ha;
} else {
QQmlBinding *newBinding = new QQmlBinding(d->heightString.value, d->target, qmlContext(this));
QQmlProperty property(d->target, QLatin1String("height"));
newBinding->setTarget(property);
- QQuickAction ha;
+ QQuickStateAction ha;
ha.property = property;
ha.toBinding = QQmlAbstractBinding::getPointer(newBinding);
ha.fromValue = ha.property.read();
d->origStackBefore = d->rewindStackBefore;
}
-/*void QQuickParentChange::copyOriginals(QQuickActionEvent *other)
+/*void QQuickParentChange::copyOriginals(QQuickStateActionEvent *other)
{
Q_D(QQuickParentChange);
QQuickParentChange *pc = static_cast<QQuickParentChange*>(other);
d->doChange(d->origParent, d->origStackBefore);
}
-QQuickActionEvent::EventType QQuickParentChange::type() const
+QQuickStateActionEvent::EventType QQuickParentChange::type() const
{
return ParentChange;
}
-bool QQuickParentChange::override(QQuickActionEvent*other)
+bool QQuickParentChange::override(QQuickStateActionEvent*other)
{
Q_D(QQuickParentChange);
if (other->type() != ParentChange)
d->baselineBinding->setTarget(d->baselineProp);
}
- QQuickAction a;
+ QQuickStateAction a;
a.event = this;
return ActionList() << a;
}
d->target->setY(d->origY);
}
-QQuickActionEvent::EventType QQuickAnchorChanges::type() const
+QQuickStateActionEvent::EventType QQuickAnchorChanges::type() const
{
return AnchorChanges;
}
-QList<QQuickAction> QQuickAnchorChanges::additionalActions()
+QList<QQuickStateAction> QQuickAnchorChanges::additionalActions()
{
Q_D(QQuickAnchorChanges);
- QList<QQuickAction> extra;
+ QList<QQuickStateAction> extra;
QQuickAnchors::Anchors combined = d->anchorSet->d_func()->usedAnchors | d->anchorSet->d_func()->resetAnchors;
bool hChange = combined & QQuickAnchors::Horizontal_Mask;
bool vChange = combined & QQuickAnchors::Vertical_Mask;
if (d->target) {
- QQuickAction a;
+ QQuickStateAction a;
if (hChange && d->fromX != d->toX) {
a.property = QQmlProperty(d->target, QLatin1String("x"));
a.toValue = d->toX;
saveCurrentValues();
}
-void QQuickAnchorChanges::copyOriginals(QQuickActionEvent *other)
+void QQuickAnchorChanges::copyOriginals(QQuickStateActionEvent *other)
{
Q_D(QQuickAnchorChanges);
QQuickAnchorChanges *ac = static_cast<QQuickAnchorChanges*>(other);
<< acp->topBinding << acp->bottomBinding << acp->vCenterBinding << acp->baselineBinding;
//clear old values from other
- //### could this be generalized for all QQuickActionEvents, and called after copyOriginals?
+ //### could this be generalized for all QQuickStateActionEvents, and called after copyOriginals?
acp->leftBinding = 0;
acp->rightBinding = 0;
acp->hCenterBinding = 0;
}
}
-bool QQuickAnchorChanges::override(QQuickActionEvent*other)
+bool QQuickAnchorChanges::override(QQuickStateActionEvent*other)
{
if (other->type() != AnchorChanges)
return false;
- if (static_cast<QQuickActionEvent*>(this) == other)
+ if (static_cast<QQuickStateActionEvent*>(this) == other)
return true;
if (static_cast<QQuickAnchorChanges*>(other)->object() == object())
return true;
QT_BEGIN_NAMESPACE
class QQuickParentChangePrivate;
-class Q_AUTOTEST_EXPORT QQuickParentChange : public QQuickStateOperation, public QQuickActionEvent
+class Q_AUTOTEST_EXPORT QQuickParentChange : public QQuickStateOperation, public QQuickStateActionEvent
{
Q_OBJECT
Q_DECLARE_PRIVATE(QQuickParentChange)
virtual ActionList actions();
virtual void saveOriginals();
- //virtual void copyOriginals(QQuickActionEvent*);
+ //virtual void copyOriginals(QQuickStateActionEvent*);
virtual void execute(Reason reason = ActualChange);
virtual bool isReversable();
virtual void reverse(Reason reason = ActualChange);
virtual EventType type() const;
- virtual bool override(QQuickActionEvent*other);
+ virtual bool override(QQuickStateActionEvent*other);
virtual void rewind();
virtual void saveCurrentValues();
};
};
class QQuickAnchorChangesPrivate;
-class Q_AUTOTEST_EXPORT QQuickAnchorChanges : public QQuickStateOperation, public QQuickActionEvent
+class Q_AUTOTEST_EXPORT QQuickAnchorChanges : public QQuickStateOperation, public QQuickStateActionEvent
{
Q_OBJECT
Q_DECLARE_PRIVATE(QQuickAnchorChanges)
virtual bool isReversable();
virtual void reverse(Reason reason = ActualChange);
virtual EventType type() const;
- virtual bool override(QQuickActionEvent*other);
+ virtual bool override(QQuickStateActionEvent*other);
virtual bool changesBindings();
virtual void saveOriginals();
virtual bool needsCopy() { return true; }
- virtual void copyOriginals(QQuickActionEvent*);
+ virtual void copyOriginals(QQuickStateActionEvent*);
virtual void clearBindings();
virtual void rewind();
virtual void saveCurrentValues();
- QList<QQuickAction> additionalActions();
+ QList<QQuickStateAction> additionalActions();
virtual void saveTargetValues();
};
d->reversing = (direction == Backward);
if (!d->name.isEmpty()) {
for (int ii = 0; ii < actions.count(); ++ii) {
- QQuickAction &action = actions[ii];
+ QQuickStateAction &action = actions[ii];
- if (action.event && action.event->type() == QQuickActionEvent::Script
+ if (action.event && action.event->type() == QQuickStateActionEvent::Script
&& static_cast<QQuickStateChangeScript*>(action.event)->name() == d->name) {
d->runScriptScript = static_cast<QQuickStateChangeScript*>(action.event)->script();
d->hasRunScriptScript = true;
virtual void doAction()
{
for (int ii = 0; ii < actions.count(); ++ii) {
- const QQuickAction &action = actions.at(ii);
+ const QQuickStateAction &action = actions.at(ii);
QQmlPropertyPrivate::write(action.property, action.toValue, QQmlPropertyPrivate::BypassInterceptor | QQmlPropertyPrivate::DontRemoveBinding);
}
}
if (d->value.isValid()) {
for (int i = 0; i < props.count(); ++i) {
for (int j = 0; j < targets.count(); ++j) {
- QQuickAction myAction;
+ QQuickStateAction myAction;
myAction.property = d->createProperty(targets.at(j), props.at(i), this);
if (myAction.property.isValid()) {
myAction.toValue = d->value;
data->actions << myAction;
hasExplicit = true;
for (int ii = 0; ii < actions.count(); ++ii) {
- QQuickAction &action = actions[ii];
+ QQuickStateAction &action = actions[ii];
if (action.property.object() == myAction.property.object() &&
myAction.property.name() == action.property.name()) {
modified << action.property;
if (!hasExplicit)
for (int ii = 0; ii < actions.count(); ++ii) {
- QQuickAction &action = actions[ii];
+ QQuickStateAction &action = actions[ii];
QObject *obj = action.property.object();
QString propertyName = action.property.name();
if ((targets.isEmpty() || targets.contains(obj) || (!same && targets.contains(sObj))) &&
(!d->exclude.contains(obj)) && (same || (!d->exclude.contains(sObj))) &&
(props.contains(propertyName) || (!same && props.contains(sPropertyName)))) {
- QQuickAction myAction = action;
+ QQuickStateAction myAction = action;
if (d->value.isValid())
myAction.toValue = d->value;
if (reverse)
v = 1 - v;
for (int ii = 0; ii < actions.count(); ++ii) {
- QQuickAction &action = actions[ii];
+ QQuickStateAction &action = actions[ii];
if (v == 1.) {
QQmlPropertyPrivate::write(action.property, action.toValue, QQmlPropertyPrivate::BypassInterceptor | QQmlPropertyPrivate::DontRemoveBinding);
if (d->toIsDefined) {
for (int i = 0; i < props.count(); ++i) {
for (int j = 0; j < targets.count(); ++j) {
- QQuickAction myAction;
+ QQuickStateAction myAction;
myAction.property = d->createProperty(targets.at(j), props.at(i), this);
if (myAction.property.isValid()) {
if (d->fromIsDefined) {
newActions << myAction;
hasExplicit = true;
for (int ii = 0; ii < actions.count(); ++ii) {
- QQuickAction &action = actions[ii];
+ QQuickStateAction &action = actions[ii];
if (action.property.object() == myAction.property.object() &&
myAction.property.name() == action.property.name()) {
modified << action.property;
if (!hasExplicit)
for (int ii = 0; ii < actions.count(); ++ii) {
- QQuickAction &action = actions[ii];
+ QQuickStateAction &action = actions[ii];
QObject *obj = action.property.object();
QString propertyName = action.property.name();
(!d->exclude.contains(obj)) && (same || (!d->exclude.contains(sObj))) &&
(props.contains(propertyName) || (!same && props.contains(sPropertyName))
|| (useType && action.property.propertyType() == d->interpolatorType))) {
- QQuickAction myAction = action;
+ QQuickStateAction myAction = action;
if (d->fromIsDefined)
myAction.fromValue = d->from;
if (actions.size()) {
for (int i=0; i<actions.size(); ++i) {
- QQuickAction &action = actions[i];
+ QQuickStateAction &action = actions[i];
if (action.property.name() != propertyName)
continue;
modified << action.property;
const QVariant ¤tValue = d->property.read();
QQuickStateOperation::ActionList actions;
- QQuickAction action;
+ QQuickStateAction action;
action.property = d->property;
action.fromValue = currentValue;
action.toValue = value;
This property holds the object which contains the properties to be changed.
*/
-class QQuickReplaceSignalHandler : public QQuickActionEvent
+class QQuickReplaceSignalHandler : public QQuickStateActionEvent
{
public:
QQuickReplaceSignalHandler() {}
}
virtual bool needsCopy() { return true; }
- virtual void copyOriginals(QQuickActionEvent *other)
+ virtual void copyOriginals(QQuickStateActionEvent *other)
{
QQuickReplaceSignalHandler *rsh = static_cast<QQuickReplaceSignalHandler*>(other);
saveCurrentValues();
rewindExpression = QQmlPropertyPrivate::signalExpression(property);
}
- virtual bool override(QQuickActionEvent*other) {
+ virtual bool override(QQuickStateActionEvent*other) {
if (other == this)
return true;
if (other->type() != type())
for (int ii = 0; ii < d->properties.count(); ++ii) {
- QQuickAction a(d->object, d->properties.at(ii).first,
+ QQuickStateAction a(d->object, d->properties.at(ii).first,
qmlContext(this), d->properties.at(ii).second);
if (a.property.isValid()) {
QQuickReplaceSignalHandler *handler = d->signalReplacements.at(ii);
if (handler->property.isValid()) {
- QQuickAction a;
+ QQuickStateAction a;
a.event = handler;
list << a;
}
QQmlProperty prop = d->property(property);
if (prop.isValid()) {
- QQuickAction a;
+ QQuickStateAction a;
a.restore = restoreEntryValues();
a.property = prop;
a.fromValue = a.property.read();
}
}
- QQuickAction action;
+ QQuickStateAction action;
action.restore = restoreEntryValues();
action.property = d->property(name);
action.fromValue = action.property.read();
newBinding->setTarget(d->property(name));
QQmlPropertyPrivate::setBinding(d->property(name), newBinding, QQmlPropertyPrivate::DontRemoveBinding | QQmlPropertyPrivate::BypassInterceptor);
} else {
- QQuickAction action;
+ QQuickStateAction action;
action.restore = restoreEntryValues();
action.property = d->property(name);
action.fromValue = action.property.read();
DEFINE_BOOL_CONFIG_OPTION(stateChangeDebug, STATECHANGE_DEBUG);
-QQuickAction::QQuickAction()
+QQuickStateAction::QQuickStateAction()
: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), fromBinding(0), event(0),
specifiedObject(0)
{
}
-QQuickAction::QQuickAction(QObject *target, const QString &propertyName,
+QQuickStateAction::QQuickStateAction(QObject *target, const QString &propertyName,
const QVariant &value)
: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false),
property(target, propertyName, qmlEngine(target)), toValue(value),
fromValue = property.read();
}
-QQuickAction::QQuickAction(QObject *target, const QString &propertyName,
+QQuickStateAction::QQuickStateAction(QObject *target, const QString &propertyName,
QQmlContext *context, const QVariant &value)
: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false),
property(target, propertyName, context), toValue(value),
}
-QQuickActionEvent::~QQuickActionEvent()
+QQuickStateActionEvent::~QQuickStateActionEvent()
{
}
-void QQuickActionEvent::execute(Reason)
+void QQuickStateActionEvent::execute(Reason)
{
}
-bool QQuickActionEvent::isReversable()
+bool QQuickStateActionEvent::isReversable()
{
return false;
}
-void QQuickActionEvent::reverse(Reason)
+void QQuickStateActionEvent::reverse(Reason)
{
}
-bool QQuickActionEvent::changesBindings()
+bool QQuickStateActionEvent::changesBindings()
{
return false;
}
-void QQuickActionEvent::clearBindings()
+void QQuickStateActionEvent::clearBindings()
{
}
-bool QQuickActionEvent::override(QQuickActionEvent *other)
+bool QQuickStateActionEvent::override(QQuickStateActionEvent *other)
{
Q_UNUSED(other);
return false;
d->transitionManager.cancel();
}
-void QQuickAction::deleteFromBinding()
+void QQuickStateAction::deleteFromBinding()
{
if (fromBinding) {
QQmlPropertyPrivate::setBinding(property, 0);
return false;
}
-void QQuickState::addEntryToRevertList(const QQuickAction &action)
+void QQuickState::addEntryToRevertList(const QQuickStateAction &action)
{
Q_D(QQuickState);
}
}
-void QQuickState::addEntriesToRevertList(const QList<QQuickAction> &actionList)
+void QQuickState::addEntriesToRevertList(const QList<QQuickStateAction> &actionList)
{
Q_D(QQuickState);
if (isStateActive()) {
QList<QQuickSimpleAction> simpleActionList;
- QListIterator<QQuickAction> actionListIterator(actionList);
+ QListIterator<QQuickStateAction> actionListIterator(actionList);
while(actionListIterator.hasNext()) {
- const QQuickAction &action = actionListIterator.next();
+ const QQuickStateAction &action = actionListIterator.next();
QQuickSimpleAction simpleAction(action);
action.property.write(action.toValue);
if (!action.toBinding.isNull()) {
QQuickStatePrivate::SimpleActionList additionalReverts;
// First add the reverse of all the applyList actions
for (int ii = 0; ii < applyList.count(); ++ii) {
- QQuickAction &action = applyList[ii];
+ QQuickStateAction &action = applyList[ii];
if (action.event) {
if (!action.event->isReversable())
continue;
bool found = false;
for (int jj = 0; jj < d->revertList.count(); ++jj) {
- QQuickActionEvent *event = d->revertList.at(jj).event();
+ QQuickStateActionEvent *event = d->revertList.at(jj).event();
if (event && event->type() == action.event->type()) {
if (action.event->override(event)) {
found = true;
for (int ii = 0; ii < d->revertList.count(); ++ii) {
bool found = false;
if (d->revertList.at(ii).event()) {
- QQuickActionEvent *event = d->revertList.at(ii).event();
+ QQuickStateActionEvent *event = d->revertList.at(ii).event();
if (!event->isReversable())
continue;
for (int jj = 0; !found && jj < applyList.count(); ++jj) {
- const QQuickAction &action = applyList.at(jj);
+ const QQuickStateAction &action = applyList.at(jj);
if (action.event && action.event->type() == event->type()) {
if (action.event->override(event))
found = true;
}
} else {
for (int jj = 0; !found && jj < applyList.count(); ++jj) {
- const QQuickAction &action = applyList.at(jj);
+ const QQuickStateAction &action = applyList.at(jj);
if (action.property == d->revertList.at(ii).property())
found = true;
}
if (delBinding)
delBinding->destroy();
- QQuickAction a;
+ QQuickStateAction a;
a.property = d->revertList.at(ii).property();
a.fromValue = cur;
a.toValue = d->revertList.at(ii).value();
#ifndef QT_NO_DEBUG_STREAM
// Output for debugging
if (stateChangeDebug()) {
- foreach(const QQuickAction &action, applyList) {
+ foreach(const QQuickStateAction &action, applyList) {
if (action.event)
- qWarning() << " QQuickAction event:" << action.event->type();
+ qWarning() << " QQuickStateAction event:" << action.event->type();
else
- qWarning() << " QQuickAction:" << action.property.object()
+ qWarning() << " QQuickStateAction:" << action.property.object()
<< action.property.name() << "From:" << action.fromValue
<< "To:" << action.toValue;
}
QT_BEGIN_NAMESPACE
-class QQuickActionEvent;
+class QQuickStateActionEvent;
class QQmlAbstractBinding;
class QQmlBinding;
class QQmlExpression;
-class QQuickAction
+class QQuickStateAction
{
public:
- QQuickAction();
- QQuickAction(QObject *, const QString &, const QVariant &);
- QQuickAction(QObject *, const QString &,
+ QQuickStateAction();
+ QQuickStateAction(QObject *, const QString &, const QVariant &);
+ QQuickStateAction(QObject *, const QString &,
QQmlContext *, const QVariant &);
bool restore:1;
QQmlAbstractBinding *fromBinding;
QWeakPointer<QQmlAbstractBinding> toBinding;
- QQuickActionEvent *event;
+ QQuickStateActionEvent *event;
//strictly for matching
QObject *specifiedObject;
void deleteFromBinding();
};
-class Q_AUTOTEST_EXPORT QQuickActionEvent
+class Q_AUTOTEST_EXPORT QQuickStateActionEvent
{
public:
- virtual ~QQuickActionEvent();
+ virtual ~QQuickStateActionEvent();
enum EventType { Script, SignalHandler, ParentChange, AnchorChanges };
enum Reason { ActualChange, FastForward };
virtual void reverse(Reason reason = ActualChange);
virtual void saveOriginals() {}
virtual bool needsCopy() { return false; }
- virtual void copyOriginals(QQuickActionEvent *) {}
+ virtual void copyOriginals(QQuickStateActionEvent *) {}
virtual bool isRewindable() { return isReversable(); }
virtual void rewind() {}
virtual bool changesBindings();
virtual void clearBindings();
- virtual bool override(QQuickActionEvent*other);
+ virtual bool override(QQuickStateActionEvent*other);
};
//### rename to QQuickStateChange?
public:
QQuickStateOperation(QObject *parent = 0)
: QObject(parent) {}
- typedef QList<QQuickAction> ActionList;
+ typedef QList<QQuickStateAction> ActionList;
virtual ActionList actions();
bool changeValueInRevertList(QObject *target, const QString &name, const QVariant &revertValue);
bool changeBindingInRevertList(QObject *target, const QString &name, QQmlAbstractBinding *binding);
bool removeEntryFromRevertList(QObject *target, const QString &name);
- void addEntryToRevertList(const QQuickAction &action);
+ void addEntryToRevertList(const QQuickStateAction &action);
void removeAllEntriesFromRevertList(QObject *target);
- void addEntriesToRevertList(const QList<QQuickAction> &actions);
+ void addEntriesToRevertList(const QList<QQuickStateAction> &actions);
QVariant valueInRevertList(QObject *target, const QString &name) const;
QQmlAbstractBinding *bindingInRevertList(QObject *target, const QString &name) const;
{
public:
enum State { StartState, EndState };
- QQuickSimpleAction(const QQuickAction &a, State state = StartState)
+ QQuickSimpleAction(const QQuickStateAction &a, State state = StartState)
{
m_property = a.property;
m_specifiedObject = a.specifiedObject;
return m_specifiedProperty;
}
- QQuickActionEvent *event() const
+ QQuickStateActionEvent *event() const
{
return m_event;
}
QQmlAbstractBinding::Pointer m_binding;
QObject *m_specifiedObject;
QString m_specifiedProperty;
- QQuickActionEvent *m_event;
+ QQuickStateActionEvent *m_event;
bool m_reverseEvent;
};
public:
QQuickRevertAction() : event(0) {}
QQuickRevertAction(const QQmlProperty &prop) : property(prop), event(0) {}
- QQuickRevertAction(QQuickActionEvent *e) : event(e) {}
+ QQuickRevertAction(QQuickStateActionEvent *e) : event(e) {}
QQmlProperty property;
- QQuickActionEvent *event;
+ QQuickStateActionEvent *event;
};
class QQuickStateOperationPrivate : public QObjectPrivate
QQuickStateChangeScript::ActionList QQuickStateChangeScript::actions()
{
ActionList rv;
- QQuickAction a;
+ QQuickStateAction a;
a.event = this;
rv << a;
return rv;
}
-QQuickActionEvent::EventType QQuickStateChangeScript::type() const
+QQuickStateActionEvent::EventType QQuickStateChangeScript::type() const
{
return Script;
}
QT_BEGIN_NAMESPACE
class QQuickStateChangeScriptPrivate;
-class Q_AUTOTEST_EXPORT QQuickStateChangeScript : public QQuickStateOperation, public QQuickActionEvent
+class Q_AUTOTEST_EXPORT QQuickStateChangeScript : public QQuickStateOperation, public QQuickStateActionEvent
{
Q_OBJECT
Q_DECLARE_PRIVATE(QQuickStateChangeScript)
void QQuickTransitionManagerPrivate::applyBindings()
{
- foreach(const QQuickAction &action, bindingsList) {
+ foreach(const QQuickStateAction &action, bindingsList) {
if (!action.toBinding.isNull()) {
QQmlPropertyPrivate::setBinding(action.property, action.toBinding.data());
} else if (action.event) {
{
}
-void QQuickTransitionManager::transition(const QList<QQuickAction> &list,
+void QQuickTransitionManager::transition(const QList<QQuickStateAction> &list,
QQuickTransition *transition,
QObject *defaultTarget)
{
QQuickStateOperation::ActionList applyList = list;
// Determine which actions are binding changes and disable any current bindings
- foreach(const QQuickAction &action, applyList) {
+ foreach(const QQuickStateAction &action, applyList) {
if (action.toBinding)
d->bindingsList << action;
if (action.fromBinding)
// Apply all the property and binding changes
for (int ii = 0; ii < applyList.size(); ++ii) {
- const QQuickAction &action = applyList.at(ii);
+ const QQuickStateAction &action = applyList.at(ii);
if (!action.toBinding.isNull()) {
QQmlPropertyPrivate::setBinding(action.property, action.toBinding.data(), QQmlPropertyPrivate::BypassInterceptor | QQmlPropertyPrivate::DontRemoveBinding);
} else if (!action.event) {
QQmlPropertyPrivate::write(action.property, action.toValue, QQmlPropertyPrivate::BypassInterceptor | QQmlPropertyPrivate::DontRemoveBinding);
} else if (action.event->isReversable()) {
if (action.reverseEvent)
- action.event->reverse(QQuickActionEvent::FastForward);
+ action.event->reverse(QQuickStateActionEvent::FastForward);
else
- action.event->execute(QQuickActionEvent::FastForward);
+ action.event->execute(QQuickStateActionEvent::FastForward);
}
}
// Read all the end values for binding changes
for (int ii = 0; ii < applyList.size(); ++ii) {
- QQuickAction *action = &applyList[ii];
+ QQuickStateAction *action = &applyList[ii];
if (action->event) {
action->event->saveTargetValues();
continue;
}
// Revert back to the original values
- foreach(const QQuickAction &action, applyList) {
+ foreach(const QQuickStateAction &action, applyList) {
if (action.event) {
if (action.event->isReversable()) {
action.event->clearBindings();
// Modify the action list to remove actions handled in the transition
for (int ii = 0; ii < applyList.count(); ++ii) {
- const QQuickAction &action = applyList.at(ii);
+ const QQuickStateAction &action = applyList.at(ii);
if (action.event) {
// be applied immediately. We skip applying bindings, as they are all
// applied at the end in applyBindings() to avoid any nastiness mid
// transition
- foreach(const QQuickAction &action, applyList) {
+ foreach(const QQuickStateAction &action, applyList) {
if (action.event && !action.event->changesBindings()) {
if (action.event->isReversable() && action.reverseEvent)
action.event->reverse();
}
#ifndef QT_NO_DEBUG_STREAM
if (stateChangeDebug()) {
- foreach(const QQuickAction &action, applyList) {
+ foreach(const QQuickStateAction &action, applyList) {
if (action.event)
qWarning() << " No transition for event:" << action.event->type();
else
d->transitionInstance->stop();
for(int i = 0; i < d->bindingsList.count(); ++i) {
- QQuickAction action = d->bindingsList[i];
+ QQuickStateAction action = d->bindingsList[i];
if (!action.toBinding.isNull() && action.deletableToBinding) {
QQmlPropertyPrivate::setBinding(action.property, 0);
action.toBinding.data()->destroy();
bool isRunning() const;
- void transition(const QList<QQuickAction> &, QQuickTransition *transition, QObject *defaultTarget = 0);
+ void transition(const QList<QQuickStateAction> &, QQuickTransition *transition, QObject *defaultTarget = 0);
void cancel();