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
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
sorry, I mean there is something like QSortFilterProxyModel but that does not have the convenient setFilter for dirs, files etc.
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
Qt Code:
... if (dir != fileView->rootIndex() && dirModel->isDir(dir)) { currentPath = dirModel->filePath(dir); treeView->setCurrentIndex(index); fileModel->setRootPath(currentPath); fileView->setRootIndex(fileModel->index(currentPath)); }To copy to clipboard, switch view to plain text mode
You could of course subclass the QSortFilterProxyModel as well...
Horse sense is the thing that keeps horses from betting on people. --W.C. Fields
Ask Smart Questions
Bookmarks