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. Sort System Drives via QSortFilterProxyModel
Forum Updated to NodeBB v4.3 + New Features

Sort System Drives via QSortFilterProxyModel

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 677 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 just want to know which function of QSortFilterProxyModel class is used to sort the local and removable drives in system. Basically I am working on a app where I am using treeview and I need to sort them in a order.

    Here is the code:
    @pSystemPrimaryModel = new QFileSystemModel(this);
    pSystemPrimaryModel->setRootPath(QDir::currentPath());
    pSystemPrimaryModel->setFilter( QDir::AllDirs | QDir::NoDotAndDotDot );

    // Sets the model for the view to present.
    ui->PrimTreeView->setModel(pSystemPrimaryModel);

    // Just Display NAME and hide other Columns
    for(int nCount = 1; nCount < pSystemPrimaryModel->columnCount(); nCount++)
    ui->PrimTreeView->hideColumn(nCount);@

    This displays drives in a regular manner as follows:
    @Name:

    • C:
    • New Volume(D:)
    • New Volume(E:)
    • SD_Card(F:)
    • Transcend Drive(G:)@
      Basically I want to display it like follows:
      @+ Local Folder
      • C:
      • New Volume(D:)
      • New Volume(E:)
    • Removable Drives
      • SD_Card(F:)
      • Transcend Drive(G:)@

    --
    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