BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
viewmodel.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/viewmodel/mvvm/viewmodel/viewmodel.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_VIEWMODEL_MVVM_VIEWMODEL_VIEWMODEL_H
16 #define BORNAGAIN_MVVM_VIEWMODEL_MVVM_VIEWMODEL_VIEWMODEL_H
17 
19 
20 namespace ModelView {
21 
22 class SessionModel;
23 class SessionItem;
24 class ViewItem;
25 class ViewModelController;
26 
27 //! Main class to represent content of SessionModel in Qt's trees and tables.
28 
29 class MVVM_VIEWMODEL_EXPORT ViewModel : public ViewModelBase {
30  Q_OBJECT
31 
32 public:
33  ViewModel(std::unique_ptr<ViewModelController> controller, QObject* parent = nullptr);
34  ~ViewModel() override;
35 
36  QVariant headerData(int section, Qt::Orientation orientation,
37  int role = Qt::DisplayRole) const override;
38 
39  SessionModel* sessionModel() const;
40 
41  SessionItem* rootSessionItem();
42 
43  void setRootSessionItem(SessionItem* item);
44 
45  SessionItem* sessionItemFromIndex(const QModelIndex& index) const;
46 
47  ViewItem* viewItemFromIndex(const QModelIndex& index) const;
48 
49  QModelIndexList indexOfSessionItem(const SessionItem* item) const;
50 
51  std::vector<ViewItem*> findViews(const ModelView::SessionItem* item) const;
52 
53 private:
54  std::unique_ptr<ViewModelController> m_controller;
55 };
56 
57 } // namespace ModelView
58 
59 #endif // BORNAGAIN_MVVM_VIEWMODEL_MVVM_VIEWMODEL_VIEWMODEL_H
The main object representing an editable/displayable/serializable entity.
Definition: sessionitem.h:38
Main class to hold hierarchy of SessionItem objects.
Definition: sessionmodel.h:37
Represents the view of SessionItem's data in a single cell of ViewModel.
Definition: viewitem.h:29
Base class for all view models to show content of SessionModel in Qt views.
Definition: viewmodelbase.h:31
Main class to represent content of SessionModel in Qt's trees and tables.
Definition: viewmodel.h:29
std::unique_ptr< ViewModelController > m_controller
Definition: viewmodel.h:54
materialitems.h Collection of materials to populate MaterialModel.
Defines class CLASS?