aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2020-11-27 14:08:31 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-11-30 18:46:00 +0000
commite70ce81ac6df3c966416ecae8ef200b37c0eac7b (patch)
treeb3eda1da4d463649df429530a2b72e275b9cd597 /src/qml
parent4d1675748f11474f9e1025aeab1310a8b036816f (diff)
Porting guide: Document URL resolution change
Task-number: QTBUG-88965 Change-Id: Ib62082935ddba7bf5b359a32712e6799b3242091 Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit e2a74579850d89d229dad918404a8d8ecebb80b3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/doc/src/qt6-changes.qdoc22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/qml/doc/src/qt6-changes.qdoc b/src/qml/doc/src/qt6-changes.qdoc
index ee9525ae5c..087c500ab2 100644
--- a/src/qml/doc/src/qt6-changes.qdoc
+++ b/src/qml/doc/src/qt6-changes.qdoc
@@ -43,6 +43,28 @@
\section1 QML language
+ \section2 URL resolution
+
+ In Qt 5, relative urls were often, albeit inconsistently, directly resolved, especially when
+ assigned to an url property. In Qt 6 this is no longer the case.
+
+ If you had a QML file stored under "/home/qml/example.qml", and "example.qml" contained
+ \begincode
+ property url imageFolder: "./images"
+ \oldcode
+ then the url property would store the URL "/home/qml/images". This made it impossible to use
+ relative URLs in QML in this way, so in Qt 6, the URL stays relative, and only gets resolved
+ when this is required (e.g. when it is used as the source of an Image component).
+ If you depend on the old behavior, you can use \c Qt.resolvedUrl
+ \oldcode
+ property url imageFolder: "./images"
+ \newcode
+ property url imageFolder: Qt.resolvedUrl("./images")
+ \endcode
+ Qt.resolvedUrl can be used in both Qt 5 and 6.
+
+ \section2 Variant Properties
+
\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