[Interest] Define map of static items in QML

Elvis Stansvik elvstone at gmail.com
Wed Mar 30 08:36:17 CEST 2016


Hi all,

I can understand why I can do

property Item foo: Foo {}
property Item bar: Bar {}
property variant items: {
    "foo": foo,
    "bar": bar
}

but not

property variant items: {
    "foo": Foo{},
    "bar": Bar{}
}

The first opening { in the second example probably puts me in JS territory,
where the Item {} syntax is not understood as a static definition of an
item.

However, is there some way of defining a map of static items like this,
without having to bind the item instances to properties first? Such that I
can later do e.g. items["foo"] to access an item?

Thanks in advance,
Elvis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160330/bd632010/attachment.html>


More information about the Interest mailing list