BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
GroupInfo.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Models/GroupInfo.h
6 //! @brief Defines class GroupInfo
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_GROUPINFO_H
16 #define BORNAGAIN_GUI_COREGUI_MODELS_GROUPINFO_H
17 
18 #include <QString>
19 #include <QStringList>
20 #include <QVector>
21 
22 //! Defines info for GroupProperty, i.e. collection of model types, their labels and
23 //! the name of default item's modelType.
24 
25 class GroupInfo {
26 public:
27  explicit GroupInfo(const QString& groupType = "", bool is_sorted = true);
28 
29  void add(const QString& itemType, const QString& itemLabel);
30 
31  QString defaultType() const;
32  void setDefaultType(const QString& modelType);
33 
34  QString groupType() const;
35 
36  QStringList itemTypes() const;
37 
38  QStringList itemLabels() const;
39 
40  bool isValid();
41 
42 private:
43  struct TypeAndLabel {
44  QString m_itemType;
45  QString m_itemLabel;
46  };
47 
48  bool containsType(const QString& itemType) const;
49 
50  //!< Default model type for given group (i.e. FFCylinder for formfactor group)
52  //!< Unique group name for GroupInfoCatalog
53  QString m_groupType;
54  //!< Info will be sorted if true, otherwise order of insertion will be preserved
55  bool is_sorted;
56  QVector<TypeAndLabel> m_info;
57 };
58 
59 #endif // BORNAGAIN_GUI_COREGUI_MODELS_GROUPINFO_H
Defines info for GroupProperty, i.e.
Definition: GroupInfo.h:25
GroupInfo(const QString &groupType="", bool is_sorted=true)
Definition: GroupInfo.cpp:18
bool isValid()
Definition: GroupInfo.cpp:78
QVector< TypeAndLabel > m_info
Definition: GroupInfo.h:56
QStringList itemLabels() const
Definition: GroupInfo.cpp:69
void add(const QString &itemType, const QString &itemLabel)
Definition: GroupInfo.cpp:23
QString m_groupType
Info will be sorted if true, otherwise order of insertion will be preserved.
Definition: GroupInfo.h:53
QString defaultType() const
Definition: GroupInfo.cpp:40
QStringList itemTypes() const
Definition: GroupInfo.cpp:60
bool is_sorted
Definition: GroupInfo.h:55
QString groupType() const
Definition: GroupInfo.cpp:55
QString m_defaultItemType
Unique group name for GroupInfoCatalog.
Definition: GroupInfo.h:51
bool containsType(const QString &itemType) const
Default model type for given group (i.e. FFCylinder for formfactor group)
Definition: GroupInfo.cpp:83
void setDefaultType(const QString &modelType)
Definition: GroupInfo.cpp:47