treeview show dirs and tableview show files with one filesystemmodel?
playing with this example.
ttp://doc.qt.nokia.com/4.6/model-view-using.html
how can I make the treview display only directories and the table view only files? If I change something in the model with setfilter, both react to it.
thanks
Re: treeview show dirs and tableview show files with one filesystemmodel?
sorry, I mean there is something like QSortFilterProxyModel but that does not have the convenient setFilter for dirs, files etc.
Re: treeview show dirs and tableview show files with one filesystemmodel?
ok found it for those who are interested:
I use two models, one for the treeview (QDirModel) and one for the tableview (QFileSystemModel)
then when the directory is changed in the treeview, I set the setRootPath of the QFileSystemModel
Code:
...
if (dir != fileView->rootIndex() && dirModel->isDir(dir))
{
currentPath = dirModel->filePath(dir);
treeView->setCurrentIndex(index);
fileModel->setRootPath(currentPath);
fileView->setRootIndex(fileModel->index(currentPath));
}
Re: treeview show dirs and tableview show files with one filesystemmodel?
You could of course subclass the QSortFilterProxyModel as well...