How to set filter for directories in qfiledialog
I would like to know is there any way to select only some directories and some files at a time using QFileDialog
class. Here I set filesfilter but I also need to set folder filter. I have folders which have sort of "extension" in their name (e.g. name.abc,flight.abc etc) and I want only such folders to be selected on the basis of their name
I'm currently using
QStr开发者_如何转开发ingList files = QFileDialog::getOpenFileNames(this, tr("Files & Directories"), QDir::currentPath(),tr("*.doc*.txt") );
tr("*.doc*.txt")
is my files filter. In the same way I need folders filter with name only .abc
at the end.
It looks like you need to use proxy model for the open file dialog. Take a look on the QFileDialog::setProxyModel()
and documentation of the Qt Model/View programming.
精彩评论