BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
SessionItemData.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Models/SessionItemData.h
6 //! @brief Defines class SessionItemData
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_MODELS_SESSIONITEMDATA_H
16 #define BORNAGAIN_GUI_COREGUI_MODELS_SESSIONITEMDATA_H
17 
18 #include <QVariant>
19 #include <QVector>
20 
21 //! Handles all data roles for SessionItem.
22 
24 public:
25  QVector<int> roles() const;
26 
27  QVariant data(int role) const;
28 
29  bool setData(int role, const QVariant& value);
30 
31 private:
32  class ItemData {
33  public:
34  ItemData(int r = -1, const QVariant& v = {});
35  int role;
36  QVariant data;
37  bool operator==(const ItemData& other) const;
38  };
39 
40  QVector<ItemData> m_values;
41 };
42 
43 #endif // BORNAGAIN_GUI_COREGUI_MODELS_SESSIONITEMDATA_H
ItemData(int r=-1, const QVariant &v={})
bool operator==(const ItemData &other) const
Handles all data roles for SessionItem.
QVector< ItemData > m_values
QVector< int > roles() const
QVariant data(int role) const
bool setData(int role, const QVariant &value)
Sets the data for given role. Returns true if data was changed.