Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qobject.h File Reference

(ce2585d0e950ff0d81adbcf5463ddfbcb1367900)

#include <QtCore/qobjectdefs.h>
#include <QtCore/qstring.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qlist.h>
#include <QtCore/qscopedpointer.h>
#include <QtCore/qmetatype.h>
#include <QtCore/qobject_impl.h>
#include <QtCore/qbindingstorage.h>
#include <QtCore/qtcoreexports.h>
#include <chrono>
+ Include dependency graph for qobject.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  QObjectData
 
class  QObject
 \inmodule QtCore More...
 
class  QSignalBlocker
 Exception-safe wrapper around QObject::blockSignals(). More...
 

Namespaces

namespace  QtPrivate
 \macro QT_NO_KEYWORDS >
 

Macros

#define Q_DECLARE_INTERFACE(IFace, IId)
 
#define Q_SET_OBJECT_NAME(obj)   QT_PREPEND_NAMESPACE(QtPrivate)::deref_for_methodcall(obj).setObjectName(QLatin1StringView(#obj))
 

Typedefs

typedef QList< QObject * > QObjectList
 

Functions

Q_CORE_EXPORT void qt_qFindChildren_helper (const QObject *parent, QAnyStringView name, const QMetaObject &mo, QList< void * > *list, Qt::FindChildOptions options)
 
Q_CORE_EXPORT void qt_qFindChildren_helper (const QObject *parent, const QRegularExpression &re, const QMetaObject &mo, QList< void * > *list, Qt::FindChildOptions options)
 
Q_CORE_EXPORT QObjectqt_qFindChild_helper (const QObject *parent, QAnyStringView name, const QMetaObject &mo, Qt::FindChildOptions options)
 
template<class T >
qobject_cast (QObject *object)
 \variable QObject::staticMetaObject
 
template<class T >
qobject_cast (const QObject *object)
 
template<class T >
constexpr const char * qobject_interface_iid ()=delete
 
template<class T >
T * qobject_iid_cast (QObject *object, const char *IId=qobject_interface_iid< T * >())
 
template<class T >
std::enable_if_t< std::is_const< T >::value, T * > qobject_iid_cast (const QObject *object)
 
const QBindingStorageqGetBindingStorage (const QObject *o)
 
QBindingStorageqGetBindingStorage (QObject *o)
 
Q_CORE_EXPORT QDebug operator<< (QDebug, const QObject *)
 
QObjectQtPrivate::deref_for_methodcall (QObject &o)
 
QObjectQtPrivate::deref_for_methodcall (QObject *o)
 

Macro Definition Documentation

◆ Q_DECLARE_INTERFACE

#define Q_DECLARE_INTERFACE ( IFace,
IId )
Value:
template <> constexpr const char *qobject_interface_iid<IFace *>() \
{ return IId; } \
template <> inline IFace *qobject_cast<IFace *>(QObject *object) \
{ return qobject_iid_cast<IFace>(object); } \
template <> inline const IFace *qobject_cast<const IFace *>(const QObject *object) \
{ return qobject_iid_cast<const IFace>(object); }
\inmodule QtCore
Definition qobject.h:103

Definition at line 460 of file qobject.h.

◆ Q_SET_OBJECT_NAME

#define Q_SET_OBJECT_NAME ( obj)    QT_PREPEND_NAMESPACE(QtPrivate)::deref_for_methodcall(obj).setObjectName(QLatin1StringView(#obj))

Definition at line 571 of file qobject.h.

Typedef Documentation

◆ QObjectList

typedef QList<QObject*> QObjectList
related

Definition at line 45 of file qobject.h.

Function Documentation

◆ operator<<()

Q_CORE_EXPORT QDebug operator<< ( QDebug dbg,
const QObject * o )

Definition at line 4481 of file qobject.cpp.

References d, QObjectPrivate::get(), and o.

+ Here is the call graph for this function:

◆ qGetBindingStorage() [1/2]

const QBindingStorage * qGetBindingStorage ( const QObject * o)
inline

Definition at line 469 of file qobject.h.

References o.

Referenced by QObjectBindableProperty< Class, T, Offset, Signal >::binding(), QObjectCompatProperty< Class, T, Offset, Setter, Signal, Getter >::binding(), QObjectBindableProperty< Class, T, Offset, Signal >::bindingData(), QObjectComputedProperty< Class, T, Offset, Getter >::bindingData(), QObjectCompatProperty< Class, T, Offset, Setter, Signal, Getter >::bindingData(), QObjectBindableProperty< Class, T, Offset, Signal >::hasBinding(), QObjectCompatProperty< Class, T, Offset, Setter, Signal, Getter >::hasBinding(), QObjectBindableProperty< Class, T, Offset, Signal >::notify(), QObjectComputedProperty< Class, T, Offset, Getter >::notify(), QObjectCompatProperty< Class, T, Offset, Setter, Signal, Getter >::notify(), QObjectCompatProperty< Class, T, Offset, Setter, Signal, Getter >::removeBindingUnlessInWrapper(), QObjectBindableProperty< Class, T, Offset, Signal >::setBinding(), QObjectCompatProperty< Class, T, Offset, Setter, Signal, Getter >::setBinding(), QObjectBindableProperty< Class, T, Offset, Signal >::setValue(), QObjectCompatProperty< Class, T, Offset, Setter, Signal, Getter >::setValue(), QObjectBindableProperty< Class, T, Offset, Signal >::setValue(), QObjectBindableProperty< Class, T, Offset, Signal >::value(), QObjectComputedProperty< Class, T, Offset, Getter >::value(), and QObjectCompatProperty< Class, T, Offset, Setter, Signal, Getter >::value().

+ Here is the caller graph for this function:

◆ qGetBindingStorage() [2/2]

QBindingStorage * qGetBindingStorage ( QObject * o)
inline

Definition at line 473 of file qobject.h.

References o.

◆ qobject_cast() [1/2]

template<class T >
T qobject_cast ( const QObject * object)
related

Definition at line 430 of file qobject.h.

◆ qobject_cast() [2/2]

template<class T >
template< class T > T qobject_cast ( QObject * object)
inline

\variable QObject::staticMetaObject

This variable stores the meta-object for the class.

A meta-object contains information about a class that inherits QObject, e.g. class name, superclass name, properties, signals and slots. Every class that contains the Q_OBJECT macro will also have a meta-object.

The meta-object information is required by the signal/slot connection mechanism and the property system. The inherits() function also makes use of the meta-object.

If you have a pointer to an object, you can use metaObject() to retrieve the meta-object associated with that object.

Example:

QPushButton::staticMetaObject.className(); // returns "QPushButton"
obj->metaObject()->className(); // returns "QPushButton"
See also
metaObject()

Definition at line 419 of file qobject.h.

◆ qobject_iid_cast() [1/2]

template<class T >
std::enable_if_t< std::is_const< T >::value, T * > qobject_iid_cast ( const QObject * object)
inline

Definition at line 450 of file qobject.h.

References o.

◆ qobject_iid_cast() [2/2]

template<class T >
T * qobject_iid_cast ( QObject * object,
const char * IId = qobject_interface_iid<T *>() )
inline

Definition at line 445 of file qobject.h.

◆ qobject_interface_iid()

template<class T >
constexpr const char * qobject_interface_iid ( )
constexprdelete

◆ qt_qFindChild_helper()

Q_CORE_EXPORT QObject * qt_qFindChild_helper ( const QObject * parent,
QAnyStringView name,
const QMetaObject & mo,
Qt::FindChildOptions options )

Definition at line 2174 of file qobject.cpp.

References child, QObject::children(), Qt::FindChildrenRecursively, matches_objectName_non_null(), mo, QObjectData::parent, Q_ASSERT, and qt_qFindChild_helper().

Referenced by QObject::findChild(), and qt_qFindChild_helper().

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

◆ qt_qFindChildren_helper() [1/2]

Q_CORE_EXPORT void qt_qFindChildren_helper ( const QObject * parent,
const QRegularExpression & re,
const QMetaObject & mo,
QList< void * > * list,
Qt::FindChildOptions options )

◆ qt_qFindChildren_helper() [2/2]

Q_CORE_EXPORT void qt_qFindChildren_helper ( const QObject * parent,
QAnyStringView name,
const QMetaObject & mo,
QList< void * > * list,
Qt::FindChildOptions options )

Definition at line 2137 of file qobject.cpp.

References QList< T >::append(), QObject::children(), Qt::FindChildrenRecursively, list, matches_objectName_non_null(), mo, QObjectData::parent, Q_ASSERT, and qt_qFindChildren_helper().

Referenced by QObject::findChildren(), and qt_qFindChildren_helper().

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