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. TreeView in QML?
Forum Update on Monday, May 27th 2025

TreeView in QML?

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 3 Posters 5.4k Views
  • 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.
  • D Offline
    D Offline
    Deqing
    wrote on 10 May 2011, 01:51 last edited by
    #1

    Hi All,

    I'd like to create a TreeView by QML: folders on the left side, files on the other side. Can drag file to folders.

    Any suggestions?

    Thanks,
    Deqing

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on 10 May 2011, 06:40 last edited by
      #2

      Good luck!

      Basically, I think you will have to make a list of delegates, that recursively also contain a list of the same delegate. That is not going to be trivial to get right, I think.

      With QML slated to move really into the desktop space, I hope the model/view implementation in it will be extended again to also support tables and trees. The current implementation is fine for mobile devices, but it is not enough for the desktop, I think.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SteveKing
        wrote on 12 May 2011, 11:59 last edited by
        #3

        Hi,

        We have implemented something similar to this (without the drag + drop). Our solution is to store the folder structure as a C++ list model, with items being inserted/deleted when the view opens or closes a folder. Using roles for the items allows the QML to know whether the item has children and if it's open.

        This breaks the model/view structure in that the underlying model knows which folders are open in the view, but it means the QML is nice and simple.

        Regards,
        Steve

        1 Reply Last reply
        0

        1/3

        10 May 2011, 01:51

        • Login

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