BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
MaterialEditorDialog.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Views/MaterialEditor/MaterialEditorDialog.h
6 //! @brief Defines class MaterialEditorDialog
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI_COREGUI_VIEWS_MATERIALEDITOR_MATERIALEDITORDIALOG_H
16 #define BORNAGAIN_GUI_COREGUI_VIEWS_MATERIALEDITOR_MATERIALEDITORDIALOG_H
17 
18 #include <QDialog>
19 #include <memory>
20 
21 class MaterialModel;
22 class MaterialEditor;
23 class ExternalProperty;
24 class QBoxLayout;
25 
26 //! Dialog to hold MaterialEditor.
27 //! It's main function is to return MaterialModel to original state, if user decided to cancel
28 //! changes.
29 
30 class MaterialEditorDialog : public QDialog {
31  Q_OBJECT
32 
33 public:
34  MaterialEditorDialog(MaterialModel* materialModel, QWidget* parent = nullptr);
35 
37 
38  void setMaterialProperty(const ExternalProperty& matProperty);
39 
40 public slots:
41  void onOKButton();
42  void onCancelButton();
43 
44 private:
45  QBoxLayout* createButtonLayout();
46 
47  void init_material_editor();
48  void readSettings();
49  void writeSettings();
50 
52  std::unique_ptr<MaterialModel> m_tmpMaterialModel;
54 };
55 
56 #endif // BORNAGAIN_GUI_COREGUI_VIEWS_MATERIALEDITOR_MATERIALEDITORDIALOG_H
The ExternalProperty class defines custom QVariant property to carry the text, color and an identifie...
Dialog to hold MaterialEditor.
void setMaterialProperty(const ExternalProperty &matProperty)
std::unique_ptr< MaterialModel > m_tmpMaterialModel
QBoxLayout * createButtonLayout()
MaterialEditor * m_materialEditor
MaterialEditorDialog(MaterialModel *materialModel, QWidget *parent=nullptr)
void onOKButton()
replaces original material model with the model modified by MaterialEditor
ExternalProperty selectedMaterialProperty()
MaterialModel * m_origMaterialModel
Main widget of MaterialEditor.