BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
MaterialEditor.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/MaterialEditor.h
6 //! @brief Defines class MaterialEditor
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_MATERIALEDITOR_H
16 #define BORNAGAIN_GUI_COREGUI_VIEWS_MATERIALEDITOR_MATERIALEDITOR_H
17 
18 #include <QWidget>
19 
20 class MaterialModel;
22 class QSplitter;
23 class QListView;
24 class ComponentEditor;
25 class QItemSelection;
26 class QItemSelectionModel;
27 class MaterialItem;
28 class ExternalProperty;
29 
30 //! Main widget of MaterialEditor
31 
32 class MaterialEditor : public QWidget {
33  Q_OBJECT
34 
35 public:
36  MaterialEditor(MaterialModel* materialModel, QWidget* parent = nullptr);
37 
38  QItemSelectionModel* selectionModel();
39 
41 
42  void setInitialMaterialProperty(const ExternalProperty& matProperty);
43 
44  bool modelWasChanged() const;
45 
46 private slots:
47  void onSelectionChanged(const QItemSelection& selected, const QItemSelection&);
48  void onDataChanged(const QModelIndex&, const QModelIndex&, const QVector<int>&);
49  void onRowsInserted(const QModelIndex&, int, int);
50  void onRowsRemoved(const QModelIndex&, int, int);
51 
52 protected:
53  void contextMenuEvent(QContextMenuEvent* event);
54 
55 private:
56  void init_views();
57 
60  QSplitter* m_splitter;
61  QListView* m_listView;
64 };
65 
66 #endif // BORNAGAIN_GUI_COREGUI_VIEWS_MATERIALEDITOR_MATERIALEDITOR_H
Component editor for SessionItem.
The ExternalProperty class defines custom QVariant property to carry the text, color and an identifie...
Toolbar for MaterialEditor.
Main widget of MaterialEditor.
MaterialModel * m_materialModel
bool modelWasChanged() const
MaterialItem * selectedMaterial()
void onDataChanged(const QModelIndex &, const QModelIndex &, const QVector< int > &)
void onRowsInserted(const QModelIndex &, int, int)
void contextMenuEvent(QContextMenuEvent *event)
Context menu reimplemented to supress default menu.
MaterialEditorToolBar * m_toolBar
bool m_model_was_modified
void onSelectionChanged(const QItemSelection &selected, const QItemSelection &)
QItemSelectionModel * selectionModel()
QSplitter * m_splitter
ComponentEditor * m_componentEditor
MaterialEditor(MaterialModel *materialModel, QWidget *parent=nullptr)
void setInitialMaterialProperty(const ExternalProperty &matProperty)
Sets selection corresponding to initial material property.
void onRowsRemoved(const QModelIndex &, int, int)
QListView * m_listView