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. Display System Drives in Order using QFileSystemModel
QtWS25 Last Chance

Display System Drives in Order using QFileSystemModel

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

    I have a treeview where I am displaying all system drives using QFileSystemModel. I am looking for much better approach where a tree view can display Local Drives in one section, Removable Drive in another and so on.

    Here is the code:
    @ pSystemPrimaryModel = new QFileSystemModel(this);
    /* Sets the directory that is being watched by the model to currentPath by installing
    a file system watcher on it. */
    pSystemPrimaryModel->setRootPath(QDir::currentPath());
    pSystemPrimaryModel->setFilter( QDir::AllDirs | QDir::NoDotAndDotDot );
    // Sets the model for the view to present.
    ui->PrimTreeView->setModel(pSystemPrimaryModel);
    // Regard less how many columns you can do this using for:
    for(int nCount = nColCount; nCount < pSystemPrimaryModel->columnCount(); nCount++)
    ui->PrimTreeView->hideColumn(nCount);@

    It gives me the following:
    !http://www.qtcentre.org/attachment.php?attachmentid=8476&d=1354601834(ScreenShot)!
    I want to display it like the second picture shown above. How can that be achieved?

    --
    Thanks & Regards,
    Stoned Jesus

    1 Reply Last reply
    0
    • L Offline
      L Offline
      leon.anavi
      wrote on last edited by
      #2

      [quote author="Stoned Jesus" date="1354603201"]It gives me the following:
      !http://www.qtcentre.org/attachment.php?attachmentid=8476&d=1354601834(ScreenShot)!
      I want to display it like the second picture shown above. How can that be achieved?
      [/quote]

      The picture is not displayed. Seems that only people with registration at qtcentre.org can open it.

      http://anavi.org/

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

        [quote author="leon.anavi" date="1354603689"]
        [quote author="Stoned Jesus" date="1354603201"]It gives me the following:
        !http://www.qtcentre.org/attachment.php?attachmentid=8476&d=1354601834(ScreenShot)!
        I want to display it like the second picture shown above. How can that be achieved?
        [/quote]

        The picture is not displayed. Seems that only people with registration at qtcentre.org can open it.
        [/quote]

        Basically It displays C:\ D:\ etc under a heading Local Drive, Removable Drives under a separate heading and so on.

        --
        Thanks & Regards,
        Stoned Jesus

        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