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
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// Copyright (C) 2013 Olivier Goffart <ogoffart@woboq.com>
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4// Qt-Security score:significant reason:default
5
6#ifndef QOBJECT_H
7#define QOBJECT_H
8
9#ifndef QT_NO_QOBJECT
10
11#include <QtCore/qobjectdefs.h>
12#include <QtCore/qstring.h>
13#include <QtCore/qbytearray.h>
14#include <QtCore/qlist.h>
15#ifdef QT_INCLUDE_COMPAT
16#include <QtCore/qcoreevent.h>
17#endif
18#include <QtCore/qscopedpointer.h>
19#include <QtCore/qmetatype.h>
20
21#include <QtCore/qobject_impl.h>
22#include <QtCore/qbindingstorage.h>
23#include <QtCore/qtcoreexports.h>
24
25#include <chrono>
26
28
29
30template <typename T> class QBindable;
31class QEvent;
32class QTimerEvent;
33class QChildEvent;
34struct QMetaObject;
35class QVariant;
36class QObjectPrivate;
37class QObject;
38class QThread;
39class QWidget;
40class QAccessibleWidget;
41#if QT_CONFIG(regularexpression)
42class QRegularExpression;
43#endif
44struct QDynamicMetaObjectData;
45
47
48#if QT_CORE_REMOVED_SINCE(6, 7)
49Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, const QString &name,
50 const QMetaObject &mo, QList<void *> *list, Qt::FindChildOptions options);
51#endif
52Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, QAnyStringView name,
53 const QMetaObject &mo, QList<void *> *list,
54 Qt::FindChildOptions options);
55#if QT_CORE_REMOVED_SINCE(6, 7)
56Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, const QMetaObject &mo,
57 QList<void *> *list, Qt::FindChildOptions options);
58#endif
59Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, const QRegularExpression &re,
60 const QMetaObject &mo, QList<void *> *list, Qt::FindChildOptions options);
61#if QT_CORE_REMOVED_SINCE(6, 7)
62Q_CORE_EXPORT QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo, Qt::FindChildOptions options);
63#endif
64Q_CORE_EXPORT QObject *qt_qFindChild_helper(const QObject *parent, QAnyStringView name,
65 const QMetaObject &mo, Qt::FindChildOptions options);
66
67class Q_CORE_EXPORT QObjectData
68{
69 Q_DISABLE_COPY(QObjectData)
70public:
71 QObjectData() = default;
72 virtual ~QObjectData() = 0;
73 QObject *q_ptr;
74 QObject *parent;
76
77 uint isWidget : 1;
78 uint blockSig : 1;
79 uint wasDeleted : 1;
83 uint isWindow : 1; // for QWindow
85 uint isQuickItem : 1;
86 uint willBeWidget : 1; // for handling widget-specific bits in QObject's ctor
87 uint wasWidget : 1; // for properly cleaning up in QObject's dtor
89 uint unused : 20;
91 QDynamicMetaObjectData *metaObject;
93
94#if QT_CORE_REMOVED_SINCE(6, 9) && defined(Q_COMPILER_MANGLES_RETURN_TYPE)
95 QMetaObject *dynamicMetaObject() const;
96#else
97 const QMetaObject *dynamicMetaObject() const;
98#endif
99
100#ifdef QT_DEBUG
101 enum { CheckForParentChildLoopsWarnDepth = 4096 };
102#endif
103};
104
105class Q_CORE_EXPORT QObject
106{
107 Q_OBJECT
108
109 Q_PROPERTY(QString objectName READ objectName WRITE setObjectName NOTIFY objectNameChanged
110 BINDABLE bindableObjectName)
111 Q_DECLARE_PRIVATE(QObject)
112
113public:
114 Q_INVOKABLE explicit QObject(QObject *parent = nullptr);
115 virtual ~QObject();
116
117 virtual bool event(QEvent *event);
118 virtual bool eventFilter(QObject *watched, QEvent *event);
119
120#if defined(QT_NO_TRANSLATION) || defined(Q_QDOC)
121 static QString tr(const char *sourceText, const char * = nullptr, int = -1)
122 { return QString::fromUtf8(sourceText); }
123#endif // QT_NO_TRANSLATION
124
125 QString objectName() const;
126#if QT_CORE_REMOVED_SINCE(6, 4)
127 void setObjectName(const QString &name);
128#endif
129 Q_WEAK_OVERLOAD
130 void setObjectName(const QString &name) { doSetObjectName(name); }
131 void setObjectName(QAnyStringView name);
132 QBindable<QString> bindableObjectName();
133
134 inline bool isWidgetType() const { return d_ptr->isWidget; }
135 inline bool isWindowType() const { return d_ptr->isWindow; }
136 inline bool isQuickItemType() const { return d_ptr->isQuickItem; }
137
138 bool isQmlExposed() const noexcept;
139
140 inline bool signalsBlocked() const noexcept { return d_ptr->blockSig; }
141 bool blockSignals(bool b) noexcept;
142
143 QThread *thread() const;
144#if QT_CORE_REMOVED_SINCE(6, 7)
145 void moveToThread(QThread *thread);
146#endif
147 bool moveToThread(QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL);
148
149 int startTimer(int interval, Qt::TimerType timerType = Qt::CoarseTimer);
150
151#if QT_CORE_REMOVED_SINCE(6, 8)
152 int startTimer(std::chrono::milliseconds time, Qt::TimerType timerType = Qt::CoarseTimer);
153#endif
154 int startTimer(std::chrono::nanoseconds time, Qt::TimerType timerType = Qt::CoarseTimer);
155
156 void killTimer(int id);
157 void killTimer(Qt::TimerId id);
158
159 template<typename T>
160 T findChild(QAnyStringView aName, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const
161 {
162 typedef typename std::remove_cv<typename std::remove_pointer<T>::type>::type ObjType;
163 static_assert(QtPrivate::HasQ_OBJECT_Macro<ObjType>::Value,
164 "No Q_OBJECT in the class passed to QObject::findChild");
165 return static_cast<T>(qt_qFindChild_helper(this, aName, ObjType::staticMetaObject, options));
166 }
167
168 template<typename T>
169 QList<T> findChildren(QAnyStringView aName, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const
170 {
171 typedef typename std::remove_cv<typename std::remove_pointer<T>::type>::type ObjType;
172 static_assert(QtPrivate::HasQ_OBJECT_Macro<ObjType>::Value,
173 "No Q_OBJECT in the class passed to QObject::findChildren");
174 QList<T> list;
175 qt_qFindChildren_helper(this, aName, ObjType::staticMetaObject,
176 reinterpret_cast<QList<void *> *>(&list), options);
177 return list;
178 }
179
180 template<typename T>
181 T findChild(Qt::FindChildOptions options = Qt::FindChildrenRecursively) const
182 {
183 return findChild<T>({}, options);
184 }
185
186 template<typename T>
187 QList<T> findChildren(Qt::FindChildOptions options = Qt::FindChildrenRecursively) const
188 {
189 return findChildren<T>(QAnyStringView{}, options);
190 }
191
192#if QT_CONFIG(regularexpression)
193 template<typename T>
194 inline QList<T> findChildren(const QRegularExpression &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const
195 {
196 typedef typename std::remove_cv<typename std::remove_pointer<T>::type>::type ObjType;
197 static_assert(QtPrivate::HasQ_OBJECT_Macro<ObjType>::Value,
198 "No Q_OBJECT in the class passed to QObject::findChildren");
199 QList<T> list;
200 qt_qFindChildren_helper(this, re, ObjType::staticMetaObject,
201 reinterpret_cast<QList<void *> *>(&list), options);
202 return list;
203 }
204#endif // QT_CONFIG(regularexpression)
205
206 inline const QObjectList &children() const { return d_ptr->children; }
207
208 void setParent(QObject *parent);
209 void installEventFilter(QObject *filterObj);
210 void removeEventFilter(QObject *obj);
211
212 static QMetaObject::Connection connect(const QObject *sender, const char *signal,
213 const QObject *receiver, const char *member, Qt::ConnectionType = Qt::AutoConnection);
214
215 static QMetaObject::Connection connect(const QObject *sender, const QMetaMethod &signal,
216 const QObject *receiver, const QMetaMethod &method,
217 Qt::ConnectionType type = Qt::AutoConnection);
218
219 inline QMetaObject::Connection connect(const QObject *sender, const char *signal,
220 const char *member, Qt::ConnectionType type = Qt::AutoConnection) const;
221
222#ifdef Q_QDOC
223 template<typename PointerToMemberFunction>
224 static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type = Qt::AutoConnection);
225 template<typename PointerToMemberFunction, typename Functor>
226 static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor);
227 template<typename PointerToMemberFunction, typename Functor>
228 static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type = Qt::AutoConnection);
229#else
230 //connect with context
231 template <typename Func1, typename Func2>
232 static inline QMetaObject::Connection
233 connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal,
234 const typename QtPrivate::ContextTypeForFunctor<Func2>::ContextType *context, Func2 &&slot,
235 Qt::ConnectionType type = Qt::AutoConnection)
236 {
237 typedef QtPrivate::FunctionPointer<Func1> SignalType;
238 typedef QtPrivate::FunctionPointer<std::decay_t<Func2>> SlotType;
239
240 if constexpr (SlotType::ArgumentCount != -1) {
241 static_assert((QtPrivate::AreArgumentsCompatible<typename SlotType::ReturnType, typename SignalType::ReturnType>::value),
242 "Return type of the slot is not compatible with the return type of the signal.");
243 } else {
244 constexpr int FunctorArgumentCount = QtPrivate::ComputeFunctorArgumentCount<std::decay_t<Func2>, typename SignalType::Arguments>::Value;
245 [[maybe_unused]]
246 constexpr int SlotArgumentCount = (FunctorArgumentCount >= 0) ? FunctorArgumentCount : 0;
247 typedef typename QtPrivate::FunctorReturnType<std::decay_t<Func2>, typename QtPrivate::List_Left<typename SignalType::Arguments, SlotArgumentCount>::Value>::type SlotReturnType;
248
249 static_assert((QtPrivate::AreArgumentsCompatible<SlotReturnType, typename SignalType::ReturnType>::value),
250 "Return type of the slot is not compatible with the return type of the signal.");
251 }
252
253 static_assert(QtPrivate::HasQ_OBJECT_Macro<typename SignalType::Object>::Value,
254 "No Q_OBJECT in the class with the signal");
255
256 //compilation error if the arguments does not match.
257 static_assert(int(SignalType::ArgumentCount) >= int(SlotType::ArgumentCount),
258 "The slot requires more arguments than the signal provides.");
259
260 const int *types = nullptr;
261 if (type == Qt::QueuedConnection || type == Qt::BlockingQueuedConnection)
262 types = QtPrivate::ConnectionTypes<typename SignalType::Arguments>::types();
263
264 void **pSlot = nullptr;
265 if constexpr (std::is_member_function_pointer_v<std::decay_t<Func2>>) {
266 pSlot = const_cast<void **>(reinterpret_cast<void *const *>(&slot));
267 } else {
268 Q_ASSERT_X((type & Qt::UniqueConnection) == 0, "",
269 "QObject::connect: Unique connection requires the slot to be a pointer to "
270 "a member function of a QObject subclass.");
271 }
272
273 return connectImpl(sender, reinterpret_cast<void **>(&signal), context, pSlot,
274 QtPrivate::makeCallableObject<Func1>(std::forward<Func2>(slot)),
275 type, types, &SignalType::Object::staticMetaObject);
276 }
277
278#ifndef QT_NO_CONTEXTLESS_CONNECT
279 //connect without context
280 template <typename Func1, typename Func2>
281 static inline QMetaObject::Connection
282 connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, Func2 &&slot)
283 {
284 return connect(sender, signal, sender, std::forward<Func2>(slot), Qt::DirectConnection);
285 }
286#endif // QT_NO_CONTEXTLESS_CONNECT
287#endif //Q_QDOC
288
289 static bool disconnect(const QObject *sender, const char *signal,
290 const QObject *receiver, const char *member);
291 static bool disconnect(const QObject *sender, const QMetaMethod &signal,
292 const QObject *receiver, const QMetaMethod &member);
293 inline bool disconnect(const char *signal = nullptr,
294 const QObject *receiver = nullptr, const char *member = nullptr) const
295 { return disconnect(this, signal, receiver, member); }
296 inline bool disconnect(const QObject *receiver, const char *member = nullptr) const
297 { return disconnect(this, nullptr, receiver, member); }
298 static bool disconnect(const QMetaObject::Connection &);
299
300#ifdef Q_QDOC
301 template<typename PointerToMemberFunction>
302 static bool disconnect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method);
303#else
304 template <typename Func1, typename Func2>
305 static inline bool disconnect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal,
306 const typename QtPrivate::FunctionPointer<Func2>::Object *receiver, Func2 slot)
307 {
308 typedef QtPrivate::FunctionPointer<Func1> SignalType;
309 typedef QtPrivate::FunctionPointer<Func2> SlotType;
310
311 static_assert(QtPrivate::HasQ_OBJECT_Macro<typename SignalType::Object>::Value,
312 "No Q_OBJECT in the class with the signal");
313
314 //compilation error if the arguments does not match.
315 static_assert((QtPrivate::CheckCompatibleArguments<typename SignalType::Arguments, typename SlotType::Arguments>::value),
316 "Signal and slot arguments are not compatible.");
317
318 return disconnectImpl(sender, reinterpret_cast<void **>(&signal), receiver, reinterpret_cast<void **>(&slot),
319 &SignalType::Object::staticMetaObject);
320 }
321 template <typename Func1>
322 static inline bool disconnect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal,
323 const QObject *receiver, void **zero)
324 {
325 // This is the overload for when one wish to disconnect a signal from any slot. (slot=nullptr)
326 // Since the function template parameter cannot be deduced from '0', we use a
327 // dummy void ** parameter that must be equal to 0
328 Q_ASSERT(!zero);
329 typedef QtPrivate::FunctionPointer<Func1> SignalType;
330 return disconnectImpl(sender, reinterpret_cast<void **>(&signal), receiver, zero,
331 &SignalType::Object::staticMetaObject);
332 }
333#endif //Q_QDOC
334
335 void dumpObjectTree() const;
336 void dumpObjectInfo() const;
337
338 QT_CORE_INLINE_SINCE(6, 6)
339 bool setProperty(const char *name, const QVariant &value);
340 inline bool setProperty(const char *name, QVariant &&value);
341 QVariant property(const char *name) const;
342 QList<QByteArray> dynamicPropertyNames() const;
343 QBindingStorage *bindingStorage() { return &d_ptr->bindingStorage; }
344 const QBindingStorage *bindingStorage() const { return &d_ptr->bindingStorage; }
345
346Q_SIGNALS:
347 void destroyed(QObject * = nullptr);
348 void objectNameChanged(const QString &objectName, QPrivateSignal);
349
350public:
351 inline QObject *parent() const { return d_ptr->parent; }
352
353 inline bool inherits(const char *classname) const
354 {
355 return const_cast<QObject *>(this)->qt_metacast(classname) != nullptr;
356 }
357
358public Q_SLOTS:
359 void deleteLater();
360
361protected:
362 QObject *sender() const;
363 int senderSignalIndex() const;
364 int receivers(const char *signal) const;
365 bool isSignalConnected(const QMetaMethod &signal) const;
366
367 virtual void timerEvent(QTimerEvent *event);
368 virtual void childEvent(QChildEvent *event);
369 virtual void customEvent(QEvent *event);
370
371 virtual void connectNotify(const QMetaMethod &signal);
372 virtual void disconnectNotify(const QMetaMethod &signal);
373
374protected:
375 QObject(QObjectPrivate &dd, QObject *parent = nullptr);
376
377protected:
378 QScopedPointer<QObjectData> d_ptr;
379
380 friend struct QMetaObject;
381 friend struct QMetaObjectPrivate;
382 friend class QMetaCallEvent;
383 friend class QApplication;
384 friend class QApplicationPrivate;
385 friend class QCoreApplication;
386 friend class QCoreApplicationPrivate;
387 friend class QWidget;
388 friend class QAccessibleWidget;
389 friend class QThreadData;
390
391private:
392 void doSetObjectName(const QString &name);
393#if QT_CORE_REMOVED_SINCE(6, 10)
394 bool doSetProperty(const char *name, const QVariant *lvalue, QVariant *rvalue);
395#endif
396 bool doSetProperty(const char *name, const QVariant &value, QVariant *rvalue);
397
398 Q_DISABLE_COPY(QObject)
399
400private:
401 static QMetaObject::Connection connectImpl(const QObject *sender, void **signal,
402 const QObject *receiver, void **slotPtr,
403 QtPrivate::QSlotObjectBase *slot, Qt::ConnectionType type,
404 const int *types, const QMetaObject *senderMetaObject);
405
406 static bool disconnectImpl(const QObject *sender, void **signal, const QObject *receiver, void **slot,
407 const QMetaObject *senderMetaObject);
408
409};
410
411inline QMetaObject::Connection QObject::connect(const QObject *asender, const char *asignal,
412 const char *amember, Qt::ConnectionType atype) const
413{ return connect(asender, asignal, this, amember, atype); }
414
415#if QT_CORE_INLINE_IMPL_SINCE(6, 6)
416bool QObject::setProperty(const char *name, const QVariant &value)
417{
418 return doSetProperty(name, value, nullptr);
419}
420#endif // inline since 6.6
421bool QObject::setProperty(const char *name, QVariant &&value)
422{
423 return doSetProperty(name, value, &value);
424}
425
426template <class T>
427inline T qobject_cast(QObject *object)
428{
429 return QtPrivate::qobject_cast_helper<T>(object);
430}
431
432template <class T>
433inline T qobject_cast(const QObject *object)
434{
435 static_assert(std::is_const_v<std::remove_pointer_t<T>>,
436 "qobject_cast cannot cast away constness (use const_cast)");
437 return QtPrivate::qobject_cast_helper<T>(object);
438}
439
440template <class T> constexpr const char * qobject_interface_iid() = delete;
441template <class T> inline T *
442qobject_iid_cast(QObject *object, const char *IId = qobject_interface_iid<T *>())
443{
444 return reinterpret_cast<T *>((object ? object->qt_metacast(IId) : nullptr));
445}
446template <class T> inline std::enable_if_t<std::is_const<T>::value, T *>
447qobject_iid_cast(const QObject *object)
448{
449 // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast)
450 QObject *o = const_cast<QObject *>(object);
451 return qobject_iid_cast<std::remove_cv_t<T>>(o);
452}
453
454#if defined(Q_QDOC)
455# define Q_DECLARE_INTERFACE(IFace, IId)
456#elif !defined(Q_MOC_RUN)
457# define Q_DECLARE_INTERFACE(IFace, IId)
458 template <> constexpr const char *qobject_interface_iid<IFace *>()
459 { return IId; }
460 template <> inline IFace *qobject_cast<IFace *>(QObject *object)
461 { return qobject_iid_cast<IFace>(object); }
462 template <> inline const IFace *qobject_cast<const IFace *>(const QObject *object)
463 { return qobject_iid_cast<const IFace>(object); }
464#endif // Q_MOC_RUN
465
466inline const QBindingStorage *qGetBindingStorage(const QObject *o)
467{
468 return o->bindingStorage();
469}
471{
472 return o->bindingStorage();
473}
474
475#ifndef QT_NO_DEBUG_STREAM
476Q_CORE_EXPORT QDebug operator<<(QDebug, const QObject *);
477#endif
478
480{
481public:
483 inline explicit QSignalBlocker(QObject *o) noexcept;
485 inline explicit QSignalBlocker(QObject &o) noexcept;
486 inline ~QSignalBlocker();
487
489 inline QSignalBlocker(QSignalBlocker &&other) noexcept;
490 inline QSignalBlocker &operator=(QSignalBlocker &&other) noexcept;
491
492 inline void reblock() noexcept;
493 inline void unblock() noexcept;
494 inline void dismiss() noexcept;
495
496private:
498 QObject *m_o;
499 bool m_blocked;
500 bool m_inhibited;
501};
502
503QSignalBlocker::QSignalBlocker(QObject *o) noexcept
504 : m_o(o),
505 m_blocked(o && o->blockSignals(true)),
506 m_inhibited(false)
507{}
508
509QSignalBlocker::QSignalBlocker(QObject &o) noexcept
510 : m_o(&o),
511 m_blocked(o.blockSignals(true)),
512 m_inhibited(false)
513{}
514
515QSignalBlocker::QSignalBlocker(QSignalBlocker &&other) noexcept
516 : m_o(other.m_o),
517 m_blocked(other.m_blocked),
518 m_inhibited(other.m_inhibited)
519{
520 other.m_o = nullptr;
521}
522
524{
525 if (this != &other) {
526 // if both *this and other block the same object's signals:
527 // unblock *this iff our dtor would unblock, but other's wouldn't
528 if (m_o != other.m_o || (!m_inhibited && other.m_inhibited))
529 unblock();
530 m_o = other.m_o;
531 m_blocked = other.m_blocked;
532 m_inhibited = other.m_inhibited;
533 // disable other:
534 other.m_o = nullptr;
535 }
536 return *this;
537}
538
540{
541 if (m_o && !m_inhibited)
542 m_o->blockSignals(m_blocked);
543}
544
545void QSignalBlocker::reblock() noexcept
546{
547 if (m_o)
548 m_o->blockSignals(true);
549 m_inhibited = false;
550}
551
552void QSignalBlocker::unblock() noexcept
553{
554 if (m_o)
555 m_o->blockSignals(m_blocked);
556 m_inhibited = true;
557}
558
559void QSignalBlocker::dismiss() noexcept
560{
561 m_o = nullptr;
562}
563
564namespace QtPrivate {
565 inline QObject & deref_for_methodcall(QObject &o) { return o; }
566 inline QObject & deref_for_methodcall(QObject *o) { return *o; }
567}
568#define Q_SET_OBJECT_NAME(obj) QT_PREPEND_NAMESPACE(QtPrivate)::deref_for_methodcall(obj).setObjectName(QLatin1StringView(#obj))
569
570QT_END_NAMESPACE
571
572#endif
573
574#endif // QOBJECT_H
QDynamicMetaObjectData * metaObject
Definition qobject.h:91
uint isDeletingChildren
Definition qobject.h:80
uint isWindow
Definition qobject.h:83
uint receiveChildEvents
Definition qobject.h:82
uint wasDeleted
Definition qobject.h:79
QObject * q_ptr
Definition qobject.h:73
uint deleteLaterCalled
Definition qobject.h:84
uint receiveParentEvents
Definition qobject.h:88
const QMetaObject * dynamicMetaObject() const
Definition qobject.cpp:159
uint unused
Definition qobject.h:89
uint isQuickItem
Definition qobject.h:85
uint isWidget
Definition qobject.h:77
uint sendChildEvents
Definition qobject.h:81
QAtomicInt postedEvents
Definition qobject.h:90
QObjectList children
Definition qobject.h:75
uint blockSig
Definition qobject.h:78
uint wasWidget
Definition qobject.h:87
uint willBeWidget
Definition qobject.h:86
QObject * parent
Definition qobject.h:74
QBindingStorage bindingStorage
Definition qobject.h:92
\inmodule QtCore
Definition qobject.h:106
friend class QWidget
Definition qpainter.h:432
Exception-safe wrapper around QObject::blockSignals().
Definition qobject.h:480
void dismiss() noexcept
Definition qobject.h:559
void unblock() noexcept
Temporarily restores the QObject::signalsBlocked() state to what it was before this QSignalBlocker's ...
Definition qobject.h:552
void reblock() noexcept
Re-blocks signals after a previous unblock().
Definition qobject.h:545
QSignalBlocker & operator=(QSignalBlocker &&other) noexcept
Move-assigns this signal blocker from other.
Definition qobject.h:523
~QSignalBlocker()
Destructor.
Definition qobject.h:539
Combined button and popup list for selecting options.
QObject & deref_for_methodcall(QObject *o)
Definition qobject.h:566
QObject & deref_for_methodcall(QObject &o)
Definition qobject.h:565
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2582
std::enable_if_t< std::is_const< T >::value, T * > qobject_iid_cast(const QObject *object)
Definition qobject.h:447
const QBindingStorage * qGetBindingStorage(const QObject *o)
Definition qobject.h:466
constexpr const char * qobject_interface_iid()=delete
Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, QAnyStringView name, const QMetaObject &mo, QList< void * > *list, Qt::FindChildOptions options)
Definition qobject.cpp:2204
T qobject_cast(QObject *object)
\variable QObject::staticMetaObject
Definition qobject.h:427
T * qobject_iid_cast(QObject *object, const char *IId=qobject_interface_iid< T * >())
Definition qobject.h:442
QList< QObject * > QObjectList
Definition qobject.h:46
Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, const QRegularExpression &re, const QMetaObject &mo, QList< void * > *list, Qt::FindChildOptions options)
T qobject_cast(const QObject *object)
Definition qobject.h:433
QBindingStorage * qGetBindingStorage(QObject *o)
Definition qobject.h:470
QT_BEGIN_NAMESPACE constexpr UINT KillProcessExitCode