I want to show all the files in the QFileDialog and hide the directories of a certain directory,while the QFileDialog provides ShowDirsOnly Options without ShowFilesOnly.
How can I resolve this issue ?
I want to show all the files in the QFileDialog and hide the directories of a certain directory,while the QFileDialog provides ShowDirsOnly Options without ShowFilesOnly.
How can I resolve this issue ?
Hi, maybe QFileDialog::setFileMode() helps.
Ginsengelf
Last edited by Ginsengelf; 17th August 2010 at 06:57. Reason: updated contents
Why would you want to deny people the ability to browse for their files?
Horse sense is the thing that keeps horses from betting on people. --W.C. Fields
Ask Smart Questions
I have solved this issue,using a QFileDialog object instead of QFileDialog static function getOpenFileName().
Following:
QFileDialog dialog;
dialog.setFileMode(QFileDialog::AnyFile);
dialog.setDirectory("/home/user1");
dialog.setFilter(QDir::Files);
dialog.setWindowTitle("Open File");
dialog.setNameFilter("Images(*.jpg *.gif *.bmp)");
dialog.exec();
QString file = dialog.selectedFiles().first();
// ... ...
Bookmarks