BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ComponentFlatView.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/ComponentFlatView.h
6 //! @brief Defines class ComponentFlatView
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_COMPONENTFLATVIEW_H
16 #define BORNAGAIN_GUI_COREGUI_VIEWS_PROPERTYEDITOR_COMPONENTFLATVIEW_H
17 
19 #include <memory>
20 
21 class SessionItem;
22 class SessionModel;
23 class QGridLayout;
24 class QBoxLayout;
25 class PropertyWidgetItem;
26 
27 //! Component property widget for SessionItems. On the contrary to ComponentTreeView
28 //! properties are presented as widgets in grid layout.
29 //! Shows only PropertyItems and current items of GroupProperties.
30 
32  Q_OBJECT
33 public:
34  ComponentFlatView(QWidget* parent = nullptr);
36 
37  void setItem(SessionItem* item);
38  void addItem(SessionItem* item);
39 
40  void setModel(SessionModel* model);
41 
42  void clearEditor();
43 
44  void setShowChildren(bool show);
45 
46 public slots:
47  void onDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight,
48  const QVector<int>& roles);
49 
50 private:
51  void clearLayout();
52  void updateItemProperties();
53  void updateItemRoles(SessionItem* item);
54  void initGridLayout();
56 
57  QBoxLayout* m_mainLayout;
58  QGridLayout* m_gridLayout;
59  QVector<PropertyWidgetItem*> m_widgetItems;
62  QVector<const SessionItem*> m_topItems;
63 };
64 
65 #endif // BORNAGAIN_GUI_COREGUI_VIEWS_PROPERTYEDITOR_COMPONENTFLATVIEW_H
Defines class ComponentView.
Component property widget for SessionItems.
QVector< PropertyWidgetItem * > m_widgetItems
void setModel(SessionModel *model)
QVector< const SessionItem * > m_topItems
PropertyWidgetItem * createWidget(const SessionItem *item)
void addItem(SessionItem *item)
void onDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles)
void setItem(SessionItem *item)
ComponentFlatView(QWidget *parent=nullptr)
QBoxLayout * m_mainLayout
SessionModel * m_model
void setShowChildren(bool show)
void updateItemRoles(SessionItem *item)
QGridLayout * m_gridLayout
Base class for ComponentTreeView and ComponentFlatView.
Definition: ComponentView.h:24
Container to hold label and editor for PropertyItem.