I'm trying to create a custom image file browser. Eventually I want it to have an image preview for the selected image and other things specific to an image browser.

However, I first want to be able to group files together. I want to take a list of files such as these:

foo.0001.png
foo.0002.png
foo.0003.png
foo.0004.png
And display them like this

foo.[0001-0004].png
The builtin QFileDialog will display them as distinct files whereas I want to have an option to display them grouped.

Is it even possible to do this by subclassing QDirModel? Because, I think that would be the nicest solution but it doesn't seem trivial. Or can this be done using a proxy model?

I can certainly write my own model from scratch (even keep it simple and ignore size and date information) but if its possible to do it with a QDirModel and/or a proxy model that would be great