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

+ class OffspecDetectorEditor

parent 10a38fab
No related branches found
No related tags found
1 merge request!1373Offspecular instrument always has spherical detector
Pipeline #90048 failed
...@@ -45,21 +45,6 @@ DetectorEditor::DetectorEditor(QWidget* parent, GISASInstrumentItem* instrument) ...@@ -45,21 +45,6 @@ DetectorEditor::DetectorEditor(QWidget* parent, GISASInstrumentItem* instrument)
createDetectorWidgets(); createDetectorWidgets();
} }
DetectorEditor::DetectorEditor(QWidget* parent, OffspecInstrumentItem* instrument)
: QGroupBox("Detector parameters", parent)
, m_instrument(instrument)
{
ASSERT(instrument);
m_formLayout = new QFormLayout(this);
auto* collapser = GroupBoxCollapser::installIntoGroupBox(this);
collapser->setExpanded(instrument->isExpandDetector());
connect(collapser, &GroupBoxCollapser::toggled, this,
[instrument](bool b) { instrument->setExpandDetector(b); });
createDetectorWidgets();
}
void DetectorEditor::createDetectorWidgets() void DetectorEditor::createDetectorWidgets()
{ {
while (m_formLayout->rowCount() > 1) while (m_formLayout->rowCount() > 1)
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
class Instrument2DItem; class Instrument2DItem;
class GISASInstrumentItem; class GISASInstrumentItem;
class OffspecInstrumentItem;
class QFormLayout; class QFormLayout;
//! Contains stack of detector editors and the logic to show proper editor for certain type //! Contains stack of detector editors and the logic to show proper editor for certain type
...@@ -30,7 +29,6 @@ class DetectorEditor : public QGroupBox { ...@@ -30,7 +29,6 @@ class DetectorEditor : public QGroupBox {
public: public:
DetectorEditor(QWidget* parent, GISASInstrumentItem* item); DetectorEditor(QWidget* parent, GISASInstrumentItem* item);
DetectorEditor(QWidget* parent, OffspecInstrumentItem* item);
signals: signals:
void dataChanged(); void dataChanged();
...@@ -38,7 +36,7 @@ signals: ...@@ -38,7 +36,7 @@ signals:
private: private:
void createDetectorWidgets(); void createDetectorWidgets();
Instrument2DItem* m_instrument; GISASInstrumentItem* m_instrument;
QFormLayout* m_formLayout; QFormLayout* m_formLayout;
}; };
......
// ************************************************************************************************
//
// BornAgain: simulate and fit reflection and scattering
//
//! @file GUI/View/Instrument/OffspecDetectorEditor.cpp
//! @brief Implements class DetectorEditor
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
// ************************************************************************************************
#include "GUI/View/Instrument/OffspecDetectorEditor.h"
#include "GUI/Model/Device/InstrumentItems.h"
#include "GUI/Model/Device/RectangularDetectorItem.h"
#include "GUI/Model/Device/SphericalDetectorItem.h"
#include "GUI/View/Instrument/RectangularDetectorEditor.h"
#include "GUI/View/Instrument/SphericalDetectorEditor.h"
#include "GUI/View/Tool/GroupBoxCollapser.h"
#include "GUI/View/Tool/WidgetUtils.h"
#include <QFormLayout>
OffspecDetectorEditor::OffspecDetectorEditor(QWidget* parent, OffspecInstrumentItem* instrument)
: QGroupBox("Detector parameters", parent)
, m_instrument(instrument)
{
ASSERT(instrument);
m_formLayout = new QFormLayout(this);
auto* collapser = GroupBoxCollapser::installIntoGroupBox(this);
collapser->setExpanded(instrument->isExpandDetector());
connect(collapser, &GroupBoxCollapser::toggled, this,
[instrument](bool b) { instrument->setExpandDetector(b); });
createDetectorWidgets();
}
void OffspecDetectorEditor::createDetectorWidgets()
{
while (m_formLayout->rowCount() > 1)
m_formLayout->removeRow(1);
SphericalDetectorItem* detectorItem = m_instrument->detectorItem();
auto* editor = new SphericalDetectorEditor(this, detectorItem);
m_formLayout->addRow(editor);
connect(editor, &SphericalDetectorEditor::dataChanged, this,
&OffspecDetectorEditor::dataChanged);
}
// ************************************************************************************************
//
// BornAgain: simulate and fit reflection and scattering
//
//! @file GUI/View/Instrument/OffspecDetectorEditor.h
//! @brief Defines class DetectorEditor
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
// ************************************************************************************************
#ifndef BORNAGAIN_GUI_VIEW_INSTRUMENT_OFFSPECDETECTOREDITOR_H
#define BORNAGAIN_GUI_VIEW_INSTRUMENT_OFFSPECDETECTOREDITOR_H
#include <QGroupBox>
class Instrument2DItem;
class OffspecInstrumentItem;
class QFormLayout;
//! Contains stack of detector editors and the logic to show proper editor for certain type
//! of detector item (SphericalDetectorEditor or RectangularDetectorEditor).
class OffspecDetectorEditor : public QGroupBox {
Q_OBJECT
public:
OffspecDetectorEditor(QWidget* parent, OffspecInstrumentItem* item);
signals:
void dataChanged();
private:
void createDetectorWidgets();
OffspecInstrumentItem* m_instrument;
QFormLayout* m_formLayout;
};
#endif // BORNAGAIN_GUI_VIEW_INSTRUMENT_OFFSPECDETECTOREDITOR_H
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
#include "GUI/View/Instrument/OffspecInstrumentEditor.h" #include "GUI/View/Instrument/OffspecInstrumentEditor.h"
#include "GUI/Model/Device/InstrumentItems.h" #include "GUI/Model/Device/InstrumentItems.h"
#include "GUI/View/Instrument/DetectorEditor.h"
#include "GUI/View/Instrument/OffspecBeamEditor.h" #include "GUI/View/Instrument/OffspecBeamEditor.h"
#include "GUI/View/Instrument/OffspecDetectorEditor.h"
#include "GUI/View/Instrument/PolarizationAnalysisEditor.h" #include "GUI/View/Instrument/PolarizationAnalysisEditor.h"
#include <QVBoxLayout> #include <QVBoxLayout>
...@@ -30,7 +30,7 @@ OffspecInstrumentEditor::OffspecInstrumentEditor(QWidget* parent, OffspecInstrum ...@@ -30,7 +30,7 @@ OffspecInstrumentEditor::OffspecInstrumentEditor(QWidget* parent, OffspecInstrum
auto* beamEditor = new OffspecBeamEditor(this, instrument); auto* beamEditor = new OffspecBeamEditor(this, instrument);
layout->addWidget(beamEditor); layout->addWidget(beamEditor);
auto* detectorEditor = new DetectorEditor(this, instrument); auto* detectorEditor = new OffspecDetectorEditor(this, instrument);
layout->addWidget(detectorEditor); layout->addWidget(detectorEditor);
auto* polMatricesAnalysisEditor = new PolarizationAnalysisEditor(this, instrument); auto* polMatricesAnalysisEditor = new PolarizationAnalysisEditor(this, instrument);
...@@ -40,7 +40,7 @@ OffspecInstrumentEditor::OffspecInstrumentEditor(QWidget* parent, OffspecInstrum ...@@ -40,7 +40,7 @@ OffspecInstrumentEditor::OffspecInstrumentEditor(QWidget* parent, OffspecInstrum
connect(beamEditor, &OffspecBeamEditor::dataChanged, this, connect(beamEditor, &OffspecBeamEditor::dataChanged, this,
&OffspecInstrumentEditor::dataChanged); &OffspecInstrumentEditor::dataChanged);
connect(detectorEditor, &DetectorEditor::dataChanged, this, connect(detectorEditor, &OffspecDetectorEditor::dataChanged, this,
&OffspecInstrumentEditor::dataChanged); &OffspecInstrumentEditor::dataChanged);
connect(polMatricesAnalysisEditor, &PolarizationAnalysisEditor::dataChanged, this, connect(polMatricesAnalysisEditor, &PolarizationAnalysisEditor::dataChanged, this,
&OffspecInstrumentEditor::dataChanged); &OffspecInstrumentEditor::dataChanged);
......
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