Commit 4dddb22a authored by Mathieu Tillet's avatar Mathieu Tillet
Browse files

Reset the render view tab on workspace change

When the workspace shown in the instrument view is replaced, all the
widgets in the render tab are reset to a fresh state.
parent 62b5a617
......@@ -268,7 +268,7 @@ protected:
/// add the selected tabs
void addSelectedTabs();
/// update integration widget visibility and range
void updateIntegrationWidget();
void updateIntegrationWidget(bool init = false);
// GUI elements
QLabel *mInteractionInfo;
......
......@@ -295,7 +295,7 @@ void InstrumentWidget::init(bool resetGeometry, bool autoscaling,
new InstrumentActor(m_workspaceName, autoscaling, scaleMin, scaleMax));
}
updateIntegrationWidget();
updateIntegrationWidget(true);
auto surface = getSurface();
if (resetGeometry || !surface) {
......@@ -589,11 +589,15 @@ void InstrumentWidget::replaceWorkspace(
renameWorkspace(newWs);
m_instrumentActor.reset(new InstrumentActor(QString::fromStdString(newWs)));
// change the view and colormap
// update the view and colormap
auto surface = getSurface();
surface->resetInstrumentActor(m_instrumentActor.get());
setupColorMap();
// reset the instrument position
m_renderTab->resetView();
// update the integration widget
updateIntegrationWidget();
// change the title of the instrument window
......@@ -604,9 +608,15 @@ void InstrumentWidget::replaceWorkspace(
/**
* Update the range of the integration widget, and show or hide it is needed
*/
void InstrumentWidget::updateIntegrationWidget() {
void InstrumentWidget::updateIntegrationWidget(bool init) {
m_xIntegration->setTotalRange(m_instrumentActor->minBinValue(),
m_instrumentActor->maxBinValue());
if (!init) {
m_xIntegration->setRange(m_instrumentActor->minBinValue(),
m_instrumentActor->maxBinValue());
}
m_xIntegration->setUnits(QString::fromStdString(
m_instrumentActor->getWorkspace()->getAxis(0)->unit()->caption()));
......
Supports Markdown
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