46 #include <QtCore/qobjectdefs.h>
47 #include <QtCore/qstring.h>
48 #include <QtCore/qbytearray.h>
49 #include <QtCore/qlist.h>
50 #ifdef QT_INCLUDE_COMPAT
51 #include <QtCore/qcoreevent.h>
53 #include <QtCore/qscopedpointer.h>
54 #include <QtCore/qmetatype.h>
56 #include <QtCore/qobject_impl.h>
57 #include <QtCore/qbindingstorage.h>
59 #if __has_include(<chrono>)
77 #if QT_CONFIG(regularexpression)
120 enum { CheckForParentChildLoopsWarnDepth = 4096 };
129 BINDABLE bindableObjectName)
139 #if defined(QT_NO_TRANSLATION) || defined(Q_CLANG_QDOC)
140 static QString tr(
const char *sourceText,
const char * =
nullptr,
int = -1)
158 #if __has_include(<chrono>)
162 return startTimer(
int(
time.count()), timerType);
165 void killTimer(
int id);
194 #if QT_CONFIG(regularexpression)
223 template<
typename Po
interToMemberFunction>
225 template<
typename Po
interToMemberFunction,
typename Functor>
227 template<
typename Po
interToMemberFunction,
typename Functor>
231 template <
typename Func1,
typename Func2>
240 "No Q_OBJECT in the class with the signal");
243 static_assert(
int(SignalType::ArgumentCount) >=
int(SlotType::ArgumentCount),
244 "The slot requires more arguments than the signal provides.");
246 "Signal and slot arguments are not compatible.");
248 "Return type of the slot is not compatible with the return type of the signal.");
250 const int *
types =
nullptr;
254 return connectImpl(sender,
reinterpret_cast<void **
>(&
signal),
255 receiver,
reinterpret_cast<void **
>(&slot),
257 typename SignalType::ReturnType>(slot),
258 type,
types, &SignalType::Object::staticMetaObject);
262 template <
typename Func1,
typename Func2>
270 template <
typename Func1,
typename Func2>
280 "No Q_OBJECT in the class with the signal");
283 static_assert(
int(SignalType::ArgumentCount) >=
int(SlotType::ArgumentCount),
284 "The slot requires more arguments than the signal provides.");
286 "Signal and slot arguments are not compatible.");
288 "Return type of the slot is not compatible with the return type of the signal.");
290 const int *
types =
nullptr;
294 return connectImpl(sender,
reinterpret_cast<void **
>(&
signal),
context,
nullptr,
297 typename SignalType::ReturnType>(slot),
298 type,
types, &SignalType::Object::staticMetaObject);
302 template <
typename Func1,
typename Func2>
303 static inline typename std::enable_if<
305 !std::is_convertible_v<Func2, const char*>,
313 template <
typename Func1,
typename Func2>
314 static inline typename std::enable_if<
316 !std::is_convertible_v<Func2, const char*>,
324 static_assert((FunctorArgumentCount >= 0),
325 "Signal and slot arguments are not compatible.");
326 const int SlotArgumentCount = (FunctorArgumentCount >= 0) ? FunctorArgumentCount : 0;
330 "Return type of the slot is not compatible with the return type of the signal.");
333 "No Q_OBJECT in the class with the signal");
335 const int *
types =
nullptr;
339 return connectImpl(sender,
reinterpret_cast<void **
>(&
signal),
context,
nullptr,
342 typename SignalType::ReturnType>(std::move(slot)),
343 type,
types, &SignalType::Object::staticMetaObject);
348 const QObject *receiver,
const char *member);
352 const QObject *receiver =
nullptr,
const char *member =
nullptr)
const
355 {
return disconnect(
this,
nullptr, receiver, member); }
359 template<
typename Po
interToMemberFunction>
362 template <
typename Func1,
typename Func2>
370 "No Q_OBJECT in the class with the signal");
374 "Signal and slot arguments are not compatible.");
376 return disconnectImpl(sender,
reinterpret_cast<void **
>(&
signal), receiver,
reinterpret_cast<void **
>(&slot),
377 &SignalType::Object::staticMetaObject);
379 template <
typename Func1>
388 return disconnectImpl(sender,
reinterpret_cast<void **
>(&
signal), receiver,
zero,
389 &SignalType::Object::staticMetaObject);
393 void dumpObjectTree()
const;
394 void dumpObjectInfo()
const;
396 #ifndef QT_NO_PROPERTIES
413 return const_cast<QObject *
>(
this)->qt_metacast(classname) !=
nullptr;
421 int senderSignalIndex()
const;
422 int receivers(
const char *
signal)
const;
455 const QObject *receiver,
void **slotPtr,
459 static bool disconnectImpl(
const QObject *sender,
void **
signal,
const QObject *receiver,
void **slot,
466 {
return connect(asender, asignal,
this, amember, atype); }
473 "qobject_cast requires the type to have a Q_OBJECT macro");
474 return static_cast<T>(ObjType::staticMetaObject.cast(
object));
482 "qobject_cast requires the type to have a Q_OBJECT macro");
483 return static_cast<T>(ObjType::staticMetaObject.cast(
object));
488 template <
class T>
inline T *
491 return reinterpret_cast<T *
>((
object ?
object->qt_metacast(IId) :
nullptr));
498 return qobject_iid_cast<std::remove_cv_t<T>>(
o);
501 #if defined(Q_CLANG_QDOC)
502 # define Q_DECLARE_INTERFACE(IFace, IId)
503 #elif !defined(Q_MOC_RUN)
504 # define Q_DECLARE_INTERFACE(IFace, IId) \
505 template <> constexpr const char *qobject_interface_iid<IFace *>() \
507 template <> inline IFace *qobject_cast<IFace *>(QObject *object) \
508 { return qobject_iid_cast<IFace>(object); } \
509 template <> inline const IFace *qobject_cast<const IFace *>(const QObject *object) \
510 { return qobject_iid_cast<const IFace>(object); }
515 return o->bindingStorage();
519 return o->bindingStorage();
522 #ifndef QT_NO_DEBUG_STREAM
536 inline void reblock() noexcept;
537 inline void unblock() noexcept;
548 m_blocked(
o &&
o->blockSignals(
true)),
554 m_blocked(
o.blockSignals(
true)),
560 m_blocked(
other.m_blocked),
561 m_inhibited(
other.m_inhibited)
568 if (
this != &
other) {
571 if (m_o !=
other.m_o || (!m_inhibited &&
other.m_inhibited))
574 m_blocked =
other.m_blocked;
575 m_inhibited =
other.m_inhibited;
584 if (m_o && !m_inhibited)
606 #define Q_SET_OBJECT_NAME(obj) QT_PREPEND_NAMESPACE(QtPrivate)::deref_for_methodcall(obj).setObjectName(QLatin1String(#obj))
The QApplication class manages the GUI application's control flow and main settings.
QBindable is a wrapper class around binding-enabled properties. It allows type-safe operations while ...
The QChildEvent class contains event parameters for child object events.
The QCoreApplication class provides an event loop for Qt applications without UI.
operator<<(QDataStream &ds, qfloat16 f)
The QDebug class provides an output stream for debugging information.
The QEvent class is the base class of all event classes. Event objects contain event parameters.
QDynamicMetaObjectData * metaObject
QBindingStorage bindingStorage
The QObject class is the base class of all Qt objects.
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 ::type connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *context, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
T findChild(const QString &aName=QString(), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
const QObjectList & children() const
bool isWindowType() const
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
QList< T > findChildren(Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
static QMetaObject::Connection ::type connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 slot)
QBindingStorage * bindingStorage()
const QBindingStorage * bindingStorage() const
static QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
QList< T > findChildren(const QString &aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
bool signalsBlocked() const noexcept
template< class T > T qobject_cast(const QObject *object)
QScopedPointer< QObjectData > d_ptr
bool blockSignals(bool b) noexcept
static bool disconnect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot)
static std::enable_if< QtPrivate::FunctionPointer< Func2 >::ArgumentCount==-1 &&!std::is_convertible_v< Func2, const char * >, QMetaObject::Connection >::type connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 slot)
bool disconnect(const QObject *receiver, const char *member=nullptr) const
bool inherits(const char *classname) const
void objectNameChanged(const QString &objectName, QPrivateSignal)
void destroyed(QObject *=nullptr)
static std::enable_if< QtPrivate::FunctionPointer< Func2 >::ArgumentCount==-1 &&!std::is_convertible_v< Func2, const char * >, QMetaObject::Connection >::type connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *context, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
bool isWidgetType() const
The QRegularExpression class provides pattern matching using regular expressions.
Exception-safe wrapper around QObject::blockSignals().
QSignalBlocker & operator=(QSignalBlocker &&other) noexcept
QSignalBlocker(QObject *o) noexcept
The QString class provides a Unicode character string.
static QString fromUtf8(QByteArrayView utf8)
The QTimerEvent class contains parameters that describe a timer event.
The QVariant class acts like a union for the most common Qt data types.
object setProperty("down", true)
object setObjectName("A new object name")
auto it unsigned count const
@ FindChildrenRecursively
@ BlockingQueuedConnection
QObject & deref_for_methodcall(QObject &o)
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
#define Q_DISABLE_COPY(Class)
Q_CORE_EXPORT QObject * qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo, Qt::FindChildOptions options)
Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, const QString &name, const QMetaObject &mo, QList< void * > *list, Qt::FindChildOptions options)
T * qobject_iid_cast(QObject *object, const char *IId=qobject_interface_iid< T * >())
constexpr const char * qobject_interface_iid()=delete
const QBindingStorage * qGetBindingStorage(const QObject *o)
GLboolean GLboolean GLboolean b
GLsizei GLenum GLenum * types
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)
monitoredObj installEventFilter(filterObj)
[13]
myObject moveToThread(QApplication::instance() ->thread())
[6]
myObject disconnect()
[26]
someQObject blockSignals(wasBlocked)
file setParent(multiPart)
static const int * types()
List_Append< List< typename L::Car >, typename List_Left< typename L::Cdr, N - 1 >::Value >::Value Value
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent