List of lists model from c++ and view in qml



  • i want to make a list of lists
    what i tried "but failed" so far
    the model in c++ list inherits from qabstractlistmodel holds qlist of another class inherits also from qbastractlistmodel
    the view in qml listview, its delegate is a listview
    any better solutions plz help

    [Moderator's note: Moved to the Qt Quick forum -- mlong]



  • after i tried this way i got this error
    QML ListView: Binding loop detected for property "model"


  • Moderators

    Do you have any sample code you can post? Makes it much easier to offer help and suggestions.



  • that's the main list
    @
    ListView{
    id:horizontalList
    x: 1
    y: 0
    width: parent.width; height: parent.height-30
    visible: true
    orientation: ListView.Vertical
    model:outerModel
    focus: true
    delegate:
    ListMenu {
    id: listMenu
    focus: true
    width: window.width
    height: window.height/3
    anchors.leftMargin: 10
    anchors.rightMargin: 10
    }
    }
    @
    that's the delegate of the main list holding a list
    @
    ListView {
    id: list1
    x: 14
    y:listName.height
    anchors.leftMargin: 20
    width: parent.width
    anchors.topMargin: 30
    height:61
    focus: true
    orientation: ListView.Horizontal
    Keys.onUpPressed: {horizontalList.decrement()}
    Keys.onDownPressed: {horizontalList.increment()}
    model: getModel(cuurentIndex) //retrive innermodel
    cacheBuffer: 2000
    delegate: ListViewDelegate {}
    }
    @
    the outerModel is inherited from abstractlistmodel and holds an list of the innermodel which is also inherited from abstractlistmdodel

    [Edit: Added @ tags for code formatting -- mlong]


Log in to reply
 

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