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. ListElement refer ListModel
Qt 6.11 is out! See what's new in the release blog

ListElement refer ListModel

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 990 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.
  • K Offline
    K Offline
    keolsen
    wrote on last edited by
    #1

    Hi

    I am trying to populate a ListView with a ListModel which id I get from the ListElement of another ListModel...see my simple example below.
    However it obviously doesn't work, since I'm asking for your support.
    How can make this work?

    Thanks in advance! :-)

    Like this:
    @
    ListModel {
    id: model1
    ListElement {
    modellink: "model2"
    }
    }

    ListModel {
    id: model2
    ListElement {
    something: "blabla"
    }
    }

    ListView {
    id: mylistview
    model: model1
    delegate: ListView {
    id: anotherlistview
    model: modellink
    delegate: Text {
    text: something
    }
    }
    }
    @

    [Edit: Added @ tags around code and changed formatting for legibility -- 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