diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2025-12-09 13:10:16 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2025-12-10 20:16:35 +0100 |
| commit | ee6a47ab3fc0dfcfb7301562b9b6dd5807d71079 (patch) | |
| tree | 5d091374b19edc643796a8532a64c1823cd21b84 /tests/auto/qml/qmlcppcodegen/data/stringLength.qml | |
| parent | 95ede80c64b87e2fbb69d36a77ac346a6a4631b7 (diff) | |
QmlCompiler: Get length from strings wrapped in QJSPrimitiveValue
We need to consider the original type of the value in order to see what
we can do with it and we need to convert it (back) to string where
necessary.
Pick-to: 6.11 6.10
Fixes: QTBUG-142550
Change-Id: Ic0eb2c7a22636cfb2d97297421b911555bd32bb1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/data/stringLength.qml')
| -rw-r--r-- | tests/auto/qml/qmlcppcodegen/data/stringLength.qml | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/data/stringLength.qml b/tests/auto/qml/qmlcppcodegen/data/stringLength.qml index df9bbb7f2d..d09f032d65 100644 --- a/tests/auto/qml/qmlcppcodegen/data/stringLength.qml +++ b/tests/auto/qml/qmlcppcodegen/data/stringLength.qml @@ -1,6 +1,14 @@ +pragma Strict import QtQml QtObject { objectName: "astringb" property int stringLength: objectName.length + property string a: { + const value = objectName; + if (value && value.length > 0) { + return value; + } + return "no" + } } |
