[Interest] Array syntax in QML

Joerg Bornemann joerg.bornemann at digia.com
Fri Jul 4 16:41:13 CEST 2014


On 05-Jun-14 10:49, Christopher Courtois wrote:

> In QML the regular syntax to fill an array in declarative way is :
>
> states: [
>      State {...},
>      State {...},
>      State {...}
> ]
>
> I found out by accident that an alternative syntax is also supported but
> it didn't find any doc about it :
>
> states {
>      State {...}
>      State {...}
>      State {...}
> }
>
> It doesn't seem new since it is supported also on Qt 4.8 for instance.

This is the syntax for "grouped properties" which apparently also 
supports Item lists.

Usually this is used for things like
     font {pixelSize: 12; bold: true}
instead of
     font.pixelSize: 12
     font.bold: true

This example is taken from the documentation at 
http://qt-project.org/doc/qt-4.8/propertybinding.html
I couldn't find any mention of the behavior you've discovered though.


BR,

Joerg



More information about the Interest mailing list