Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Windows Tree View
QtWS25 Last Chance

Windows Tree View

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 906 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.
  • S Offline
    S Offline
    samdol
    wrote on last edited by
    #1

    alt text

    I made a treeView/QFileSystemModel to show directory structure.
    When I set root index as following,
    QTreeView *treeView = new QTreeView(this);
    treeView->setRootIndex(treeView->model()->index(-1,-1));
    it show only drive letters as you can see the left hand side of attached
    picture.
    Does anyone know how I show the directory structure like the right hand side of picture?
    Thank you.

    jsulmJ raven-worxR 2 Replies Last reply
    0
    • S samdol

      alt text

      I made a treeView/QFileSystemModel to show directory structure.
      When I set root index as following,
      QTreeView *treeView = new QTreeView(this);
      treeView->setRootIndex(treeView->model()->index(-1,-1));
      it show only drive letters as you can see the left hand side of attached
      picture.
      Does anyone know how I show the directory structure like the right hand side of picture?
      Thank you.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @samdol

      Did you try http://doc.qt.io/qt-5.7/qtreeview.html#setExpanded ?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • S samdol

        alt text

        I made a treeView/QFileSystemModel to show directory structure.
        When I set root index as following,
        QTreeView *treeView = new QTreeView(this);
        treeView->setRootIndex(treeView->model()->index(-1,-1));
        it show only drive letters as you can see the left hand side of attached
        picture.
        Does anyone know how I show the directory structure like the right hand side of picture?
        Thank you.

        raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by
        #3

        @samdol
        thats not possible directly, since they are "Windows specific".
        You can create a custom proxy model (around the QFileSystemModel) and insert them yourself.
        But i don't know if the exact same view is even achievable.

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        2

        • Login

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