Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.8.0
-
None
-
d9d1c1fb5 (dev), 6df089674 (6.9)
Description
Using the instanceof operator with qmls url type never seems to work. I have tried using both `Addressable` and the new `Assertable` `ValueTypeBehavior` pragma values and while the as operator works if in Addressable mode instanceof never works.
It does work with string and rect property types though, I created a simple test app testing instanceof, as and typeof for url, string and rect and only url does not work as I would expect leading me to think there is an issue here:
root.urlProperty instanceof QtQuick.url // fails root.stringProperty instanceof QtQuick.string // succeeds root.rectProperty instanceof QtQuick.rect // succeeds
See the attached Main.qml file for the full code examples.
Note, while the as cast succeeds with pragma ValueTypeBehavior: Addressable enabled it will print the following warning so I don't see that as a win either:
qt.qml.coercingTypeAssertion: qrc:/qt/qml/url-instance-of/Main.qml:58: Coercing a value to QML/url using a type assertion. This behavior is deprecated. Add 'pragma ValueTypeBehavior: Assertable' to prevent it.