Qt: How to add Custom 'Local Drive' row in QFileSystemModel to display Drives
-
I am using QFileSystemModel to represent file structure through the QTreeView. Everything works fine and it displays C:, D: etc drives in TreeView, but I need to add an additional row at the beginning of the tree. For example for now is:
- C:
- D:
- E:
After adding the row 'Local Drives' at the beginning, I wanna display it like:
@+ Local Drive- C:
- D:
- E:@
Here is the code:
@pSystemPrimaryModel = new QFileSystemModel(this);
pSystemPrimaryModel->setRootPath(QDir::currentPath());
ui->TreeView->setModel(pSystemPrimaryModel);@ -
Anyone here who can help me???
-
Take a look at this: "http://qt-project.org/forums/viewthread/22639/":http://qt-project.org/forums/viewthread/22639/
It should help your problem.