BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
DistributionEditor Class Reference

Description

DistributionSelector as above but contained in a GroupBox with a title and a button to open the distribution dialog.

Definition at line 85 of file DistributionEditor.h.

Inheritance diagram for DistributionEditor:
[legend]
Collaboration diagram for DistributionEditor:
[legend]

Signals

void distributionChanged ()
 

Public Member Functions

 DistributionEditor (const QString &title, const std::optional< MeanConfig > &mean_config, GUI::ID::Distributions distributions, QWidget *parent, BeamDistributionItem *item)
 
void updateData ()
 Update UI from data. More...
 

Private Member Functions

void updatePlot ()
 

Private Attributes

DistributionPlotm_plot
 
DistributionSelectorm_selector
 

Constructor & Destructor Documentation

◆ DistributionEditor()

DistributionEditor::DistributionEditor ( const QString &  title,
const std::optional< MeanConfig > &  mean_config,
GUI::ID::Distributions  distributions,
QWidget *  parent,
BeamDistributionItem item 
)

Definition at line 165 of file DistributionEditor.cpp.

169  : QGroupBox(title, parent)
170 {
171  setProperty("subgroup", true); // for stylesheet addressing
172  auto* hLayout = new QHBoxLayout(this);
173  m_selector = new DistributionSelector(mean_config, distributions, this, item);
174  hLayout->addWidget(m_selector);
175  hLayout->setSpacing(50);
176 
177  m_plot = new DistributionPlot(this);
178  m_plot->setFixedSize(280, 170);
179  m_plot->setShowMouseCoords(false);
180  hLayout->addWidget(m_plot);
181  hLayout->addStretch(1);
182 
184 
189 
190  updatePlot();
191 }
DistributionPlot * m_plot
DistributionSelector * m_selector
void distributionChanged()
The DistributionPlot class plots 1d functions corresponding to domain's Distribution1D.
void setShowMouseCoords(bool b)
Widget for selecting a distribution (combo box) and input of the corresponding values with respect to...
static GroupBoxCollapser * installIntoGroupBox(QGroupBox *groupBox, bool expanded=true)

References DistributionSelector::distributionChanged(), distributionChanged(), GroupBoxCollapser::installIntoGroupBox(), m_plot, m_selector, DistributionPlot::setShowMouseCoords(), and updatePlot().

Here is the call graph for this function:

Member Function Documentation

◆ distributionChanged

◆ updateData()

void DistributionEditor::updateData ( )

Update UI from data.

Definition at line 193 of file DistributionEditor.cpp.

194 {
195  m_selector->refresh();
196 }

References m_selector, and DistributionSelector::refresh().

Referenced by SpecularBeamEditor::SpecularBeamEditor().

Here is the call graph for this function:

◆ updatePlot()

void DistributionEditor::updatePlot ( )
private

Definition at line 198 of file DistributionEditor.cpp.

199 {
200  auto* d = m_selector->item()->distribution();
201  m_plot->setVisible(!dynamic_cast<const DistributionNoneItem*>(d));
202  m_plot->setItem(d);
203  m_plot->plotItem();
204 }
DistributionItem * distribution() const
void setItem(DistributionItem *item)
BeamDistributionItem * item() const

References BeamDistributionItem::distribution(), DistributionSelector::item(), m_plot, m_selector, DistributionPlot::plotItem(), and DistributionPlot::setItem().

Referenced by DistributionEditor().

Here is the call graph for this function:

Member Data Documentation

◆ m_plot

DistributionPlot* DistributionEditor::m_plot
private

Definition at line 103 of file DistributionEditor.h.

Referenced by DistributionEditor(), and updatePlot().

◆ m_selector

DistributionSelector* DistributionEditor::m_selector
private

Definition at line 102 of file DistributionEditor.h.

Referenced by DistributionEditor(), updateData(), and updatePlot().


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