Commit 49b6623e authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas

- don't crash if file format is not handled by reader

parent cbb0640a
......@@ -279,6 +279,14 @@ void dtkVisualizationViewer::importDataSet(const QString& path)
return;
d->dataset = dtkVisualizationVTKReader(path);
if (!d->dataset) {
QMessageBox msgBox;
msgBox.setText("Fail to read file, check file extension");
msgBox.exec();
return;
}
QVariant data = dtk::variantFromValue(d->dataset);
dtkVisualizationDecoratorInfo *decorator_info = new dtkVisualizationDecoratorInfo;
......@@ -388,5 +396,13 @@ void dtkVisualizationViewer::resizeEvent(QResizeEvent *event)
dtkWidgetsMainWindow::resizeEvent(event);
}
void dtkVisualizationViewer::mouseMoveEvent(QMouseEvent *event)
{
// do not show title bar when over the menu. use hardcoded values of menu :-(
if (event->pos().x() < 300 + 32 + 12)
return;
dtkWidgetsMainWindow::mouseMoveEvent(event);
}
//
// dtkVisualizationViewer.cpp ends here
......@@ -44,6 +44,7 @@ protected:
protected:
void resizeEvent(QResizeEvent *) override;
void mouseMoveEvent(QMouseEvent *event) override;
private:
class dtkVisualizationViewerPrivate *d;
......
......@@ -50,6 +50,7 @@ vtkDataSet *dtkVisualizationVTKReader(const QString& path)
if (path.endsWith(".vtu"))
return dtkVisualizationVTKReaderVTU(path);
qWarning() << "file" << path << "is not handled by vtk reader";
return nullptr;
}
......
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