aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2020-02-17 17:39:23 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2020-02-20 16:16:24 +0100
commit5054bb49a88a8ab76f586f79b6ef62a9142e6c83 (patch)
tree20319fa14bc8ef6ed8e0d4af4495a22847c893c9
parent5884c214dce3d5c1f5d21f63e60d6a9e0dfdacfa (diff)
Fix QML basic type documentation
Removed the documentation of some limitations that no longer apply. Fixed up grammar in the process. Fixes: QTBUG-82249 Change-Id: I807cbef10393f11bf864cf44ddd7556aa0eabb92 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
-rw-r--r--src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc33
1 files changed, 7 insertions, 26 deletions
diff --git a/src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc b/src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc
index 5144fe219e..53984a440d 100644
--- a/src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc
+++ b/src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc
@@ -582,34 +582,15 @@ property is only invoked when the property is reassigned to a different object v
QML objects (and certainly not JavaScript object either) and the key-value
pairs in \c attributes are \e not QML properties. Rather, the \c items
property holds an array of values, and \c attributes holds a set of key-value
- pairs. Since they are stored as a set of values, instead of as an object,
- their contents \e cannot be modified individually:
-
- \qml
- Item {
- property variant items: [1, 2, 3, "four", "five"]
- property variant attributes: { 'color': 'red', 'width': 100 }
-
- Component.onCompleted: {
- items[0] = 10
- console.log(items[0]) // This will still be '1'!
- attributes.color = 'blue'
- console.log(attributes.color) // This will still be 'red'!
- }
- }
- \endqml
-
- Since it is not possible to individually add or remove items from a list or
- object stored in a \c variant, the only way to modify its contents is to
- reassign a new value. However, this is not efficient, as it causes the value
- to be serialized and deserialized.
+ pairs.
Additionally, since \c items and \c attributes are not QML objects, changing
- their individual values do not trigger property change notifications. If
- the above example had \c onNumberChanged or \c onAnimalChanged signal
- handlers, they would not have been called. If, however, the \c items or
- \c attributes properties themselves were reassigned to different values, then
- such handlers would be called.
+ the values they contain does not trigger property change notifications. If
+ the above example had \c onItemsChanged or \c onAttributesChanged signal
+ handlers, they would not be called when assigning individual entries in
+ either property. If, however, the \c items or \c attributes properties
+ themselves were reassigned to different values, then such handlers would be
+ called.
JavaScript programmers should also note that when a JavaScript object is
copied to an array or map property, the \e contents of the object (that is,