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());
proxyModel->setSourceModel(pSystemPrimaryModel);
proxyModel->setDynamicSortFilter(false);
// Set the QFileSystemModel model of QTreeView to display drives
ui->PrimTreeView->setModel(proxyModel);
pSystemPrimaryModel = new QFileSystemModel(this);
pSystemPrimaryModel->setRootPath(QDir::currentPath());
QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel(this);
proxyModel->setSourceModel(pSystemPrimaryModel);
proxyModel->setDynamicSortFilter(false);
// Set the QFileSystemModel model of QTreeView to display drives
ui->PrimTreeView->setModel(proxyModel);
To copy to clipboard, switch view to plain text mode
This displays drives in a regular manner as follows:
+ C:
+ New Volume(D:)
+ New Volume(E:)
+ SD_Card(F:)
+ Transcend Drive(G:
+ C:
+ New Volume(D:)
+ New Volume(E:)
+ SD_Card(F:)
+ Transcend Drive(G:
To copy to clipboard, switch view to plain text mode
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:)
+ Local Folder
+ C:
+ New Volume(D:)
+ New Volume(E:)
+ Removable Drives
+ SD_Card(F:)
+ Transcend Drive(G:)
To copy to clipboard, switch view to plain text mode
Bookmarks