BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
ResolutionFunctionItemCatalog.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/CatDevice/ResolutionFunctionItemCatalog.h
6 //! @brief Defines class ResolutionFunctionItemCatalog
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2021
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI_MODEL_CATDEVICE_RESOLUTIONFUNCTIONITEMCATALOG_H
16 #define BORNAGAIN_GUI_MODEL_CATDEVICE_RESOLUTIONFUNCTIONITEMCATALOG_H
17 
18 #include "GUI/Support/Type/Unit.h"
19 #include <QString>
20 #include <QVector>
21 #include <variant>
22 
24 
26 public:
28 
29  // Do not change the numbering! It is serialized!
30  enum class Type : uint8_t { None = 0, Gaussian = 1 };
31 
32  struct UiInfo {
33  QString menuEntry;
34  QString description;
35  };
36 
37  //! Creates the item of the given type.
39  const std::variant<QString, Unit>& unit = Unit::unitless);
40 
41  //! Available types of items.
42  //!
43  //! This list is sorted as expected in the UI (e.g. in combo box)
44  static QVector<Type> types();
45 
46  //! UiInfo on the given type.
47  static UiInfo uiInfo(Type t);
48 
49  //! Returns the enum type of the given item.
50  static Type type(const ResolutionFunctionItem* item);
51 };
52 
53 #endif // BORNAGAIN_GUI_MODEL_CATDEVICE_RESOLUTIONFUNCTIONITEMCATALOG_H
Defines class Unit.
@ unitless
static Type type(const ResolutionFunctionItem *item)
Returns the enum type of the given item.
static UiInfo uiInfo(Type t)
UiInfo on the given type.
static ResolutionFunctionItem * create(Type type, const std::variant< QString, Unit > &unit=Unit::unitless)
Creates the item of the given type.
static QVector< Type > types()
Available types of items.