I would like to display a file open dialog that filters on a particular pattern, for example *.000
to *.999
.
QFileDialog::getOpenFileNames
allows you to specify discrete filters, such as *.000
, *.001
, etc. I would like to set a regular expression as a filter, in this case ^.*\.\d\d\d$
, i.e. any file name that has a three digit extension.
It can be done by adding proxy model to QFileDialog. It is explained here: Filtering in QFileDialog
ariwez pointed me into the right direction. The main thing to watch out for is to call
dialog.setOption(QFileDialog::DontUseNativeDialog)
beforedialog.setProxyModel
.The proxy model is:
The file dialog is created as follows: