owais_blore
4th December 2012, 07:18
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:
8476
I want to display it like the second picture shown above. How can that be achieved?
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:
8476
I want to display it like the second picture shown above. How can that be achieved?