Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Display System Drives in Order using QFileSystemModel

    General and Desktop
    2
    3
    2063
    Loading More Posts
    • 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
      Stoned Jesus last edited by

      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 Reply Quote 0
      • L
        leon.anavi last edited by

        [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 Reply Quote 0
        • S
          Stoned Jesus last edited by

          [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 Reply Quote 0
          • First post
            Last post