diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2010-02-25 07:07:16 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2010-02-25 07:09:05 (GMT) |
commit | b469289a6ed067be92eb24239c59f5cd1f5f7956 (patch) | |
tree | 9d176cff9128c342333d710b062097f771eee72f /src/declarative/util/qdeclarativepropertychanges.cpp | |
parent | e6c85641ddc6068b1d50a52b95b136f366cad15a (diff) | |
download | Qt-b469289a6ed067be92eb24239c59f5cd1f5f7956.zip Qt-b469289a6ed067be92eb24239c59f5cd1f5f7956.tar.gz Qt-b469289a6ed067be92eb24239c59f5cd1f5f7956.tar.bz2 |
Document and test resetting properties in a state change.
Task-number: QT-1817
Diffstat (limited to 'src/declarative/util/qdeclarativepropertychanges.cpp')
-rw-r--r-- | src/declarative/util/qdeclarativepropertychanges.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp index 6c2e256..454fb06 100644 --- a/src/declarative/util/qdeclarativepropertychanges.cpp +++ b/src/declarative/util/qdeclarativepropertychanges.cpp @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE /*! \qmlclass PropertyChanges QDeclarativePropertyChanges - \since 4.7 + \since 4.7 \brief The PropertyChanges element describes new property values for a state. PropertyChanges provides a state change that modifies the properties of an item. @@ -98,6 +98,33 @@ QT_BEGIN_NAMESPACE } \endqml + You can reset a property in a state change by assigning \c undefined. In the following + example we reset \c theText's width when we enter state1. This will give the text its + natural width (which is the whole string on one line). + + \qml + import Qt 4.6 + + Rectangle { + width: 640 + height: 480 + Text { + id: theText + width: 50 + wrap: true + text: "a text string that is longer than 50 pixels" + } + + states: State { + name: "state1" + PropertyChanges { + target: theText + width: undefined + } + } + } + \endqml + Changes to an Item's parent or anchors should be done using the associated change elements (ParentChange and AnchorChanges, respectively) rather than PropertyChanges. |