BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
VariantUtil.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Support/Type/VariantUtil.h
6 //! @brief Defines namespace GUI::Util::Variant
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_SUPPORT_TYPE_VARIANTUTIL_H
16 #define BORNAGAIN_GUI_SUPPORT_TYPE_VARIANTUTIL_H
17 
18 #include <QString>
19 #include <QVariant>
20 #include <heinz/Vectors3D.h>
21 
22 class SessionItem;
23 class GroupInfo;
24 
25 namespace GUI::Util::Variant {
26 
27 //! Returns type of variant (additionally checks for user type).
28 int VariantType(const QVariant& variant);
29 
30 //! Returns true if variants has compatible types.
31 bool CompatibleVariantTypes(const QVariant& oldValue, const QVariant& newValue);
32 
33 //! Returns true if given variants have same type and value.
34 //! For custom variants (e.g. ComboProperty) will always return false (see
35 //! explanations in cpp file).
36 
37 bool IsTheSame(const QVariant& var1, const QVariant& var2);
38 
39 } // namespace GUI::Util::Variant
40 
41 #endif // BORNAGAIN_GUI_SUPPORT_TYPE_VARIANTUTIL_H
Defines info for GroupProperty, i.e. collection of model types, their labels and the name of default ...
Definition: GroupInfo.h:25
Base class for a GUI data item.
Definition: SessionItem.h:204
bool IsTheSame(const QVariant &var1, const QVariant &var2)
Returns true if given variants have same type and value. For custom variants (e.g....
Definition: VariantUtil.cpp:39
int VariantType(const QVariant &variant)
Returns type of variant (additionally checks for user type).
Definition: VariantUtil.cpp:17
bool CompatibleVariantTypes(const QVariant &oldValue, const QVariant &newValue)
Returns true if variants has compatible types.
Definition: VariantUtil.cpp:25