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. Qt: How to add Custom 'Local Drive' row in QFileSystemModel to display Drives
Forum Updated to NodeBB v4.3 + New Features

Qt: How to add Custom 'Local Drive' row in QFileSystemModel to display Drives

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

    I am using QFileSystemModel to represent file structure through the QTreeView. Everything works fine and it displays C:, D: etc drives in TreeView, but I need to add an additional row at the beginning of the tree. For example for now is:

    • C:
    • D:
    • E:

    After adding the row 'Local Drives' at the beginning, I wanna display it like:
    @+ Local Drive

    • C:
    • D:
    • E:@

    Here is the code:
    @pSystemPrimaryModel = new QFileSystemModel(this);
    pSystemPrimaryModel->setRootPath(QDir::currentPath());
    ui->TreeView->setModel(pSystemPrimaryModel);@

    --
    Thanks & Regards,
    Stoned Jesus

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Stoned Jesus
      wrote on last edited by
      #2

      Anyone here who can help me???

      --
      Thanks & Regards,
      Stoned Jesus

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DRAX
        wrote on last edited by
        #3

        Take a look at this: "http://qt-project.org/forums/viewthread/22639/":http://qt-project.org/forums/viewthread/22639/
        It should help your problem.

        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