is there any way to get multiple Dirs using getexistingdirectory ?
-
is there any way to get multiple Dirs using getexistingdirectory ??
-
just a guess, but maybe you can use some kind of
setFilter(QDir::Dirs)
andselectedUrls()
orselectedFiles()
-
@sneubert getexistingdirectory or getopenfilenames is static API
-
sorry, if you cant create an object of
QFileDialog
, I think it´s not possible -
@sneubert
@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();@ -
Try this you can select/Deselect the directories. since native directory file browser won't support the multiple directory selection, need to set the flags DontUseNativeDialog, its exactly what @opengpu2 has said.
QFileDialog w; w.setFileMode(QFileDialog::DirectoryOnly); w.setOption(QFileDialog::DontUseNativeDialog,true); QListView *lView = w.findChild<QListView*>("listView"); if (lView) lView->setSelectionMode(QAbstractItemView::MultiSelection); QTreeView *tView = w.findChild<QTreeView*>(); if (tView) tView->setSelectionMode(QAbstractItemView::MultiSelection); w.exec(); qDebug() << " Selected Directories : " << w.selectedFiles();
-
selectedFiles can return the selected Dirs and Files....
but these are in QStringList....how can i distinguish the dir from the files?
thank you!