10#include <QtCore/qobjectdefs.h>
11#include <QtCore/qstring.h>
12#include <QtCore/qbytearray.h>
13#include <QtCore/qlist.h>
14#ifdef QT_INCLUDE_COMPAT
15#include <QtCore/qcoreevent.h>
17#include <QtCore/qscopedpointer.h>
18#include <QtCore/qmetatype.h>
20#include <QtCore/qobject_impl.h>
21#include <QtCore/qbindingstorage.h>
38class QAccessibleWidget;
39#if QT_CONFIG(regularexpression)
85 enum { CheckForParentChildLoopsWarnDepth = 4096 };
94 BINDABLE bindableObjectName)
104#if defined(QT_NO_TRANSLATION) || defined(Q_QDOC)
105 static QString tr(
const char *sourceText,
const char * =
nullptr,
int = -1)
110#if QT_CORE_REMOVED_SINCE(6, 4)
130 void killTimer(
int id);
135 typedef typename std::remove_cv<typename std::remove_pointer<T>::type>
::type ObjType;
142 typedef typename std::remove_cv<typename std::remove_pointer<T>::type>
::type ObjType;
152 typedef typename std::remove_cv<typename std::remove_pointer<T>::type>
::type ObjType;
159#if QT_CONFIG(regularexpression)
163 typedef typename std::remove_cv<typename std::remove_pointer<T>::type>
::type ObjType;
188 template<
typename Po
interToMemberFunction>
190 template<
typename Po
interToMemberFunction,
typename Functor>
192 template<
typename Po
interToMemberFunction,
typename Functor>
196 template <
typename Func1,
typename Func2>
205 if constexpr (SlotType::ArgumentCount != -1) {
207 "Return type of the slot is not compatible with the return type of the signal.");
211 constexpr int SlotArgumentCount = (FunctorArgumentCount >= 0) ? FunctorArgumentCount : 0;
215 "Return type of the slot is not compatible with the return type of the signal.");
219 "No Q_OBJECT in the class with the signal");
222 static_assert(int(SignalType::ArgumentCount) >= int(SlotType::ArgumentCount),
223 "The slot requires more arguments than the signal provides.");
225 const int *
types =
nullptr;
229 void **pSlot =
nullptr;
230 if constexpr (std::is_member_function_pointer_v<std::decay_t<Func2>>)
231 pSlot =
const_cast<void **
>(
reinterpret_cast<void *
const *
>(&slot));
233 return connectImpl(sender,
reinterpret_cast<void **
>(&
signal),
context, pSlot,
234 QtPrivate::makeCallableObject<Func1>(std::forward<Func2>(slot)),
235 type,
types, &SignalType::Object::staticMetaObject);
238#ifndef QT_NO_CONTEXTLESS_CONNECT
240 template <
typename Func1,
typename Func2>
250 const QObject *receiver,
const char *member);
254 const QObject *receiver =
nullptr,
const char *member =
nullptr)
const
257 {
return disconnect(
this,
nullptr, receiver, member); }
261 template<
typename Po
interToMemberFunction>
264 template <
typename Func1,
typename Func2>
272 "No Q_OBJECT in the class with the signal");
276 "Signal and slot arguments are not compatible.");
278 return disconnectImpl(sender,
reinterpret_cast<void **
>(&
signal), receiver,
reinterpret_cast<void **
>(&slot),
279 &SignalType::Object::staticMetaObject);
281 template <
typename Func1>
290 return disconnectImpl(sender,
reinterpret_cast<void **
>(&
signal), receiver,
zero,
291 &SignalType::Object::staticMetaObject);
295 void dumpObjectTree()
const;
296 void dumpObjectInfo()
const;
298 QT_CORE_INLINE_SINCE(6, 6)
315 return const_cast<QObject *
>(
this)->qt_metacast(classname) !=
nullptr;
323 int senderSignalIndex()
const;
324 int receivers(
const char *
signal)
const;
348 friend class QAccessibleWidget;
360 const QObject *receiver,
void **slotPtr,
364 static bool disconnectImpl(
const QObject *sender,
void **
signal,
const QObject *receiver,
void **slot,
371{
return connect(asender, asignal,
this, amember, atype); }
373#if QT_CORE_INLINE_IMPL_SINCE(6, 6)
376 return doSetProperty(
name, &
value,
nullptr);
387 typedef typename std::remove_cv<typename std::remove_pointer<T>::type>
::type ObjType;
389 "qobject_cast requires the type to have a Q_OBJECT macro");
390 return static_cast<T
>(ObjType::staticMetaObject.cast(
object));
396 typedef typename std::remove_cv<typename std::remove_pointer<T>::type>
::type ObjType;
398 "qobject_cast requires the type to have a Q_OBJECT macro");
399 return static_cast<T
>(ObjType::staticMetaObject.cast(
object));
404template <
class T>
inline T *
407 return reinterpret_cast<T *
>((
object ?
object->qt_metacast(IId) :
nullptr));
409template <
class T>
inline std::enable_if_t<std::is_const<T>::value, T *>
414 return qobject_iid_cast<std::remove_cv_t<T>>(
o);
418# define Q_DECLARE_INTERFACE(IFace, IId)
419#elif !defined(Q_MOC_RUN)
420# define Q_DECLARE_INTERFACE(IFace, IId) \
421 template <> constexpr const char *qobject_interface_iid<IFace *>() \
423 template <> inline IFace *qobject_cast<IFace *>(QObject *object) \
424 { return qobject_iid_cast<IFace>(object); } \
425 template <> inline const IFace *qobject_cast<const IFace *>(const QObject *object) \
426 { return qobject_iid_cast<const IFace>(object); }
431 return o->bindingStorage();
435 return o->bindingStorage();
438#ifndef QT_NO_DEBUG_STREAM
455 inline void reblock()
noexcept;
456 inline void unblock()
noexcept;
467 m_blocked(
o &&
o->blockSignals(
true)),
473 m_blocked(
o.blockSignals(
true)),
479 m_blocked(
other.m_blocked),
480 m_inhibited(
other.m_inhibited)
487 if (
this != &
other) {
490 if (m_o !=
other.m_o || (!m_inhibited &&
other.m_inhibited))
493 m_blocked =
other.m_blocked;
494 m_inhibited =
other.m_inhibited;
503 if (m_o && !m_inhibited)
525#define Q_SET_OBJECT_NAME(obj) QT_PREPEND_NAMESPACE(QtPrivate)::deref_for_methodcall(obj).setObjectName(QLatin1StringView(#obj))
The QApplication class manages the GUI application's control flow and main settings.
QDynamicMetaObjectData * metaObject
QBindingStorage bindingStorage
static bool disconnect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero)
bool disconnect(const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const
static QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection)
T findChild(const QString &aName=QString(), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
Returns the child of this object that can be cast into type T and that is called name,...
const QObjectList & children() const
Returns a list of child objects.
bool isWindowType() const
Returns true if the object is a window; otherwise returns false.
QObject * parent() const
Returns a pointer to the parent object.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
QList< T > findChildren(Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QList< T > findChildren(const QString &aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
Returns all children of this object with the given name that can be cast to type T,...
const QBindingStorage * bindingStorage() const
bool signalsBlocked() const noexcept
Returns true if signals are blocked; otherwise returns false.
static QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot)
bool isQuickItemType() const
Returns true if the object is a QQuickItem; otherwise returns false.
QScopedPointer< QObjectData > d_ptr
bool blockSignals(bool b) noexcept
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke...
Q_WEAK_OVERLOAD void setObjectName(const QString &name)
Sets the object's name to name.
static bool disconnect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot)
bool setProperty(const char *name, const QVariant &value)
Sets the value of the object's name property to value.
bool disconnect(const QObject *receiver, const char *member=nullptr) const
bool inherits(const char *classname) const
Returns true if this object is an instance of a class that inherits className or a QObject subclass t...
void objectNameChanged(const QString &objectName, QPrivateSignal)
This signal is emitted after the object's name has been changed.
void destroyed(QObject *=nullptr)
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointe...
bool isWidgetType() const
Returns true if the object is a widget; otherwise returns false.
\inmodule QtCore \reentrant
Exception-safe wrapper around QObject::blockSignals().
void unblock() noexcept
Temporarily restores the QObject::signalsBlocked() state to what it was before this QSignalBlocker's ...
void reblock() noexcept
Re-blocks signals after a previous unblock().
QSignalBlocker & operator=(QSignalBlocker &&other) noexcept
Move-assigns this signal blocker from other.
Q_NODISCARD_CTOR QSignalBlocker(QObject *o) noexcept
Constructor.
~QSignalBlocker()
Destructor.
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
object setProperty("down", true)
object setObjectName("A new object name")
Combined button and popup list for selecting options.
QObject & deref_for_methodcall(QObject &o)
@ FindChildrenRecursively
@ BlockingQueuedConnection
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char * method
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
void qt_qFindChildren_helper(const QObject *parent, const QString &name, const QMetaObject &mo, QList< void * > *list, Qt::FindChildOptions options)
QObject * qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo, Qt::FindChildOptions options)
const QBindingStorage * qGetBindingStorage(const QObject *o)
constexpr const char * qobject_interface_iid()=delete
T * qobject_iid_cast(QObject *object, const char *IId=qobject_interface_iid< T * >())
QList< QObject * > QObjectList
Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, const QString &name, const QMetaObject &mo, QList< void * > *list, Qt::FindChildOptions options)
T qobject_cast(QObject *object)
\variable QObject::staticMetaObject
Q_CORE_EXPORT QObject * qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo, Qt::FindChildOptions options)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QObject *)
GLboolean GLboolean GLboolean b
GLsizei GLenum GLenum * types
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)
monitoredObj installEventFilter(filterObj)
[13]
myObject disconnect()
[26]
myObject moveToThread(QApplication::instance() ->thread())
[6]
someQObject blockSignals(wasBlocked)
file setParent(multiPart)
static const int * types()
List_Append< List< typenameL::Car >, typenameList_Left< typenameL::Cdr, N-1 >::Value >::Value Value
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent