diff options
author | Maximilian Goldstein <max.goldstein@qt.io> | 2020-10-19 16:41:40 +0200 |
---|---|---|
committer | Maximilian Goldstein <max.goldstein@qt.io> | 2020-10-22 15:24:13 +0200 |
commit | 90cb1091b3d7ca56c700c62b9ecc58cf5194c0ff (patch) | |
tree | 3713fbb3121769e095dcc9ff9a77ffea4effaf43 | |
parent | 019d0f31b5d42348522a12ea2b4b9a366f9faf93 (diff) | |
download | qtdoc-90cb1091b3d7ca56c700c62b9ecc58cf5194c0ff.tar.gz |
qmlapp/codingconventions: Treat states and transitions as properties
States and transitions are not special on a language level.
They should be written along with other object properties.
Also updates the example to no longer use the undesirable syntax for Lists.
Change-Id: Ib20eb768bd9f6c96b6850cd714f47cda45ce69b9
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
-rw-r--r-- | doc/snippets/qmlapp/codingconventions/photo.qml | 26 | ||||
-rw-r--r-- | doc/src/qmlapp/codingconventions.qdoc | 2 |
2 files changed, 15 insertions, 13 deletions
diff --git a/doc/snippets/qmlapp/codingconventions/photo.qml b/doc/snippets/qmlapp/codingconventions/photo.qml index 57bbd709..e898c8d6 100644 --- a/doc/snippets/qmlapp/codingconventions/photo.qml +++ b/doc/snippets/qmlapp/codingconventions/photo.qml @@ -76,6 +76,21 @@ Rectangle { } } + states: [ + State { + name: "selected" + PropertyChanges { target: border; color: "red" } + } + ] + + transitions: [ + Transition { + from: "" + to: "selected" + ColorAnimation { target: border; duration: 200 } + } + ] + Rectangle { // child objects id: border anchors.centerIn: parent; color: "white" @@ -85,16 +100,5 @@ Rectangle { anchors.centerIn: parent } } - - states: State { // states - name: "selected" - PropertyChanges { target: border; color: "red" } - } - - transitions: Transition { // transitions - from: "" - to: "selected" - ColorAnimation { target: border; duration: 200 } - } } //! [0] diff --git a/doc/src/qmlapp/codingconventions.qdoc b/doc/src/qmlapp/codingconventions.qdoc index bc271639..2a2d7482 100644 --- a/doc/src/qmlapp/codingconventions.qdoc +++ b/doc/src/qmlapp/codingconventions.qdoc @@ -43,8 +43,6 @@ Throughout our documentation and examples, \l{QML Object Attributes}{QML object \li JavaScript functions \li object properties \li child objects -\li states -\li transitions \endlist For better readability, we separate these different parts with an empty line. |