[SOLVED]Adding subitems to ListModel



  • Hello folks, searched this forum and googled a bit but found no reply yet to the following important question:

    ListModel can have elements added via simple ListModel.append command.

    Is there a way to add data to the element highlighted below? (e.g. to add a subitem to the ListModel via append command?)

    @ListElement {
    itemTitle: "Item title 1"
    attributes: [
    ListElement { subItemTitle: "Subitem title 1/1" } // Is there a way to add these using append?
    ListElement { subItemTitle: "Subitem title 2/1" }
    ]
    }@

    UPDATE: well ofc course this was pretty lame...:

    Solution:
    @testModel.append({"itemTitle":"Item title 2", "attributes":[{"subItemTitle":"Subitem title 1/2"}]})@

    But truth is - for people like me this is supposed to be in the documentation...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.