BornAgain
1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Namespaces | |
CoordName | |
IO | |
Provides utility methods for output data. | |
Layout | |
Utility functions to add/remove widgets to the layout on the fly. Taken from https://stackoverflow.com/questions/5395266/removing-widgets-from-qgridlayout. | |
Path | |
String | |
Style | |
Variant | |
Functions | |
template<typename T > | |
void | copyContents (const T *source, T *dest) |
template<typename T > | |
QByteArray | createBackup (const T *t) |
ScientificSpinBox * | createScientificSpinBox (QFormLayout *parentLayout, const DoubleDescriptor &d, std::function< void(double)> slot=nullptr) |
Create a label and a scientific spin box with the information found in a DoubleDescriptor and place them in a row in a form layout. More... | |
template<typename T > | |
QComboBox * | createSelectionCombo (QWidget *parent, const SelectionDescriptor< T > d, std::function< void(int)> slot=nullptr) |
Create a combo box with the information found in a selection descriptor. More... | |
DoubleSpinBox * | createSpinBox (QFormLayout *parentLayout, const DoubleDescriptor &d, std::function< void(double)> slot=nullptr) |
Create a label and a spin box with the information found in a DoubleDescriptor and place them in a row in a form layout. More... | |
QSpinBox * | createSpinBox (QFormLayout *parentLayout, const UIntDescriptor &d) |
Create a label and a spin box with the information found in a UIntDescriptor and place them in a row in a form layout. More... | |
QSpinBox * | createSpinBox (QWidget *parent, const UIntDescriptor &d, std::function< void(uint)> slot=nullptr) |
Create a spin box with the information found in a UIntDescriptor. More... | |
QString | labelWithUnit (const DoubleDescriptor &d) |
Create a label with an optional unit in brackets, both taken from the given descriptor. More... | |
QString | labelWithUnit (const QString &label, std::variant< QString, Unit > unit) |
Create a label with an optional unit in brackets. More... | |
template<typename T > | |
void | restoreBackup (T *t, const QByteArray &backup) |
void GUI::Util::copyContents | ( | const T * | source, |
T * | dest | ||
) |
Definition at line 46 of file Backup.h.
References createBackup(), and restoreBackup().
Referenced by InstrumentItem::createCopy(), and MultiLayerItem::initFrom().
QByteArray GUI::Util::createBackup | ( | const T * | t | ) |
Definition at line 24 of file Backup.h.
Referenced by CommandRemoveLayer::CommandRemoveLayer(), copyContents(), and MaterialInplaceForm::selectMaterial().
ScientificSpinBox * GUI::Util::createScientificSpinBox | ( | QFormLayout * | parentLayout, |
const DoubleDescriptor & | d, | ||
std::function< void(double)> | slot = nullptr |
||
) |
Create a label and a scientific spin box with the information found in a DoubleDescriptor and place them in a row in a form layout.
The spin box will be fully initialized (tooltip, limits, current value, unit, size policy). Furthermore, the spin box will prohibit accidental changes by the mouse wheel. Otherwise it would be dangerous if the spin box is on a scrollable form - unintended and unnoticed changes would take place when just scrolling through the form.
No connections to update the descriptor will be established! Therefore changes in the spin box will not be notified to the descriptor. The additional (and optional) slot can be used to be notified about a value change.
Definition at line 82 of file WidgetUtils.cpp.
References GUI::View::EditUtil::configSpinbox(), DoubleDescriptor::decimals, DoubleDescriptor::get, DoubleDescriptor::label, labelWithUnit(), DoubleDescriptor::limits, DoubleDescriptor::tooltip, DoubleDescriptor::unit, and ScientificSpinBox::valueChanged().
Referenced by DistributionSelector::createMeanSpinBox().
QComboBox* GUI::Util::createSelectionCombo | ( | QWidget * | parent, |
const SelectionDescriptor< T > | d, | ||
std::function< void(int)> | slot = nullptr |
||
) |
Create a combo box with the information found in a selection descriptor.
The combo will be filled with the available options and will get the found tooltip. The current index will be set according to the current index in the selection. Furthermore, the combo box will prohibit accidental changes by the mouse wheel. Otherwise it would be dangerous if the combo is on a scrollable form - unintended and unnoticed changes would take place when just scrolling through the form.
Changes in the combobox will be notified to the SelectionDescriptor already. The additional (and optional) slot can be used to be notified about an already executed change.
Definition at line 45 of file WidgetUtils.h.
References SelectionDescriptor< T >::currentIndex(), WheelEventEater::install(), SelectionDescriptor< T >::options, SelectionDescriptor< T >::setCurrentIndex(), and SelectionDescriptor< T >::tooltip.
Referenced by DetectorAlignmentEditor::DetectorAlignmentEditor(), DetectorEditor::DetectorEditor(), DistributionSelector::DistributionSelector(), EnvironmentEditor::EnvironmentEditor(), FootprintCorrectionEditor::FootprintCorrectionEditor(), ResolutionFunctionEditor::ResolutionFunctionEditor(), and MinimizerSettingsWidget::setItem().
DoubleSpinBox * GUI::Util::createSpinBox | ( | QFormLayout * | parentLayout, |
const DoubleDescriptor & | d, | ||
std::function< void(double)> | slot = nullptr |
||
) |
Create a label and a spin box with the information found in a DoubleDescriptor and place them in a row in a form layout.
The spin box will be fully initialized (tooltip, limits, current value, unit, size policy). Furthermore, the spin box will prohibit accidental changes by the mouse wheel. Otherwise it would be dangerous if the spin box is on a scrollable form - unintended and unnoticed changes would take place when just scrolling through the form.
No connections to update the descriptor will be established! Therefore changes in the spin box will not be notified to the descriptor. The additional (and optional) slot can be used to be notified about a value change (the notified new value is in the base unit of the DoubleDescriptor).
Definition at line 47 of file WidgetUtils.cpp.
References DoubleSpinBox::baseValueChanged(), DoubleDescriptor::label, labelWithUnit(), and DoubleDescriptor::unit.
QSpinBox * GUI::Util::createSpinBox | ( | QFormLayout * | parentLayout, |
const UIntDescriptor & | d | ||
) |
Create a label and a spin box with the information found in a UIntDescriptor and place them in a row in a form layout.
The label will also contain the unit, if present. Regarding the spin box creation see the method above.
Definition at line 59 of file WidgetUtils.cpp.
References createSpinBox(), UIntDescriptor::label, labelWithUnit(), and UIntDescriptor::unit.
QSpinBox * GUI::Util::createSpinBox | ( | QWidget * | parent, |
const UIntDescriptor & | d, | ||
std::function< void(uint)> | slot = nullptr |
||
) |
Create a spin box with the information found in a UIntDescriptor.
The spin box will be fully initialized (tooltip, limits, current value, size policy). Furthermore, the spin box will prohibit accidental changes by the mouse wheel. Otherwise it would be dangerous if the spin box is on a scrollable form - unintended and unnoticed changes would take place when just scrolling through the form.
No connections to update the descriptor will be established! Therefore changes in the spin box will not be notified to the descriptor. The additional (and optional) slot can be used to be notified about a value change.
Definition at line 24 of file WidgetUtils.cpp.
References UIntDescriptor::get, UIntDescriptor::limits, and UIntDescriptor::tooltip.
Referenced by AxisPropertyEditor::AxisPropertyEditor(), FormLayouter::addValue(), ResolutionFunctionEditor::createResolutionWidgets(), DistributionSelector::createSpinBox(), DetectorAlignmentEditor::createSpinBox(), and createSpinBox().
QString GUI::Util::labelWithUnit | ( | const DoubleDescriptor & | d | ) |
Create a label with an optional unit in brackets, both taken from the given descriptor.
No trailing ':' will be appended
Definition at line 77 of file WidgetUtils.cpp.
References DoubleDescriptor::label, labelWithUnit(), and DoubleDescriptor::unit.
QString GUI::Util::labelWithUnit | ( | const QString & | label, |
std::variant< QString, Unit > | unit | ||
) |
Create a label with an optional unit in brackets.
No trailing ':' will be appended
Referenced by PolarizationAnalysisEditor::PolarizationAnalysisEditor(), ParameterTreeBuilder::addBackground(), ParameterTreeBuilder::addParameterItem(), DetectorAlignmentEditor::addVector(), PolarizationAnalysisEditor::addVector(), createScientificSpinBox(), createSpinBox(), and labelWithUnit().
void GUI::Util::restoreBackup | ( | T * | t, |
const QByteArray & | backup | ||
) |
Definition at line 36 of file Backup.h.
Referenced by copyContents(), and CommandRemoveLayer::undo().