Hello everyone,

I am searching for an easy way to filter out all folders in a QFileSystemModel that have a specific name.
In my case folders that are named "publish" or "misc".

As far as I understand I need the opposite of the function setNameFilters() of the QFileSystemModel which shows only the items that match a list of string patterns.

Has anyone an Idea if its possible to reverse setNameFilters() to not INclude but EXclude?

I know that there would be a way to have a QSortFilterProxyModel, reimplement filterAcceptsRow() to hide a row if it's named a certain way but I have a scenario in which I sometimes have to change the names of folders I want to hide. So it would be convenient to just after my signal was emitted call one function with the new folder names i want to exclude.

Or are there other functions of the QSortFilterProxyModel that might be useful for that ? Like setFilterRegularExpression(), setFilterWildcard(), setFilterFixedString(), setFilterRegExp() I'm not quite sure how these functions work or how I could use those to hide all folders that match a certain filter. (As quick side node I am using PySide2 but I think I should be able to transfer all Qt answers!)

I'm looking forward for any advice!