Skip to content
Snippets Groups Projects
Commit c5e06644 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

DepthprobeSim uses SpecularBeamEditor

parent 6d468b51
No related branches found
No related tags found
1 merge request!1416DepthprobeSim uses SpecularBeamEditor
Pipeline #90945 passed
......@@ -13,54 +13,32 @@
// ************************************************************************************************
#include "GUI/View/Instrument/DepthprobeInstrumentEditor.h"
#include "GUI/Model/Device/BeamWavelengthItem.h"
#include "GUI/Model/Device/InstrumentItems.h"
#include "GUI/Model/Device/InstrumentsEditController.h"
#include "GUI/View/Device/AxisPropertyForm.h"
#include "GUI/View/Device/SphericalAxisForm.h"
#include "GUI/View/Instrument/AlphaScanEditor.h"
#include "GUI/View/Instrument/DistributionEditor.h"
#include "GUI/View/Tool/GroupBoxCollapser.h"
#include <QGridLayout>
#include "GUI/View/Instrument/SpecularBeamEditor.h"
#include <QVBoxLayout>
DepthprobeInstrumentEditor::DepthprobeInstrumentEditor(QWidget* parent,
DepthprobeInstrumentItem* instrument)
DepthprobeInstrumentItem* instrument,
InstrumentsEditController* ec)
: QWidget(parent)
, m_ec(ec, instrument)
{
ASSERT(instrument);
auto* layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
auto* parametersGroupBox = new QGroupBox(this);
parametersGroupBox->setTitle("Beam and scan parameters");
auto* vLayout = new QVBoxLayout(parametersGroupBox);
vLayout->setContentsMargins(30, 8, 0, 0);
auto* m_wavelengthEditor =
new DistributionEditor("Wavelength", MeanConfig{true}, GUI::ID::Distributions::Symmetric,
this, instrument->beamItem()->wavelengthItem());
vLayout->addWidget(m_wavelengthEditor);
auto* inclinationEditor =
new AlphaScanEditor(this, instrument->beamItem()->inclinationAngleItem());
vLayout->addWidget(inclinationEditor);
auto* beamEditor = new SpecularBeamEditor(this, instrument->beamItem(), &m_ec);
layout->addWidget(beamEditor);
auto* depthAxisEditor = new AxisPropertyForm(this, "Depth axis", &instrument->zAxis(),
"Number of points in scan across sample bulk");
vLayout->addWidget(depthAxisEditor);
auto* collapser = GroupBoxCollapser::installIntoGroupBox(parametersGroupBox);
collapser->setExpanded(instrument->isExpandParameters());
connect(collapser, &GroupBoxCollapser::toggled, this,
[instrument](bool b) { instrument->setExpandParameters(b); });
layout->addWidget(parametersGroupBox);
layout->addWidget(depthAxisEditor);
layout->addStretch();
connect(m_wavelengthEditor, &DistributionEditor::distributionChanged, this,
&DepthprobeInstrumentEditor::dataChanged);
connect(inclinationEditor, &AlphaScanEditor::dataChanged, this,
connect(beamEditor, &SpecularBeamEditor::dataChanged, this,
&DepthprobeInstrumentEditor::dataChanged);
connect(depthAxisEditor, &AxisPropertyForm::dataChanged, this,
&DepthprobeInstrumentEditor::dataChanged);
......
......@@ -15,18 +15,24 @@
#ifndef BORNAGAIN_GUI_VIEW_INSTRUMENT_DEPTHPROBEINSTRUMENTEDITOR_H
#define BORNAGAIN_GUI_VIEW_INSTRUMENT_DEPTHPROBEINSTRUMENTEDITOR_H
#include "GUI/View/Instrument/InstrumentEditController.h"
#include <QWidget>
class InstrumentsEditController;
class DepthprobeInstrumentItem;
class DepthprobeInstrumentEditor : public QWidget {
Q_OBJECT
public:
DepthprobeInstrumentEditor(QWidget* parent, DepthprobeInstrumentItem* item);
DepthprobeInstrumentEditor(QWidget* parent, DepthprobeInstrumentItem* item,
InstrumentsEditController* ec);
signals:
void dataChanged();
private:
InstrumentEditController m_ec;
};
#endif // BORNAGAIN_GUI_VIEW_INSTRUMENT_DEPTHPROBEINSTRUMENTEDITOR_H
......@@ -215,9 +215,9 @@ void InstrumentLibraryEditor::createWidgetsForCurrentInstrument()
GroupBoxCollapser::installIntoGroupBox(g);
auto* ec = m_instrumentLibrary->editController();
if (auto* sp = dynamic_cast<SpecularInstrumentItem*>(currentInstrument)) {
auto* editor = new SpecularInstrumentEditor(m_ui->scrollArea, sp,
m_instrumentLibrary->editController());
auto* editor = new SpecularInstrumentEditor(m_ui->scrollArea, sp, ec);
connect(editor, &SpecularInstrumentEditor::dataChanged, this,
&InstrumentLibraryEditor::onInstrumentChangedByEditor);
layout->addWidget(editor);
......@@ -232,7 +232,7 @@ void InstrumentLibraryEditor::createWidgetsForCurrentInstrument()
&InstrumentLibraryEditor::onInstrumentChangedByEditor);
layout->addWidget(editor);
} else if (auto* dp = dynamic_cast<DepthprobeInstrumentItem*>(currentInstrument)) {
auto* editor = new DepthprobeInstrumentEditor(m_ui->scrollArea, dp);
auto* editor = new DepthprobeInstrumentEditor(m_ui->scrollArea, dp, ec);
connect(editor, &DepthprobeInstrumentEditor::dataChanged, this,
&InstrumentLibraryEditor::onInstrumentChangedByEditor);
layout->addWidget(editor);
......
......@@ -144,7 +144,7 @@ void InstrumentView::createWidgetsForCurrentInstrument()
&InstrumentView::onInstrumentChangedByEditor);
layout->addWidget(editor);
} else if (auto* dp = dynamic_cast<DepthprobeInstrumentItem*>(currentInstrument)) {
auto* editor = new DepthprobeInstrumentEditor(m_scrollArea, dp);
auto* editor = new DepthprobeInstrumentEditor(m_scrollArea, dp, ec);
connect(editor, &DepthprobeInstrumentEditor::dataChanged, this,
&InstrumentView::onInstrumentChangedByEditor);
layout->addWidget(editor);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment