diff --git a/GUI/View/Instrument/InstrumentView.cpp b/GUI/View/Instrument/InstrumentView.cpp index f205ff9d426ffe511c7afcf2d3e291fd6617779c..7f075e9b408de502e23c914970cf40a3c8e973a2 100644 --- a/GUI/View/Instrument/InstrumentView.cpp +++ b/GUI/View/Instrument/InstrumentView.cpp @@ -126,34 +126,23 @@ void InstrumentView::createWidgetsForCurrentInstrument() //... All remaining content depends on instrument type + IComponentEditor* editor; auto* ec = gDoc->multiNotifier(); - if (auto* ii = dynamic_cast<SpecularInstrumentItem*>(currentInstrument)) { - auto* editor = new SpecularInstrumentEditor(ii, ec); - connect(editor, &SpecularInstrumentEditor::dataChanged, this, - &InstrumentView::onInstrumentChangedByEditor); - layout->addWidget(editor); - - } else if (auto* ii = dynamic_cast<OffspecInstrumentItem*>(currentInstrument)) { - auto* editor = new OffspecInstrumentEditor(ii, ec); - connect(editor, &OffspecInstrumentEditor::dataChanged, this, - &InstrumentView::onInstrumentChangedByEditor); - layout->addWidget(editor); - - } else if (auto* ii = dynamic_cast<GISASInstrumentItem*>(currentInstrument)) { - auto* editor = new GISASInstrumentEditor(ii); - connect(editor, &GISASInstrumentEditor::dataChanged, this, - &InstrumentView::onInstrumentChangedByEditor); - layout->addWidget(editor); - - } else if (auto* ii = dynamic_cast<DepthprobeInstrumentItem*>(currentInstrument)) { - auto* editor = new DepthprobeInstrumentEditor(ii, ec); - connect(editor, &DepthprobeInstrumentEditor::dataChanged, this, - &InstrumentView::onInstrumentChangedByEditor); - layout->addWidget(editor); - - } else + if (auto* ii = dynamic_cast<SpecularInstrumentItem*>(currentInstrument)) + editor = new SpecularInstrumentEditor(ii, ec); + else if (auto* ii = dynamic_cast<OffspecInstrumentItem*>(currentInstrument)) + editor = new OffspecInstrumentEditor(ii, ec); + else if (auto* ii = dynamic_cast<GISASInstrumentItem*>(currentInstrument)) + editor = new GISASInstrumentEditor(ii); + else if (auto* ii = dynamic_cast<DepthprobeInstrumentItem*>(currentInstrument)) + editor = new DepthprobeInstrumentEditor(ii, ec); + else ASSERT_NEVER; + layout->addWidget(editor); + connect(editor, &IComponentEditor::dataChanged, this, + &InstrumentView::onInstrumentChangedByEditor); + m_scrollArea->setWidget(w); }