Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. List of lists model from c++ and view in qml
Qt 6.11 is out! See what's new in the release blog

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

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 2.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    m.hamdy
    wrote on last edited by
    #1

    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]

    1 Reply Last reply
    0
    • M Offline
      M Offline
      m.hamdy
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mlong
        wrote on last edited by
        #3

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

        Software Engineer
        My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          m.hamdy
          wrote on last edited by
          #4

          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]

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved