Add statically object to ListModel

Viewed 5349

I need to create a ListModel, that contains an object (string and bool inside) statically. If I add to an empty ListModel element by using append - all works well.

property ListModel qwe: ListModel {}
var imageToAdd { value: "picture.png", imageType: 1 }

qwe.append({
    text: "TextToAdd",
    image: imageToADD,
    position: 1
})
// This works correct

But I need to create ListModel statically and it doesn't work.

ListModel {
    ListElement {
        text: "TextToAdd"
        image: { value: "Qwer.png", imageType: 1 }  // <-- This doesn't work
        position: 1
    }
}

How it should look like?

2 Answers
Related