diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-11-12 03:53:41 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-11-12 03:53:41 (GMT) |
commit | 2744c8f6c824b3eda4b31c1ab1d588ae90ede4e1 (patch) | |
tree | db2ff98f4781c622b710b1b70b6724b6928709f1 /src/declarative | |
parent | 49cc2d35d7da4a78d696503930720e88a6403722 (diff) | |
download | Qt-2744c8f6c824b3eda4b31c1ab1d588ae90ede4e1.zip Qt-2744c8f6c824b3eda4b31c1ab1d588ae90ede4e1.tar.gz Qt-2744c8f6c824b3eda4b31c1ab1d588ae90ede4e1.tar.bz2 |
Autotests.
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/util/qmlpropertychanges.cpp | 28 | ||||
-rw-r--r-- | src/declarative/util/qmlstateoperations.cpp | 7 |
2 files changed, 32 insertions, 3 deletions
diff --git a/src/declarative/util/qmlpropertychanges.cpp b/src/declarative/util/qmlpropertychanges.cpp index 75c9f80..a18db46 100644 --- a/src/declarative/util/qmlpropertychanges.cpp +++ b/src/declarative/util/qmlpropertychanges.cpp @@ -287,6 +287,15 @@ void QmlPropertyChanges::setObject(QObject *o) d->object = o; } +/*! + \qmlproperty bool PropertyChanges::restoreEntryValues + + Whether or not the previous values should be restored when + leaving the state. By default, restoreEntryValues is true. + + By setting restoreEntryValues to false, you can create a temporary state + that has permanent effects on property values. +*/ bool QmlPropertyChanges::restoreEntryValues() const { Q_D(const QmlPropertyChanges); @@ -380,6 +389,25 @@ QmlPropertyChanges::ActionList QmlPropertyChanges::actions() return list; } +/*! + \qmlproperty bool PropertyChanges::explicit + + If explicit is set to true, any potential bindings will be interpreted as + once-off assignments that occur when the state is entered. + + In the following example, the addition of explicit prevents myItem.width from + being bound to parent.width. Instead, it is assigned the value of parent.width + at the time of the state change. + \qml + PropertyChanges { + target: myItem + explicit: true + width: parent.width + } + \endqml + + By default, explicit is false. +*/ bool QmlPropertyChanges::isExplicit() const { Q_D(const QmlPropertyChanges); diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp index 03337cb..d1aa748 100644 --- a/src/declarative/util/qmlstateoperations.cpp +++ b/src/declarative/util/qmlstateoperations.cpp @@ -76,18 +76,19 @@ void QmlParentChangePrivate::doChange(QmlGraphicsItem *targetParent, QmlGraphics const QTransform &transform = target->itemTransform(targetParent, &ok); if (transform.type() >= QTransform::TxShear || !ok) { qmlInfo(q) << QObject::tr("Unable to preserve appearance under complex transform"); + ok = false; } qreal scale = 1; qreal rotation = 0; - if (transform.type() != QTransform::TxRotate) { + if (ok && transform.type() != QTransform::TxRotate) { if (transform.m11() == transform.m22()) scale = transform.m11(); else { qmlInfo(q) << QObject::tr("Unable to preserve appearance under non-uniform scale"); ok = false; } - } else if (transform.type() == QTransform::TxRotate) { + } else if (ok && transform.type() == QTransform::TxRotate) { if (transform.m11() == transform.m22()) scale = qSqrt(transform.m11()*transform.m11() + transform.m12()*transform.m12()); else { @@ -105,7 +106,7 @@ void QmlParentChangePrivate::doChange(QmlGraphicsItem *targetParent, QmlGraphics qreal xt = transform.dx(); qreal yt = transform.dy(); - if (target->transformOrigin() != QmlGraphicsItem::TopLeft) { + if (ok && target->transformOrigin() != QmlGraphicsItem::TopLeft) { qreal tempxt = target->transformOriginPoint().x(); qreal tempyt = target->transformOriginPoint().y(); QTransform t; |