2
votes

is there a method to create a ListView with dynamic parameters (for example for the model?)

I want to create this qml item dynamically:

Item{
id:item
    ListView{
        id:listitem
        spacing: 5
        width:list.width
        height:list.height/3
        orientation: ListView.Horizontal
        model: imageModelX //variablename is dynamic
        delegate: Delegate{
            ....
       }
      }

}

Best regards

1
I have seen your previous (already deleted) question. Why you don't want to create model which returns inner models in some role? - Kakadu
Can I do this? I've test it last time, but the program is crashed. I will test it again. - 501 - not implemented
I will try to find some code example.... - Kakadu
thank you! QVariant::fromValue(model) is the trick for the inner model - 501 - not implemented

1 Answers

3
votes

I have resolved similar problem by adding to main model role that returns inner models. Code is here: https://github.com/Kakadu/qml-test-2