Display System Drives in Order using QFileSystemModel
-
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? -
[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 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.