Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qobject.h File Reference
#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 <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_NAMESPACE
 

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, const QString &name, const QMetaObject &mo, QList< void * > *list, Qt::FindChildOptions options)
 
Q_CORE_EXPORT void qt_qFindChildren_helper (const QObject *parent, 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, const QString &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:90

Definition at line 420 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 525 of file qobject.h.

Typedef Documentation

◆ QObjectList

typedef QList<QObject*> QObjectList
related

Definition at line 44 of file qobject.h.

Function Documentation

◆ operator<<()

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

Definition at line 4336 of file qobject.cpp.

References o.

◆ qGetBindingStorage() [1/2]

const QBindingStorage * qGetBindingStorage ( const QObject o)
inline

Definition at line 429 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 433 of file qobject.h.

References o.

◆ qobject_cast() [1/2]

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

Definition at line 394 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"
The QPushButton widget provides a command button.
Definition qpushbutton.h:20
GLhandleARB obj
[2]
See also
metaObject()

Definition at line 385 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 410 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 405 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,
const QString name,
const QMetaObject mo,
Qt::FindChildOptions  options 
)

Definition at line 2121 of file qobject.cpp.

References child, QObject::children(), Qt::FindChildrenRecursively, 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/3]

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

Definition at line 2084 of file qobject.cpp.

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

+ Here is the call graph for this function:

◆ qt_qFindChildren_helper() [2/3]

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() [3/3]

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

Definition at line 2072 of file qobject.cpp.

References list, mo, QObjectData::parent, qt_qFindChildren_helper(), and qt_qFindChildren_with_name().

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

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