Commit be85eb6f authored by finetjul's avatar finetjul
Browse files

BUG: Fix Add Data when loading modules

The directory was given to the optionwidget, not the filename

git-svn-id: http://svn.slicer.org/Slicer4/trunk@15636 3bd1e089-480b-0410-8dfb-8563597acbee
parent 1ae46119
......@@ -186,12 +186,16 @@ bool qSlicerCoreIOManager::loadNodes(const qSlicerIO::IOFileType& fileType,
foreach (qSlicerIO* reader, readers)
{
reader->setMRMLScene(d->currentScene());
if (!reader->canLoadFile(parameters["fileName"].toString()) ||
!reader->load(parameters))
if (!reader->canLoadFile(parameters["fileName"].toString()))
{
continue;
}
qDebug() << "Reader has read the file" << parameters["fileName"].toString();
if (!reader->load(parameters))
{
continue;
}
qDebug() << reader->description() << "Reader has successfully read the file"
<< parameters["fileName"].toString();
nodes << reader->loadedNodes();
success = true;
break;
......
......@@ -168,7 +168,7 @@ void qSlicerDataDialogPrivate::addFile(const QFileInfo& file)
// widget is visible
optionsWidget->setMinimumWidth(optionsWidget->sizeHint().width());
// The optionsWidget can use the filename to initialize some options.
optionsWidget->setFileName(file.absolutePath());
optionsWidget->setFileName(file.absoluteFilePath());
this->FileWidget->setCellWidget(row, OptionsColumn, optionsWidget);
// TODO: connect signal validChanged(bool) with the accept button
}
......@@ -200,8 +200,6 @@ QList<qSlicerIO::IOProperties> qSlicerDataDialogPrivate::selectedFiles()const
qSlicerIO::IOProperties properties;
QTableWidgetItem* fileItem = this->FileWidget->item(row, FileColumn);
QTableWidgetItem* descriptionItem = this->FileWidget->item(row, TypeColumn);
qSlicerIOOptionsWidget* optionsItem = dynamic_cast<qSlicerIOOptionsWidget*>(
this->FileWidget->cellWidget(row, OptionsColumn));
Q_ASSERT(fileItem);
Q_ASSERT(descriptionItem);
if (fileItem->checkState() != Qt::Checked)
......@@ -210,8 +208,11 @@ QList<qSlicerIO::IOProperties> qSlicerDataDialogPrivate::selectedFiles()const
continue;
}
properties["fileType"] = descriptionItem->data(Qt::AccessibleDescriptionRole).toInt();
qSlicerIOOptionsWidget* optionsItem = dynamic_cast<qSlicerIOOptionsWidget*>(
this->FileWidget->cellWidget(row, OptionsColumn));
if (optionsItem)
{
// The optionsItem contains all the file properties including "fileName"
properties.unite(optionsItem->properties());
}
else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment