I'm building a explorer like view with a directory tree / navigation pane using a QTreeView
on the left side and an icon view on the right/main side using a QListView
. The tree side should only show directories (preferable non empty directories…but that's a different story) and the icon view only files with a specific name filter and no directories. And I'm struggling how to do this right.
First: I don't know if I should use one or two QFileSystemModels
for that. Using one I've to filter with two attached QSortFilterProxyModels
for each view—but I don't have file system properties anymore .... and using only RegEx for that is kind of limiting. And using two models have been proven hard cause I can't really map a QModelIndex
from one model into the other cause the models contain not the same items. For example when I click on a directory on the left the root path of the right should get updated. But the directory is not included in the model ...so this doesn't work.
Any ideas on how to do this right? Thank you!
Not insisting that is the only way but works for me:
QSortFilterProxyModel
we first have to obtain the current view position from there