BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
SessionDecorationModel.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Toplevel/SessionDecorationModel.h
6 //! @brief Defines class SessionDecorationModel
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_TOPLEVEL_SESSIONDECORATIONMODEL_H
16 #define BORNAGAIN_GUI_VIEW_TOPLEVEL_SESSIONDECORATIONMODEL_H
17 
18 #include <QIdentityProxyModel>
19 
20 class SessionModel;
21 class SessionItem;
22 
23 //! Provides decorations (text color, icons, etc) for SessionModel in SessionModelView context.
24 //! It is implemented as identity proxy model, so it has one-to-one data structure as in
25 //! source SessionModel.
26 
27 class SessionDecorationModel : public QIdentityProxyModel {
28  Q_OBJECT
29 public:
30  explicit SessionDecorationModel(QObject* parent, SessionModel* model = nullptr);
31 
32  void setSessionModel(SessionModel* model);
33 
34  QVariant data(const QModelIndex& index, int role) const override;
35 
36 private:
37  QVariant textColor(const QModelIndex& index) const;
38 
40 };
41 
42 #endif // BORNAGAIN_GUI_VIEW_TOPLEVEL_SESSIONDECORATIONMODEL_H
Provides decorations (text color, icons, etc) for SessionModel in SessionModelView context....
QVariant textColor(const QModelIndex &index) const
Returns text color. Disabled SessionItem's will appear in gray.
void setSessionModel(SessionModel *model)
QVariant data(const QModelIndex &index, int role) const override
SessionDecorationModel(QObject *parent, SessionModel *model=nullptr)
Base class for a GUI data item.
Definition: SessionItem.h:204
Base class for a GUI data collection. A collection is e.g. all real data (RealDataModel)....
Definition: SessionModel.h:42