From 0a7f1415546035d43f9b2e797e6fa04d268d5867 Mon Sep 17 00:00:00 2001 From: Ovidiu Mircescu Date: Thu, 21 Dec 2017 17:09:30 +0100 Subject: [PATCH] You can now select folders in the input files list. --- src/genericgui/BL_CreateJobWizard.cxx | 29 +++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/genericgui/BL_CreateJobWizard.cxx b/src/genericgui/BL_CreateJobWizard.cxx index f14ade8..ed7acdf 100644 --- a/src/genericgui/BL_CreateJobWizard.cxx +++ b/src/genericgui/BL_CreateJobWizard.cxx @@ -22,6 +22,7 @@ #include #include +#include #ifndef WNT #include @@ -1095,13 +1096,29 @@ FilesPage::isComplete() const void FilesPage::choose_input_files() { - QStringList files = QFileDialog::getOpenFileNames(this, - tr("Add input files"), "", - tr("All Files (*)")); - for (int i = 0; i < files.size(); ++i) + // We need to be able to select both files and folders. + // Standard QFileDialog cannot do it. + QFileDialog w(this, tr("Select input files"), + "", tr("All files and folders(*)")) ; + w.setOption(QFileDialog::DontUseNativeDialog,true); + QListView *l = w.findChild("listView"); + if (l) + { + l->setSelectionMode(QAbstractItemView::MultiSelection); + } + QTreeView *t = w.findChild(); + if (t) { - if (ui->input_files_list->findItems(files.at(i), Qt::MatchFixedString).size() == 0) - ui->input_files_list->addItem(files.at(i)); + t->setSelectionMode(QAbstractItemView::MultiSelection); + } + if(w.exec()) + { + QStringList files = w.selectedFiles(); + for (int i = 0; i < files.size(); ++i) + { + if (ui->input_files_list->findItems(files.at(i), Qt::MatchFixedString).size() == 0) + ui->input_files_list->addItem(files.at(i)); + } } } -- 2.39.2