236 const char *className()
const;
237 const QMetaObject *superClass()
const;
239 bool inherits(
const QMetaObject *metaObject)
const noexcept;
240 QObject *cast(QObject *obj)
const
241 {
return const_cast<QObject *>(cast(
const_cast<
const QObject *>(obj))); }
242 const QObject *cast(
const QObject *obj)
const;
244#if !defined(QT_NO_TRANSLATION) || defined(Q_QDOC)
245 QString tr(
const char *s,
const char *c,
int n = -1)
const;
248 QMetaType metaType()
const;
250 int methodOffset()
const;
251 int enumeratorOffset()
const;
252 int propertyOffset()
const;
253 int classInfoOffset()
const;
255 int constructorCount()
const;
256 int methodCount()
const;
257 int enumeratorCount()
const;
258 int propertyCount()
const;
259 int classInfoCount()
const;
261 int indexOfConstructor(
const char *constructor)
const;
262 int indexOfMethod(
const char *method)
const;
263 int indexOfSignal(
const char *signal)
const;
264 int indexOfSlot(
const char *slot)
const;
265 int indexOfEnumerator(
const char *name)
const;
267 int indexOfProperty(
const char *name)
const;
268 int indexOfClassInfo(
const char *name)
const;
270 QMetaMethod constructor(
int index)
const;
271 QMetaMethod method(
int index)
const;
272 QMetaEnum enumerator(
int index)
const;
273 QMetaProperty property(
int index)
const;
274 QMetaClassInfo classInfo(
int index)
const;
275 QMetaProperty userProperty()
const;
277 static bool checkConnectArgs(
const char *signal,
const char *method);
278 static bool checkConnectArgs(
const QMetaMethod &signal,
279 const QMetaMethod &method);
280 static QByteArray normalizedSignature(
const char *method);
281 static QByteArray normalizedType(
const char *type);
284 static Connection connect(
const QObject *sender,
int signal_index,
285 const QObject *receiver,
int method_index,
286 int type = 0,
int *types =
nullptr);
288 static bool disconnect(
const QObject *sender,
int signal_index,
289 const QObject *receiver,
int method_index);
290 static bool disconnectOne(
const QObject *sender,
int signal_index,
291 const QObject *receiver,
int method_index);
293 static void connectSlotsByName(QObject *o);
296 static void activate(QObject *sender,
int signal_index,
void **argv);
297 static void activate(QObject *sender,
const QMetaObject *,
int local_signal_index,
void **argv);
298 static void activate(QObject *sender,
int signal_offset,
int local_signal_index,
void **argv);
299 template <
typename Ret,
typename... Args>
static inline void
300 activate(QObject *sender,
const QMetaObject *mo,
int local_signal_index, Ret *ret,
const Args &... args)
303 const_cast<
void *>(
reinterpret_cast<
const volatile void *>(ret)),
304 const_cast<
void *>(
reinterpret_cast<
const volatile void *>(std::addressof(args)))...
306 activate(sender, mo, local_signal_index, _a);
309#if QT_VERSION <= QT_VERSION_CHECK(7
, 0
, 0
)
310 static bool invokeMethod(QObject *obj,
const char *member,
312 QGenericReturnArgument ret,
313 QGenericArgument val0 = QGenericArgument(
nullptr),
314 QGenericArgument val1 = QGenericArgument(),
315 QGenericArgument val2 = QGenericArgument(),
316 QGenericArgument val3 = QGenericArgument(),
317 QGenericArgument val4 = QGenericArgument(),
318 QGenericArgument val5 = QGenericArgument(),
319 QGenericArgument val6 = QGenericArgument(),
320 QGenericArgument val7 = QGenericArgument(),
321 QGenericArgument val8 = QGenericArgument(),
322 QGenericArgument val9 = QGenericArgument());
324 static inline bool invokeMethod(QObject *obj,
const char *member,
325 QGenericReturnArgument ret,
326 QGenericArgument val0 = QGenericArgument(
nullptr),
327 QGenericArgument val1 = QGenericArgument(),
328 QGenericArgument val2 = QGenericArgument(),
329 QGenericArgument val3 = QGenericArgument(),
330 QGenericArgument val4 = QGenericArgument(),
331 QGenericArgument val5 = QGenericArgument(),
332 QGenericArgument val6 = QGenericArgument(),
333 QGenericArgument val7 = QGenericArgument(),
334 QGenericArgument val8 = QGenericArgument(),
335 QGenericArgument val9 = QGenericArgument())
337 return invokeMethod(obj, member, Qt::AutoConnection, ret, val0, val1, val2, val3,
338 val4, val5, val6, val7, val8, val9);
341 static inline bool invokeMethod(QObject *obj,
const char *member,
342 Qt::ConnectionType type,
343 QGenericArgument val0,
344 QGenericArgument val1 = QGenericArgument(),
345 QGenericArgument val2 = QGenericArgument(),
346 QGenericArgument val3 = QGenericArgument(),
347 QGenericArgument val4 = QGenericArgument(),
348 QGenericArgument val5 = QGenericArgument(),
349 QGenericArgument val6 = QGenericArgument(),
350 QGenericArgument val7 = QGenericArgument(),
351 QGenericArgument val8 = QGenericArgument(),
352 QGenericArgument val9 = QGenericArgument())
354 return invokeMethod(obj, member, type, QGenericReturnArgument(), val0, val1, val2,
355 val3, val4, val5, val6, val7, val8, val9);
358 static inline bool invokeMethod(QObject *obj,
const char *member,
359 QGenericArgument val0,
360 QGenericArgument val1 = QGenericArgument(),
361 QGenericArgument val2 = QGenericArgument(),
362 QGenericArgument val3 = QGenericArgument(),
363 QGenericArgument val4 = QGenericArgument(),
364 QGenericArgument val5 = QGenericArgument(),
365 QGenericArgument val6 = QGenericArgument(),
366 QGenericArgument val7 = QGenericArgument(),
367 QGenericArgument val8 = QGenericArgument(),
368 QGenericArgument val9 = QGenericArgument())
370 return invokeMethod(obj, member, Qt::AutoConnection, QGenericReturnArgument(), val0,
371 val1, val2, val3, val4, val5, val6, val7, val8, val9);
375 template <
typename ReturnArg,
typename... Args>
static
379 QtPrivate::Invoke::IfNotOldStyleArgs<
bool, Args...>
381 invokeMethod(QObject *obj,
const char *member, Qt::ConnectionType c,
382 QTemplatedMetaMethodReturnArgument<ReturnArg> r, Args &&... arguments)
384 auto h = QtPrivate::invokeMethodHelper(r, std::forward<Args>(arguments)...);
385 return invokeMethodImpl(obj, member, c, h.parameterCount(), h.parameters.data(),
386 h.typeNames.data(), h.metaTypes.data());
389 template <
typename... Args>
static
393 QtPrivate::Invoke::IfNotOldStyleArgs<
bool, Args...>
395 invokeMethod(QObject *obj,
const char *member, Qt::ConnectionType c, Args &&... arguments)
397 QTemplatedMetaMethodReturnArgument<
void> r = {};
398 return invokeMethod(obj, member, c, r, std::forward<Args>(arguments)...);
401 template <
typename ReturnArg,
typename... Args>
static
405 QtPrivate::Invoke::IfNotOldStyleArgs<
bool, Args...>
407 invokeMethod(QObject *obj,
const char *member, QTemplatedMetaMethodReturnArgument<ReturnArg> r,
408 Args &&... arguments)
410 return invokeMethod(obj, member, Qt::AutoConnection, r, std::forward<Args>(arguments)...);
413 template <
typename... Args>
static
417 QtPrivate::Invoke::IfNotOldStyleArgs<
bool, Args...>
419 invokeMethod(QObject *obj,
const char *member, Args &&... arguments)
421 QTemplatedMetaMethodReturnArgument<
void> r = {};
422 return invokeMethod(obj, member, Qt::AutoConnection, r, std::forward<Args>(arguments)...);
426 template<
typename Functor,
typename FunctorReturnType>
427 static bool invokeMethod(QObject *context, Functor &&function, Qt::ConnectionType type = Qt::AutoConnection, FunctorReturnType *ret =
nullptr);
428 template<
typename Functor,
typename FunctorReturnType>
429 static bool invokeMethod(QObject *context, Functor &&function, FunctorReturnType *ret);
431 template<
typename Functor,
typename FunctorReturnType,
typename... Args>
432 static bool invokeMethod(QObject *context, Functor &&function, Qt::ConnectionType type, QTemplatedMetaMethodReturnArgument<FunctorReturnType> ret, Args &&...arguments);
433 template<
typename Functor,
typename FunctorReturnType,
typename... Args>
434 static bool invokeMethod(QObject *context, Functor &&function, QTemplatedMetaMethodReturnArgument<FunctorReturnType> ret, Args &&...arguments);
435 template<
typename Functor,
typename... Args>
436 static bool invokeMethod(QObject *context, Functor &&function, Qt::ConnectionType type, Args &&...arguments);
437 template<
typename Functor,
typename... Args>
438 static bool invokeMethod(QObject *context, Functor &&function, Args &&...arguments);
440 template <
typename Func>
441 static std::enable_if_t<!std::disjunction_v<std::is_convertible<Func,
const char *>,
442 QtPrivate::Invoke::AreOldStyleArgs<Func>>,
444 invokeMethod(
typename QtPrivate::ContextTypeForFunctor<Func>::ContextType *object,
445 Func &&function, Qt::ConnectionType type,
446 typename QtPrivate::Callable<Func>::ReturnType *ret)
448 using R =
typename QtPrivate::Callable<Func>::ReturnType;
449 const auto getReturnArg = [ret]() -> QTemplatedMetaMethodReturnArgument<R> {
450 if constexpr (std::is_void_v<R>)
453 return ret ? qReturnArg(*ret) : QTemplatedMetaMethodReturnArgument<R>{};
455 return invokeMethod(object, std::forward<Func>(function), type, getReturnArg());
457 template <
typename Func>
458 static std::enable_if_t<!std::disjunction_v<std::is_convertible<Func,
const char *>,
459 QtPrivate::Invoke::AreOldStyleArgs<Func>>,
461 invokeMethod(
typename QtPrivate::ContextTypeForFunctor<Func>::ContextType *object,
462 Func &&function,
typename QtPrivate::Callable<Func>::ReturnType *ret)
464 return invokeMethod(object, std::forward<Func>(function), Qt::AutoConnection, ret);
467 template <
typename Func,
typename... Args>
468 static std::enable_if_t<!std::disjunction_v<std::is_convertible<Func,
const char *>,
469 QtPrivate::Invoke::AreOldStyleArgs<Args...>>,
471 invokeMethod(
typename QtPrivate::ContextTypeForFunctor<Func>::ContextType *object,
472 Func &&function, Qt::ConnectionType type,
473 QTemplatedMetaMethodReturnArgument<
474 typename QtPrivate::Callable<Func, Args...>::ReturnType>
478 return invokeMethodCallableHelper(object, std::forward<Func>(function), type, ret,
479 std::forward<Args>(args)...);
482 template <
typename Func,
typename... Args>
483 static std::enable_if_t<!std::disjunction_v<std::is_convertible<Func,
const char *>,
484 QtPrivate::Invoke::AreOldStyleArgs<Args...>>,
486 invokeMethod(
typename QtPrivate::ContextTypeForFunctor<Func>::ContextType *object,
487 Func &&function, Qt::ConnectionType type, Args &&...args)
489 using R =
typename QtPrivate::Callable<Func, Args...>::ReturnType;
490 QTemplatedMetaMethodReturnArgument<R> r{ QtPrivate::qMetaTypeInterfaceForType<R>(),
nullptr,
492 return invokeMethod(object, std::forward<Func>(function), type, r,
493 std::forward<Args>(args)...);
496 template <
typename Func,
typename... Args>
497 static std::enable_if_t<!std::disjunction_v<std::is_convertible<Func,
const char *>,
498 QtPrivate::Invoke::AreOldStyleArgs<Args...>>,
500 invokeMethod(
typename QtPrivate::ContextTypeForFunctor<Func>::ContextType *object,
502 QTemplatedMetaMethodReturnArgument<
503 typename QtPrivate::Callable<Func, Args...>::ReturnType>
507 return invokeMethod(object, std::forward<Func>(function), Qt::AutoConnection, ret,
508 std::forward<Args>(args)...);
511 template <
typename Func,
typename... Args>
512 static std::enable_if_t<!std::disjunction_v<std::is_convertible<Func,
const char *>,
513 QtPrivate::Invoke::AreOldStyleArgs<Args...>>,
515 invokeMethod(
typename QtPrivate::ContextTypeForFunctor<Func>::ContextType *object,
516 Func &&function, Args &&...args)
518 using R =
typename QtPrivate::Callable<Func, Args...>::ReturnType;
519 QTemplatedMetaMethodReturnArgument<R> r{ QtPrivate::qMetaTypeInterfaceForType<R>(),
nullptr,
521 return invokeMethod(object, std::forward<Func>(function), Qt::AutoConnection, r,
522 std::forward<Args>(args)...);
527#if QT_VERSION < QT_VERSION_CHECK(7
, 0
, 0
)
528 QObject *newInstance(QGenericArgument val0,
529 QGenericArgument val1 = QGenericArgument(),
530 QGenericArgument val2 = QGenericArgument(),
531 QGenericArgument val3 = QGenericArgument(),
532 QGenericArgument val4 = QGenericArgument(),
533 QGenericArgument val5 = QGenericArgument(),
534 QGenericArgument val6 = QGenericArgument(),
535 QGenericArgument val7 = QGenericArgument(),
536 QGenericArgument val8 = QGenericArgument(),
537 QGenericArgument val9 = QGenericArgument())
const;
540 template <
typename... Args>
544 QtPrivate::Invoke::IfNotOldStyleArgs<QObject *, Args...>
546 newInstance(Args &&... arguments)
const
548 auto h = QtPrivate::invokeMethodHelper(QMetaMethodReturnArgument{}, std::forward<Args>(arguments)...);
549 return newInstanceImpl(
this, h.parameterCount(), h.parameters.data(),
550 h.typeNames.data(), h.metaTypes.data());
560 RegisterPropertyMetaType,
561 RegisterMethodArgumentMetaType,
567 int static_metacall(Call,
int,
void **)
const;
568 static int metacall(QObject *, Call,
int,
void **);
570 template <
const QMetaObject &MO>
static constexpr const QMetaObject *staticMetaObject()
576 using Getter =
const QMetaObject *(*)();
577 const QMetaObject *direct;
578 SuperData() =
default;
579 constexpr SuperData(std::nullptr_t) : direct(
nullptr) {}
580 constexpr SuperData(
const QMetaObject *mo) : direct(mo) {}
582 constexpr const QMetaObject *operator->()
const {
return operator
const QMetaObject *(); }
584#ifdef QT_NO_DATA_RELOCATION
585 Getter indirect =
nullptr;
586 constexpr SuperData(Getter g) : direct(
nullptr), indirect(g) {}
587 constexpr operator
const QMetaObject *()
const
588 {
return indirect ? indirect() : direct; }
589 template <
const QMetaObject &MO>
static constexpr SuperData link()
590 {
return SuperData(QMetaObject::staticMetaObject<MO>); }
592 constexpr SuperData(Getter g) : direct(g()) {}
593 constexpr operator
const QMetaObject *()
const
595 template <
const QMetaObject &MO>
static constexpr SuperData link()
596 {
return SuperData(QMetaObject::staticMetaObject<MO>()); }
602 const uint *stringdata;
604 typedef void (*StaticMetacallFunction)(QObject *, QMetaObject::Call,
int,
void **);
605 StaticMetacallFunction static_metacall;
606 const SuperData *relatedMetaObjects;
607 const QtPrivate::QMetaTypeInterface *
const *metaTypes;
614 template <
typename Func,
typename... Args>
616 invokeMethodCallableHelper(
typename QtPrivate::ContextTypeForFunctor<Func>::ContextType *object,
617 Func &&function, Qt::ConnectionType type,
const QMetaMethodReturnArgument &ret,
620 using Callable = QtPrivate::Callable<Func, Args...>;
621 using ExpectedArguments =
typename Callable::Arguments;
622 static_assert(
sizeof...(Args) <= ExpectedArguments::size,
"Too many arguments");
623 using ActualArguments = QtPrivate::List<Args...>;
624 static_assert(QtPrivate::CheckCompatibleArguments<ActualArguments,
625 ExpectedArguments>::value,
626 "Incompatible arguments");
628 auto h = QtPrivate::invokeMethodHelper(ret, std::forward<Args>(args)...);
631 auto callable =
new QtPrivate::QCallableObject<std::decay_t<Func>, ActualArguments,
632 typename Callable::ReturnType>(std::forward<Func>(function));
633 return invokeMethodImpl(object, callable, type, h.parameterCount(), h.parameters.data(),
634 h.typeNames.data(), h.metaTypes.data());
637 static bool invokeMethodImpl(QObject *object,
const char *member, Qt::ConnectionType type,
638 qsizetype parameterCount,
const void *
const *parameters,
const char *
const *names,
639 const QtPrivate::QMetaTypeInterface *
const *metaTypes);
640 static bool invokeMethodImpl(QObject *object, QtPrivate::QSlotObjectBase *slotObj,
641 Qt::ConnectionType type, qsizetype parameterCount,
642 const void *
const *params,
const char *
const *names,
643 const QtPrivate::QMetaTypeInterface *
const *metaTypes);
644#if QT_CORE_REMOVED_SINCE(6
, 7
)
645 static bool invokeMethodImpl(QObject *object, QtPrivate::QSlotObjectBase *slot, Qt::ConnectionType type,
void *ret);
647 static QObject *newInstanceImpl(
const QMetaObject *mobj, qsizetype parameterCount,
648 const void **parameters,
const char **typeNames,
649 const QtPrivate::QMetaTypeInterface **metaTypes);
651 friend class QChronoTimer;