BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
modellistenerbase.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // qt-mvvm: Model-view-view-model framework for large GUI applications
4 //
5 //! @file mvvm/model/mvvm/signals/modellistenerbase.h
6 //! @brief Defines class 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 2020
11 //! @authors Gennady Pospelov et al, Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_MVVM_MODEL_MVVM_SIGNALS_MODELLISTENERBASE_H
16 #define BORNAGAIN_MVVM_MODEL_MVVM_SIGNALS_MODELLISTENERBASE_H
17 
19 
20 namespace ModelView {
21 
22 class SessionModel;
23 
24 //! Provides sets of methods to subscribe to various signals generated by SessionModel.
25 //! Automatically tracks the time of life of SessionModel. Unsubscribes from the model on
26 //! own destruction.
27 
28 class MVVM_MODEL_EXPORT ModelListenerBase : public ModelListenerInterface {
29 public:
31  ~ModelListenerBase() override;
32 
33  // 'client' is not used here, since 'this' is used
34 
35  void setOnDataChange(Callbacks::item_int_t f, Callbacks::slot_t client = {}) override;
36  void setOnItemInserted(Callbacks::item_tagrow_t f, Callbacks::slot_t client = {}) override;
37  void setOnItemRemoved(Callbacks::item_tagrow_t f, Callbacks::slot_t client = {}) override;
38  void setOnAboutToRemoveItem(Callbacks::item_tagrow_t f, Callbacks::slot_t client = {}) override;
39  void setOnModelDestroyed(Callbacks::model_t f, Callbacks::slot_t client = {}) override;
40  void setOnModelAboutToBeReset(Callbacks::model_t f, Callbacks::slot_t client = {}) override;
41  void setOnModelReset(Callbacks::model_t f, Callbacks::slot_t client = {}) override;
42 
43  void unsubscribe(Callbacks::slot_t client = {}) override;
44 
45 protected:
46  SessionModel* m_model{nullptr};
47 };
48 
49 } // namespace ModelView
50 
51 #endif // BORNAGAIN_MVVM_MODEL_MVVM_SIGNALS_MODELLISTENERBASE_H
Provides sets of methods to subscribe to various signals generated by SessionModel.
Interface to subscribe to various signals generated by SessionModel.
Main class to hold hierarchy of SessionItem objects.
Definition: sessionmodel.h:37
Defines class CLASS?
std::function< void(SessionModel *)> model_t
std::function< void(SessionItem *, TagRow)> item_tagrow_t
std::function< void(SessionItem *, int)> item_int_t
materialitems.h Collection of materials to populate MaterialModel.