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
...
if (dir != fileView->rootIndex() && dirModel->isDir(dir))
{
currentPath = dirModel->filePath(dir);
treeView->setCurrentIndex(index);
fileModel->setRootPath(currentPath);
fileView->setRootIndex(fileModel->index(currentPath));
}
...
QModelIndex dir = index.sibling(index.row(), 0);
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
Bookmarks