[Interest] QML type checking quirk

Daniel França daniel.franca at gmail.com
Mon Oct 26 12:52:12 CET 2015


My guess is that the error message comes in a much earlier step in
compilation, in a static analysis when parsing QML.
When there's an expression it can't do this kind of check in compile time
and then the javascript implicit conversion works as a charm and your code
works.

Em dom, 25 de out de 2015 às 08:43, Sze Howe Koh <szehowe.koh at gmail.com>
escreveu:

> I just found out (during the discussion at
> https://forum.qt.io/topic/60021 ) that the following items all give a
> height of 100:
>
>     // Initialization assignment
>     height: 100
>     height: "10" + "0"
>     height: "10" + 0
>     height: 10 + "0"
>
>     // Imperative assignment
>     height = "100"
>
>
> However, this initialization assignment produces an error:
>
>     height: "100" // ERROR: "Invalid property assignment: number expected"
>
>
> Is this intentional? Given that the first 5 examples are all legal,
> shouldn't the last one be legal too?
>
>
> Regards,
> Sze-Howe
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151026/76edb051/attachment.html>


More information about the Interest mailing list