diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2024-04-26 18:31:40 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2024-05-24 08:22:23 +0200 |
commit | 71e259837967f1eee50c057229094c2a971a1a61 (patch) | |
tree | dc8de1d3f1ceb0c6938e81842877ba19185d8d1a /tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp | |
parent | 8c8bd839b9a288b2cd7cc25d1158ae3e4cf1ff00 (diff) |
QML: Deprecate coercion on type assertions
By using an "as" cast you want to check the type of the value, not
coerce it. Previously, however, if you did this with a value type, it
would create the value type instead of just checking for it.
Add an attribute "Assertable" to the ValueTypeBehavior pragma that
prevents this and enables the correct behavior. Also print a warning
when coercing as part of an as-cast.
[ChangeLog][QtQml] A new attribute "Assertable" has been added to the
"ValueTypeBehavior" pragma. You should always use it if you want to
type-check value types using "as". If you don't use it, an instance of
the type is created as result of the "as" if the type doesn't match.
Task-number: QTBUG-124662
Change-Id: I1d5a6ca0a6f97d7d48440330bed1f9f6472198aa
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp')
0 files changed, 0 insertions, 0 deletions