[Qt-interest] little help with QFileSystemModel

Andre Somers andre at familiesomers.nl
Wed Feb 15 07:35:40 CET 2012


Op 15-2-2012 1:13, Mandaya Prakash schreef:
> Hi there I am using QFileSystemModel in my treeview, I want to show 
> only those directory which has *.mng extension.
> I tried using Filter *.mng in QStringlist and then called 
> setNameFilter on model but it is showing me all other directories 
> which are not having this file too which I dont want.
> I think i am missing some small thing but just can not figure it out.
> please help
>
This is not a small issue. Filtering a tree this way is not cheap 
operation, and that is why it is not done by default. The problem is 
that in order to know if a branch meets the criteria of having an .mng 
file *somewhere* in its child branches, you have to basically scan the 
entire tree. In the case of a QFileSystemModel that means, scanning the 
entire file system. That is not a fast operation to say the least...

André




More information about the Qt-interest-old mailing list