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 @@ ...@@ -13,54 +13,32 @@
// ************************************************************************************************ // ************************************************************************************************
#include "GUI/View/Instrument/DepthprobeInstrumentEditor.h" #include "GUI/View/Instrument/DepthprobeInstrumentEditor.h"
#include "GUI/Model/Device/BeamWavelengthItem.h"
#include "GUI/Model/Device/InstrumentItems.h" #include "GUI/Model/Device/InstrumentItems.h"
#include "GUI/Model/Device/InstrumentsEditController.h"
#include "GUI/View/Device/AxisPropertyForm.h" #include "GUI/View/Device/AxisPropertyForm.h"
#include "GUI/View/Device/SphericalAxisForm.h" #include "GUI/View/Instrument/SpecularBeamEditor.h"
#include "GUI/View/Instrument/AlphaScanEditor.h"
#include "GUI/View/Instrument/DistributionEditor.h"
#include "GUI/View/Tool/GroupBoxCollapser.h"
#include <QGridLayout>
#include <QVBoxLayout> #include <QVBoxLayout>
DepthprobeInstrumentEditor::DepthprobeInstrumentEditor(QWidget* parent, DepthprobeInstrumentEditor::DepthprobeInstrumentEditor(QWidget* parent,
DepthprobeInstrumentItem* instrument) DepthprobeInstrumentItem* instrument,
InstrumentsEditController* ec)
: QWidget(parent) : QWidget(parent)
, m_ec(ec, instrument)
{ {
ASSERT(instrument); ASSERT(instrument);
auto* layout = new QVBoxLayout(this); auto* layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0); layout->setContentsMargins(0, 0, 0, 0);
auto* parametersGroupBox = new QGroupBox(this); auto* beamEditor = new SpecularBeamEditor(this, instrument->beamItem(), &m_ec);
parametersGroupBox->setTitle("Beam and scan parameters"); layout->addWidget(beamEditor);
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* depthAxisEditor = new AxisPropertyForm(this, "Depth axis", &instrument->zAxis(), auto* depthAxisEditor = new AxisPropertyForm(this, "Depth axis", &instrument->zAxis(),
"Number of points in scan across sample bulk"); "Number of points in scan across sample bulk");
vLayout->addWidget(depthAxisEditor); layout->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->addStretch(); layout->addStretch();
connect(m_wavelengthEditor, &DistributionEditor::distributionChanged, this, connect(beamEditor, &SpecularBeamEditor::dataChanged, this,
&DepthprobeInstrumentEditor::dataChanged);
connect(inclinationEditor, &AlphaScanEditor::dataChanged, this,
&DepthprobeInstrumentEditor::dataChanged); &DepthprobeInstrumentEditor::dataChanged);
connect(depthAxisEditor, &AxisPropertyForm::dataChanged, this, connect(depthAxisEditor, &AxisPropertyForm::dataChanged, this,
&DepthprobeInstrumentEditor::dataChanged); &DepthprobeInstrumentEditor::dataChanged);
......
...@@ -15,18 +15,24 @@ ...@@ -15,18 +15,24 @@
#ifndef BORNAGAIN_GUI_VIEW_INSTRUMENT_DEPTHPROBEINSTRUMENTEDITOR_H #ifndef BORNAGAIN_GUI_VIEW_INSTRUMENT_DEPTHPROBEINSTRUMENTEDITOR_H
#define BORNAGAIN_GUI_VIEW_INSTRUMENT_DEPTHPROBEINSTRUMENTEDITOR_H #define BORNAGAIN_GUI_VIEW_INSTRUMENT_DEPTHPROBEINSTRUMENTEDITOR_H
#include "GUI/View/Instrument/InstrumentEditController.h"
#include <QWidget> #include <QWidget>
class InstrumentsEditController;
class DepthprobeInstrumentItem; class DepthprobeInstrumentItem;
class DepthprobeInstrumentEditor : public QWidget { class DepthprobeInstrumentEditor : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
DepthprobeInstrumentEditor(QWidget* parent, DepthprobeInstrumentItem* item); DepthprobeInstrumentEditor(QWidget* parent, DepthprobeInstrumentItem* item,
InstrumentsEditController* ec);
signals: signals:
void dataChanged(); void dataChanged();
private:
InstrumentEditController m_ec;
}; };
#endif // BORNAGAIN_GUI_VIEW_INSTRUMENT_DEPTHPROBEINSTRUMENTEDITOR_H #endif // BORNAGAIN_GUI_VIEW_INSTRUMENT_DEPTHPROBEINSTRUMENTEDITOR_H
...@@ -215,9 +215,9 @@ void InstrumentLibraryEditor::createWidgetsForCurrentInstrument() ...@@ -215,9 +215,9 @@ void InstrumentLibraryEditor::createWidgetsForCurrentInstrument()
GroupBoxCollapser::installIntoGroupBox(g); GroupBoxCollapser::installIntoGroupBox(g);
auto* ec = m_instrumentLibrary->editController();
if (auto* sp = dynamic_cast<SpecularInstrumentItem*>(currentInstrument)) { if (auto* sp = dynamic_cast<SpecularInstrumentItem*>(currentInstrument)) {
auto* editor = new SpecularInstrumentEditor(m_ui->scrollArea, sp, auto* editor = new SpecularInstrumentEditor(m_ui->scrollArea, sp, ec);
m_instrumentLibrary->editController());
connect(editor, &SpecularInstrumentEditor::dataChanged, this, connect(editor, &SpecularInstrumentEditor::dataChanged, this,
&InstrumentLibraryEditor::onInstrumentChangedByEditor); &InstrumentLibraryEditor::onInstrumentChangedByEditor);
layout->addWidget(editor); layout->addWidget(editor);
...@@ -232,7 +232,7 @@ void InstrumentLibraryEditor::createWidgetsForCurrentInstrument() ...@@ -232,7 +232,7 @@ void InstrumentLibraryEditor::createWidgetsForCurrentInstrument()
&InstrumentLibraryEditor::onInstrumentChangedByEditor); &InstrumentLibraryEditor::onInstrumentChangedByEditor);
layout->addWidget(editor); layout->addWidget(editor);
} else if (auto* dp = dynamic_cast<DepthprobeInstrumentItem*>(currentInstrument)) { } 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, connect(editor, &DepthprobeInstrumentEditor::dataChanged, this,
&InstrumentLibraryEditor::onInstrumentChangedByEditor); &InstrumentLibraryEditor::onInstrumentChangedByEditor);
layout->addWidget(editor); layout->addWidget(editor);
......
...@@ -144,7 +144,7 @@ void InstrumentView::createWidgetsForCurrentInstrument() ...@@ -144,7 +144,7 @@ void InstrumentView::createWidgetsForCurrentInstrument()
&InstrumentView::onInstrumentChangedByEditor); &InstrumentView::onInstrumentChangedByEditor);
layout->addWidget(editor); layout->addWidget(editor);
} else if (auto* dp = dynamic_cast<DepthprobeInstrumentItem*>(currentInstrument)) { } 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, connect(editor, &DepthprobeInstrumentEditor::dataChanged, this,
&InstrumentView::onInstrumentChangedByEditor); &InstrumentView::onInstrumentChangedByEditor);
layout->addWidget(editor); 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