Hi

I've hitten a 'fun' corner where I found a surprising but documented
feature of QFileSystemModel and discovered how it interacted with
certain QSortFilterProxyModel configurations and QTreeView interactions

Assume the following:

Create a QSortFilterProxyModel with 
    setRecursiveFilteringEnabled(true);


create a folder hierachy under /home/yourusername/somefolder:
folder1
 \-- foo
folder2
 \-- bar



set the the filesystem model as source on the proxy model
set the the root path on the filesystemmodel to
/home/yourusername/somefolder
set the treeview root to the root item mapped to the proxymodel


Try set 'foo' as a filter in the QSFPM and see just 

folder1 
 \-- foo

in the view

Try set 'home' as a filter in the QSFPM and see the full view expanded.

This seems to be because 'home' matches the 'home' in the path (because
setRootPath on QFileSystemModel doesn't change the model root node, but
just where the file gatherer is running; and also why you need to both
set the root path on the QFileSystemModel and the mapped index as the
root on the QTreeView)

Does anyone know a workaround or something else I have missed ?

I guess a SubtreeFilteringProxyModel could be what I'm looking for, but
didn't directly find it.

Any pointers anyone?

/Sune

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to