BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ComponentTreeView.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/ComponentTreeView.h
6 //! @brief Defines class ComponentTreeView
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_COMPONENTTREEVIEW_H
16 #define BORNAGAIN_GUI_COREGUI_VIEWS_PROPERTYEDITOR_COMPONENTTREEVIEW_H
17 
19 #include <memory>
20 
21 class QTreeView;
22 class SessionModel;
25 class QModelIndex;
26 class SessionItem;
27 class QStandardItemModel;
30 
31 //! Component property tree for SessionItems.
32 //! Shows only PropertyItems and current items of GroupProperties.
33 
35  Q_OBJECT
36 public:
37  ComponentTreeView(QWidget* parent = nullptr);
39 
40  void setItem(SessionItem* item);
41  void clearEditor();
42 
43  void setShowHeader(bool show);
44  void setShowRootItem(bool show);
45 
46 private slots:
47  void onCustomContextMenuRequested(const QPoint& pos);
48 
49 private:
50  void setModel(SessionModel* model);
51  void setRootIndex(const QModelIndex& index, bool show_root_item = true);
52 
53  QTreeView* m_tree;
56  QStandardItemModel* m_placeHolderModel;
57  std::unique_ptr<RightMouseButtonEater> m_eventFilter;
59  bool m_show_root_item; //!< Tree will starts from item itself, if true.
60 };
61 
62 #endif // BORNAGAIN_GUI_COREGUI_VIEWS_PROPERTYEDITOR_COMPONENTTREEVIEW_H
Defines class ComponentView.
Proxy model to adjust SessionModel for component editor (right bottom corner of SampleView and simila...
Additional action for ComponentTreeView.
Component property tree for SessionItems.
SessionModelDelegate * m_delegate
std::unique_ptr< RightMouseButtonEater > m_eventFilter
ComponentTreeView(QWidget *parent=nullptr)
void setItem(SessionItem *item)
bool m_show_root_item
Tree will starts from item itself, if true.
QStandardItemModel * m_placeHolderModel
void setModel(SessionModel *model)
ComponentProxyModel * m_proxyModel
void setRootIndex(const QModelIndex &index, bool show_root_item=true)
void setShowRootItem(bool show)
void onCustomContextMenuRequested(const QPoint &pos)
ComponentTreeActions * m_actions
void setShowHeader(bool show)
Base class for ComponentTreeView and ComponentFlatView.
Definition: ComponentView.h:24
Filter out right mouse button events.
The SessionModelDelegate class presents the content of SessionModel items in standard QTreeView.