237 const char *className()
const;
238 const QMetaObject *superClass()
const;
240 bool inherits(
const QMetaObject *metaObject)
const noexcept;
241 QObject *cast(QObject *obj)
const
242 {
return const_cast<QObject *>(cast(
const_cast<
const QObject *>(obj))); }
243 const QObject *cast(
const QObject *obj)
const;
245#if !defined(QT_NO_TRANSLATION) || defined(Q_QDOC)
246 QString tr(
const char *s,
const char *c,
int n = -1)
const;
249 QMetaType metaType()
const;
251 int methodOffset()
const;
252 int enumeratorOffset()
const;
253 int propertyOffset()
const;
254 int classInfoOffset()
const;
256 int constructorCount()
const;
257 int methodCount()
const;
258 int enumeratorCount()
const;
259 int propertyCount()
const;
260 int classInfoCount()
const;
262 int indexOfConstructor(
const char *constructor)
const;
263 int indexOfMethod(
const char *method)
const;
264 int indexOfSignal(
const char *signal)
const;
265 int indexOfSlot(
const char *slot)
const;
266 int indexOfEnumerator(
const char *name)
const;
268 int indexOfProperty(
const char *name)
const;
269 int indexOfClassInfo(
const char *name)
const;
271 QMetaMethod constructor(
int index)
const;
272 QMetaMethod method(
int index)
const;
273 QMetaEnum enumerator(
int index)
const;
274 QMetaProperty property(
int index)
const;
275 QMetaClassInfo classInfo(
int index)
const;
276 QMetaProperty userProperty()
const;
278 static bool checkConnectArgs(
const char *signal,
const char *method);
279 static bool checkConnectArgs(
const QMetaMethod &signal,
280 const QMetaMethod &method);
281 static QByteArray normalizedSignature(
const char *method);
282 static QByteArray normalizedType(
const char *type);
285 static Connection connect(
const QObject *sender,
int signal_index,
286 const QObject *receiver,
int method_index,
287 int type = 0,
int *types =
nullptr);
289 static bool disconnect(
const QObject *sender,
int signal_index,
290 const QObject *receiver,
int method_index);
291 static bool disconnectOne(
const QObject *sender,
int signal_index,
292 const QObject *receiver,
int method_index);
294 static void connectSlotsByName(QObject *o);
297 template<
typename PointerToMemberFunction>
298 static QMetaObject::Connection connect(
const QObject *sender,
const QMetaMethod &signal,
const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type = Qt::AutoConnection);
299 template<
typename Functor>
300 static QMetaObject::Connection connect(
const QObject *sender,
const QMetaMethod &signal,
const QObject *context, Functor functor, Qt::ConnectionType type = Qt::AutoConnection);
302 template <
typename Func>
303 static inline Connection
304 connect(
const QObject *sender,
const QMetaMethod &signal,
305 const typename QtPrivate::ContextTypeForFunctor<Func>::ContextType *context, Func &&slot,
306 Qt::ConnectionType type = Qt::AutoConnection);
310 static void activate(QObject *sender,
int signal_index,
void **argv);
311 static void activate(QObject *sender,
const QMetaObject *,
int local_signal_index,
void **argv);
312 static void activate(QObject *sender,
int signal_offset,
int local_signal_index,
void **argv);
313 template <
typename Ret,
typename... Args>
static inline void
314 activate(QObject *sender,
const QMetaObject *mo,
int local_signal_index, Ret *ret,
const Args &... args)
317 const_cast<
void *>(
reinterpret_cast<
const volatile void *>(ret)),
318 const_cast<
void *>(
reinterpret_cast<
const volatile void *>(std::addressof(args)))...
320 activate(sender, mo, local_signal_index, _a);
323#if QT_VERSION <= QT_VERSION_CHECK(7
, 0
, 0
)
324 static bool invokeMethod(QObject *obj,
const char *member,
326 QGenericReturnArgument ret,
327 QGenericArgument val0 = QGenericArgument(
nullptr),
328 QGenericArgument val1 = QGenericArgument(),
329 QGenericArgument val2 = QGenericArgument(),
330 QGenericArgument val3 = QGenericArgument(),
331 QGenericArgument val4 = QGenericArgument(),
332 QGenericArgument val5 = QGenericArgument(),
333 QGenericArgument val6 = QGenericArgument(),
334 QGenericArgument val7 = QGenericArgument(),
335 QGenericArgument val8 = QGenericArgument(),
336 QGenericArgument val9 = QGenericArgument());
338 static inline bool invokeMethod(QObject *obj,
const char *member,
339 QGenericReturnArgument ret,
340 QGenericArgument val0 = QGenericArgument(
nullptr),
341 QGenericArgument val1 = QGenericArgument(),
342 QGenericArgument val2 = QGenericArgument(),
343 QGenericArgument val3 = QGenericArgument(),
344 QGenericArgument val4 = QGenericArgument(),
345 QGenericArgument val5 = QGenericArgument(),
346 QGenericArgument val6 = QGenericArgument(),
347 QGenericArgument val7 = QGenericArgument(),
348 QGenericArgument val8 = QGenericArgument(),
349 QGenericArgument val9 = QGenericArgument())
351 return invokeMethod(obj, member, Qt::AutoConnection, ret, val0, val1, val2, val3,
352 val4, val5, val6, val7, val8, val9);
355 static inline bool invokeMethod(QObject *obj,
const char *member,
356 Qt::ConnectionType type,
357 QGenericArgument val0,
358 QGenericArgument val1 = QGenericArgument(),
359 QGenericArgument val2 = QGenericArgument(),
360 QGenericArgument val3 = QGenericArgument(),
361 QGenericArgument val4 = QGenericArgument(),
362 QGenericArgument val5 = QGenericArgument(),
363 QGenericArgument val6 = QGenericArgument(),
364 QGenericArgument val7 = QGenericArgument(),
365 QGenericArgument val8 = QGenericArgument(),
366 QGenericArgument val9 = QGenericArgument())
368 return invokeMethod(obj, member, type, QGenericReturnArgument(), val0, val1, val2,
369 val3, val4, val5, val6, val7, val8, val9);
372 static inline bool invokeMethod(QObject *obj,
const char *member,
373 QGenericArgument val0,
374 QGenericArgument val1 = QGenericArgument(),
375 QGenericArgument val2 = QGenericArgument(),
376 QGenericArgument val3 = QGenericArgument(),
377 QGenericArgument val4 = QGenericArgument(),
378 QGenericArgument val5 = QGenericArgument(),
379 QGenericArgument val6 = QGenericArgument(),
380 QGenericArgument val7 = QGenericArgument(),
381 QGenericArgument val8 = QGenericArgument(),
382 QGenericArgument val9 = QGenericArgument())
384 return invokeMethod(obj, member, Qt::AutoConnection, QGenericReturnArgument(), val0,
385 val1, val2, val3, val4, val5, val6, val7, val8, val9);
389 template <
typename ReturnArg,
typename... Args>
static
393 QtPrivate::Invoke::IfNotOldStyleArgs<
bool, Args...>
395 invokeMethod(QObject *obj,
const char *member, Qt::ConnectionType c,
396 QTemplatedMetaMethodReturnArgument<ReturnArg> r, Args &&... arguments)
398 auto h = QtPrivate::invokeMethodHelper(r, std::forward<Args>(arguments)...);
399 return invokeMethodImpl(obj, member, c, h.parameterCount(), h.parameters.data(),
400 h.typeNames.data(), h.metaTypes.data());
403 template <
typename... Args>
static
407 QtPrivate::Invoke::IfNotOldStyleArgs<
bool, Args...>
409 invokeMethod(QObject *obj,
const char *member, Qt::ConnectionType c, Args &&... arguments)
411 QTemplatedMetaMethodReturnArgument<
void> r = {};
412 return invokeMethod(obj, member, c, r, std::forward<Args>(arguments)...);
415 template <
typename ReturnArg,
typename... Args>
static
419 QtPrivate::Invoke::IfNotOldStyleArgs<
bool, Args...>
421 invokeMethod(QObject *obj,
const char *member, QTemplatedMetaMethodReturnArgument<ReturnArg> r,
422 Args &&... arguments)
424 return invokeMethod(obj, member, Qt::AutoConnection, r, std::forward<Args>(arguments)...);
427 template <
typename... Args>
static
431 QtPrivate::Invoke::IfNotOldStyleArgs<
bool, Args...>
433 invokeMethod(QObject *obj,
const char *member, Args &&... arguments)
435 QTemplatedMetaMethodReturnArgument<
void> r = {};
436 return invokeMethod(obj, member, Qt::AutoConnection, r, std::forward<Args>(arguments)...);
440 template<
typename Functor,
typename FunctorReturnType>
441 static bool invokeMethod(QObject *context, Functor &&function, Qt::ConnectionType type = Qt::AutoConnection, FunctorReturnType *ret =
nullptr);
442 template<
typename Functor,
typename FunctorReturnType>
443 static bool invokeMethod(QObject *context, Functor &&function, FunctorReturnType *ret);
445 template<
typename Functor,
typename FunctorReturnType,
typename... Args>
446 static bool invokeMethod(QObject *context, Functor &&function, Qt::ConnectionType type, QTemplatedMetaMethodReturnArgument<FunctorReturnType> ret, Args &&...arguments);
447 template<
typename Functor,
typename FunctorReturnType,
typename... Args>
448 static bool invokeMethod(QObject *context, Functor &&function, QTemplatedMetaMethodReturnArgument<FunctorReturnType> ret, Args &&...arguments);
449 template<
typename Functor,
typename... Args>
450 static bool invokeMethod(QObject *context, Functor &&function, Qt::ConnectionType type, Args &&...arguments);
451 template<
typename Functor,
typename... Args>
452 static bool invokeMethod(QObject *context, Functor &&function, Args &&...arguments);
454 template <
typename Func>
455 static std::enable_if_t<!std::disjunction_v<std::is_convertible<Func,
const char *>,
456 QtPrivate::Invoke::AreOldStyleArgs<Func>>,
458 invokeMethod(
typename QtPrivate::ContextTypeForFunctor<Func>::ContextType *object,
459 Func &&function, Qt::ConnectionType type,
460 typename QtPrivate::Callable<Func>::ReturnType *ret)
462 using R =
typename QtPrivate::Callable<Func>::ReturnType;
463 const auto getReturnArg = [ret]() -> QTemplatedMetaMethodReturnArgument<R> {
464 if constexpr (std::is_void_v<R>)
467 return ret ? qReturnArg(*ret) : QTemplatedMetaMethodReturnArgument<R>{};
469 return invokeMethod(object, std::forward<Func>(function), type, getReturnArg());
471 template <
typename Func>
472 static std::enable_if_t<!std::disjunction_v<std::is_convertible<Func,
const char *>,
473 QtPrivate::Invoke::AreOldStyleArgs<Func>>,
475 invokeMethod(
typename QtPrivate::ContextTypeForFunctor<Func>::ContextType *object,
476 Func &&function,
typename QtPrivate::Callable<Func>::ReturnType *ret)
478 return invokeMethod(object, std::forward<Func>(function), Qt::AutoConnection, ret);
481 template <
typename Func,
typename... Args>
482 static std::enable_if_t<!std::disjunction_v<std::is_convertible<Func,
const char *>,
483 QtPrivate::Invoke::AreOldStyleArgs<Args...>>,
485 invokeMethod(
typename QtPrivate::ContextTypeForFunctor<Func>::ContextType *object,
486 Func &&function, Qt::ConnectionType type,
487 QTemplatedMetaMethodReturnArgument<
488 typename QtPrivate::Callable<Func, Args...>::ReturnType>
492 return invokeMethodCallableHelper(object, std::forward<Func>(function), type, ret,
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,
501 Func &&function, Qt::ConnectionType type, Args &&...args)
503 using R =
typename QtPrivate::Callable<Func, Args...>::ReturnType;
504 QTemplatedMetaMethodReturnArgument<R> r{ QtPrivate::qMetaTypeInterfaceForType<R>(),
nullptr,
506 return invokeMethod(object, std::forward<Func>(function), type, r,
507 std::forward<Args>(args)...);
510 template <
typename Func,
typename... Args>
511 static std::enable_if_t<!std::disjunction_v<std::is_convertible<Func,
const char *>,
512 QtPrivate::Invoke::AreOldStyleArgs<Args...>>,
514 invokeMethod(
typename QtPrivate::ContextTypeForFunctor<Func>::ContextType *object,
516 QTemplatedMetaMethodReturnArgument<
517 typename QtPrivate::Callable<Func, Args...>::ReturnType>
521 return invokeMethod(object, std::forward<Func>(function), Qt::AutoConnection, ret,
522 std::forward<Args>(args)...);
525 template <
typename Func,
typename... Args>
526 static std::enable_if_t<!std::disjunction_v<std::is_convertible<Func,
const char *>,
527 QtPrivate::Invoke::AreOldStyleArgs<Args...>>,
529 invokeMethod(
typename QtPrivate::ContextTypeForFunctor<Func>::ContextType *object,
530 Func &&function, Args &&...args)
532 using R =
typename QtPrivate::Callable<Func, Args...>::ReturnType;
533 QTemplatedMetaMethodReturnArgument<R> r{ QtPrivate::qMetaTypeInterfaceForType<R>(),
nullptr,
535 return invokeMethod(object, std::forward<Func>(function), Qt::AutoConnection, r,
536 std::forward<Args>(args)...);
541#if QT_VERSION < QT_VERSION_CHECK(7
, 0
, 0
)
542 QObject *newInstance(QGenericArgument val0,
543 QGenericArgument val1 = QGenericArgument(),
544 QGenericArgument val2 = QGenericArgument(),
545 QGenericArgument val3 = QGenericArgument(),
546 QGenericArgument val4 = QGenericArgument(),
547 QGenericArgument val5 = QGenericArgument(),
548 QGenericArgument val6 = QGenericArgument(),
549 QGenericArgument val7 = QGenericArgument(),
550 QGenericArgument val8 = QGenericArgument(),
551 QGenericArgument val9 = QGenericArgument())
const;
554 template <
typename... Args>
558 QtPrivate::Invoke::IfNotOldStyleArgs<QObject *, Args...>
560 newInstance(Args &&... arguments)
const
562 auto h = QtPrivate::invokeMethodHelper(QMetaMethodReturnArgument{}, std::forward<Args>(arguments)...);
563 return newInstanceImpl(
this, h.parameterCount(), h.parameters.data(),
564 h.typeNames.data(), h.metaTypes.data());
574 RegisterPropertyMetaType,
575 RegisterMethodArgumentMetaType,
581 int static_metacall(Call,
int,
void **)
const;
582 static int metacall(QObject *, Call,
int,
void **);
584 template <
const QMetaObject &MO>
static constexpr const QMetaObject *staticMetaObject()
590 using Getter =
const QMetaObject *(*)();
591 const QMetaObject *direct;
592 SuperData() =
default;
593 constexpr SuperData(std::nullptr_t) : direct(
nullptr) {}
594 constexpr SuperData(
const QMetaObject *mo) : direct(mo) {}
596 constexpr const QMetaObject *operator->()
const {
return operator
const QMetaObject *(); }
598#ifdef QT_NO_DATA_RELOCATION
599 Getter indirect =
nullptr;
600 constexpr SuperData(Getter g) : direct(
nullptr), indirect(g) {}
601 constexpr operator
const QMetaObject *()
const
602 {
return indirect ? indirect() : direct; }
603 template <
const QMetaObject &MO>
static constexpr SuperData link()
604 {
return SuperData(QMetaObject::staticMetaObject<MO>); }
606 constexpr SuperData(Getter g) : direct(g()) {}
607 constexpr operator
const QMetaObject *()
const
609 template <
const QMetaObject &MO>
static constexpr SuperData link()
610 {
return SuperData(QMetaObject::staticMetaObject<MO>()); }
616 const uint *stringdata;
618 typedef void (*StaticMetacallFunction)(QObject *, QMetaObject::Call,
int,
void **);
619 StaticMetacallFunction static_metacall;
620 const SuperData *relatedMetaObjects;
621 const QtPrivate::QMetaTypeInterface *
const *metaTypes;
628 template <
typename Func,
typename... Args>
630 invokeMethodCallableHelper(
typename QtPrivate::ContextTypeForFunctor<Func>::ContextType *object,
631 Func &&function, Qt::ConnectionType type,
const QMetaMethodReturnArgument &ret,
634 using Callable = QtPrivate::Callable<Func, Args...>;
635 using ExpectedArguments =
typename Callable::Arguments;
636 static_assert(
sizeof...(Args) <= ExpectedArguments::size,
"Too many arguments");
637 using ActualArguments = QtPrivate::List<Args...>;
638 static_assert(QtPrivate::CheckCompatibleArguments<ActualArguments,
639 ExpectedArguments>::value,
640 "Incompatible arguments");
642 auto h = QtPrivate::invokeMethodHelper(ret, std::forward<Args>(args)...);
645 auto callable =
new QtPrivate::QCallableObject<std::decay_t<Func>, ActualArguments,
646 typename Callable::ReturnType>(std::forward<Func>(function));
647 return invokeMethodImpl(object, callable, type, h.parameterCount(), h.parameters.data(),
648 h.typeNames.data(), h.metaTypes.data());
652 static bool invokeMethodImpl(QObject *object,
const char *member, Qt::ConnectionType type,
653 qsizetype parameterCount,
const void *
const *parameters,
const char *
const *names,
654 const QtPrivate::QMetaTypeInterface *
const *metaTypes);
655 static bool invokeMethodImpl(QObject *object, QtPrivate::QSlotObjectBase *slotObj,
656 Qt::ConnectionType type, qsizetype parameterCount,
657 const void *
const *params,
const char *
const *names,
658 const QtPrivate::QMetaTypeInterface *
const *metaTypes);
659#if QT_CORE_REMOVED_SINCE(6
, 7
)
660 static bool invokeMethodImpl(QObject *object, QtPrivate::QSlotObjectBase *slot, Qt::ConnectionType type,
void *ret);
662 static QObject *newInstanceImpl(
const QMetaObject *mobj, qsizetype parameterCount,
663 const void **parameters,
const char **typeNames,
664 const QtPrivate::QMetaTypeInterface **metaTypes);
666 static QMetaObject::Connection connectImpl(
const QObject *sender,
const QMetaMethod& signal,
667 const QObject *receiver,
void **slotPtr,
668 QtPrivate::QSlotObjectBase *slot, Qt::ConnectionType type);
671 friend class QChronoTimer;