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. [Solved] Create listmodel in a function
Forum Updated to NodeBB v4.3 + New Features

[Solved] Create listmodel in a function

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 3 Posters 2.0k 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.
  • E Offline
    E Offline
    ecost4
    wrote on last edited by
    #1

    Hi,

    I need create a listmodel in a function, it's possible? the creation of listmodel must be dynamic :s

    example:
    @ListModel {
    id: myModel
    ListElement {
    tag: "Directory1"
    photos: [
    ListElement { path: "c:\img1.jpg" },
    ListElement { path: "c:\img2.jpg" }
    ]
    }
    ListElement {
    tag: "Directory2"
    photos: [
    ListElement { path: "c:\img3.jpg" },
    ListElement { path: "c:\img4.jpg" }
    ]
    }
    }@
    Thanks

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DenisKormalev
      wrote on last edited by
      #2

      You've marked thread as solved so it will be good to share with others your solution.

      BTW, you've simply used append() method of model or something else more complex?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        shullw
        wrote on last edited by
        #3

        I am also interested in seeing how you created a dynamic list. This would help greatly. Like do you do some array type work as well?

        A QML Purest Point of View!

        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