#include <QtGui>
int main(int argc, char *argv[])
{
QListView *l
= w.
findChild<QListView
*>
("listView");
if (l) {
}
if (t) {
}
return w.exec();
}
#include <QtGui>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QFileDialog w;
w.setFileMode(QFileDialog::DirectoryOnly);
w.setOption(QFileDialog::DontUseNativeDialog,true);
QListView *l = w.findChild<QListView*>("listView");
if (l) {
l->setSelectionMode(QAbstractItemView::MultiSelection);
}
QTreeView *t = w.findChild<QTreeView*>();
if (t) {
t->setSelectionMode(QAbstractItemView::MultiSelection);
}
return w.exec();
}
To copy to clipboard, switch view to plain text mode
The following is the codes that you could try(The original link is http://www.qtcentre.org/threads/3422...108#post220108):
_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();
QFileDialog* _f_dlg = new QFileDialog(this);
_f_dlg->setFileMode(QFileDialog::Directory);
_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) {
l->setSelectionMode(QAbstractItemView::MultiSelection);
}
QTreeView *t = _f_dlg->findChild<QTreeView*>();
if (t) {
t->setSelectionMode(QAbstractItemView::MultiSelection);
}
int nMode = _f_dlg->exec();
QStringList _fnames = _f_dlg->selectedFiles();
To copy to clipboard, switch view to plain text mode
Bookmarks