I have a QTreeview where I am displaying all system drives using QFileSystemModel. 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 need to sort them in a order.
Here is the code:
This displays drives in a regular manner even when removable drive is connected as follows:Code:pSystemPrimaryModel = new QFileSystemModel(this); pSystemPrimaryModel->setRootPath(QDir::currentPath()); // Sets the model for the view to present. ui->PrimTreeView->setModel(pSystemPrimaryModel); ui->PrimTreeView->header()->hide();
Basically I want to display it like follows:Code:+ C: + New Volume(D:) + New Volume(E:) + SD_Card(F:) + Transcend Drive(G:)
Does QSortFilterProxyModel can help me achieve this or is there some other Qt Class?? If yes then I would appreciate if you could guide meCode:Local Folder C: New Volume(D:) New Volume(E:) Removable Drives SD_Card(F:) Transcend Drive(G:)![]()

Reply With Quote

