BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
RectangularDetectorEditor Class Reference
Inheritance diagram for RectangularDetectorEditor:
[legend]
Collaboration diagram for RectangularDetectorEditor:
[legend]

Public Slots

void onPropertyChanged (const QString &propertyName)
 

Public Member Functions

 RectangularDetectorEditor (QWidget *parent=nullptr)
 
virtual QList< QAction * > actionList ()
 
SessionItemcurrentItem ()
 
const SessionItemcurrentItem () const
 
virtual void setItem (SessionItem *item)
 

Protected Member Functions

RectangularDetectorItemdetectorItem ()
 
virtual void hideEvent (QHideEvent *)
 
virtual void showEvent (QShowEvent *)
 
void subscribeToItem ()
 
void unsubscribeFromItem ()
 

Private Member Functions

void create_editors ()
 
void init_alignment_editors ()
 
void init_editors ()
 

Private Attributes

ComponentEditorm_alignmentEditor
 
ComponentEditorm_directionEditor
 
QGridLayout * m_gridLayout
 
SessionItemControllerm_itemController
 
ComponentEditorm_normalEditor
 
ComponentEditorm_positionsEditor
 
ComponentEditorm_resolutionFunctionEditor
 
ComponentEditorm_xAxisEditor
 
ComponentEditorm_yAxisEditor
 

Detailed Description

Definition at line 23 of file RectangularDetectorEditor.h.

Constructor & Destructor Documentation

◆ RectangularDetectorEditor()

RectangularDetectorEditor::RectangularDetectorEditor ( QWidget *  parent = nullptr)

Definition at line 22 of file RectangularDetectorEditor.cpp.

23  : SessionItemWidget(parent)
24  , m_xAxisEditor(nullptr)
25  , m_yAxisEditor(nullptr)
27  , m_alignmentEditor(nullptr)
28  , m_positionsEditor(nullptr)
29  , m_normalEditor(nullptr)
30  , m_directionEditor(nullptr)
31  , m_gridLayout(new QGridLayout)
32 {
34 
35  auto mainLayout = new QVBoxLayout;
36  mainLayout->setContentsMargins(0, 0, 0, 0);
37  mainLayout->addLayout(m_gridLayout);
38  mainLayout->addStretch();
39  setLayout(mainLayout);
40 }
ComponentEditor * m_resolutionFunctionEditor
SessionItemWidget(QWidget *parent=0)

References create_editors(), and m_gridLayout.

Here is the call graph for this function:

Member Function Documentation

◆ actionList()

QList< QAction * > SessionItemWidget::actionList ( )
virtualinherited

◆ create_editors()

void RectangularDetectorEditor::create_editors ( )
private

Definition at line 74 of file RectangularDetectorEditor.cpp.

75 {
76  // axes and resolution function editors
78  m_gridLayout->addWidget(m_xAxisEditor, 1, 0);
79 
81  m_gridLayout->addWidget(m_yAxisEditor, 1, 1);
82 
84  new ComponentEditor(ComponentEditor::GroupWidget, "Resolution function");
85  m_gridLayout->addWidget(m_resolutionFunctionEditor, 1, 2);
86 
87  // alignment selector editors
89  m_gridLayout->addWidget(m_alignmentEditor, 2, 0);
90 
91  // editors for various positions
93  m_gridLayout->addWidget(m_positionsEditor, 3, 0);
94 
96  m_gridLayout->addWidget(m_normalEditor, 3, 1);
97 
99  m_gridLayout->addWidget(m_directionEditor, 3, 2);
100 }
Component editor for SessionItem.

References ComponentEditor::GroupWidget, m_alignmentEditor, m_directionEditor, m_gridLayout, m_normalEditor, m_positionsEditor, m_resolutionFunctionEditor, m_xAxisEditor, m_yAxisEditor, and ComponentEditor::PlainWidget.

Referenced by RectangularDetectorEditor().

◆ currentItem() [1/2]

SessionItem * SessionItemWidget::currentItem ( )
inherited

Definition at line 41 of file SessionItemWidget.cpp.

42 {
43  return const_cast<SessionItem*>(static_cast<const SessionItemWidget*>(this)->currentItem());
44 }
The SessionItemWidget class is a base for all widgets representing the content of SessionItem.
SessionItem * currentItem()

Referenced by detectorItem(), SphericalDetectorEditor::detectorItem(), FitFlowWidget::fitSuiteItem(), DistributionEditor::groupItem(), DepthProbeInstrumentEditor::instrumentItem(), EnvironmentEditor::instrumentItem(), GISASBeamEditor::instrumentItem(), GISASDetectorEditor::instrumentItem(), GISASInstrumentEditor::instrumentItem(), OffSpecularBeamEditor::instrumentItem(), OffSpecularInstrumentEditor::instrumentItem(), PolarizationAnalysisEditor::instrumentItem(), SpecularBeamEditor::instrumentItem(), SpecularInstrumentEditor::instrumentItem(), RealDataMaskWidget::intensityDataItem(), IntensityDataCanvas::intensityDataItem(), IntensityDataProjectionsWidget::intensityDataItem(), IntensityDataWidget::intensityDataItem(), ProjectionsPlot::intensityItem(), ColorMap::intensityItem(), DetectorPresenter::itemPresentation(), InstrumentPresenter::itemPresentation(), JobResultsPresenter::itemPresentation(), FitComparisonWidget::jobItem(), FitComparisonWidget1D::jobItem(), FitParameterWidget::jobItem(), RunFitControlWidget::jobItem(), JobPropertiesWidget::jobItem(), ParameterTuningWidget::jobItem(), SpecularDataImportWidget::realDataItem(), ItemComboWidget::setPresentation(), JobResultsPresenter::setPresentation(), SpecularDataCanvas::specularDataItem(), SpecularDataImportWidget::specularDataItem(), SpecularDataWidget::specularDataItem(), SpecularPlot::specularItem(), ItemComboWidget::subscribeToItem(), DistributionEditor::subscribeToItem(), GISASDetectorEditor::subscribeToItem(), PolarizationAnalysisEditor::subscribeToItem(), IntensityDataPropertyWidget::subscribeToItem(), JobPropertiesWidget::subscribeToItem(), ProjectionsPropertyPanel::subscribeToItem(), ProjectionsPlot::unsubscribeFromChildren(), and Plot1D::viewItem().

◆ currentItem() [2/2]

const SessionItem * SessionItemWidget::currentItem ( ) const
inherited

Definition at line 46 of file SessionItemWidget.cpp.

47 {
48  return m_itemController->currentItem();
49 }
SessionItemController * m_itemController

References SessionItemController::currentItem(), and SessionItemWidget::m_itemController.

Here is the call graph for this function:

◆ detectorItem()

RectangularDetectorItem * RectangularDetectorEditor::detectorItem ( )
protected

Definition at line 67 of file RectangularDetectorEditor.cpp.

68 {
69  auto result = dynamic_cast<RectangularDetectorItem*>(currentItem());
70  ASSERT(result);
71  return result;
72 }
#define ASSERT(condition)
Definition: Assert.h:31

References ASSERT, and SessionItemWidget::currentItem().

Referenced by init_alignment_editors(), init_editors(), and subscribeToItem().

Here is the call graph for this function:

◆ hideEvent()

void SessionItemWidget::hideEvent ( QHideEvent *  )
protectedvirtualinherited

Definition at line 56 of file SessionItemWidget.cpp.

57 {
59 }
void unsubscribe()
Fully unsubscribes the parent from listening item's signals.

References SessionItemWidget::m_itemController, and SessionItemController::unsubscribe().

Here is the call graph for this function:

◆ init_alignment_editors()

void RectangularDetectorEditor::init_alignment_editors ( )
private

Definition at line 120 of file RectangularDetectorEditor.cpp.

121 {
123  m_positionsEditor->hide();
124 
126  m_normalEditor->hide();
127 
129  m_directionEditor->hide();
130 
131  ComboProperty alignment =
133 
134  if (alignment.getValue() == "Generic") {
135  m_positionsEditor->show();
136  m_normalEditor->show();
137  m_directionEditor->show();
138 
141 
142  auto normalVectorItem = detectorItem()->getItem(RectangularDetectorItem::P_NORMAL);
143  m_normalEditor->setItem(normalVectorItem);
144 
145  auto directionVectorItem = detectorItem()->getItem(RectangularDetectorItem::P_DIRECTION);
146  m_directionEditor->setItem(directionVectorItem);
147 
148  } else if (alignment.getValue() == "Perpendicular to direct beam"
149  || alignment.getValue() == "Perpendicular to reflected beam (dpos)") {
150  m_positionsEditor->show();
154 
155  } else if (alignment.getValue() == "Perpendicular to sample x-axis"
156  || alignment.getValue() == "Perpendicular to reflected beam") {
157  m_positionsEditor->show();
158 
162  }
163 }
Custom property to define list of string values with multiple selections.
Definition: ComboProperty.h:25
QString getValue() const
void addItem(SessionItem *item)
void setItem(SessionItem *item)
RectangularDetectorItem * detectorItem()
static const QString P_DIRECTION
static const QString P_NORMAL
static const QString P_DBEAM_V0
static const QString P_DISTANCE
static const QString P_ALIGNMENT
static const QString P_DBEAM_U0
QVariant getItemValue(const QString &tag) const
Directly access value of item under given tag.
SessionItem * getItem(const QString &tag="", int row=0) const
Returns item in given row of given tag.

References ComponentEditor::addItem(), ComponentEditor::clearEditor(), detectorItem(), SessionItem::getItem(), SessionItem::getItemValue(), ComboProperty::getValue(), m_directionEditor, m_normalEditor, m_positionsEditor, RectangularDetectorItem::P_ALIGNMENT, RectangularDetectorItem::P_DBEAM_U0, RectangularDetectorItem::P_DBEAM_V0, RectangularDetectorItem::P_DIRECTION, RectangularDetectorItem::P_DISTANCE, RectangularDetectorItem::P_NORMAL, RectangularDetectorItem::P_U0, RectangularDetectorItem::P_V0, and ComponentEditor::setItem().

Referenced by init_editors(), and onPropertyChanged().

Here is the call graph for this function:

◆ init_editors()

void RectangularDetectorEditor::init_editors ( )
private

Definition at line 102 of file RectangularDetectorEditor.cpp.

References ComponentEditor::clearEditor(), detectorItem(), SessionItem::getItem(), init_alignment_editors(), m_alignmentEditor, m_resolutionFunctionEditor, m_xAxisEditor, m_yAxisEditor, RectangularDetectorItem::P_ALIGNMENT, DetectorItem::P_RESOLUTION_FUNCTION, and ComponentEditor::setItem().

Referenced by subscribeToItem().

Here is the call graph for this function:

◆ onPropertyChanged

void RectangularDetectorEditor::onPropertyChanged ( const QString &  propertyName)
slot

Definition at line 42 of file RectangularDetectorEditor.cpp.

43 {
44  if (propertyName == RectangularDetectorItem::P_ALIGNMENT)
46 }

References init_alignment_editors(), and RectangularDetectorItem::P_ALIGNMENT.

Referenced by subscribeToItem().

Here is the call graph for this function:

◆ setItem()

void SessionItemWidget::setItem ( SessionItem item)
virtualinherited

Reimplemented in SpecularPlotCanvas, SpecularDataImportWidget, SpecularDataWidget, IntensityDataWidget, SpecularDataCanvas, ProjectionsWidget, IntensityDataCanvas, ColorMapCanvas, and Plot1DCanvas.

Definition at line 28 of file SessionItemWidget.cpp.

29 {
31 
32  if (isVisible())
34 }
void setItem(SessionItem *item)
void subscribe()
Subscribe parent to item's signals.

References SessionItemWidget::m_itemController, SessionItemController::setItem(), and SessionItemController::subscribe().

Referenced by IntensityDataWidget::onFFTAction(), JobSelectorWidget::onSelectionChanged(), ProjectionsEditor::resetContext(), ProjectionsEditor::setContext(), MaskGraphicsProxy::setIntensityItem(), FitSessionWidget::setItem(), Plot1DCanvas::setItem(), InstrumentEditorWidget::setItem(), ColorMapCanvas::setItem(), IntensityDataCanvas::setItem(), ProjectionsWidget::setItem(), SpecularDataCanvas::setItem(), DistributionDialog::setItem(), IntensityDataWidget::setItem(), SpecularDataWidget::setItem(), SpecularDataImportWidget::setItem(), SpecularPlotCanvas::setItem(), ItemComboWidget::setPresentation(), GISASInstrumentEditor::subscribeToItem(), OffSpecularInstrumentEditor::subscribeToItem(), SpecularInstrumentEditor::subscribeToItem(), FitComparisonWidget::subscribeToItem(), FitComparisonWidget1D::subscribeToItem(), and GISASDetectorEditor::updateDetectorPresenter().

Here is the call graph for this function:

◆ showEvent()

void SessionItemWidget::showEvent ( QShowEvent *  )
protectedvirtualinherited

Definition at line 51 of file SessionItemWidget.cpp.

52 {
54 }

References SessionItemWidget::m_itemController, and SessionItemController::subscribe().

Here is the call graph for this function:

◆ subscribeToItem()

void RectangularDetectorEditor::subscribeToItem ( )
protectedvirtual

Reimplemented from SessionItemWidget.

Definition at line 48 of file RectangularDetectorEditor.cpp.

49 {
51  [this](const QString& name) { onPropertyChanged(name); }, this);
52 
53  init_editors();
54 }
void setOnPropertyChange(std::function< void(QString)> f, const void *caller=0)
Definition: ModelMapper.cpp:35
void onPropertyChanged(const QString &propertyName)
ModelMapper * mapper()
Returns the current model mapper of this item. Creates new one if necessary.
QString const & name(EShape k)
Definition: particles.cpp:21

References detectorItem(), init_editors(), SessionItem::mapper(), RealSpace::Particles::name(), onPropertyChanged(), and ModelMapper::setOnPropertyChange().

Here is the call graph for this function:

◆ unsubscribeFromItem()

void RectangularDetectorEditor::unsubscribeFromItem ( )
protectedvirtual

Reimplemented from SessionItemWidget.

Definition at line 56 of file RectangularDetectorEditor.cpp.

References ComponentEditor::clearEditor(), m_alignmentEditor, m_directionEditor, m_normalEditor, m_positionsEditor, m_resolutionFunctionEditor, m_xAxisEditor, and m_yAxisEditor.

Here is the call graph for this function:

Member Data Documentation

◆ m_alignmentEditor

ComponentEditor* RectangularDetectorEditor::m_alignmentEditor
private

Definition at line 45 of file RectangularDetectorEditor.h.

Referenced by create_editors(), init_editors(), and unsubscribeFromItem().

◆ m_directionEditor

ComponentEditor* RectangularDetectorEditor::m_directionEditor
private

◆ m_gridLayout

QGridLayout* RectangularDetectorEditor::m_gridLayout
private

Definition at line 49 of file RectangularDetectorEditor.h.

Referenced by RectangularDetectorEditor(), and create_editors().

◆ m_itemController

◆ m_normalEditor

ComponentEditor* RectangularDetectorEditor::m_normalEditor
private

◆ m_positionsEditor

ComponentEditor* RectangularDetectorEditor::m_positionsEditor
private

◆ m_resolutionFunctionEditor

ComponentEditor* RectangularDetectorEditor::m_resolutionFunctionEditor
private

Definition at line 44 of file RectangularDetectorEditor.h.

Referenced by create_editors(), init_editors(), and unsubscribeFromItem().

◆ m_xAxisEditor

ComponentEditor* RectangularDetectorEditor::m_xAxisEditor
private

Definition at line 42 of file RectangularDetectorEditor.h.

Referenced by create_editors(), init_editors(), and unsubscribeFromItem().

◆ m_yAxisEditor

ComponentEditor* RectangularDetectorEditor::m_yAxisEditor
private

Definition at line 43 of file RectangularDetectorEditor.h.

Referenced by create_editors(), init_editors(), and unsubscribeFromItem().


The documentation for this class was generated from the following files: