Quantcast
Channel: How can you downcast in QML JavaScript? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

How can you downcast in QML JavaScript?

$
0
0

Javascript is a dynamically typed language and to the best of my knowledge has no concept of static type checking...

But QML's qmllint program tries to apply static type checking to the Javascript subset of a QML document and gives a warning for this code:

[build] Warning: /home/user/project/Plot.qml:162:2: Member "colorAccess" not found on type "QQuickItem" [missing-property]

[build] itemAt(index).colorAccess.value = "" + newColor[build]               ^^^^^^^^^^^

The surrounding element is a Repeater. QMLLint looks into the qmltypes file and sees that it has a function itemAt that returns a QQuickItem*. But the complete story is, that we only use delegates that do have a colorAccess property. How can we teach the linter this knowledge?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>