Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QMetaObject Class Reference

\inmodule QtCore More...

#include <qobjectdefs.h>

+ Inheritance diagram for QMetaObject:
+ Collaboration diagram for QMetaObject:

Classes

struct  Data
 
struct  SuperData
 

Public Types

enum  Call {
  InvokeMetaMethod , ReadProperty , WriteProperty , ResetProperty ,
  CreateInstance , IndexOfMethod , RegisterPropertyMetaType , RegisterMethodArgumentMetaType ,
  BindableProperty , CustomCall , ConstructInPlace
}
 
typedef void *Connection::* RestrictedBool
 

Public Member Functions

const char * className () const
 Returns the class name.
 
const QMetaObjectsuperClass () const
 Returns the meta-object of the superclass, or \nullptr if there is no such object.
 
bool inherits (const QMetaObject *metaObject) const noexcept
 Returns true if the class described by this QMetaObject inherits the type described by metaObject; otherwise returns false.
 
QObjectcast (QObject *obj) const
 
const QObjectcast (const QObject *obj) const
 
QString tr (const char *s, const char *c, int n=-1) const
 
QMetaType metaType () const
 
int methodOffset () const
 Returns the method offset for this class; i.e.
 
int enumeratorOffset () const
 Returns the enumerator offset for this class; i.e.
 
int propertyOffset () const
 Returns the property offset for this class; i.e.
 
int classInfoOffset () const
 Returns the class information offset for this class; i.e.
 
int constructorCount () const
 
int methodCount () const
 Returns the number of methods in this class, including the number of methods provided by each base class.
 
int enumeratorCount () const
 Returns the number of enumerators in this class.
 
int propertyCount () const
 Returns the number of properties in this class, including the number of properties provided by each base class.
 
int classInfoCount () const
 Returns the number of items of class information in this class.
 
int indexOfConstructor (const char *constructor) const
 
int indexOfMethod (const char *method) const
 Finds method and returns its index; otherwise returns -1.
 
int indexOfSignal (const char *signal) const
 Finds signal and returns its index; otherwise returns -1.
 
int indexOfSlot (const char *slot) const
 Finds slot and returns its index; otherwise returns -1.
 
int indexOfEnumerator (const char *name) const
 Finds enumerator name and returns its index; otherwise returns -1.
 
int indexOfProperty (const char *name) const
 Finds property name and returns its index; otherwise returns -1.
 
int indexOfClassInfo (const char *name) const
 Finds class information item name and returns its index; otherwise returns -1.
 
QMetaMethod constructor (int index) const
 
QMetaMethod method (int index) const
 Returns the meta-data for the method with the given index.
 
QMetaEnum enumerator (int index) const
 Returns the meta-data for the enumerator with the given index.
 
QMetaProperty property (int index) const
 Returns the meta-data for the property with the given index.
 
QMetaClassInfo classInfo (int index) const
 Returns the meta-data for the item of class information with the given index.
 
QMetaProperty userProperty () const
 
template<typename... Args>
QtPrivate::Invoke::IfNotOldStyleArgs< QObject *, Args... > newInstance (Args &&... arguments) const
 
int static_metacall (Call, int, void **) const
 
 ~Connection ()
 
 Connection ()
 
 Connection (const Connection &other)
 
Connectionoperator= (const Connection &other)
 
 operator RestrictedBool () const
 
 Connection (Connection &&other) noexcept
 
void swap (Connection &other) noexcept
 

Static Public Member Functions

static bool checkConnectArgs (const char *signal, const char *method)
 Returns true if the signal and method arguments are compatible; otherwise returns false.
 
static bool checkConnectArgs (const QMetaMethod &signal, const QMetaMethod &method)
 
static QByteArray normalizedSignature (const char *method)
 Normalizes the signature of the given method.
 
static QByteArray normalizedType (const char *type)
 
static Connection connect (const QObject *sender, int signal_index, const QObject *receiver, int method_index, int type=0, int *types=nullptr)
 
static bool disconnect (const QObject *sender, int signal_index, const QObject *receiver, int method_index)
 
static bool disconnectOne (const QObject *sender, int signal_index, const QObject *receiver, int method_index)
 
static void connectSlotsByName (QObject *o)
 Searches recursively for all child objects of the given object, and connects matching signals from them to slots of object that follow the following form:
 
static void activate (QObject *sender, int signal_index, void **argv)
 
static void activate (QObject *sender, const QMetaObject *, int local_signal_index, void **argv)
 
static void activate (QObject *sender, int signal_offset, int local_signal_index, void **argv)
 
static bool invokeMethod (QObject *obj, const char *member, Qt::ConnectionType, QGenericReturnArgument ret, QGenericArgument val0=QGenericArgument(nullptr), QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument(), QGenericArgument val4=QGenericArgument(), QGenericArgument val5=QGenericArgument(), QGenericArgument val6=QGenericArgument(), QGenericArgument val7=QGenericArgument(), QGenericArgument val8=QGenericArgument(), QGenericArgument val9=QGenericArgument())
 \threadsafe This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. \obsolete [6.5] Please use the variadic overload of this function
 
static bool invokeMethod (QObject *obj, const char *member, QGenericReturnArgument ret, QGenericArgument val0=QGenericArgument(nullptr), QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument(), QGenericArgument val4=QGenericArgument(), QGenericArgument val5=QGenericArgument(), QGenericArgument val6=QGenericArgument(), QGenericArgument val7=QGenericArgument(), QGenericArgument val8=QGenericArgument(), QGenericArgument val9=QGenericArgument())
 
static bool invokeMethod (QObject *obj, const char *member, Qt::ConnectionType type, QGenericArgument val0, QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument(), QGenericArgument val4=QGenericArgument(), QGenericArgument val5=QGenericArgument(), QGenericArgument val6=QGenericArgument(), QGenericArgument val7=QGenericArgument(), QGenericArgument val8=QGenericArgument(), QGenericArgument val9=QGenericArgument())
 
static bool invokeMethod (QObject *obj, const char *member, QGenericArgument val0, QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument(), QGenericArgument val4=QGenericArgument(), QGenericArgument val5=QGenericArgument(), QGenericArgument val6=QGenericArgument(), QGenericArgument val7=QGenericArgument(), QGenericArgument val8=QGenericArgument(), QGenericArgument val9=QGenericArgument())
 
template<typename... Args>
static QtPrivate::Invoke::IfNotOldStyleArgs< bool, Args... > invokeMethod (QObject *obj, const char *member, Qt::ConnectionType c, QMetaMethodReturnArgument r, Args &&... arguments)
 
template<typename... Args>
static QtPrivate::Invoke::IfNotOldStyleArgs< bool, Args... > invokeMethod (QObject *obj, const char *member, Qt::ConnectionType c, Args &&... arguments)
 
template<typename... Args>
static QtPrivate::Invoke::IfNotOldStyleArgs< bool, Args... > invokeMethod (QObject *obj, const char *member, QMetaMethodReturnArgument r, Args &&... arguments)
 
template<typename... Args>
static QtPrivate::Invoke::IfNotOldStyleArgs< bool, Args... > invokeMethod (QObject *obj, const char *member, Args &&... arguments)
 
template<typename Func >
static std::enable_if_t<!std::disjunction_v< std::is_convertible< Func, const char * >, QtPrivate::Invoke::AreOldStyleArgs< Func > >, bool > invokeMethod (typename QtPrivate::ContextTypeForFunctor< Func >::ContextType *object, Func &&function, Qt::ConnectionType type=Qt::AutoConnection, typename QtPrivate::Callable< Func >::ReturnType *ret=nullptr)
 
template<typename Func >
static std::enable_if_t<!std::disjunction_v< std::is_convertible< Func, const char * >, QtPrivate::Invoke::AreOldStyleArgs< Func > >, bool > invokeMethod (typename QtPrivate::ContextTypeForFunctor< Func >::ContextType *object, Func &&function, typename QtPrivate::Callable< Func >::ReturnType *ret)
 
static int metacall (QObject *, Call, int, void **)
 
template<const QMetaObject & MO>
static constexpr const QMetaObjectstaticMetaObject ()
 

Public Attributes

struct QMetaObject::Data d
 

Friends

class QTimer
 
class QObject
 
class QObjectPrivate
 
struct QMetaObject
 

Detailed Description

\inmodule QtCore

The QMetaObject class contains meta-information about Qt objects.

The Qt \l{Meta-Object System} in Qt is responsible for the signals and slots inter-object communication mechanism, runtime type information, and the Qt property system. A single QMetaObject instance is created for each QObject subclass that is used in an application, and this instance stores all the meta-information for the QObject subclass. This object is available as QObject::metaObject().

This class is not normally required for application programming, but it is useful if you write meta-applications, such as scripting engines or GUI builders.

The functions you are most likely to find useful are these: \list

The index functions indexOfConstructor(), indexOfMethod(), indexOfEnumerator(), and indexOfProperty() map names of constructors, member functions, enumerators, or properties to indexes in the meta-object. For example, Qt uses indexOfMethod() internally when you connect a signal to a slot.

Classes can also have a list of {name}–{value} pairs of additional class information, stored in QMetaClassInfo objects. The number of pairs is returned by classInfoCount(), single pairs are returned by classInfo(), and you can search for pairs with indexOfClassInfo().

Note
Operations that use the meta object system are generally thread- safe, as QMetaObjects are typically static read-only instances generated at compile time. However, if meta objects are dynamically modified by the application (for instance, when using QQmlPropertyMap), then the application has to explicitly synchronize access to the respective meta object.
See also
QMetaClassInfo, QMetaEnum, QMetaMethod, QMetaProperty, QMetaType, {Meta-Object System}

Definition at line 225 of file qobjectdefs.h.

Member Typedef Documentation

◆ RestrictedBool

typedef void* Connection::* QMetaObject::RestrictedBool

Definition at line 553 of file qobjectdefs.h.

Member Enumeration Documentation

◆ Call

\value InvokeMetaMethod \value ReadProperty \value WriteProperty \value ResetProperty \value CreateInstance \value IndexOfMethod \value RegisterPropertyMetaType \value RegisterMethodArgumentMetaType \value BindableProperty \value CustomCall \value ConstructInPlace

Enumerator
InvokeMetaMethod 
ReadProperty 
WriteProperty 
ResetProperty 
CreateInstance 
IndexOfMethod 
RegisterPropertyMetaType 
RegisterMethodArgumentMetaType 
BindableProperty 
CustomCall 
ConstructInPlace 

Definition at line 467 of file qobjectdefs.h.

Constructor & Destructor Documentation

◆ ~Connection()

QMetaObject::~Connection ( )

Member Function Documentation

◆ activate() [1/3]

void QMetaObject::activate ( QObject sender,
const QMetaObject m,
int  local_signal_index,
void **  argv 
)
static

Definition at line 4029 of file qobject.cpp.

References Q_UNLIKELY, qt_signal_spy_callback_set, and QMetaObjectPrivate::signalOffset().

+ Here is the call graph for this function:

◆ activate() [2/3]

◆ activate() [3/3]

void QMetaObject::activate ( QObject sender,
int  signalOffset,
int  local_signal_index,
void **  argv 
)
static

Definition at line 4043 of file qobject.cpp.

References Q_UNLIKELY, and qt_signal_spy_callback_set.

◆ cast() [1/2]

const QObject * QMetaObject::cast ( const QObject obj) const

Returns obj if object obj inherits from this meta-object; otherwise returns \nullptr.

Definition at line 393 of file qmetaobject.cpp.

◆ cast() [2/2]

QObject * QMetaObject::cast ( QObject obj) const
inline

Returns obj if object obj inherits from this meta-object; otherwise returns \nullptr.

Definition at line 232 of file qobjectdefs.h.

Referenced by convertMetaObject(), and QQmlPropertyPrivate::write().

+ Here is the caller graph for this function:

◆ checkConnectArgs() [1/2]

bool QMetaObject::checkConnectArgs ( const char *  signal,
const char *  method 
)
static

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

Both signal and method are expected to be normalized.

See also
normalizedSignature()

Definition at line 1265 of file qmetaobject.cpp.

References method, qstrcmp(), qstrlen(), s2, and signal.

Referenced by QObject::connect(), and signalForMember().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkConnectArgs() [2/2]

bool QMetaObject::checkConnectArgs ( const QMetaMethod signal,
const QMetaMethod method 
)
static
Since
5.0 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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

Definition at line 1287 of file qmetaobject.cpp.

References QMetaObjectPrivate::checkConnectArgs(), method, and signal.

+ Here is the call graph for this function:

◆ classInfo()

QMetaClassInfo QMetaObject::classInfo ( int  index) const

Returns the meta-data for the item of class information with the given index.

Example:

class MyClass : public QObject
{
Q_CLASSINFO("author", "Sabrina Schweinsteiger")
Q_CLASSINFO("url", "http://doc.moosesoft.co.uk/1.0/")
public:
...
};
\inmodule QtCore
Definition qobject.h:90
#define Q_OBJECT
#define Q_CLASSINFO(name, value)
QUrl url("example.com")
[constructor-url-reference]
See also
classInfoCount(), classInfoOffset(), indexOfClassInfo()

Definition at line 1242 of file qmetaobject.cpp.

References classInfo(), QMetaObjectPrivate::classInfoCount, QMetaObjectPrivate::classInfoData, classInfoOffset(), d, QMetaObject::Data::data, i, priv(), and QMetaObject::Data::superdata.

Referenced by QMetaObjectBuilder::addMetaObject(), and classInfo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ classInfoCount()

int QMetaObject::classInfoCount ( ) const

Returns the number of items of class information in this class.

See also
classInfo(), classInfoOffset(), indexOfClassInfo()

Definition at line 619 of file qmetaobject.cpp.

References QMetaObjectPrivate::classInfoCount, d, QMetaObject::Data::data, priv(), and QMetaObject::Data::superdata.

Referenced by QMetaObjectBuilder::addMetaObject(), and QQmlMetaType::clone().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ classInfoOffset()

int QMetaObject::classInfoOffset ( ) const

Returns the class information offset for this class; i.e.

the index position of this class's first class information item.

If the class has no superclasses with class information, the offset is 0; otherwise the offset is the sum of all the class information items in the class's superclasses.

See also
classInfo(), classInfoCount(), indexOfClassInfo()

Definition at line 529 of file qmetaobject.cpp.

References QMetaObjectPrivate::classInfoCount, d, priv(), and QMetaObject::Data::superdata.

Referenced by QMetaObjectBuilder::addMetaObject(), classInfo(), and QQmlMetaType::clone().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ className()

const char * QMetaObject::className ( ) const

Returns the class name.

See also
superClass()

Definition at line 347 of file qmetaobject.cpp.

References objectClassName().

Referenced by QMetaObjectBuilder::addMetaObject(), check_and_warn_compat(), QQmlMetaObject::className(), QObject::connect(), connectWarning(), QObject::dumpObjectInfo(), findAttachedParent(), QApplication::font(), QQmlOpenMetaObjectTypePrivate::init(), metaType(), msgConnect(), printMethodNotFoundWarning(), QTest::qPrintDataTags(), QDBusAdaptorConnector::relay(), QQmlType::typeName(), QQuick3DCustomMaterial::updateSpatialNode(), and QQuick3DEffect::updateSpatialNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ connect()

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

types is a 0-terminated vector of meta types for queued connections.

if signal_index is -1, then we effectively connect all signals from the sender to the receiver's slot

Definition at line 3419 of file qobject.cpp.

References QMetaObjectPrivate::connect(), and methodIndexToSignalIndex().

Referenced by QQmlPropertyPrivate::connect(), QDBusAdaptorConnector::connectAllSignals(), QQuickPixmap::connectDownloadProgress(), QQuickPixmap::connectFinished(), QQuickContainer::contentItemChange(), QQmlSettingsPrivate::load(), QWidgetTextControlPrivate::setContent(), and QQuickRectangle::setGradient().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Connection() [1/3]

◆ Connection() [2/3]

QMetaObject::Connection ( Connection &&  other)
inlinenoexcept

Definition at line 557 of file qobjectdefs.h.

◆ Connection() [3/3]

QMetaObject::Connection ( const Connection other)

◆ connectSlotsByName()

void QMetaObject::connectSlotsByName ( QObject object)
static

Searches recursively for all child objects of the given object, and connects matching signals from them to slots of object that follow the following form:

void on_<object name>_<signal name>(<signal parameters>);
auto signal
void on_< object name > _< signal name >(< signal parameters >)
[32]

Let's assume our object has a child object of type {QPushButton} with the \l{QObject::objectName}{object name} {button1}. The slot to catch the button's {clicked()} signal would be:

void on_button1_clicked()
[33]

If object itself has a properly set object name, its own signals are also connected to its respective slots.

See also
QObject::setObjectName()

Definition at line 3670 of file qobject.cpp.

References QMetaObjectPrivate::absoluteSignalCount(), QList< T >::at(), QMetaMethod::Cloned, QMetaObjectPrivate::connect(), QByteArray::constData(), i, QByteArray::indexOf(), QByteArray::isEmpty(), j, QByteArray::lastIndexOf(), list, method, mo, msgConnect(), o, QObject::objectName, QList< T >::prepend(), Q_ASSERT, qCDebug, qCWarning, qstrlen(), qstrncmp(), QMetaObjectPrivate::signal(), signal, QByteArray::size(), QList< T >::size(), and QString::toLatin1().

+ Here is the call graph for this function:

◆ constructor()

QMetaMethod QMetaObject::constructor ( int  index) const
Since
4.5

Returns the meta-data for the constructor with the given index.

See also
constructorCount(), newInstance()

Definition at line 1154 of file qmetaobject.cpp.

References QMetaObjectPrivate::constructorCount, d, QMetaObject::Data::data, i, and priv().

Referenced by QMetaObjectBuilder::addMetaObject(), QQmlMetaObject::constructorParameterTypes(), fromMatchingType(), fromVerifiedType(), and indexOfConstructor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ constructorCount()

int QMetaObject::constructorCount ( ) const
Since
4.5

Returns the number of constructors in this class.

See also
constructor(), indexOfConstructor()

Definition at line 547 of file qmetaobject.cpp.

References QMetaObjectPrivate::constructorCount, d, QMetaObject::Data::data, priv(), Q_ASSERT, and QMetaObjectPrivate::revision.

Referenced by QMetaObjectBuilder::addMetaObject(), and fromMatchingType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ disconnect()

bool QMetaObject::disconnect ( const QObject sender,
int  signal_index,
const QObject receiver,
int  method_index 
)
static

Definition at line 3504 of file qobject.cpp.

References QMetaObjectPrivate::disconnect(), and methodIndexToSignalIndex().

Referenced by QQuickContainer::contentItemChange(), QDBusAdaptorConnector::disconnectAllSignals(), QWidgetTextControlPrivate::setContent(), and QQuickRectangle::setGradient().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ disconnectOne()

bool QMetaObject::disconnectOne ( const QObject sender,
int  signal_index,
const QObject receiver,
int  method_index 
)
static
\internal

Disconnect a single signal connection. If QMetaObject::connect() has been called multiple times for the same sender, signal_index, receiver and method_index only one of these connections will be removed.

Definition at line 3520 of file qobject.cpp.

References QMetaObjectPrivate::disconnect(), QMetaObjectPrivate::DisconnectOne, and methodIndexToSignalIndex().

+ Here is the call graph for this function:

◆ enumerator()

QMetaEnum QMetaObject::enumerator ( int  index) const

Returns the meta-data for the enumerator with the given index.

See also
enumeratorCount(), enumeratorOffset(), indexOfEnumerator()

Definition at line 1184 of file qmetaobject.cpp.

References d, QMetaObject::Data::data, enumerator(), QMetaObjectPrivate::enumeratorCount, enumeratorOffset(), i, priv(), and QMetaObject::Data::superdata.

Referenced by QMetaObjectBuilder::addMetaObject(), enumerator(), formatWidgetAttributes(), qt_QMetaEnum_debugOperator(), and qt_QMetaEnum_flagDebugOperator().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enumeratorCount()

int QMetaObject::enumeratorCount ( ) const

Returns the number of enumerators in this class.

See also
enumerator(), enumeratorOffset(), indexOfEnumerator()

Definition at line 581 of file qmetaobject.cpp.

References d, QMetaObject::Data::data, QMetaObjectPrivate::enumeratorCount, priv(), and QMetaObject::Data::superdata.

Referenced by QMetaObjectBuilder::addMetaObject(), and QQmlMetaType::clone().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enumeratorOffset()

int QMetaObject::enumeratorOffset ( ) const

Returns the enumerator offset for this class; i.e.

the index position of this class's first enumerator.

If the class has no superclasses with enumerators, the offset is 0; otherwise the offset is the sum of all the enumerators in the class's superclasses.

See also
enumerator(), enumeratorCount(), indexOfEnumerator()

Definition at line 487 of file qmetaobject.cpp.

References d, QMetaObjectPrivate::enumeratorCount, priv(), and QMetaObject::Data::superdata.

Referenced by QMetaObjectBuilder::addMetaObject(), QQmlMetaType::clone(), and enumerator().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ indexOfClassInfo()

int QMetaObject::indexOfClassInfo ( const char *  name) const

Finds class information item name and returns its index; otherwise returns -1.

See also
classInfo(), classInfoCount(), classInfoOffset()

Definition at line 1132 of file qmetaobject.cpp.

References QMetaObjectPrivate::classInfoCount, QMetaObjectPrivate::classInfoData, i, priv(), and rawStringData().

Referenced by QQmlMetaType::clone().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ indexOfConstructor()

int QMetaObject::indexOfConstructor ( const char *  constructor) const
Since
4.5

Finds constructor and returns its index; otherwise returns -1.

Note that the constructor has to be in normalized form, as returned by normalizedSignature().

See also
constructor(), constructorCount(), normalizedSignature()

Definition at line 723 of file qmetaobject.cpp.

References constructor(), d, QMetaObject::Data::data, QMetaObjectPrivate::decodeMethodSignature(), QMetaObjectPrivate::indexOfConstructor(), priv(), Q_ASSERT, and QMetaObjectPrivate::revision.

+ Here is the call graph for this function:

◆ indexOfEnumerator()

int QMetaObject::indexOfEnumerator ( const char *  name) const

Finds enumerator name and returns its index; otherwise returns -1.

See also
enumerator(), enumeratorCount(), enumeratorOffset()

Definition at line 1062 of file qmetaobject.cpp.

References d, e, i, priv(), and rawStringData().

Referenced by QQmlMetaType::clone(), formatWidgetAttributes(), qt_QMetaEnum_debugOperator(), and qt_QMetaEnum_flagDebugOperator().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ indexOfMethod()

int QMetaObject::indexOfMethod ( const char *  method) const

Finds method and returns its index; otherwise returns -1.

Note that the method has to be in normalized form, as returned by normalizedSignature().

See also
method(), methodCount(), methodOffset(), normalizedSignature()

Definition at line 739 of file qmetaobject.cpp.

References QMetaObjectPrivate::decodeMethodSignature(), i, method, priv(), Q_ASSERT, and QMetaObjectPrivate::revision.

Referenced by QTextDocument::loadResource(), and maybeInvokeSetupMethod().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ indexOfProperty()

int QMetaObject::indexOfProperty ( const char *  name) const

Finds property name and returns its index; otherwise returns -1.

See also
property(), propertyCount(), propertyOffset()

Definition at line 1100 of file qmetaobject.cpp.

References QAbstractDynamicMetaObject::createProperty(), d, QMetaObject::Data::data, DynamicMetaObject, QMetaObjectPrivate::flags, i, priv(), and rawStringData().

Referenced by QQmlMetaType::clone(), doWriteProperties(), QQmlPropertyPrivate::initProperty(), QObject::property(), qQmlPropertyCacheCreate(), removePendingQPropertyBinding(), VDMListDelegateDataType::setValue(), QQuickWheelHandlerPrivate::targetMetaProperty(), VDMListDelegateDataType::value(), QQuickMultiPointHandlerPrivate::xMetaProperty(), and QQuickMultiPointHandlerPrivate::yMetaProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ indexOfSignal()

int QMetaObject::indexOfSignal ( const char *  signal) const

Finds signal and returns its index; otherwise returns -1.

This is the same as indexOfMethod(), except that it will return -1 if the method exists but isn't a signal.

Note that the signal has to be in normalized form, as returned by normalizedSignature().

See also
indexOfMethod(), normalizedSignature(), method(), methodCount(), methodOffset()

Definition at line 804 of file qmetaobject.cpp.

References QMetaObjectPrivate::decodeMethodSignature(), i, QMetaObjectPrivate::indexOfSignalRelative(), priv(), Q_ASSERT, QMetaObjectPrivate::revision, and signal.

Referenced by QDBusAbstractAdaptor::setAutoRelaySignals().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ indexOfSlot()

int QMetaObject::indexOfSlot ( const char *  slot) const

Finds slot and returns its index; otherwise returns -1.

This is the same as indexOfMethod(), except that it will return -1 if the method exists but isn't a slot.

See also
indexOfMethod(), method(), methodCount(), methodOffset()

Definition at line 851 of file qmetaobject.cpp.

References QMetaObjectPrivate::decodeMethodSignature(), i, QMetaObjectPrivate::indexOfSlotRelative(), priv(), Q_ASSERT, and QMetaObjectPrivate::revision.

Referenced by QQuickPixmapReader::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ inherits()

bool QMetaObject::inherits ( const QMetaObject metaObject) const
noexcept

Returns true if the class described by this QMetaObject inherits the type described by metaObject; otherwise returns false.

A type is considered to inherit itself.

Since
5.7

Definition at line 369 of file qmetaobject.cpp.

References metaObject().

Referenced by QQmlMetaObject::canConvert(), canConvertMetaObject(), and convertMetaObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ invokeMethod() [1/10]

template<typename... Args>
template< typename... Args > bool QMetaObject::invokeMethod ( QObject obj,
const char *  member,
Args &&...  args 
)
inlinestatic
Since
6.5 \threadsafe

Invokes the member (a signal or a slot name) on the object obj. Returns true if the member could be invoked. Returns false if there is no such member or the parameters did not match.

For the overloads with a QMetaMethodReturnArgument parameter, the return value of the member function call is placed in ret. For the overloads without such a member, the return value of the called function (if any) will be discarded. QMetaMethodReturnArgument is an internal type you should not use directly. Instead, use the qReturnArg() function.

The overloads with a Qt::ConnectionType type parameter allow explicitly selecting whether the invocation will be synchronous or not:

\list

  • If type is Qt::QueuedConnection, a QEvent will be sent and the member is invoked as soon as the application enters the event loop in the thread that the obj was created in or was moved to.
  • If type is Qt::BlockingQueuedConnection, the method will be invoked in the same way as for Qt::QueuedConnection, except that the current thread will block until the event is delivered. Using this connection type to communicate between objects in the same thread will lead to deadlocks.
  • If type is Qt::AutoConnection, the member is invoked synchronously if obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously. This is the behavior of the overloads that do not have the type parameter. \endlist

You only need to pass the name of the signal or slot to this function, not the entire signature. For example, to asynchronously invoke the \l{QThread::quit()}{quit()} slot on a QThread, use the following code:

@ QueuedConnection
static bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType, QGenericReturnArgument ret, QGenericArgument val0=QGenericArgument(nullptr), QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument(), QGenericArgument val4=QGenericArgument(), QGenericArgument val5=QGenericArgument(), QGenericArgument val6=QGenericArgument(), QGenericArgument val7=QGenericArgument(), QGenericArgument val8=QGenericArgument(), QGenericArgument val9=QGenericArgument())
\threadsafe This is an overloaded member function, provided for convenience. It differs from the abov...

With asynchronous method invocations, the parameters must be copyable types, because Qt needs to copy the arguments to store them in an event behind the scenes. Since Qt 6.5, this function automatically registers the types being used; however, as a side-effect, it is not possible to make calls using types that are only forward-declared. Additionally, it is not possible to make asynchronous calls that use references to non-const-qualified types as parameters either.

To synchronously invoke the compute(QString, int, double) slot on some arbitrary object obj retrieve its return value:

QString retVal;
qReturnArg(retVal),
QString("sqrt"), 42, 9.7);
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
@ DirectConnection
void qReturnArg(const T &&)=delete
GLhandleARB obj
[2]

If the "compute" slot does not take exactly one \l QString, one int, and one double in the specified order, the call will fail. Note how it was necessary to be explicit about the type of the QString, as the character literal is not exactly the right type to match. If the method instead took a \l QStringView, a \l qsizetype, and a float, the call would need to be written as:

QString retVal;
qReturnArg(retVal),
QStringView("sqrt"), qsizetype(42), 9.7f);
\inmodule QtCore
Definition qstringview.h:76
ptrdiff_t qsizetype
Definition qtypes.h:70

The same call can be executed using the Q_ARG() and Q_RETURN_ARG() macros, as in:

QString retVal;
Q_ARG(QString, "sqrt"),
Q_ARG(int, 42),
Q_ARG(double, 9.7));
#define Q_RETURN_ARG(Type, data)
Definition qobjectdefs.h:63
#define Q_ARG(Type, data)
Definition qobjectdefs.h:62

The macros are kept for compatibility with Qt 6.4 and earlier versions, and can be freely mixed with parameters that do not use the macro. They may be necessary in rare situations when calling a method that used a typedef to forward-declared type as a parameter or the return type.

See also
Q_ARG(), Q_RETURN_ARG(), QMetaMethod::invoke()

Definition at line 401 of file qobjectdefs.h.

References arguments, and Qt::AutoConnection.

◆ invokeMethod() [2/10]

static bool QMetaObject::invokeMethod ( QObject obj,
const char *  member,
QGenericArgument  val0,
QGenericArgument  val1 = QGenericArgument(),
QGenericArgument  val2 = QGenericArgument(),
QGenericArgument  val3 = QGenericArgument(),
QGenericArgument  val4 = QGenericArgument(),
QGenericArgument  val5 = QGenericArgument(),
QGenericArgument  val6 = QGenericArgument(),
QGenericArgument  val7 = QGenericArgument(),
QGenericArgument  val8 = QGenericArgument(),
QGenericArgument  val9 = QGenericArgument() 
)
inlinestatic

Definition at line 340 of file qobjectdefs.h.

References Qt::AutoConnection.

◆ invokeMethod() [3/10]

static bool QMetaObject::invokeMethod ( QObject obj,
const char *  member,
QGenericReturnArgument  ret,
QGenericArgument  val0 = QGenericArgument(nullptr),
QGenericArgument  val1 = QGenericArgument(),
QGenericArgument  val2 = QGenericArgument(),
QGenericArgument  val3 = QGenericArgument(),
QGenericArgument  val4 = QGenericArgument(),
QGenericArgument  val5 = QGenericArgument(),
QGenericArgument  val6 = QGenericArgument(),
QGenericArgument  val7 = QGenericArgument(),
QGenericArgument  val8 = QGenericArgument(),
QGenericArgument  val9 = QGenericArgument() 
)
inlinestatic

Definition at line 306 of file qobjectdefs.h.

References Qt::AutoConnection, and ret.

◆ invokeMethod() [4/10]

template<typename... Args>
template< typename... Args > bool QMetaObject::invokeMethod ( QObject obj,
const char *  member,
QMetaMethodReturnArgument  r,
Args &&...  arguments 
)
inlinestatic

Definition at line 389 of file qobjectdefs.h.

References arguments, and Qt::AutoConnection.

◆ invokeMethod() [5/10]

template<typename... Args>
template< typename... Args > bool QMetaObject::invokeMethod ( QObject obj,
const char *  member,
Qt::ConnectionType  c,
Args &&...  arguments 
)
inlinestatic

Definition at line 377 of file qobjectdefs.h.

References arguments.

◆ invokeMethod() [6/10]

template<typename... Args>
template< typename... Args > bool QMetaObject::invokeMethod ( QObject obj,
const char *  member,
Qt::ConnectionType  c,
QMetaMethodReturnArgument  r,
Args &&...  arguments 
)
inlinestatic

Definition at line 363 of file qobjectdefs.h.

References arguments, and QtPrivate::invokeMethodHelper().

+ Here is the call graph for this function:

◆ invokeMethod() [7/10]

static bool QMetaObject::invokeMethod ( QObject obj,
const char *  member,
Qt::ConnectionType  type,
QGenericArgument  val0,
QGenericArgument  val1 = QGenericArgument(),
QGenericArgument  val2 = QGenericArgument(),
QGenericArgument  val3 = QGenericArgument(),
QGenericArgument  val4 = QGenericArgument(),
QGenericArgument  val5 = QGenericArgument(),
QGenericArgument  val6 = QGenericArgument(),
QGenericArgument  val7 = QGenericArgument(),
QGenericArgument  val8 = QGenericArgument(),
QGenericArgument  val9 = QGenericArgument() 
)
inlinestatic

Definition at line 323 of file qobjectdefs.h.

◆ invokeMethod() [8/10]

\threadsafe This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. \obsolete [6.5] Please use the variadic overload of this function

Invokes the member (a signal or a slot name) on the object obj. Returns true if the member could be invoked. Returns false if there is no such member or the parameters did not match.

See the variadic invokeMethod() function for more information. This function should behave the same way as that one, with the following limitations:

\list

  • The number of parameters is limited to 10.
  • Parameter names may need to be an exact string match.
  • Meta types are not automatically registered. \endlist

With asynchronous method invocations, the parameters must be of types that are already known to Qt's meta-object system, because Qt needs to copy the arguments to store them in an event behind the scenes. If you try to use a queued connection and get the error message

QMetaObject::invokeMethod: Unable to handle unregistered datatype 'MyType'
GLuint64 GLenum void * handle

call qRegisterMetaType() to register the data type before you call invokeMethod().

See also
Q_ARG(), Q_RETURN_ARG(), qRegisterMetaType(), QMetaMethod::invoke()

Definition at line 1542 of file qmetaobject.cpp.

References MaximumParamCount, qstrlen(), and ret.

Referenced by QAndroidPlatformServices::QAndroidPlatformServices(), QDBusAbstractAdaptor::QDBusAbstractAdaptor(), QDBusPendingCallWatcher::QDBusPendingCallWatcher(), QGeoTiledMappingManagerEngineNokia::QGeoTiledMappingManagerEngineNokia(), QNetworkReplyDataImpl::QNetworkReplyDataImpl(), QNetworkReplyFileImpl::QNetworkReplyFileImpl(), QNetworkReplyHttpImpl::QNetworkReplyHttpImpl(), QPlaceContentReplyUnsupported::QPlaceContentReplyUnsupported(), QPlaceDetailsReplyUnsupported::QPlaceDetailsReplyUnsupported(), QPlaceIdReplyUnsupported::QPlaceIdReplyUnsupported(), QPlaceMatchReplyUnsupported::QPlaceMatchReplyUnsupported(), QPlaceReplyUnsupported::QPlaceReplyUnsupported(), QPlaceSearchReplyUnsupported::QPlaceSearchReplyUnsupported(), QPlaceSearchSuggestionReplyUnsupported::QPlaceSearchSuggestionReplyUnsupported(), QQnxIntegration::QQnxIntegration(), QVncServer::QVncServer(), QWaylandClientExtension::QWaylandClientExtension(), SharedTextureImageResponse::SharedTextureImageResponse(), QAndroidTextureVideoOutput::~QAndroidTextureVideoOutput(), QNetworkReplyFileImpl::~QNetworkReplyFileImpl(), QNetworkReplyHttpImplPrivate::_q_bufferOutgoingDataFinished(), QNetworkReplyImplPrivate::_q_bufferOutgoingDataFinished(), QNetworkReplyHttpImplPrivate::_q_cacheLoadReadyRead(), QHttpNetworkConnectionChannel::_q_connected(), QAbstractItemViewPrivate::_q_delegateSizeHintChanged(), QHttpNetworkConnectionChannel::_q_disconnected(), QHttpNetworkConnectionChannel::_q_encrypted(), QHttpNetworkConnectionChannel::_q_error(), QHttpNetworkConnectionPrivate::_q_hostLookupFinished(), QGraphicsScenePrivate::_q_polishItems(), QNetworkAccessManagerPrivate::_q_replyFinished(), QAbstractProxyModelPrivate::_q_sourceModelColumnsInserted(), QAbstractProxyModelPrivate::_q_sourceModelColumnsRemoved(), QAbstractProxyModelPrivate::_q_sourceModelRowsInserted(), QAbstractProxyModelPrivate::_q_sourceModelRowsRemoved(), QHttpThreadDelegate::abortRequest(), QQuickActionGroupPrivate::actions_clear(), QLayout::addChildWidget(), VariantRef::addref(), QHttpNetworkConnectionChannel::allDone(), QtWaylandClient::QWaylandWindow::applyConfigureWhenPossible(), AndroidCamera::autoFocus(), QQuick3DLightmapBaker::bake(), QPlatformAudioDecoder::bufferAvailableChanged(), QPlatformAudioDecoder::bufferReady(), QQuickButtonGroupPrivate::buttons_clear(), AndroidCamera::cancelAutoFocus(), QAbstractSocketPrivate::canCloseNotification(), QDeclarativePlace::category_clear(), QPSQLDriverPrivate::checkPendingNotifications(), QNetworkReplyFileImpl::close(), QHttpNetworkConnectionChannel::closeAndResendCurrentRequest(), contextStateCallback(), QGeoTileFetcherNokia::copyrightsFetched(), QtWaylandClient::QWaylandWindow::createDecoration(), QGraphicsProxyWidget::createProxyForChildWidget(), QQC2::createTreeViewHelperWindow(), QBluetoothLocalDevicePrivate::deviceConnected(), QBluetoothLocalDevicePrivate::deviceDisconnected(), QtAndroidDialogHelpers::dialogResult(), AVFImageCapture::doCapture(), QFFmpegImageCapture::doCapture(), QFFmpeg::Renderer::doForceStep(), SharedTextureImageResponse::doRequest(), QAbstractItemDelegatePrivate::editorEventFilter(), QSocks5SocketEnginePrivate::emitConnectionNotification(), QSocks5SocketEnginePrivate::emitReadNotification(), QHttpNetworkConnectionPrivate::emitReplyError(), QSocks5SocketEnginePrivate::emitWriteNotification(), QHttpNetworkConnectionChannel::ensureConnection(), QSocketNotifier::event(), QObject::event(), executeIMFRequest(), QTestEventLoop::exitLoop(), AndroidCamera::fetchLastPreviewFrame(), QDeclarativeGeoMapItemTransitionManager::finalizeEnterTransition(), QDeclarativeGeoMapItemTransitionManager::finalizeExitTransition(), QHttpThreadDelegate::finishedSlot(), QHttpThreadDelegate::finishedWithErrorSlot(), QNetworkReplyHttpImplPrivate::followRedirect(), QJSValuePrivate::free(), OrgFreedesktopDBusPropertiesAdaptor::Get(), OrgFreedesktopDBusPropertiesAdaptor::GetAll(), OrgFreedesktopDBusObjectManagerAdaptor::GetManagedObjects(), QPlaceManagerEngineNokiaV2::getPlaceContent(), handle_sqlite_callback(), QtAndroidInput::handleLocationChanged(), QPdfPageRendererPrivate::handleNextRequest(), handleOrientationChanged(), QHttpNetworkConnectionChannel::handleStatus(), QHttpNetworkConnectionChannel::handleUnexpectedEOF(), QtWaylandClient::QWaylandWindow::handleUpdate(), QPlaceManagerEngineMapbox::initializeCategories(), QPlatformMediaDevices::initVideoDevicesConnection(), QQuickTextEdit::invalidate(), QGraphicsSceneBspTreeIndexPrivate::invalidateSortCache(), QtAndroidAccessibility::invokeActionOnInterfaceInMainThread(), invokeDecrementPendingDevicesCountAndCheckFinished(), QQuickCanvasItem::itemChange(), jump(), QtAndroidInput::keyboardVisibilityChanged(), QQuickTumbler::keyPressEvent(), locationProvidersChanged(), locationProvidersDisabled(), AndroidCamera::lock(), QtAndroidInput::longPress(), LowEnergyNotificationHub::lowEnergy_advertisementError(), LowEnergyNotificationHub::lowEnergy_characteristicWritten(), LowEnergyNotificationHub::lowEnergy_connectionChange(), LowEnergyNotificationHub::lowEnergy_servicesDiscovered(), main(), QSSGLayerRenderData::maybeBakeLightmap(), MyObject::methodWithDelayedReply(), QNetworkConnectionEvents::NetworkConnectionConnectivityChanged(), networkInfoCleanup(), QNearFieldManagerPrivateImpl::newIntent(), AndroidCamera::notifyNewFrames(), notifySatelliteInfoUpdated(), QNearFieldManagerPrivateImpl::onCardInserted(), SocketWorker::onReadyRead(), QGeoPositionInfoSourceWinRT::onStatusChanged(), QNetworkAccessFileBackend::open(), AndroidCamera::open(), QMacPageSetupDialogPrivate::openCocoaPageLayout(), QPrintDialogPrivate::openCocoaPrintPanel(), QDesktopServices::openUrl(), QFFmpeg::PlaybackEngine::ObjectDeleter::operator()(), positionUpdated(), QNetworkReplyHttpImplPrivate::postRequest(), qEventCallback(), QInputMethod::queryFocusObject(), QPulseAudioSource::read(), QHttpThreadDelegate::readBufferFreed(), QSslSocket::readData(), QHttpNetworkConnectionPrivate::readMoreLater(), QNearFieldTargetPrivateImpl::readNdefMessages(), OrgBluezGattCharacteristic1Adaptor::ReadValue(), OrgBluezGattDescriptor1Adaptor::ReadValue(), AndroidCamera::reconnect(), QAnimationTimer::registerAnimation(), QQmlAnimationTimer::registerAnimation(), OrgBluezLEAdvertisement1Adaptor::Release(), AndroidCamera::release(), VariantRef::release(), QHttpNetworkConnectionPrivate::removeReply(), QLayoutPrivate::reparentChildWidgets(), QNearFieldTargetPrivate::reportError(), QBluetoothLocalDevice::requestPairing(), QtWaylandClient::QWaylandWindow::requestUpdate(), QHttpNetworkConnectionChannel::requeueCurrentlyPipelinedRequests(), QHttpNetworkConnectionPrivate::requeueRequest(), QHttpNetworkConnectionChannel::resendCurrentRequest(), QProgressDialog::reset(), QDarwinAudioSource::reset(), QAndroidTextureVideoOutput::reset(), QDarwinAudioSource::resume(), QSslSocket::resume(), QHttpNetworkConnectionPrivate::resumeConnection(), QEvdevTouchScreenHandlerThread::run(), QtAndroidAccessibility::runInObjectContext(), runOnQtThread(), QAndroidInputContext::safeCall(), QPlaceManagerEngineNokiaV2::search(), QPlaceManagerEngineNokiaV2::searchSuggestions(), QNetworkReplyHttpImplPrivate::sendCacheContents(), QNearFieldTargetPrivateImpl::sendCommand(), QHttpProtocolHandler::sendRequest(), QHttpNetworkConnectionChannel::sendRequestDelayed(), OrgFreedesktopDBusPropertiesAdaptor::Set(), AndroidCamera::setAutoExposureLock(), AndroidCamera::setAutoWhiteBalanceLock(), QAndroidPlatformIntegration::setAvailableGeometry(), QtWaylandClient::QWaylandWindow::setCanResize(), QAndroidPlatformIntegration::setColorScheme(), QDBusConnectionPrivate::setConnection(), QGraphicsItem::setCursor(), QFFmpeg::AudioSourceIO::setDevice(), AndroidCamera::setDisplayOrientation(), AndroidCamera::setExposureCompensation(), AndroidCamera::setFlashMode(), AndroidCamera::setFocusAreas(), AndroidCamera::setFocusMode(), AndroidCamera::setJpegQuality(), QFFmpegMediaPlayer::setMedia(), QFFmpeg::AudioSourceIO::setMuted(), QFFmpeg::Renderer::setOutputInternal(), QAudioEngine::setOutputMode(), QFFmpeg::PlaybackEngineObject::setPaused(), QDBusConnectionPrivate::setPeer(), QAndroidPlatformIntegration::setPhysicalSize(), AndroidCamera::setPictureSize(), QFFmpeg::Renderer::setPlaybackRate(), AndroidCamera::setPreviewDisplay(), AndroidCamera::setPreviewFormat(), AndroidCamera::setPreviewFpsRange(), AndroidCamera::setPreviewSize(), AndroidCamera::setPreviewTexture(), QAndroidPlatformIntegration::setRefreshRate(), AndroidCamera::setRotation(), QFFmpeg::AudioSourceIO::setRunning(), AndroidCamera::setSceneMode(), QGraphicsScenePrivate::setScenePosItemEnabled(), QAndroidPlatformIntegration::setScreenSize(), QAndroidPlatformIntegration::setScreenSizeParameters(), QNetworkReplyImplPrivate::setup(), AndroidCamera::setupPreviewFrameCallback(), QNetworkReplyHttpImplPrivate::setupTransferTimeout(), QQnxClipboard::MimeData::setUserMimeData(), QAndroidTextureVideoOutput::setVideoSize(), QFFmpeg::AudioSourceIO::setVolume(), AndroidCamera::setWhiteBalance(), QTableView::setWordWrap(), QHttpSocketEngine::setWriteNotificationEnabled(), AndroidCamera::setZoom(), QHttpNetworkConnectionPrivate::shouldEmitChannelError(), QTimer::singleShot(), QAudioEngine::start(), QUnifiedTimer::startAnimationTimer(), QHttpNetworkConnectionPrivate::startHostInfoLookup(), OrgBluezGattCharacteristic1Adaptor::StartNotify(), AndroidCamera::startPreview(), QHttpThreadDelegate::startRequestSynchronously(), QSingleShotTimer::startTimerForReceiver(), QGeoPositionInfoSourceGeoclue2::startUpdates(), QDarwinAudioSource::stop(), QAudioEngine::stop(), QAndroidTextureVideoOutput::stop(), QUnifiedTimer::stopAnimationTimer(), OrgBluezGattCharacteristic1Adaptor::StopNotify(), AndroidCamera::stopPreview(), AndroidCamera::stopPreviewSynchronous(), QWindowsMediaDeviceReader::stopRecording(), QNetworkAccessManager::supportedSchemes(), QAndroidPlatformScreen::surfaceChanged(), QAndroidTextureVideoOutput::surfaceTexture(), QDarwinAudioSource::suspend(), QHttpThreadDelegate::synchronousFinishedSlot(), QHttpThreadDelegate::synchronousFinishedWithErrorSlot(), QFFmpeg::Renderer::syncSoft(), AndroidCamera::takePicture(), QQuickContext2D::toImage(), QtAndroidInput::touchAdd(), SearchSuggestionReply::triggerDone(), AndroidCamera::unlock(), QAnimationTimer::unregisterAnimation(), QQmlAnimationTimer::unregisterAnimation(), QGraphicsItem::unsetCursor(), QGraphicsScene::update(), QTableView::updateGeometries(), QTreeView::updateGeometries(), QQuick3DViewport::updatePaintNode(), QQuick3DRuntimeLoader::updateSpatialNode(), QGeoTiledMappingManagerEngine::updateTileRequests(), updateWindow(), QGeoTileFetcherNokia::versionFetched(), wrapInFunction(), QBuffer::writeData(), QSslSocket::writeData(), QBluetoothSocketPrivateBluez::writeData(), QNearFieldTargetPrivateImpl::writeNdefMessages(), OrgBluezGattCharacteristic1Adaptor::WriteValue(), and OrgBluezGattDescriptor1Adaptor::WriteValue().

+ Here is the call graph for this function:

◆ invokeMethod() [9/10]

template<typename Func >
static std::enable_if_t<!std::disjunction_v< std::is_convertible< Func, const char * >, QtPrivate::Invoke::AreOldStyleArgs< Func > >, bool > QMetaObject::invokeMethod ( typename QtPrivate::ContextTypeForFunctor< Func >::ContextType *  object,
Func &&  function,
Qt::ConnectionType  type = Qt::AutoConnection,
typename QtPrivate::Callable< Func >::ReturnType *  ret = nullptr 
)
inlinestatic

Definition at line 417 of file qobjectdefs.h.

References function, and ret.

◆ invokeMethod() [10/10]

template<typename Func >
static std::enable_if_t<!std::disjunction_v< std::is_convertible< Func, const char * >, QtPrivate::Invoke::AreOldStyleArgs< Func > >, bool > QMetaObject::invokeMethod ( typename QtPrivate::ContextTypeForFunctor< Func >::ContextType *  object,
Func &&  function,
typename QtPrivate::Callable< Func >::ReturnType *  ret 
)
inlinestatic

Definition at line 432 of file qobjectdefs.h.

References Qt::AutoConnection, function, and ret.

◆ metacall()

◆ metaType()

QMetaType QMetaObject::metaType ( ) const
Since
6.2 Returns the metatype corresponding to this metaobject. If the metaobject originates from a namespace, an invalid metatype is returned.

Definition at line 413 of file qmetaobject.cpp.

References className(), d, QMetaType::fromName(), and priv().

Referenced by VDMAbstractItemModelDataType::createItem(), and VDMListDelegateDataType::createItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ method()

QMetaMethod QMetaObject::method ( int  index) const

Returns the meta-data for the method with the given index.

See also
methodCount(), methodOffset(), indexOfMethod()

Definition at line 1167 of file qmetaobject.cpp.

References d, QMetaObject::Data::data, i, method(), QMetaObjectPrivate::methodCount, methodOffset(), priv(), and QMetaObject::Data::superdata.

Referenced by QMetaObjectBuilder::addMetaObject(), QQmlMetaType::clone(), QObject::connect(), QObject::dumpObjectInfo(), QQmlBoundSignalExpression::evaluate(), QTextDocument::loadResource(), main(), maybeInvokeSetupMethod(), QDBusInterfacePrivate::metacall(), QQmlVMEMetaObject::metaCall(), method(), QQmlMetaObject::methodParameterTypes(), QQmlMetaObject::methodReturnType(), QMetaProperty::notifySignal(), printMethodNotFoundWarning(), QTest::qPrintDataTags(), and QDBusAbstractAdaptor::setAutoRelaySignals().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ methodCount()

int QMetaObject::methodCount ( ) const

Returns the number of methods in this class, including the number of methods provided by each base class.

These include signals and slots as well as normal member functions.

Use code like the following to obtain a QStringList containing the methods specific to a given class:

const QMetaObject* metaObject = obj->metaObject();
for(int i = metaObject->methodOffset(); i < metaObject->methodCount(); ++i)
methods << QString::fromLatin1(metaObject->method(i).methodSignature());
static JNINativeMethod methods[]
\inmodule QtCore
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:5710
obj metaObject() -> className()
\inmodule QtCore
See also
method(), methodOffset(), indexOfMethod()

Definition at line 565 of file qmetaobject.cpp.

References d, QMetaObject::Data::data, QMetaObjectPrivate::methodCount, priv(), and QMetaObject::Data::superdata.

Referenced by QMetaObjectBuilder::addMetaObject(), QQmlMetaType::clone(), QQmlDMObjectDataMetaObject::createProperty(), QQmlPropertyCache::invalidate(), main(), printMethodNotFoundWarning(), QTest::qPrintDataTags(), QDBusAbstractAdaptor::setAutoRelaySignals(), and QQmlPropertyCache::update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ methodOffset()

int QMetaObject::methodOffset ( ) const

Returns the method offset for this class; i.e.

the index position of this class's first member function.

The offset is the sum of all the methods in the class's superclasses (which is always positive since QObject has the deleteLater() slot and a destroyed() signal).

See also
method(), methodCount(), indexOfMethod()

Definition at line 465 of file qmetaobject.cpp.

References d, QMetaObjectPrivate::methodCount, priv(), and QMetaObject::Data::superdata.

Referenced by QMetaObjectBuilder::addMetaObject(), QQmlMetaType::clone(), QObject::connect(), QMetaObjectPrivate::connect(), QQmlDMObjectDataMetaObject::createProperty(), QQmlOpenMetaObjectTypePrivate::init(), QDBusInterfacePrivate::metacall(), method(), QMetaMethod::methodIndex(), QMetaProperty::notifySignalIndex(), and QQmlMetaObject::resolveGadgetMethodOrPropertyIndex().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ newInstance()

template<typename... Args>
template< typename... Args > QObject * QMetaObject::newInstance ( Args &&...  arguments) const
inline
Since
6.5

Constructs a new instance of this class and returns the new object, or \nullptr if no suitable constructor is available. The types of the arguments arguments will be used to find a matching constructor, and then forwarded to it the same way signal-slot connections do.

Note that only constructors that are declared with the Q_INVOKABLE modifier are made available through the meta-object system.

See also
constructor()

Definition at line 460 of file qobjectdefs.h.

References arguments, and QtPrivate::invokeMethodHelper().

+ Here is the call graph for this function:

◆ normalizedSignature()

QByteArray QMetaObject::normalizedSignature ( const char *  method)
static

Normalizes the signature of the given method.

Qt uses normalized signatures to decide whether two given signals and slots are compatible. Normalization reduces whitespace to a minimum, moves 'const' to the front where appropriate, removes 'const' from value types and replaces const references with values.

See also
checkConnectArgs(), normalizedType()

Definition at line 1363 of file qmetaobject.cpp.

References d, QVarLengthArray< T, Prealloc >::data(), method, qNormalizeType(), and qRemoveWhitespace().

Referenced by QSignalSpy::QSignalSpy(), QObject::connect(), QObject::disconnect(), QMetaObjectBuilder::indexOfConstructor(), QMetaObjectBuilder::indexOfMethod(), QMetaObjectBuilder::indexOfSignal(), QMetaObjectBuilder::indexOfSlot(), QDBusConnectionPrivate::prepareHook(), QObject::receivers(), QDBusAbstractAdaptor::setAutoRelaySignals(), QDBusPendingCallPrivate::setReplyCallback(), signalForMember(), and wrapInFunction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ normalizedType()

QByteArray QMetaObject::normalizedType ( const char *  type)
static
Since
4.2

Normalizes a type.

See QMetaObject::normalizedSignature() for a description on how Qt normalizes.

Example:

QByteArray normType = QMetaObject::normalizedType(" int const *");
// normType is now "const int*"
\inmodule QtCore
Definition qbytearray.h:57
static QByteArray normalizedType(const char *type)
See also
normalizedSignature()

Definition at line 1347 of file qmetaobject.cpp.

References qstrlen().

Referenced by QMetaMethod::invokeOnGadget(), QQmlJSCodeGenerator::metaTypeFromName(), qMetaTypeTypeImpl(), QMetaType::qRegisterMetaType(), qRegisterNormalizedMetaTypeImplementation(), QMetaMethodBuilder::setReturnType(), and wrapInFunction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator RestrictedBool()

QMetaObject::operator RestrictedBool ( ) const
inline

Definition at line 554 of file qobjectdefs.h.

◆ operator=()

Connection & QMetaObject::operator= ( const Connection other)

◆ property()

QMetaProperty QMetaObject::property ( int  index) const

Returns the meta-data for the property with the given index.

If no such property exists, a null QMetaProperty is returned.

See also
propertyCount(), propertyOffset(), indexOfProperty()

Definition at line 1202 of file qmetaobject.cpp.

References d, QMetaObject::Data::data, i, priv(), property(), QMetaObjectPrivate::propertyCount, propertyOffset(), and QMetaObject::Data::superdata.

Referenced by QQmlVMEResolvedList::QQmlVMEResolvedList(), QMetaObjectBuilder::addMetaObject(), createOrConstructValueType(), QQmlBinding::dependencies(), doWriteProperties(), doWriteProperties(), doWriteProperties(), QQmlAbstractBinding::getPropertyData(), getValueFromProperty(), QQmlPropertyPrivate::initProperty(), main(), QQmlDesignerMetaObject::metaCall(), QQmlProperty::name(), QQmlDesignerMetaObject::notifyPropertyChange(), QObject::property(), property(), QQmlGadgetPtrWrapper::property(), QQmlProperty::propertyTypeName(), qQmlPropertyCacheCreate(), removePendingQPropertyBinding(), VDMListDelegateDataType::setValue(), QQuickWheelHandlerPrivate::targetMetaProperty(), QQmlPropertyToPropertyBinding::update(), VDMListDelegateDataType::value(), QQuickMultiPointHandlerPrivate::xMetaProperty(), and QQuickMultiPointHandlerPrivate::yMetaProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ propertyCount()

int QMetaObject::propertyCount ( ) const

Returns the number of properties in this class, including the number of properties provided by each base class.

Use code like the following to obtain a QStringList containing the properties specific to a given class:

const QMetaObject* metaObject = obj->metaObject();
for(int i = metaObject->propertyOffset(); i < metaObject->propertyCount(); ++i)
properties << QString::fromLatin1(metaObject->property(i).name());
static const QCssKnownValue properties[NumProperties - 1]
See also
property(), propertyOffset(), indexOfProperty()

Definition at line 603 of file qmetaobject.cpp.

References d, QMetaObject::Data::data, priv(), QMetaObjectPrivate::propertyCount, and QMetaObject::Data::superdata.

Referenced by QMetaObjectBuilder::addMetaObject(), QQmlMetaType::clone(), VDMListDelegateDataType::columnCount(), VDMListDelegateDataType::createProperty(), QQmlDMObjectDataMetaObject::createProperty(), QQmlBinding::dependencies(), doWriteProperties(), doWriteProperties(), doWriteProperties(), VDMListDelegateDataType::emitAllSignals(), QQmlPropertyCache::invalidate(), main(), QQmlMetaObject::propertyCount(), QQmlPropertyCache::update(), and userProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ propertyOffset()

int QMetaObject::propertyOffset ( ) const

Returns the property offset for this class; i.e.

the index position of this class's first property.

The offset is the sum of all the properties in the class's superclasses (which is always positive since QObject has the name() property).

See also
property(), propertyCount(), indexOfProperty()

Definition at line 508 of file qmetaobject.cpp.

References d, priv(), QMetaObjectPrivate::propertyCount, and QMetaObject::Data::superdata.

Referenced by QMetaObjectBuilder::addMetaObject(), QMetaProperty::bindable(), QQmlMetaType::clone(), QQmlDMObjectDataMetaObject::createProperty(), QQmlOpenMetaObjectTypePrivate::init(), property(), QMetaProperty::propertyIndex(), qQmlPropertyCacheCreate(), QMetaProperty::read(), QMetaProperty::reset(), QQmlMetaObject::resolveGadgetMethodOrPropertyIndex(), QQuick3DCustomMaterial::updateSpatialNode(), QQuick3DEffect::updateSpatialNode(), and QMetaProperty::write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ static_metacall()

int QMetaObject::static_metacall ( Call  cl,
int  idx,
void **  argv 
) const

Definition at line 317 of file qmetaobject.cpp.

References d, QMetaObject::Data::data, priv(), Q_ASSERT, QMetaObjectPrivate::revision, and QMetaObject::Data::static_metacall.

Referenced by callConstructor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ staticMetaObject()

template<const QMetaObject & MO>
static constexpr const QMetaObject * QMetaObject::staticMetaObject ( )
inlinestaticconstexpr

Definition at line 484 of file qobjectdefs.h.

Referenced by VDMListDelegateDataType::metaObjectFromType().

+ Here is the caller graph for this function:

◆ superClass()

const QMetaObject * QMetaObject::superClass ( ) const
inline

Returns the meta-object of the superclass, or \nullptr if there is no such object.

See also
className()

Definition at line 567 of file qobjectdefs.h.

References d, and QMetaObject::Data::superdata.

Referenced by QMetaObjectBuilder::addMetaObject(), QQmlPropertyCache::createStandalone(), QObject::disconnect(), QMetaObjectPrivate::firstMethod(), QApplication::font(), QQDMIncubationTask::initializeRequiredProperties(), QQmlPrivate::isTypeCompatible(), qQmlPropertyCacheCreate(), QQmlMetaObject::resolveGadgetMethodOrPropertyIndex(), QQmlInterceptorMetaObject::toDynamicMetaObject(), QQuick3DCustomMaterial::updateSpatialNode(), and QQuick3DEffect::updateSpatialNode().

+ Here is the caller graph for this function:

◆ swap()

void QMetaObject::swap ( Connection other)
inlinenoexcept

Definition at line 559 of file qobjectdefs.h.

References other(), and qt_ptr_swap().

+ Here is the call graph for this function:

◆ tr()

QString QMetaObject::tr ( const char *  s,
const char *  c,
int  n = -1 
) const

Definition at line 402 of file qmetaobject.cpp.

References objectClassName(), and QCoreApplication::translate().

+ Here is the call graph for this function:

◆ userProperty()

QMetaProperty QMetaObject::userProperty ( ) const
Since
4.2

Returns the property that has the USER flag set to true.

See also
QMetaProperty::isUser()

Definition at line 1221 of file qmetaobject.cpp.

References i, QMetaProperty::isUser(), property, and propertyCount().

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ QMetaObject

friend struct QMetaObject
friend

Definition at line 541 of file qobjectdefs.h.

◆ QObject

friend class QObject
friend

Definition at line 539 of file qobjectdefs.h.

◆ QObjectPrivate

friend class QObjectPrivate
friend

Definition at line 540 of file qobjectdefs.h.

◆ QTimer

friend class QTimer
friend

Definition at line 533 of file qobjectdefs.h.

Member Data Documentation

◆ d


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