How to make a file dialog with dirs only, multiselection and network places?
Hey guys
I need to create a file dialog where one can pick directories only with multiselection and there must be network places.
I cannot do all this stuff using the standard possibilities of QFileDialog. The closest method to my problem is QFileDialog::getExistingDirectory (there are only directories, multiselection and network places -- all I need) but it has a bug -- when one selects several folders the method returns "" (an empty string). I tried to rewrite getExistingDirectory in QFileDialog.cpp but in that case I have to rebuild qt dll (QtCore.dll as far as I remember). Maybe there is an easier solution?
How can I solve my problem? I need some help, please.
Re: How to make a file dialog with dirs only, multiselection and network places?
Re: How to make a file dialog with dirs only, multiselection and network places?
Thank you but I need another thing. I need a native standard file dialog where one can choose several folders (multiselection). So in other words I need a kind of re-implemented QFileDialog::getExistingDirectory that returns QStringList instead of QString. I want to get a list of selected folders. So I need my file dialog to look like QFileDialog::getOpenFileNames but for folders, not for files.
Re: How to make a file dialog with dirs only, multiselection and network places?
Code:
#include <QtGui>
int main(int argc, char *argv[])
{
QListView *l
= w.
findChild<QListView
*>
("listView");
if (l) {
}
if (t) {
}
return w.exec();
}
The following is the codes that you could try(The original link is http://www.qtcentre.org/threads/3422...108#post220108):
Code:
_f_dlg
->setOption
(QFileDialog::DontUseNativeDialog,
true);
// Try to select multiple files and directories at the same time in QFileDialog
QListView *l
= _f_dlg
->findChild<QListView
*>
("listView");
if (l) {
}
QTreeView *t
= _f_dlg
->findChild<QTreeView
*>
();
if (t) {
}
int nMode = _f_dlg->exec();
Re: How to make a file dialog with dirs only, multiselection and network places?
Thank you again, I have tried your code. Only one problem -- the dialog is not native and there are no network places. :( I have read another discussion board and one said there that only static methods of QFileDialog offered native windows, windows that I need. So I am afraid there is no opportunity to solve my problem completely using QFileDialog. Maybe I should change Qt's source code and build another QtCore.dll to use reimplemented static methods.