[Interest] QML property vs. id.property

Alexander Dyagilev alervdvcw at gmail.com
Mon Oct 7 10:04:02 CEST 2024


On Sun, Oct 6, 2024 at 7:52 PM Sze Howe Koh <szehowe.koh at gmail.com> wrote:

>
> It's invisible for a different reason. Text (Item) already has an "x"
> property: https://doc.qt.io/qt-6/qml-qtquick-item.html#x-prop
>
> `visible: x` refers to the Text's x-position, which is 0 here.
>

Ooops. Thank you! :)



>
> Writing `property var x` is equivalent to writing `property var x:
> undefined` since you didn't give it an initial/default value. Is it
> expected that [undefined] does not implicitly convert to bool? I don't
> have an official answer, but I certainly won't want my code to rely on
> undefined variables.
>
>
>
Well, I'm not a javascript expert, but undefined should evaluate to false
there. Maybe it's not the case for QML...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20241007/78c78503/attachment.htm>


More information about the Interest mailing list