BornAgain
1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
|
A widget to contain a selection, defined by a SelectionDescriptor.
This SelectionContainerForm is limited to contain the selection combo box and a list of double values represented by DoubleDescriptors. The list of DoubleDescriptors is queried by calling LayerEditorUtils::doubleDescriptorsOfItem(). To have the correct DoubleDescriptors on this form, you may have to overload this method according to your class and your needs. The overload will expect the template type you defined for SelectionDescriptor.
Example: SelectionDescriptor<RotationItem*> => LayerEditorUtils::doubleDescriptorsOfItem(RotationItem*)
The connection from selection combo -> SelectionDescriptor is made via SampleEditorController::setCurrentIndex(), where a command can be used for undo purposes.
For each DoubleDescriptor, a unit-aware DoubleSpinBox is created. The connection from each spinbox to the DoubleDescriptor is made via SampleEditorController::setDouble(), where a command can be used for undo purposes.
If a more complex selection shall be realized (e.g. with sub-selections or different value types), this class is not sufficient.
Definition at line 100 of file SelectionContainerForm.h.
Public Member Functions | |
template<typename T > | |
SelectionContainerForm (QWidget *parent, const SelectionDescriptor< T > &d, SampleEditorController *ec) | |
virtual void | createContent () |
Protected Member Functions | |
template<typename T > | |
void | initUI (const SelectionDescriptor< T > &d) |
Protected Attributes | |
QComboBox * | m_combo |
SampleEditorController * | m_ec |
QGridLayout * | m_gridLayout |
Private Member Functions | |
void | clear () |
Remove all descriptors from the layout. More... | |
Private Attributes | |
function< DoubleDescriptors()> | currentValues = nullptr |
|
inline |
Definition at line 103 of file SelectionContainerForm.h.
References SelectionDescriptor< T >::currentItem, currentValues, LayerEditorUtils::doubleDescriptorsOfItem(), and AbstractSelectionContainerForm::initUI().
|
inlineprivateinherited |
Remove all descriptors from the layout.
Definition at line 66 of file SelectionContainerForm.h.
References GUI::Util::Layout::clearLayout(), and AbstractSelectionContainerForm::m_gridLayout.
Referenced by AbstractSelectionContainerForm::initUI().
|
inlinevirtual |
Implements AbstractSelectionContainerForm.
Definition at line 117 of file SelectionContainerForm.h.
References LayerEditorUtils::addMultiPropertyToGrid(), currentValues, AbstractSelectionContainerForm::m_ec, and AbstractSelectionContainerForm::m_gridLayout.
|
inlineprotectedinherited |
Definition at line 42 of file SelectionContainerForm.h.
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::LatticeTypeSelectionForm(), and SelectionContainerForm().
|
private |
Definition at line 124 of file SelectionContainerForm.h.
Referenced by SelectionContainerForm(), and createContent().
|
protectedinherited |
Definition at line 76 of file SelectionContainerForm.h.
Referenced by AbstractSelectionContainerForm::initUI().
|
protectedinherited |
Definition at line 77 of file SelectionContainerForm.h.
Referenced by createContent(), LatticeTypeSelectionForm::createContent(), and AbstractSelectionContainerForm::initUI().
|
protectedinherited |
Definition at line 75 of file SelectionContainerForm.h.
Referenced by AbstractSelectionContainerForm::clear(), createContent(), LatticeTypeSelectionForm::createContent(), and AbstractSelectionContainerForm::initUI().