QFileDialog: how to filter files with no extension
Hi,
a very quick question,
I am trying to open/filter files with QFileDialog::getOpenFileName which have no extension. Something like document1, document2, etc
My code works so far for .txt and All Files
Code:
QString fileName
= QFileDialog::getOpenFileName( this, tr
("Open HST xy-list(flux vs wave) file..."), sWDir, tr
("HST ASCII File (*.txt);;All files (*.*)"),
0,
QFileDialog::DontUseNativeDialog );
Re: QFileDialog: how to filter files with no extension
The following code works fine for me in Linux:
Code:
QString fileName
= QFileDialog::getOpenFileName( this, tr
("Open HST xy-list(flux vs wave) file..."), sWDir, tr
("HST ASCII File (*.txt);;All files (*)"),
0,
QFileDialog::DontUseNativeDialog );
Re: QFileDialog: how to filter files with no extension
this does not work in windows, it shows simply all files and all extensions. Any ideas?!
Re: QFileDialog: how to filter files with no extension
nothing new? regular expression perhaps?
Re: QFileDialog: how to filter files with no extension
You can try to reimplement QFileDialog filtering filenames with dots, but standard class cannot do this. Yes, asterisk shows all files without exceptions.
Re: QFileDialog: how to filter files with no extension
do you mean by using reg expression? I haven't seen anything similar so far. I'll give a try, but if you have something to suggest..more than welcome!
Re: QFileDialog: how to filter files with no extension
Yes, you can use regexp to filter files. But are you sure you really want to hide all files containing dots? Windows thinks that everything after last dot is extension, but actually it can be simply a part of name, like .htaccess files.
Re: QFileDialog: how to filter files with no extension
believe it or not, I haven't managed to filter filenames with dots.
Actually as I google I haven't seen any example of QRegExpand QFileDialog.
This thread appears in google results as the most representative for this problem :)))