QFileSystemModel doesnt follow the conventional functions for removing items, I guess because it is so potentially destructive.
you need to call self.model.remove(index)
for each one. This will permanently delete the files.
You also need to call self.model.rmdir(index)
if it happens to be a folder.
see
http://doc.qt.io/qt-4.8/qfilesystemmodel.html#remove
If you are just trying to hide the rows, then you can add a list of filters e.g. ["*.cpp", "*.h"] via QFileSystem.setNameFilters, which uses QDir::setNameFIlters.
If you are doing something more specialised, then you can use QSortFilterProxy
. Either use it directly with a QRegExp, or subclass and implement filterAcceptsRow()