BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ComponentEditor.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Views/PropertyEditor/ComponentEditor.h
6 //! @brief Defines ComponentEditor class
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_PROPERTYEDITOR_COMPONENTEDITOR_H
16 #define BORNAGAIN_GUI_COREGUI_VIEWS_PROPERTYEDITOR_COMPONENTEDITOR_H
17 
18 #include <QWidget>
19 
20 class ComponentView;
21 class SessionItem;
22 class QBoxLayout;
23 
24 //! Component editor for SessionItem. Can have various appearance depending
25 //! on EditorFlags
26 
27 class ComponentEditor : public QWidget {
28  Q_OBJECT
29 public:
30  enum EditorFlags {
31  Tree = 0x1000,
32  Widget = 0x2000,
33 
34  PlainLayout = 0x0010, // editor embedded in standard box layout
35  GroupLayout = 0x0020, // editor embedded in QGroupBox
36  InfoLayout = 0x0040, // editor embedded in GroupInfoBox
37 
38  T_Header = 0x0100, // to show QTreeView header (Tree mode only)
39  T_Root = 0x0200, // to show root item (Tree mode only)
40  W_NoChildren = 0x0400, // show no children (Widget mode only)
41 
48  };
49  Q_DECLARE_FLAGS(EditorType, EditorFlags)
50 
51  ComponentEditor(EditorType editorType = HeaderTree, const QString& title = "");
52 
53  void setItem(SessionItem* item);
54  void clearEditor();
55  void addItem(SessionItem* item);
56 
57 signals:
58  void dialogRequest(SessionItem* item, const QString& names);
59 
60 private slots:
61  void onDialogRequest();
62 
63 private:
65 
66  EditorType m_type;
69  QString m_title;
70 };
71 
72 Q_DECLARE_OPERATORS_FOR_FLAGS(ComponentEditor::EditorType)
73 
74 #endif // BORNAGAIN_GUI_COREGUI_VIEWS_PROPERTYEDITOR_COMPONENTEDITOR_H
Component editor for SessionItem.
void addItem(SessionItem *item)
ComponentEditor(EditorType editorType=HeaderTree, const QString &title="")
void setItem(SessionItem *item)
EditorType m_type
void dialogRequest(SessionItem *item, const QString &names)
SessionItem * m_item
ComponentView * createComponentView()
ComponentView * m_componentView
Base class for ComponentTreeView and ComponentFlatView.
Definition: ComponentView.h:24