doc: add qmllint incompatible-type warnings (for 6.8)

Add description of the warning introduced in 6.8 and an example on
how to fix it.

No need to pick back to 6.7 as this warning was introduced in 6.8 via
9cdd485c2b.

Pick-to: 6.8
Task-number: QTBUG-118112
Change-Id: Ice2a161cb195bc47dff2aa98bfee882d2ee6d417
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Sami Shalayel 2024-07-17 14:56:16 +02:00
parent dcc8ec3f2c
commit 04984f49cd
1 changed files with 28 additions and 0 deletions

View File

@ -95,6 +95,34 @@ Item {
\endqml
\section1 Construction from string is deprecated; Use structured value type construction instead
\section2 What happened?
You constructed a \l{qqmlengine.html#QML_STRUCTURED_VALUE}{structured value type} using a string.
\section2 Why is this bad?
This is deprecated and prone to typos.
\section2 Example
\qml
import QtQuick
Item {
property point p: "5, 6"
}
\endqml
To fix this warning, populate the structured value type as explained
\l{qqmlengine.html#QML_STRUCTURED_VALUE}{here} instead of binding a string to the property:
\qml
import QtQuick
Item {
property point p: ({ x: 5, y: 6 })
}
\endqml
\section1 Function without return type annotation returns
\section2 What happened?