aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/doc
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2020-10-29 10:11:17 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2020-10-29 13:11:04 +0100
commitf7da9ffd3a4939b29ade8c3a467d5bc1726cae99 (patch)
treea0f3aa425995eb40f19b4d9a49a33f72fae6222c /src/qml/doc
parent43eaa77e8ed03153335c0002dcc8b660c39a0beb (diff)
QML migration guide: Add initial content
Add information about the variant/var unification. Remove place-holder sentence. Change-Id: I79bb230820eab71fea72929a24fb8c1b0479b256 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/doc')
-rw-r--r--src/qml/doc/src/qt6-changes.qdoc30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/qml/doc/src/qt6-changes.qdoc b/src/qml/doc/src/qt6-changes.qdoc
index c312ba55a7..513a9508a5 100644
--- a/src/qml/doc/src/qt6-changes.qdoc
+++ b/src/qml/doc/src/qt6-changes.qdoc
@@ -41,6 +41,34 @@
In this topic we summarize those changes in Qt QML, and provide
guidance to handle them.
- \section1 ADD STUFF HERE
+ \section1 QML language
+
+ \c variant properties, which have been marked as obsolete since Qt 5, are now treated in exactly
+ the same way as \c var properties.
+ Code that relied on implicit string conversion triggered on assignment to variant properties
+ should be updated to explicitly create an object of the correct type.
+ \oldcode
+ property variant myColor: "red"
+ \newcode
+ property variant myColor: Qt.color("red")
+ \endcode
+
+ Implicit conversions were done for strings that could be parsed as
+ \list
+ \li color (use Qt.color instead instead),
+ \li date (use the Date object instead),
+ \li rect (use Qt.rect instead) and
+ \li size (use Qt.size instead)
+ \endlist
+
+ \c variant still remains a deprecated keyword in Qt 6, though new code is strongly encouraged to
+ use \c var properties instead.
+
+ \note If the type of the property is known not to change, use a property of the concrete type,
+ instead of a \c var property.
+
+ \note These conversions were also applied to \c QVariant properties of classes registered with
+ the engine. As with \c variant properties, code that relied on implicit string conversions need
+ to use the corresponding functions of the Qt object.
*/