@@ -138,14 +138,48 @@ class Q_CORE_EXPORT QMetaMethod
138
138
template <typename PointerToMemberFunction>
139
139
static inline QMetaMethod fromSignal (PointerToMemberFunction signal)
140
140
{
141
- typedef QtPrivate::FunctionPointer<PointerToMemberFunction> SignalType;
142
- static_assert (QtPrivate::HasQ_OBJECT_Macro<typename SignalType::Object>::Value,
143
- " No Q_OBJECT in the class with the signal" );
144
- return fromSignalImpl (&SignalType::Object::staticMetaObject,
145
- reinterpret_cast <void **>(&signal ));
141
+ QMetaMethod method = from (signal );
142
+ if (method.methodType () == Signal)
143
+ {
144
+ return method;
145
+ }
146
+ return QMetaMethod ();
147
+ }
148
+
149
+ template <typename PointerToMemberFunction>
150
+ static inline QMetaMethod fromSlot (PointerToMemberFunction slot)
151
+ {
152
+ QMetaMethod method = from (slot);
153
+ if (method.methodType () == Slot)
154
+ {
155
+ return method;
156
+ }
157
+ return QMetaMethod ();
158
+ }
159
+
160
+ template <typename PointerToMemberFunction>
161
+ static inline QMetaMethod fromInvokable (PointerToMemberFunction invokable)
162
+ {
163
+ QMetaMethod method = from (invokable);
164
+ if (method.methodType () == Method)
165
+ {
166
+ return method;
167
+ }
168
+ return QMetaMethod ();
169
+ }
170
+
171
+ template <typename PointerToMemberFunction>
172
+ static inline QMetaMethod from (PointerToMemberFunction func)
173
+ {
174
+ typedef QtPrivate::FunctionPointer<PointerToMemberFunction> ClassType;
175
+ static_assert (QtPrivate::HasQ_OBJECT_Macro<typename ClassType::Object>::Value,
176
+ " No Q_OBJECT in the class with the func" );
177
+ return fromSignalImpl (&ClassType::Object::staticMetaObject,
178
+ reinterpret_cast <void **>(&func));
146
179
}
147
180
148
181
private:
182
+ // ### Qt 7: rename fromSignalImpl to fromImpl
149
183
static QMetaMethod fromSignalImpl (const QMetaObject *, void **);
150
184
static QMetaMethod fromRelativeMethodIndex (const QMetaObject *mobj, int index);
151
185
static QMetaMethod fromRelativeConstructorIndex (const QMetaObject *mobj, int index);
0 commit comments