From: Ovidiu Mircescu Date: Thu, 21 Dec 2017 16:09:30 +0000 (+0100) Subject: You can now select folders in the input files list. X-Git-Tag: V8_5_0a1~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0a7f1415546035d43f9b2e797e6fa04d268d5867;p=modules%2Fjobmanager.git You can now select folders in the input files list. --- 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)); + } } }