diff options
author | Sze Howe Koh <szehowe.koh@gmail.com> | 2023-02-23 17:17:28 +0800 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-04-20 10:17:06 +0000 |
commit | a21353e99b8788d8ebdc1442276982ed5067c52c (patch) | |
tree | 8135ff0e9c216cee54f651b771ca7f8edd995ee0 | |
parent | aa7644934f9605196e0e09c127e590f2fcd32ba3 (diff) |
Doc: Re-phrase descriptions around read-only properties
The current text sounds a bit like it's describing a const value.
Change-Id: Idf9b8ae14ce032af7ac073419aba6250b26f5847
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit db04cfb2d00c68e7c63bd183c118ecd77f0e4e68)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc b/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc index 60e90217f4..d442b4f8de 100644 --- a/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc +++ b/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc @@ -1,4 +1,4 @@ -// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2023 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! @@ -671,12 +671,12 @@ An object declaration may define a read-only property using the \c readonly keyword, with the following syntax: \code - readonly property <propertyType> <propertyName> : <initialValue> + readonly property <propertyType> <propertyName> : <value> \endcode -Read-only properties must be assigned a value on initialization. After a -read-only property is initialized, it no longer possible to give it a value, -whether from imperative code or otherwise. +Read-only properties must be assigned a static value or a binding expression on +initialization. After a read-only property is initialized, you cannot change +its static value or binding expression anymore. For example, the code in the \c Component.onCompleted block below is invalid: @@ -684,7 +684,7 @@ For example, the code in the \c Component.onCompleted block below is invalid: Item { readonly property int someNumber: 10 - Component.onCompleted: someNumber = 20 // doesn't work, causes an error + Component.onCompleted: someNumber = 20 // TypeError: Cannot assign to read-only property } \endqml |