PDA

View Full Version : Filter QListView/QTreeView using QFileSystemModel



Alundra
16th September 2015, 21:49
Hi,
I use a QFileSystemModel on QListView and QTreeView, all works fine but I added a searchbox and there comes problems.
I tried to inherit QSortFilterProxyModel to filter the list/tree based on my searchbox but I got only problems.
When I set the inherited QSortFilterProxyModel class, the list doesn't show the path I set but the drives.
How make correctly a search filter on this case ?
Thanks

Alundra
17th September 2015, 16:55
Ok I solved the first problem, when you use a proxy you have to map index from proxy and to proxy.
The problem is then I tried to connect a line edit to the proxy filter function but I didn't had good behavior using QSortFilterProxyModel.
The good behavior on my case is to find if the row contains a text using case insensitive and hide all other, show all parent if it's a child.
Is it needed to use a custom proxy for this case ?
Thanks