Hide 3d plot when bad data

If the model plot cannot be refreshed when data
is invalid, the plot needs to be hidden since the
qwtplot3d api does not redraw empty plots and does
not have any methods for clearing the canvas.

This workaround just hides the plot and shows a label
when the plot is invalidated.

Fixes #429.
This commit is contained in:
Mark Liversedge
2011-08-30 22:01:43 +01:00
parent eb45055ea4
commit 26a0c98028
4 changed files with 35 additions and 6 deletions

View File

@@ -53,6 +53,10 @@ ModelWindow::ModelWindow(MainWindow *parent, const QDir &home) :
QFormLayout *cl = new QFormLayout(c);
setControls(c);
// hidden text when plot invalid
nodata = new QLabel(tr("No data or bin size too large."), this);
nodata->hide();
// the plot widget
QHBoxLayout *mainLayout = new QHBoxLayout;
modelPlot= new ModelPlot(main, NULL);
@@ -63,6 +67,7 @@ ModelWindow::ModelWindow(MainWindow *parent, const QDir &home) :
zpane->setValue(0);
mainLayout->addWidget(zpane);
mainLayout->addWidget(modelPlot);
mainLayout->addWidget(nodata);
setLayout(mainLayout);
// preset Values
@@ -238,8 +243,24 @@ ModelWindow::setData(bool adjustPlot)
if (current != NULL && current->isSelected() == true)
settings.intervals.append(current);
}
setUpdatesEnabled(false);
// reset the model parameters
modelPlot->setData(&settings);
// if setdata resulted in the plot being hidden
// then the settings were not valid.
if (modelPlot->basicModelPlot->isHidden()) {
zpane->hide();
nodata->show();
} else {
zpane->show();
nodata->hide();
}
setClean();
setUpdatesEnabled(true);
}
void