BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
MultiLayerForm.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/SampleDesigner/MultiLayerForm.h
6 //! @brief Defines class MultiLayerForm
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_MULTILAYERFORM_H
16 #define BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_MULTILAYERFORM_H
17 
18 #include <QWidget>
19 
20 class MultiLayerItem;
22 class LayerItem;
23 class QVBoxLayout;
24 class QPushButton;
25 class LayerForm;
26 
27 //! Form to present/edit a MultiLayer (sample)
28 class MultiLayerForm : public QWidget {
29  Q_OBJECT
30 public:
31  MultiLayerForm(QWidget* parent, MultiLayerItem* sampleItem, SampleEditorController* ec);
32 
33  //! Show or hide all buttons related to structure editing (like "add layer", "remove particle")
34  void showInlineEditButtons(bool b);
35 
36  //! Create widgets for the new layer.
37  void onLayerAdded(LayerItem* layerItem);
38 
39  //! Call this when a layerItem has been moved to a different position.
40  //!
41  //! This updates the item's position in the layout.
42  void onLayerMoved(LayerItem* layerItem);
43 
44  //! Call this before removing (deleting) a LayerItem.
45  //!
46  //! Any widgets related to the item will be deleted or scheduled for later deletion.
47  void onAboutToRemoveLayer(LayerItem* layerItem);
48 
49  void updateRowVisibilities();
50 
51  //! Update the presented units in all contained widgets according to current settings.
52  void updateUnits();
53 
54  void ensureVisible(QWidget* w);
55 
56  //! Show values in Angstrom or nanometers
57  void setUseAngstrom(bool angstrom);
58  bool useAngstrom() const;
59 
60  //! Show values in radiants or degrees
61  void setUseRadiant(bool radiant);
62  bool useRadiant() const;
63 
64  //! Shows or hides the "Add Layer" buttons.
65  void showAddLayerButtons(bool show);
66 
67  //! Search for the next LayerForm, starting from the given widget.
68  //!
69  //! The search starts with the given widget itself If it is a LayerForm, it is returned.
70  //! If no following LayerForm is found, nullptr is returned.
71  LayerForm* findNextLayerForm(QWidget* w);
72 
73 private:
74  QVBoxLayout* m_layout;
75  MultiLayerItem* m_sampleItem; //!< Ptr is borrowed, don't delete
76  SampleEditorController* m_ec; //!< Ptr is borrowed, don't delete
80  QList<QPushButton*> m_addLayerButtons;
81 };
82 
83 #endif // BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_MULTILAYERFORM_H
@ angstrom
@ radiant
Form for editing a layer.
Definition: LayerForm.h:29
Form to present/edit a MultiLayer (sample)
MultiLayerForm(QWidget *parent, MultiLayerItem *sampleItem, SampleEditorController *ec)
void ensureVisible(QWidget *w)
void updateRowVisibilities()
void setUseAngstrom(bool angstrom)
Show values in Angstrom or nanometers.
LayerForm * findNextLayerForm(QWidget *w)
Search for the next LayerForm, starting from the given widget.
bool m_showInlineEditButtons
void onLayerAdded(LayerItem *layerItem)
Create widgets for the new layer.
SampleEditorController * m_ec
Ptr is borrowed, don't delete.
QVBoxLayout * m_layout
MultiLayerItem * m_sampleItem
Ptr is borrowed, don't delete.
void updateUnits()
Update the presented units in all contained widgets according to current settings.
void showAddLayerButtons(bool show)
Shows or hides the "Add Layer" buttons.
void onAboutToRemoveLayer(LayerItem *layerItem)
Call this before removing (deleting) a LayerItem.
QList< QPushButton * > m_addLayerButtons
bool useRadiant() const
void showInlineEditButtons(bool b)
Show or hide all buttons related to structure editing (like "add layer", "remove particle")
void setUseRadiant(bool radiant)
Show values in radiants or degrees.
bool useAngstrom() const
void onLayerMoved(LayerItem *layerItem)
Call this when a layerItem has been moved to a different position.
Class to modify a sample from the layer oriented sample editor.