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

Description

Form for editing lattice type values.

Definition at line 27 of file LatticeTypeSelectionForm.h.

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

Public Member Functions

 LatticeTypeSelectionForm (QWidget *parent, Interference2DAbstractLatticeItem *interferenceItem, SampleEditorController *ec)
 
virtual void createContent () override
 
Interference2DAbstractLatticeIteminterferenceItem () const
 
void onIntegrateOverXiChanged ()
 
void updateXiVisibility ()
 

Protected Member Functions

template<typename T >
void initUI (const SelectionDescriptor< T > &d)
 

Protected Attributes

QComboBox * m_combo
 
SampleEditorControllerm_ec
 
QGridLayout * m_gridLayout
 

Private Member Functions

void clear ()
 Remove all descriptors from the layout. More...
 

Private Attributes

QCheckBox * m_integrateOverXiCheckBox
 
Interference2DAbstractLatticeItemm_interferenceItem
 
QLabel * m_xiLabel
 

Constructor & Destructor Documentation

◆ LatticeTypeSelectionForm()

LatticeTypeSelectionForm::LatticeTypeSelectionForm ( QWidget *  parent,
Interference2DAbstractLatticeItem interferenceItem,
SampleEditorController ec 
)

Definition at line 21 of file LatticeTypeSelectionForm.cpp.

24  : AbstractSelectionContainerForm(parent, ec)
26 {
28 }
AbstractSelectionContainerForm(QWidget *parent, SampleEditorController *ec)
void initUI(const SelectionDescriptor< T > &d)
SelectionDescriptor< Lattice2DItem * > latticeType() const
Interference2DAbstractLatticeItem * m_interferenceItem
Interference2DAbstractLatticeItem * interferenceItem() const

References AbstractSelectionContainerForm::initUI(), interferenceItem(), and Interference2DAbstractLatticeItem::latticeType().

Here is the call graph for this function:

Member Function Documentation

◆ clear()

void AbstractSelectionContainerForm::clear ( )
inlineprivateinherited

Remove all descriptors from the layout.

Definition at line 66 of file SelectionContainerForm.h.

67  {
68  auto* layoutItemOfComboBox = m_gridLayout->itemAtPosition(1, 0);
69  m_gridLayout->takeAt(m_gridLayout->indexOf(layoutItemOfComboBox));
71  m_gridLayout->addWidget(layoutItemOfComboBox->widget(), 1, 0);
72  }
void clearLayout(QLayout *layout, bool deleteWidgets=true)
Removes content from box layout.
Definition: LayoutUtils.cpp:68

References GUI::Util::Layout::clearLayout(), and AbstractSelectionContainerForm::m_gridLayout.

Referenced by AbstractSelectionContainerForm::initUI().

Here is the call graph for this function:

◆ createContent()

void LatticeTypeSelectionForm::createContent ( )
overridevirtual

Implements AbstractSelectionContainerForm.

Definition at line 30 of file LatticeTypeSelectionForm.cpp.

31 {
32  auto* currentLatticeType = m_interferenceItem->latticeType().currentItem();
33  const auto valueDescriptors = currentLatticeType->geometryValues(false);
34  const bool vertical = valueDescriptors.size() > 2;
35 
36  const auto onValueChange = [=](double newValue, DoubleDescriptor d) {
38  };
39  LayerEditorUtils::addMultiPropertyToGrid(m_gridLayout, 1, valueDescriptors, onValueChange,
40  vertical, false);
41 
42  m_integrateOverXiCheckBox = new QCheckBox("Integrate over Xi", this);
44  m_gridLayout->addWidget(m_integrateOverXiCheckBox, 1, m_gridLayout->columnCount());
45  connect(m_integrateOverXiCheckBox, &QCheckBox::stateChanged,
46  [=] { m_ec->setIntegrateOverXi(this, m_integrateOverXiCheckBox->isChecked()); });
47 
48  const int colOfXiLabel = m_gridLayout->columnCount();
50  {currentLatticeType->latticeRotationAngle()},
51  onValueChange, vertical, true);
52  m_xiLabel = qobject_cast<QLabel*>(
53  m_gridLayout->itemAtPosition(vertical ? 0 : 1, colOfXiLabel)->widget());
54  ASSERT(m_xiLabel);
55 
57 }
Describes properties of a double value which are necessary to allow GUI representation,...
void setIntegrateOverXi(LatticeTypeSelectionForm *widget, bool newValue)
void setDensityRelatedValue(InterferenceItem *interferenceItem, double newValue, DoubleDescriptor d)
Set an interference function's value which affects the total particle density of the containing parti...
void addMultiPropertyToGrid(QGridLayout *m_gridLayout, int firstCol, const DoubleDescriptors &valueDescriptors, SampleEditorController *ec, bool vertically, bool addSpacer)
Create DoubleSpinBoxes for the DoubeDescriptors and connect them to SampleEditorController::setDouble...

References LayerEditorUtils::addMultiPropertyToGrid(), Interference2DAbstractLatticeItem::latticeType(), AbstractSelectionContainerForm::m_ec, AbstractSelectionContainerForm::m_gridLayout, m_integrateOverXiCheckBox, m_interferenceItem, m_xiLabel, SampleEditorController::setDensityRelatedValue(), SampleEditorController::setIntegrateOverXi(), updateXiVisibility(), and Interference2DAbstractLatticeItem::xiIntegration().

Here is the call graph for this function:

◆ initUI()

template<typename T >
void AbstractSelectionContainerForm::initUI ( const SelectionDescriptor< T > &  d)
inlineprotectedinherited

Definition at line 42 of file SelectionContainerForm.h.

43  {
44  m_gridLayout = new QGridLayout(this);
45  m_gridLayout->setContentsMargins(0, 0, 0, 0);
46  m_gridLayout->setSpacing(6);
47 
48  m_combo = new QComboBox;
50  m_combo->addItems(d.options);
51  m_combo->setCurrentIndex(d.currentIndex());
52  m_combo->setMaxVisibleItems(m_combo->count());
53 
54  QObject::connect(m_combo, QOverload<int>::of(&QComboBox::currentIndexChanged),
55  [=](int current) {
56  clear();
57  m_ec->setCurrentIndex(this, current, d);
58  });
59 
60  m_gridLayout->addWidget(m_combo, 1, 0);
61  createContent();
62  }
void clear()
Remove all descriptors from the layout.
virtual void createContent()=0
void setCurrentIndex(AbstractSelectionContainerForm *widget, int index, const AbstractSelectionDescriptor &d)
int currentIndex() const override
Get currently selected option.
QStringList options
List of options, usually presented as combo entries.
static void install(QObject *obj)

References AbstractSelectionContainerForm::clear(), AbstractSelectionContainerForm::createContent(), SelectionDescriptor< T >::currentIndex(), WheelEventEater::install(), AbstractSelectionContainerForm::m_combo, AbstractSelectionContainerForm::m_ec, AbstractSelectionContainerForm::m_gridLayout, SelectionDescriptor< T >::options, and SampleEditorController::setCurrentIndex().

Referenced by LatticeTypeSelectionForm(), and SelectionContainerForm::SelectionContainerForm().

Here is the call graph for this function:

◆ interferenceItem()

Interference2DAbstractLatticeItem * LatticeTypeSelectionForm::interferenceItem ( ) const

Definition at line 72 of file LatticeTypeSelectionForm.cpp.

73 {
74  return m_interferenceItem;
75 }

References m_interferenceItem.

Referenced by LatticeTypeSelectionForm(), and SampleEditorController::setIntegrateOverXi().

◆ onIntegrateOverXiChanged()

void LatticeTypeSelectionForm::onIntegrateOverXiChanged ( )

Definition at line 59 of file LatticeTypeSelectionForm.cpp.

60 {
61  QSignalBlocker b(m_integrateOverXiCheckBox);
64 }

References m_integrateOverXiCheckBox, m_interferenceItem, updateXiVisibility(), and Interference2DAbstractLatticeItem::xiIntegration().

Referenced by SampleEditorController::setIntegrateOverXi().

Here is the call graph for this function:

◆ updateXiVisibility()

void LatticeTypeSelectionForm::updateXiVisibility ( )

Definition at line 66 of file LatticeTypeSelectionForm.cpp.

67 {
69  m_xiLabel->buddy()->setVisible(!m_interferenceItem->xiIntegration());
70 }

References m_interferenceItem, m_xiLabel, and Interference2DAbstractLatticeItem::xiIntegration().

Referenced by createContent(), and onIntegrateOverXiChanged().

Here is the call graph for this function:

Member Data Documentation

◆ m_combo

QComboBox* AbstractSelectionContainerForm::m_combo
protectedinherited

Definition at line 76 of file SelectionContainerForm.h.

Referenced by AbstractSelectionContainerForm::initUI().

◆ m_ec

SampleEditorController* AbstractSelectionContainerForm::m_ec
protectedinherited

◆ m_gridLayout

QGridLayout* AbstractSelectionContainerForm::m_gridLayout
protectedinherited

◆ m_integrateOverXiCheckBox

QCheckBox* LatticeTypeSelectionForm::m_integrateOverXiCheckBox
private

Definition at line 41 of file LatticeTypeSelectionForm.h.

Referenced by createContent(), and onIntegrateOverXiChanged().

◆ m_interferenceItem

Interference2DAbstractLatticeItem* LatticeTypeSelectionForm::m_interferenceItem
private

◆ m_xiLabel

QLabel* LatticeTypeSelectionForm::m_xiLabel
private

Definition at line 40 of file LatticeTypeSelectionForm.h.

Referenced by createContent(), and updateXiVisibility().


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