Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QMetaObjectPrivate Struct Reference

#include <qmetaobject_p.h>

Inheritance diagram for QMetaObjectPrivate:
Collaboration diagram for QMetaObjectPrivate:

Public Types

enum  { OutputRevision = QtMocConstants::OutputRevision }
enum  { IntsPerMethod = QMetaMethod::Data::Size }
enum  { IntsPerEnum = QMetaEnum::Data::Size }
enum  { IntsPerProperty = QMetaProperty::Data::Size }
enum class  Which { Name , Alias }
enum  DisconnectType { DisconnectAll , DisconnectOne }

Static Public Member Functions

static const QMetaObjectPrivateget (const QMetaObject *metaobject)
static int originalClone (const QMetaObject *obj, int local_method_index)
static QByteArray normalizedSignature (QByteArrayView method)
static QByteArrayView decodeMethodSignature (QByteArrayView signature, QArgumentTypeArray &types)
static int indexOfSignalRelative (const QMetaObject **baseObject, QByteArrayView name, QSpan< const QArgumentType > types)
static int indexOfSlotRelative (const QMetaObject **m, QByteArrayView name, QSpan< const QArgumentType > types)
static int indexOfSignal (const QMetaObject *m, QByteArrayView name, QSpan< const QArgumentType > types)
static int indexOfSlot (const QMetaObject *m, QByteArrayView name, QSpan< const QArgumentType > types)
static int indexOfMethod (const QMetaObject *m, QByteArrayView name, QSpan< const QArgumentType > types)
static int indexOfConstructor (const QMetaObject *m, QByteArrayView name, QSpan< const QArgumentType > types)
static int indexOfEnumerator (const QMetaObject *m, QByteArrayView name, Which which)
static int indexOfEnumerator (const QMetaObject *m, QByteArrayView name)
static Q_CORE_EXPORT QMetaMethod signal (const QMetaObject *m, int signal_index)
static int signalOffset (const QMetaObject *m)
static Q_CORE_EXPORT int absoluteSignalCount (const QMetaObject *m)
static Q_CORE_EXPORT int signalIndex (const QMetaMethod &m)
static bool checkConnectArgs (QSpan< const QArgumentType > signalTypes, QSpan< const QArgumentType > methodTypes)
static bool checkConnectArgs (const QMetaMethodPrivate *signal, const QMetaMethodPrivate *method)
static QByteArrayView parameterTypeNamesFromSignature (QByteArrayView signature, QVarLengthArray< QByteArrayView, 10 > &typeNames)
static void memberIndexes (const QObject *obj, const QMetaMethod &member, int *signalIndex, int *methodIndex)
static QObjectPrivate::Connectionconnect (const QObject *sender, int signal_index, const QMetaObject *smeta, const QObject *receiver, int method_index_relative, const QMetaObject *rmeta=nullptr, int type=0, int *types=nullptr)
static bool disconnect (const QObject *sender, int signal_index, const QMetaObject *smeta, const QObject *receiver, int method_index, void **slot, DisconnectType=DisconnectAll)
static bool disconnectHelper (QObjectPrivate::ConnectionData *connections, int signalIndex, const QObject *receiver, int method_index, void **slot, QBasicMutex *senderMutex, DisconnectType=DisconnectAll)
static int indexOfMethodRelative (const QMetaObject **baseObject, QByteArrayView name, QSpan< const QArgumentType > types, QMetaMethod::MethodType what)
static bool methodMatch (const QMetaObject *m, const QMetaMethod &method, QByteArrayView name, QSpan< const QArgumentType > types)
static Q_CORE_EXPORT QMetaMethod firstMethod (const QMetaObject *baseObject, QByteArrayView name)

Public Attributes

int revision
int className
int classInfoCount
int classInfoData
int methodCount
int methodData
int propertyCount
int propertyData
int enumeratorCount
int enumeratorData
int constructorCount
int constructorData
int flags
int signalCount

Detailed Description

Definition at line 111 of file qmetaobject_p.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
OutputRevision 

Definition at line 113 of file qmetaobject_p.h.

◆ anonymous enum

anonymous enum
Enumerator
IntsPerEnum 

Definition at line 115 of file qmetaobject_p.h.

◆ anonymous enum

anonymous enum
Enumerator
IntsPerProperty 

Definition at line 116 of file qmetaobject_p.h.

◆ anonymous enum

anonymous enum
Enumerator
IntsPerMethod 

Definition at line 114 of file qmetaobject_p.h.

◆ DisconnectType

Enumerator
DisconnectAll 
DisconnectOne 

Definition at line 177 of file qmetaobject_p.h.

◆ Which

enum class QMetaObjectPrivate::Which
strong
Enumerator
Name 
Alias 

Definition at line 151 of file qmetaobject_p.h.

Member Function Documentation

◆ absoluteSignalCount()

int QMetaObjectPrivate::absoluteSignalCount ( const QMetaObject * m)
static
Since
5.0

Returns the number of signals for the class m, including the signals for the base class.

Similar to QMetaObject::methodCount(), but non-signal methods are excluded.

Definition at line 1002 of file qmetaobject.cpp.

◆ checkConnectArgs() [1/2]

bool QMetaObjectPrivate::checkConnectArgs ( const QMetaMethodPrivate * signal,
const QMetaMethodPrivate * method )
static

Returns true if the signal and method arguments are compatible; otherwise returns false.

Definition at line 1077 of file qmetaobject.cpp.

References typeFromTypeInfo().

Here is the call graph for this function:

◆ checkConnectArgs() [2/2]

bool QMetaObjectPrivate::checkConnectArgs ( QSpan< const QArgumentType > signalTypes,
QSpan< const QArgumentType > methodTypes )
static

Returns true if the signalTypes and methodTypes are compatible; otherwise returns false.

Definition at line 1059 of file qmetaobject.cpp.

◆ connect()

QObjectPrivate::Connection * QMetaObjectPrivate::connect ( const QObject * sender,
int signal_index,
const QMetaObject * smeta,
const QObject * receiver,
int method_index,
const QMetaObject * rmeta = nullptr,
int type = 0,
int * types = nullptr )
static

Same as the QMetaObject::connect, but signal_index must be the result of QObjectPrivate::signalIndex

method_index is relative to the rmeta metaobject, if rmeta is \nullptr, then it is absolute index

the QObjectPrivate::Connection* has a refcount of 2, so it must be passed to a QMetaObject::Connection

Definition at line 3708 of file qobject.cpp.

References revision.

◆ decodeMethodSignature()

QByteArrayView QMetaObjectPrivate::decodeMethodSignature ( QByteArrayView signature,
QArgumentTypeArray & types )
static

Given a method signature (e.g. foo(int,double)), this function populates the types array and returns the method name.

No normalization of the type names is performed.

Definition at line 840 of file qmetaobject.cpp.

◆ disconnect()

bool QMetaObjectPrivate::disconnect ( const QObject * sender,
int signal_index,
const QMetaObject * smeta,
const QObject * receiver,
int method_index,
void ** slot,
DisconnectType disconnectType = DisconnectAll )
static

Same as the QMetaObject::disconnect, but signal_index must be the result of QObjectPrivate::signalIndex

Definition at line 3843 of file qobject.cpp.

◆ disconnectHelper()

bool QMetaObjectPrivate::disconnectHelper ( QObjectPrivate::ConnectionData * connections,
int signalIndex,
const QObject * receiver,
int method_index,
void ** slot,
QBasicMutex * senderMutex,
DisconnectType disconnectType = DisconnectAll )
inlinestatic

Helper function to remove the connection from the senders list and set the receivers to \nullptr

Definition at line 3803 of file qobject.cpp.

◆ firstMethod()

QMetaMethod QMetaObjectPrivate::firstMethod ( const QMetaObject * baseObject,
QByteArrayView name )
static

Returns the first method with name name found in baseObject

Definition at line 692 of file qmetaobject.cpp.

◆ get()

const QMetaObjectPrivate * QMetaObjectPrivate::get ( const QMetaObject * metaobject)
inlinestatic

Definition at line 128 of file qmetaobject_p.h.

◆ indexOfConstructor()

int QMetaObjectPrivate::indexOfConstructor ( const QMetaObject * m,
QByteArrayView name,
QSpan< const QArgumentType > types )
static

Definition at line 969 of file qmetaobject.cpp.

◆ indexOfEnumerator() [1/2]

int QMetaObjectPrivate::indexOfEnumerator ( const QMetaObject * m,
QByteArrayView name )
static

Definition at line 1137 of file qmetaobject.cpp.

◆ indexOfEnumerator() [2/2]

int QMetaObjectPrivate::indexOfEnumerator ( const QMetaObject * m,
QByteArrayView name,
Which which )
static

Definition at line 1147 of file qmetaobject.cpp.

References enumeratorCount, and Name.

◆ indexOfMethod()

int QMetaObjectPrivate::indexOfMethod ( const QMetaObject * m,
QByteArrayView name,
QSpan< const QArgumentType > types )
static

Definition at line 960 of file qmetaobject.cpp.

◆ indexOfMethodRelative()

int QMetaObjectPrivate::indexOfMethodRelative ( const QMetaObject ** baseObject,
QByteArrayView name,
QSpan< const QArgumentType > types,
QMetaMethod::MethodType what )
inlinestatic

Helper function for indexOf{Method,Slot,Signal}, returns the relative index of the method within baseObject.

If what is QMetaMethod::Method it will search all functions registered for baseobject.

Definition at line 714 of file qmetaobject.cpp.

◆ indexOfSignal()

int QMetaObjectPrivate::indexOfSignal ( const QMetaObject * m,
QByteArrayView name,
QSpan< const QArgumentType > types )
static

Definition at line 942 of file qmetaobject.cpp.

◆ indexOfSignalRelative()

int QMetaObjectPrivate::indexOfSignalRelative ( const QMetaObject ** baseObject,
QByteArrayView name,
QSpan< const QArgumentType > types )
static

Same as QMetaObject::indexOfSignal, but the result is the local offset to the base object.

baseObject will be adjusted to the enclosing QMetaObject, or \nullptr if the signal is not found

Definition at line 886 of file qmetaobject.cpp.

◆ indexOfSlot()

int QMetaObjectPrivate::indexOfSlot ( const QMetaObject * m,
QByteArrayView name,
QSpan< const QArgumentType > types )
static

Definition at line 951 of file qmetaobject.cpp.

◆ indexOfSlotRelative()

int QMetaObjectPrivate::indexOfSlotRelative ( const QMetaObject ** m,
QByteArrayView name,
QSpan< const QArgumentType > types )
static

Definition at line 935 of file qmetaobject.cpp.

◆ memberIndexes()

void QMetaObjectPrivate::memberIndexes ( const QObject * obj,
const QMetaMethod & member,
int * signalIndex,
int * methodIndex )
static

This helper function calculates signal and method index for the given member in the specified class.

\list

  • If member.mobj is \nullptr then both signalIndex and methodIndex are set to -1.
  • If specified member is not a member of obj instance class (or one of its parent classes) then both signalIndex and methodIndex are set to -1. \endlist

This function is used by QObject::connect and QObject::disconnect which are working with QMetaMethod.

signalIndex is set to the signal index of member. If the member specified is not signal this variable is set to -1.

methodIndex is set to the method index of the member. If the member is not a method of the object specified by the obj argument this variable is set to -1.

Definition at line 2934 of file qobject.cpp.

References computeOffsets().

Here is the call graph for this function:

◆ methodMatch()

bool QMetaObjectPrivate::methodMatch ( const QMetaObject * m,
const QMetaMethod & method,
QByteArrayView name,
QSpan< const QArgumentType > types )
static

Definition at line 650 of file qmetaobject.cpp.

◆ normalizedSignature()

QByteArray QMetaObjectPrivate::normalizedSignature ( QByteArrayView method)
static

Definition at line 1442 of file qmetaobject.cpp.

References is_ident_char(), and is_space().

Here is the call graph for this function:

◆ originalClone()

int QMetaObjectPrivate::originalClone ( const QMetaObject * mobj,
int local_method_index )
static

If the local_method_index is a cloned method, return the index of the original.

A "cloned" method is a function with a default argument, this is handled by pretending there is an overload without the argument, and the original function is the overload with all arguments present.

Example: for a function {QObject::destroyed(QObject *o = nullptr}, if the index of {destroyed()} is passed, the index of {destroyed(QObject*)} is returned.

Definition at line 4595 of file qmetaobject.cpp.

◆ parameterTypeNamesFromSignature()

QByteArrayView QMetaObjectPrivate::parameterTypeNamesFromSignature ( QByteArrayView sig,
QVarLengthArray< QByteArrayView, 10 > & typeNames )
static

Given a method signature (e.g. foo(int,double)), this function populates the types array with the parameter type names, and returns the method name.

No normalization of the type names is performed.

Definition at line 4615 of file qmetaobject.cpp.

◆ signal()

QMetaMethod QMetaObjectPrivate::signal ( const QMetaObject * m,
int signal_index )
static
Since
5.0

Returns the signal for the given meta-object m at signal_index.

It it different from QMetaObject::method(); the index should not include non-signal methods.

Definition at line 1036 of file qmetaobject.cpp.

◆ signalIndex()

int QMetaObjectPrivate::signalIndex ( const QMetaMethod & m)
static
Since
5.0

Returns the index of the signal method m.

Similar to QMetaMethod::methodIndex(), but non-signal methods are excluded.

Definition at line 1020 of file qmetaobject.cpp.

◆ signalOffset()

int QMetaObjectPrivate::signalOffset ( const QMetaObject * m)
inlinestatic
Since
5.0

Returns the signal offset for the class m; i.e., the index position of the class's first signal.

Similar to QMetaObject::methodOffset(), but non-signal methods are excluded.

Definition at line 156 of file qmetaobject_p.h.

References signalCount.

Member Data Documentation

◆ classInfoCount

int QMetaObjectPrivate::classInfoCount

Definition at line 120 of file qmetaobject_p.h.

Referenced by buildMetaObject().

◆ classInfoData

int QMetaObjectPrivate::classInfoData

Definition at line 120 of file qmetaobject_p.h.

Referenced by buildMetaObject().

◆ className

int QMetaObjectPrivate::className

Definition at line 119 of file qmetaobject_p.h.

Referenced by buildMetaObject().

◆ constructorCount

int QMetaObjectPrivate::constructorCount

Definition at line 124 of file qmetaobject_p.h.

Referenced by buildMetaObject().

◆ constructorData

int QMetaObjectPrivate::constructorData

Definition at line 124 of file qmetaobject_p.h.

Referenced by buildMetaObject().

◆ enumeratorCount

int QMetaObjectPrivate::enumeratorCount

Definition at line 123 of file qmetaobject_p.h.

Referenced by buildMetaObject(), and indexOfEnumerator().

◆ enumeratorData

int QMetaObjectPrivate::enumeratorData

Definition at line 123 of file qmetaobject_p.h.

Referenced by buildMetaObject().

◆ flags

int QMetaObjectPrivate::flags

Definition at line 125 of file qmetaobject_p.h.

◆ methodCount

int QMetaObjectPrivate::methodCount

Definition at line 121 of file qmetaobject_p.h.

Referenced by buildMetaObject(), and computeOffsets().

◆ methodData

int QMetaObjectPrivate::methodData

Definition at line 121 of file qmetaobject_p.h.

Referenced by buildMetaObject().

◆ propertyCount

int QMetaObjectPrivate::propertyCount

Definition at line 122 of file qmetaobject_p.h.

Referenced by buildMetaObject().

◆ propertyData

int QMetaObjectPrivate::propertyData

Definition at line 122 of file qmetaobject_p.h.

Referenced by buildMetaObject().

◆ revision

int QMetaObjectPrivate::revision

Definition at line 118 of file qmetaobject_p.h.

Referenced by buildMetaObject(), computeOffsets(), and connect().

◆ signalCount

int QMetaObjectPrivate::signalCount

Definition at line 126 of file qmetaobject_p.h.

Referenced by computeOffsets(), and signalOffset().


The documentation for this struct was generated from the following files: