Scanframe Modular Application
0.1.0
Loading...
Searching...
No Matches
misc/qt/Macros.h
Go to the documentation of this file.
1
#pragma once
2
// clang-format off
8
#define SF_DECL_PROP_GS(Type, Name) \
9
[[nodiscard]] Type get##Name() const; \
10
void set##Name(Type);
11
17
#define SF_DECL_PROP_GRS(Type, Name) \
18
[[nodiscard]] Type get##Name() const; \
19
void set##Name(const Type&);
20
26
#define SF_DECL_PROP_RGRS(Type, Name) \
27
[[nodiscard]] const Type& get##Name() const; \
28
void set##Name(const Type&);
29
37
#define SF_IMPL_PROP_G(Type, Class, Name, Instance) \
38
Type Class::get##Name() const \
39
{ \
40
return Instance; \
41
}
42
50
#define SF_IMPL_PROP_RG(Type, Class, Name, Instance) \
51
const Type& Class::get##Name() const \
52
{ \
53
return Instance; \
54
}
55
63
#define SF_IMPL_PROP_S(Type, Class, Name, Instance) \
64
void Class::set##Name(Type val) \
65
{ \
66
Instance = val; \
67
}
68
77
#define SF_IMPL_PROP_SN(Type, Class, Name, Instance, NotifyFunc) \
78
void Class::set##Name(Type val) \
79
{ \
80
if (Instance != val) \
81
{ \
82
Instance = val; \
83
NotifyFunc(&Instance); \
84
} \
85
}
86
94
#define SF_IMPL_PROP_RS(Type, Class, Name, Instance) \
95
void Class::set##Name(const Type& val) \
96
{ \
97
Instance = val; \
98
}
99
108
#define SF_IMPL_PROP_RSN(Type, Class, Name, Instance, NotifyFunc) \
109
void Class::set##Name(const Type& val) \
110
{ \
111
if (Instance != val) \
112
{ \
113
Instance = val; \
114
NotifyFunc(&Instance); \
115
} \
116
}
117
125
#define SF_IMPL_PROP_GS(Type, Class, Name, Instance) \
126
SF_IMPL_PROP_G(Type, Class, Name, Instance) \
127
SF_IMPL_PROP_S(Type, Class, Name, Instance)
128
129
130
#define SF_IMPL_PROP_GRS(Type, Class, Name, Instance) \
131
SF_IMPL_PROP_G(Type, Class, Name, Instance) \
132
SF_IMPL_PROP_RS(Type, Class, Name, Instance)
133
134
143
#define SF_IMPL_PROP_GSN(Type, Class, Name, Instance, NotifyFunc) \
144
SF_IMPL_PROP_G(Type, Class, Name, Instance) \
145
SF_IMPL_PROP_SN(Type, Class, Name, Instance, NotifyFunc)
146
155
#define SF_IMPL_PROP_GRSN(Type, Class, Name, Instance, NotifyFunc) \
156
SF_IMPL_PROP_G(Type, Class, Name, Instance) \
157
SF_IMPL_PROP_RSN(Type, Class, Name, Instance, NotifyFunc)
158
166
#define SF_IMPL_PROP_RGRS(Type, Class, Name, Instance) \
167
SF_IMPL_PROP_RG(Type, Class, Name, Instance) \
168
SF_IMPL_PROP_RS(Type, Class, Name, Instance)
169
178
#define SF_IMPL_PROP_RGRSN(Type, Class, Name, Instance, NotifyFunc) \
179
SF_IMPL_PROP_RG(Type, Class, Name, Instance) \
180
SF_IMPL_PROP_RSN(Type, Class, Name, Instance, NotifyFunc)
181
190
#define SF_IMPL_PROP_GSP(Type, Class, Name, Instance, Property) \
191
Type Class::get##Name() const \
192
{ \
193
return Instance->property(#Property).value<Type>(); \
194
} \
195
void Class::set##Name(Type val) \
196
{ \
197
Instance->setProperty(#Property, QVariant::fromValue<Type>(val)); \
198
}
199
// clang-format on
src
com
misc
qt
Macros.h
Generated by
1.9.8