BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
LayerEditorUtils.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/SampleDesigner/LayerEditorUtils.h
6 //! @brief Defines class LayerEditorUtils
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2021
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_LAYEREDITORUTILS_H
16 #define BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_LAYEREDITORUTILS_H
17 
19 
22 #include <QColor>
23 #include <QList>
24 #include <functional>
25 
26 class DoubleSpinBox;
27 class Profile1DItem;
28 class FormFactorItem;
29 class ItemWithParticles;
31 class QGridLayout;
32 class QLabel;
33 class QPushButton;
34 class QString;
35 class QWidget;
36 class RotationItem;
38 class VectorDescriptor;
39 class Profile2DItem;
40 
41 //! Utility functions to support layer oriented sample editor
42 namespace LayerEditorUtils {
43 
44 void updateLabelUnit(QLabel* label);
45 void updateLabelUnit(QLabel* label, DoubleSpinBox* editor);
46 
47 //! Create DoubleSpinBoxes for the DoubeDescriptors and connect them to
48 //! SampleEditorController::setDouble()
49 void addMultiPropertyToGrid(QGridLayout* m_gridLayout, int firstCol,
50  const DoubleDescriptors& valueDescriptors, SampleEditorController* ec,
51  bool vertically, bool addSpacer);
52 
53 //! Create DoubleSpinBoxes for the DoubeDescriptors and connect them to the given setNewValue()
54 void addMultiPropertyToGrid(QGridLayout* m_gridLayout, int firstCol,
55  const DoubleDescriptors& valueDescriptors,
56  function<void(double, DoubleDescriptor)> setNewValue, bool vertically,
57  bool addSpacer);
58 
59 void addMultiPropertyToGrid(QGridLayout* m_gridLayout, int firstCol,
60  const DoubleDescriptors& valueDescriptors, SampleEditorController* ec,
61  bool addSpacer);
62 
63 //! Create DoubleSpinBoxes for the DoubeDescriptors and connect them to
64 //! SampleEditorController::setDouble()
65 void addVectorToGrid(QGridLayout* m_gridLayout, int firstCol, const VectorDescriptor& v,
66  SampleEditorController* ec, bool vertically, bool addSpacer);
67 
68 //! Create DoubleSpinBoxes for the DoubeDescriptors and connect them to the given setNewValue()
69 void addVectorToGrid(QGridLayout* m_gridLayout, int firstCol, const VectorDescriptor& v,
70  function<void(double, DoubleDescriptor)> setNewValue, bool vertically,
71  bool addSpacer);
72 
73 
74 QLabel* createBoldLabel(const QString& text);
75 
81 
82 QWidget* createWidgetForItemWithParticles(QWidget* parentWidget,
83  ItemWithParticles* itemWithParticles, bool allowAbundance,
84  SampleEditorController* ec, bool allowRemove = true);
85 
86 QPushButton*
87 createAddParticleButton(QWidget* parentWidget,
88  std::function<void(FormFactorItemCatalog::Type t)> slotAddFormFactor,
89  std::function<void(ItemWithParticlesCatalog::Type t)> slotAddParticle);
90 
91 QList<QColor> predefinedLayerColors();
92 
93 } // namespace LayerEditorUtils
94 
95 #endif // BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_LAYEREDITORUTILS_H
Defines class DoubleDescriptor.
QList< DoubleDescriptor > DoubleDescriptors
Defines class FormFactorItemCatalog.
Defines class ItemWithParticlesCatalog.
Describes properties of a double value which are necessary to allow GUI representation,...
SpinBox for DoubleDescriptors, supporting units.
Definition: DoubleSpinBox.h:22
Class to modify a sample from the layer oriented sample editor.
Describes properties of a 3D vector, consisting of three double values.
Utility functions to support layer oriented sample editor.
QList< QColor > predefinedLayerColors()
QWidget * createWidgetForItemWithParticles(QWidget *parentWidget, ItemWithParticles *itemWithParticles, bool allowAbundance, SampleEditorController *ec, bool allowRemove=true)
DoubleDescriptors doubleDescriptorsOfItem(LayerBasicRoughnessItem *item)
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...
void addVectorToGrid(QGridLayout *m_gridLayout, int firstCol, const VectorDescriptor &v, SampleEditorController *ec, bool vertically, bool addSpacer)
Create DoubleSpinBoxes for the DoubeDescriptors and connect them to SampleEditorController::setDouble...
void updateLabelUnit(QLabel *label)
QPushButton * createAddParticleButton(QWidget *parentWidget, std::function< void(FormFactorItemCatalog::Type t)> slotAddFormFactor, std::function< void(ItemWithParticlesCatalog::Type t)> slotAddParticle)
QLabel * createBoldLabel(const QString &text)