I tried to handle the same problem and I found a solution after searching in QT forums. The following is the codes that you could try:
_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