Warning, file /include/QtCore/qobject.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005 #ifndef QOBJECT_H
0006 #define QOBJECT_H
0007
0008 #ifndef QT_NO_QOBJECT
0009
0010 #include <QtCore/qobjectdefs.h>
0011 #include <QtCore/qstring.h>
0012 #include <QtCore/qbytearray.h>
0013 #include <QtCore/qlist.h>
0014 #ifdef QT_INCLUDE_COMPAT
0015 #include <QtCore/qcoreevent.h>
0016 #endif
0017 #include <QtCore/qscopedpointer.h>
0018 #include <QtCore/qmetatype.h>
0019
0020 #include <QtCore/qobject_impl.h>
0021 #include <QtCore/qbindingstorage.h>
0022
0023 #include <chrono>
0024
0025 QT_BEGIN_NAMESPACE
0026
0027
0028 template <typename T> class QBindable;
0029 class QEvent;
0030 class QTimerEvent;
0031 class QChildEvent;
0032 struct QMetaObject;
0033 class QVariant;
0034 class QObjectPrivate;
0035 class QObject;
0036 class QThread;
0037 class QWidget;
0038 class QAccessibleWidget;
0039 #if QT_CONFIG(regularexpression)
0040 class QRegularExpression;
0041 #endif
0042 struct QDynamicMetaObjectData;
0043
0044 typedef QList<QObject*> QObjectList;
0045
0046 #if QT_CORE_REMOVED_SINCE(6, 7)
0047 Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, const QString &name,
0048 const QMetaObject &mo, QList<void *> *list, Qt::FindChildOptions options);
0049 #endif
0050 Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, QAnyStringView name,
0051 const QMetaObject &mo, QList<void *> *list,
0052 Qt::FindChildOptions options);
0053 #if QT_CORE_REMOVED_SINCE(6, 7)
0054 Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, const QMetaObject &mo,
0055 QList<void *> *list, Qt::FindChildOptions options);
0056 #endif
0057 Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, const QRegularExpression &re,
0058 const QMetaObject &mo, QList<void *> *list, Qt::FindChildOptions options);
0059 #if QT_CORE_REMOVED_SINCE(6, 7)
0060 Q_CORE_EXPORT QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo, Qt::FindChildOptions options);
0061 #endif
0062 Q_CORE_EXPORT QObject *qt_qFindChild_helper(const QObject *parent, QAnyStringView name,
0063 const QMetaObject &mo, Qt::FindChildOptions options);
0064
0065 class Q_CORE_EXPORT QObjectData
0066 {
0067 Q_DISABLE_COPY(QObjectData)
0068 public:
0069 QObjectData() = default;
0070 virtual ~QObjectData() = 0;
0071 QObject *q_ptr;
0072 QObject *parent;
0073 QObjectList children;
0074
0075 uint isWidget : 1;
0076 uint blockSig : 1;
0077 uint wasDeleted : 1;
0078 uint isDeletingChildren : 1;
0079 uint sendChildEvents : 1;
0080 uint receiveChildEvents : 1;
0081 uint isWindow : 1;
0082 uint deleteLaterCalled : 1;
0083 uint isQuickItem : 1;
0084 uint willBeWidget : 1;
0085 uint wasWidget : 1;
0086 uint receiveParentEvents: 1;
0087 uint unused : 20;
0088 QAtomicInt postedEvents;
0089 QDynamicMetaObjectData *metaObject;
0090 QBindingStorage bindingStorage;
0091
0092
0093
0094 QMetaObject *dynamicMetaObject() const;
0095
0096 #ifdef QT_DEBUG
0097 enum { CheckForParentChildLoopsWarnDepth = 4096 };
0098 #endif
0099 };
0100
0101 class Q_CORE_EXPORT QObject
0102 {
0103 Q_OBJECT
0104
0105 Q_PROPERTY(QString objectName READ objectName WRITE setObjectName NOTIFY objectNameChanged
0106 BINDABLE bindableObjectName)
0107 Q_DECLARE_PRIVATE(QObject)
0108
0109 public:
0110 Q_INVOKABLE explicit QObject(QObject *parent = nullptr);
0111 virtual ~QObject();
0112
0113 virtual bool event(QEvent *event);
0114 virtual bool eventFilter(QObject *watched, QEvent *event);
0115
0116 #if defined(QT_NO_TRANSLATION) || defined(Q_QDOC)
0117 static QString tr(const char *sourceText, const char * = nullptr, int = -1)
0118 { return QString::fromUtf8(sourceText); }
0119 #endif
0120
0121 QString objectName() const;
0122 #if QT_CORE_REMOVED_SINCE(6, 4)
0123 void setObjectName(const QString &name);
0124 #endif
0125 Q_WEAK_OVERLOAD
0126 void setObjectName(const QString &name) { doSetObjectName(name); }
0127 void setObjectName(QAnyStringView name);
0128 QBindable<QString> bindableObjectName();
0129
0130 inline bool isWidgetType() const { return d_ptr->isWidget; }
0131 inline bool isWindowType() const { return d_ptr->isWindow; }
0132 inline bool isQuickItemType() const { return d_ptr->isQuickItem; }
0133
0134 inline bool signalsBlocked() const noexcept { return d_ptr->blockSig; }
0135 bool blockSignals(bool b) noexcept;
0136
0137 QThread *thread() const;
0138 #if QT_CORE_REMOVED_SINCE(6, 7)
0139 void moveToThread(QThread *thread);
0140 #endif
0141 bool moveToThread(QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL);
0142
0143 int startTimer(int interval, Qt::TimerType timerType = Qt::CoarseTimer);
0144 int startTimer(std::chrono::milliseconds time, Qt::TimerType timerType = Qt::CoarseTimer);
0145 void killTimer(int id);
0146
0147 template<typename T>
0148 T findChild(QAnyStringView aName, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const
0149 {
0150 typedef typename std::remove_cv<typename std::remove_pointer<T>::type>::type ObjType;
0151 static_assert(QtPrivate::HasQ_OBJECT_Macro<ObjType>::Value,
0152 "No Q_OBJECT in the class passed to QObject::findChild");
0153 return static_cast<T>(qt_qFindChild_helper(this, aName, ObjType::staticMetaObject, options));
0154 }
0155
0156 template<typename T>
0157 QList<T> findChildren(QAnyStringView aName, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const
0158 {
0159 typedef typename std::remove_cv<typename std::remove_pointer<T>::type>::type ObjType;
0160 static_assert(QtPrivate::HasQ_OBJECT_Macro<ObjType>::Value,
0161 "No Q_OBJECT in the class passed to QObject::findChildren");
0162 QList<T> list;
0163 qt_qFindChildren_helper(this, aName, ObjType::staticMetaObject,
0164 reinterpret_cast<QList<void *> *>(&list), options);
0165 return list;
0166 }
0167
0168 template<typename T>
0169 T findChild(Qt::FindChildOptions options = Qt::FindChildrenRecursively) const
0170 {
0171 return findChild<T>({}, options);
0172 }
0173
0174 template<typename T>
0175 QList<T> findChildren(Qt::FindChildOptions options = Qt::FindChildrenRecursively) const
0176 {
0177 return findChildren<T>(QAnyStringView{}, options);
0178 }
0179
0180 #if QT_CONFIG(regularexpression)
0181 template<typename T>
0182 inline QList<T> findChildren(const QRegularExpression &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const
0183 {
0184 typedef typename std::remove_cv<typename std::remove_pointer<T>::type>::type ObjType;
0185 static_assert(QtPrivate::HasQ_OBJECT_Macro<ObjType>::Value,
0186 "No Q_OBJECT in the class passed to QObject::findChildren");
0187 QList<T> list;
0188 qt_qFindChildren_helper(this, re, ObjType::staticMetaObject,
0189 reinterpret_cast<QList<void *> *>(&list), options);
0190 return list;
0191 }
0192 #endif
0193
0194 inline const QObjectList &children() const { return d_ptr->children; }
0195
0196 void setParent(QObject *parent);
0197 void installEventFilter(QObject *filterObj);
0198 void removeEventFilter(QObject *obj);
0199
0200 static QMetaObject::Connection connect(const QObject *sender, const char *signal,
0201 const QObject *receiver, const char *member, Qt::ConnectionType = Qt::AutoConnection);
0202
0203 static QMetaObject::Connection connect(const QObject *sender, const QMetaMethod &signal,
0204 const QObject *receiver, const QMetaMethod &method,
0205 Qt::ConnectionType type = Qt::AutoConnection);
0206
0207 inline QMetaObject::Connection connect(const QObject *sender, const char *signal,
0208 const char *member, Qt::ConnectionType type = Qt::AutoConnection) const;
0209
0210 #ifdef Q_QDOC
0211 template<typename PointerToMemberFunction>
0212 static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type = Qt::AutoConnection);
0213 template<typename PointerToMemberFunction, typename Functor>
0214 static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor);
0215 template<typename PointerToMemberFunction, typename Functor>
0216 static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type = Qt::AutoConnection);
0217 #else
0218
0219 template <typename Func1, typename Func2>
0220 static inline QMetaObject::Connection
0221 connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal,
0222 const typename QtPrivate::ContextTypeForFunctor<Func2>::ContextType *context, Func2 &&slot,
0223 Qt::ConnectionType type = Qt::AutoConnection)
0224 {
0225 typedef QtPrivate::FunctionPointer<Func1> SignalType;
0226 typedef QtPrivate::FunctionPointer<std::decay_t<Func2>> SlotType;
0227
0228 if constexpr (SlotType::ArgumentCount != -1) {
0229 static_assert((QtPrivate::AreArgumentsCompatible<typename SlotType::ReturnType, typename SignalType::ReturnType>::value),
0230 "Return type of the slot is not compatible with the return type of the signal.");
0231 } else {
0232 constexpr int FunctorArgumentCount = QtPrivate::ComputeFunctorArgumentCount<std::decay_t<Func2>, typename SignalType::Arguments>::Value;
0233 [[maybe_unused]]
0234 constexpr int SlotArgumentCount = (FunctorArgumentCount >= 0) ? FunctorArgumentCount : 0;
0235 typedef typename QtPrivate::FunctorReturnType<std::decay_t<Func2>, typename QtPrivate::List_Left<typename SignalType::Arguments, SlotArgumentCount>::Value>::Value SlotReturnType;
0236
0237 static_assert((QtPrivate::AreArgumentsCompatible<SlotReturnType, typename SignalType::ReturnType>::value),
0238 "Return type of the slot is not compatible with the return type of the signal.");
0239 }
0240
0241 static_assert(QtPrivate::HasQ_OBJECT_Macro<typename SignalType::Object>::Value,
0242 "No Q_OBJECT in the class with the signal");
0243
0244
0245 static_assert(int(SignalType::ArgumentCount) >= int(SlotType::ArgumentCount),
0246 "The slot requires more arguments than the signal provides.");
0247
0248 const int *types = nullptr;
0249 if (type == Qt::QueuedConnection || type == Qt::BlockingQueuedConnection)
0250 types = QtPrivate::ConnectionTypes<typename SignalType::Arguments>::types();
0251
0252 void **pSlot = nullptr;
0253 if constexpr (std::is_member_function_pointer_v<std::decay_t<Func2>>) {
0254 pSlot = const_cast<void **>(reinterpret_cast<void *const *>(&slot));
0255 } else {
0256 Q_ASSERT_X((type & Qt::UniqueConnection) == 0, "",
0257 "QObject::connect: Unique connection requires the slot to be a pointer to "
0258 "a member function of a QObject subclass.");
0259 }
0260
0261 return connectImpl(sender, reinterpret_cast<void **>(&signal), context, pSlot,
0262 QtPrivate::makeCallableObject<Func1>(std::forward<Func2>(slot)),
0263 type, types, &SignalType::Object::staticMetaObject);
0264 }
0265
0266 #ifndef QT_NO_CONTEXTLESS_CONNECT
0267
0268 template <typename Func1, typename Func2>
0269 static inline QMetaObject::Connection
0270 connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, Func2 &&slot)
0271 {
0272 return connect(sender, signal, sender, std::forward<Func2>(slot), Qt::DirectConnection);
0273 }
0274 #endif
0275 #endif
0276
0277 static bool disconnect(const QObject *sender, const char *signal,
0278 const QObject *receiver, const char *member);
0279 static bool disconnect(const QObject *sender, const QMetaMethod &signal,
0280 const QObject *receiver, const QMetaMethod &member);
0281 inline bool disconnect(const char *signal = nullptr,
0282 const QObject *receiver = nullptr, const char *member = nullptr) const
0283 { return disconnect(this, signal, receiver, member); }
0284 inline bool disconnect(const QObject *receiver, const char *member = nullptr) const
0285 { return disconnect(this, nullptr, receiver, member); }
0286 static bool disconnect(const QMetaObject::Connection &);
0287
0288 #ifdef Q_QDOC
0289 template<typename PointerToMemberFunction>
0290 static bool disconnect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method);
0291 #else
0292 template <typename Func1, typename Func2>
0293 static inline bool disconnect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal,
0294 const typename QtPrivate::FunctionPointer<Func2>::Object *receiver, Func2 slot)
0295 {
0296 typedef QtPrivate::FunctionPointer<Func1> SignalType;
0297 typedef QtPrivate::FunctionPointer<Func2> SlotType;
0298
0299 static_assert(QtPrivate::HasQ_OBJECT_Macro<typename SignalType::Object>::Value,
0300 "No Q_OBJECT in the class with the signal");
0301
0302
0303 static_assert((QtPrivate::CheckCompatibleArguments<typename SignalType::Arguments, typename SlotType::Arguments>::value),
0304 "Signal and slot arguments are not compatible.");
0305
0306 return disconnectImpl(sender, reinterpret_cast<void **>(&signal), receiver, reinterpret_cast<void **>(&slot),
0307 &SignalType::Object::staticMetaObject);
0308 }
0309 template <typename Func1>
0310 static inline bool disconnect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal,
0311 const QObject *receiver, void **zero)
0312 {
0313
0314
0315
0316 Q_ASSERT(!zero);
0317 typedef QtPrivate::FunctionPointer<Func1> SignalType;
0318 return disconnectImpl(sender, reinterpret_cast<void **>(&signal), receiver, zero,
0319 &SignalType::Object::staticMetaObject);
0320 }
0321 #endif
0322
0323 void dumpObjectTree() const;
0324 void dumpObjectInfo() const;
0325
0326 QT_CORE_INLINE_SINCE(6, 6)
0327 bool setProperty(const char *name, const QVariant &value);
0328 inline bool setProperty(const char *name, QVariant &&value);
0329 QVariant property(const char *name) const;
0330 QList<QByteArray> dynamicPropertyNames() const;
0331 QBindingStorage *bindingStorage() { return &d_ptr->bindingStorage; }
0332 const QBindingStorage *bindingStorage() const { return &d_ptr->bindingStorage; }
0333
0334 Q_SIGNALS:
0335 void destroyed(QObject * = nullptr);
0336 void objectNameChanged(const QString &objectName, QPrivateSignal);
0337
0338 public:
0339 inline QObject *parent() const { return d_ptr->parent; }
0340
0341 inline bool inherits(const char *classname) const
0342 {
0343 return const_cast<QObject *>(this)->qt_metacast(classname) != nullptr;
0344 }
0345
0346 public Q_SLOTS:
0347 void deleteLater();
0348
0349 protected:
0350 QObject *sender() const;
0351 int senderSignalIndex() const;
0352 int receivers(const char *signal) const;
0353 bool isSignalConnected(const QMetaMethod &signal) const;
0354
0355 virtual void timerEvent(QTimerEvent *event);
0356 virtual void childEvent(QChildEvent *event);
0357 virtual void customEvent(QEvent *event);
0358
0359 virtual void connectNotify(const QMetaMethod &signal);
0360 virtual void disconnectNotify(const QMetaMethod &signal);
0361
0362 protected:
0363 QObject(QObjectPrivate &dd, QObject *parent = nullptr);
0364
0365 protected:
0366 QScopedPointer<QObjectData> d_ptr;
0367
0368 friend struct QMetaObject;
0369 friend struct QMetaObjectPrivate;
0370 friend class QMetaCallEvent;
0371 friend class QApplication;
0372 friend class QApplicationPrivate;
0373 friend class QCoreApplication;
0374 friend class QCoreApplicationPrivate;
0375 friend class QWidget;
0376 friend class QAccessibleWidget;
0377 friend class QThreadData;
0378
0379 private:
0380 void doSetObjectName(const QString &name);
0381 bool doSetProperty(const char *name, const QVariant *lvalue, QVariant *rvalue);
0382
0383 Q_DISABLE_COPY(QObject)
0384
0385 private:
0386 static QMetaObject::Connection connectImpl(const QObject *sender, void **signal,
0387 const QObject *receiver, void **slotPtr,
0388 QtPrivate::QSlotObjectBase *slot, Qt::ConnectionType type,
0389 const int *types, const QMetaObject *senderMetaObject);
0390
0391 static bool disconnectImpl(const QObject *sender, void **signal, const QObject *receiver, void **slot,
0392 const QMetaObject *senderMetaObject);
0393
0394 };
0395
0396 inline QMetaObject::Connection QObject::connect(const QObject *asender, const char *asignal,
0397 const char *amember, Qt::ConnectionType atype) const
0398 { return connect(asender, asignal, this, amember, atype); }
0399
0400 #if QT_CORE_INLINE_IMPL_SINCE(6, 6)
0401 bool QObject::setProperty(const char *name, const QVariant &value)
0402 {
0403 return doSetProperty(name, &value, nullptr);
0404 }
0405 #endif
0406 bool QObject::setProperty(const char *name, QVariant &&value)
0407 {
0408 return doSetProperty(name, &value, &value);
0409 }
0410
0411 template <class T>
0412 inline T qobject_cast(QObject *object)
0413 {
0414 static_assert(std::is_pointer_v<T>,
0415 "qobject_cast requires to cast towards a pointer type");
0416 typedef typename std::remove_cv<typename std::remove_pointer<T>::type>::type ObjType;
0417 static_assert(QtPrivate::HasQ_OBJECT_Macro<ObjType>::Value,
0418 "qobject_cast requires the type to have a Q_OBJECT macro");
0419 return static_cast<T>(ObjType::staticMetaObject.cast(object));
0420 }
0421
0422 template <class T>
0423 inline T qobject_cast(const QObject *object)
0424 {
0425 static_assert(std::is_pointer_v<T>,
0426 "qobject_cast requires to cast towards a pointer type");
0427 static_assert(std::is_const_v<std::remove_pointer_t<T>>,
0428 "qobject_cast cannot cast away constness (use const_cast)");
0429 typedef typename std::remove_cv<typename std::remove_pointer<T>::type>::type ObjType;
0430 static_assert(QtPrivate::HasQ_OBJECT_Macro<ObjType>::Value,
0431 "qobject_cast requires the type to have a Q_OBJECT macro");
0432 return static_cast<T>(ObjType::staticMetaObject.cast(object));
0433 }
0434
0435
0436 template <class T> constexpr const char * qobject_interface_iid() = delete;
0437 template <class T> inline T *
0438 qobject_iid_cast(QObject *object, const char *IId = qobject_interface_iid<T *>())
0439 {
0440 return reinterpret_cast<T *>((object ? object->qt_metacast(IId) : nullptr));
0441 }
0442 template <class T> inline std::enable_if_t<std::is_const<T>::value, T *>
0443 qobject_iid_cast(const QObject *object)
0444 {
0445
0446 QObject *o = const_cast<QObject *>(object);
0447 return qobject_iid_cast<std::remove_cv_t<T>>(o);
0448 }
0449
0450 #if defined(Q_QDOC)
0451 # define Q_DECLARE_INTERFACE(IFace, IId)
0452 #elif !defined(Q_MOC_RUN)
0453 # define Q_DECLARE_INTERFACE(IFace, IId) \
0454 template <> constexpr const char *qobject_interface_iid<IFace *>() \
0455 { return IId; } \
0456 template <> inline IFace *qobject_cast<IFace *>(QObject *object) \
0457 { return qobject_iid_cast<IFace>(object); } \
0458 template <> inline const IFace *qobject_cast<const IFace *>(const QObject *object) \
0459 { return qobject_iid_cast<const IFace>(object); }
0460 #endif
0461
0462 inline const QBindingStorage *qGetBindingStorage(const QObject *o)
0463 {
0464 return o->bindingStorage();
0465 }
0466 inline QBindingStorage *qGetBindingStorage(QObject *o)
0467 {
0468 return o->bindingStorage();
0469 }
0470
0471 #ifndef QT_NO_DEBUG_STREAM
0472 Q_CORE_EXPORT QDebug operator<<(QDebug, const QObject *);
0473 #endif
0474
0475 class QSignalBlocker
0476 {
0477 public:
0478 Q_NODISCARD_CTOR
0479 inline explicit QSignalBlocker(QObject *o) noexcept;
0480 Q_NODISCARD_CTOR
0481 inline explicit QSignalBlocker(QObject &o) noexcept;
0482 inline ~QSignalBlocker();
0483
0484 Q_NODISCARD_CTOR
0485 inline QSignalBlocker(QSignalBlocker &&other) noexcept;
0486 inline QSignalBlocker &operator=(QSignalBlocker &&other) noexcept;
0487
0488 inline void reblock() noexcept;
0489 inline void unblock() noexcept;
0490 inline void dismiss() noexcept;
0491
0492 private:
0493 Q_DISABLE_COPY(QSignalBlocker)
0494 QObject *m_o;
0495 bool m_blocked;
0496 bool m_inhibited;
0497 };
0498
0499 QSignalBlocker::QSignalBlocker(QObject *o) noexcept
0500 : m_o(o),
0501 m_blocked(o && o->blockSignals(true)),
0502 m_inhibited(false)
0503 {}
0504
0505 QSignalBlocker::QSignalBlocker(QObject &o) noexcept
0506 : m_o(&o),
0507 m_blocked(o.blockSignals(true)),
0508 m_inhibited(false)
0509 {}
0510
0511 QSignalBlocker::QSignalBlocker(QSignalBlocker &&other) noexcept
0512 : m_o(other.m_o),
0513 m_blocked(other.m_blocked),
0514 m_inhibited(other.m_inhibited)
0515 {
0516 other.m_o = nullptr;
0517 }
0518
0519 QSignalBlocker &QSignalBlocker::operator=(QSignalBlocker &&other) noexcept
0520 {
0521 if (this != &other) {
0522
0523
0524 if (m_o != other.m_o || (!m_inhibited && other.m_inhibited))
0525 unblock();
0526 m_o = other.m_o;
0527 m_blocked = other.m_blocked;
0528 m_inhibited = other.m_inhibited;
0529
0530 other.m_o = nullptr;
0531 }
0532 return *this;
0533 }
0534
0535 QSignalBlocker::~QSignalBlocker()
0536 {
0537 if (m_o && !m_inhibited)
0538 m_o->blockSignals(m_blocked);
0539 }
0540
0541 void QSignalBlocker::reblock() noexcept
0542 {
0543 if (m_o)
0544 m_o->blockSignals(true);
0545 m_inhibited = false;
0546 }
0547
0548 void QSignalBlocker::unblock() noexcept
0549 {
0550 if (m_o)
0551 m_o->blockSignals(m_blocked);
0552 m_inhibited = true;
0553 }
0554
0555 void QSignalBlocker::dismiss() noexcept
0556 {
0557 m_o = nullptr;
0558 }
0559
0560 namespace QtPrivate {
0561 inline QObject & deref_for_methodcall(QObject &o) { return o; }
0562 inline QObject & deref_for_methodcall(QObject *o) { return *o; }
0563 }
0564 #define Q_SET_OBJECT_NAME(obj) QT_PREPEND_NAMESPACE(QtPrivate)::deref_for_methodcall(obj).setObjectName(QLatin1StringView(#obj))
0565
0566 QT_END_NAMESPACE
0567
0568 #endif
0569
0570 #endif