BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
SessionItemWidget.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Common/SessionItemWidget.h
6 //! @brief Defines class ItemComboWidget
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_VIEW_COMMON_SESSIONITEMWIDGET_H
16 #define BORNAGAIN_GUI_VIEW_COMMON_SESSIONITEMWIDGET_H
17 
18 #include <QWidget>
19 
20 class SessionItem;
21 class QShowEvent;
22 class QHideEvent;
24 
25 //! The SessionItemWidget class is a base for all widgets representing the content
26 //! of SessionItem. It provides subscribe/unsibscribe mechanism on show/hide events.
27 //! The main purpose is to save performance, when item keeps changing its properties, while
28 //! widget is hidden.
29 
30 class SessionItemWidget : public QWidget {
31  Q_OBJECT
32 public:
33  explicit SessionItemWidget(QWidget* parent = nullptr);
34  ~SessionItemWidget() override;
35 
36  virtual void setItem(SessionItem* item);
37  virtual QList<QAction*> actionList();
38 
40  const SessionItem* currentItem() const;
41 
42 protected:
43  virtual void subscribeToItem() {}
44  virtual void unsubscribeFromItem() {}
45  void showEvent(QShowEvent*) override;
46  void hideEvent(QHideEvent*) override;
47 
48 private:
50 };
51 
52 #endif // BORNAGAIN_GUI_VIEW_COMMON_SESSIONITEMWIDGET_H
Provides subscribe/unsubscribe mechanism for any QObject to track time of life of SessionItem....
The SessionItemWidget class is a base for all widgets representing the content of SessionItem....
virtual void subscribeToItem()
void showEvent(QShowEvent *) override
virtual QList< QAction * > actionList()
virtual void unsubscribeFromItem()
SessionItem * currentItem()
~SessionItemWidget() override
SessionItemWidget(QWidget *parent=nullptr)
virtual void setItem(SessionItem *item)
SessionItemController * m_itemController
void hideEvent(QHideEvent *) override
Base class for a GUI data item.
Definition: SessionItem.h:204