aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-11-14 16:27:50 +0100
committerUlf Hermann <ulf.hermann@qt.io>2022-11-15 08:33:19 +0100
commit1fc939a870ce4520688fcf92948851fa06c6926a (patch)
tree276a95a5f7430df06e2f28fa6c45d5015df0922d /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
parent1166ebf3e9493b0be7e72aaeb72362ec666bc8d6 (diff)
QML: Faithfully convert undefined and null to string
If you do that in JS you get "undefined" and "null", respectively. Our C++-based conversion methods should do the same. The documentation for QJSValue also suggests that QJSValue::toFoo() should behave like qjsvalue_cast<Foo>(x). So far QJSValue::toString() produced "undefined" and "null" while qjsvalue_cast<String>(x) produced an empty string. [ChangeLog][QtQml][Important Behavior Changes] qjsvalue_cast<QString>(x) now returns "undefined" for undefined JS values, and "null" for null JS values. This is in line with what QJSValue::toString() does, and also what JavaScript itself would produce when stringifying such values. Previously, qjsvalue_cast would return an empty string for both, undefined and null JS values. Change-Id: Ib93f4157f092ed769dca946541ffbcfbd7317d4c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
0 files changed, 0 insertions, 0 deletions