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
qobject.h File Reference

(2c212e15f8b9dc2578d93ac69a0f5826ea9de18f)

#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
 

Macros

#define Q_DECLARE_INTERFACE(IFace, IId)
 
#define Q_SET_OBJECT_NAME(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:105
constexpr const char * qobject_interface_iid()=delete
T qobject_cast(QObject *object)
\variable QObject::staticMetaObject
Definition qobject.h:421
T * qobject_iid_cast(QObject *object, const char *IId=qobject_interface_iid< T * >())
Definition qobject.h:447

Definition at line 462 of file qobject.h.

◆ Q_SET_OBJECT_NAME

#define Q_SET_OBJECT_NAME ( obj)
Value:
QT_PREPEND_NAMESPACE(QtPrivate)::deref_for_methodcall(obj).setObjectName(QLatin1StringView(#obj))
object setObjectName("A new object name")
GLhandleARB obj
[2]

Definition at line 573 of file qobject.h.

Typedef Documentation

◆ QObjectList

typedef QList<QObject*> QObjectList
related

Definition at line 45 of file qobject.h.

Function Documentation

◆ operator<<()

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

Definition at line 4601 of file qobject.cpp.

◆ qGetBindingStorage() [1/2]

const QBindingStorage * qGetBindingStorage ( const QObject * o)
inline

Definition at line 471 of file qobject.h.

◆ qGetBindingStorage() [2/2]

QBindingStorage * qGetBindingStorage ( QObject * o)
inline

Definition at line 475 of file qobject.h.

◆ qobject_cast() [1/2]

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

Definition at line 432 of file qobject.h.

◆ qobject_cast() [2/2]

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 421 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 452 of file qobject.h.

◆ 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 447 of file qobject.h.

◆ qobject_interface_iid()

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

◆ qt_qFindChild_helper()

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

Definition at line 2188 of file qobject.cpp.

◆ 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]

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

Definition at line 2151 of file qobject.cpp.