diff options
Diffstat (limited to 'src/corelib/kernel/qobject.cpp')
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 79 |
1 files changed, 75 insertions, 4 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index c235260f1b..e901d8cefa 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -4248,7 +4248,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) This macro registers an enum type with the meta-object system. It must be placed after the enum declaration in a class that has the Q_OBJECT or the - Q_GADGET macro. + Q_GADGET macro. For namespaces use \l Q_ENUM_NS instead. For example: @@ -4275,7 +4275,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) This macro registers a single \l{QFlags}{flags type} with the meta-object system. It is typically used in a class definition to declare that values of a given enum can be used as flags and combined using the - bitwise OR operator. + bitwise OR operator. For namespaces use \l Q_FLAG_NS instead. The macro must be placed after the enum declaration. @@ -4294,6 +4294,48 @@ QDebug operator<<(QDebug dbg, const QObject *o) \sa {Qt's Property System} */ +/*! + \macro Q_ENUM_NS(...) + \since 5.8 + + This macro registers an enum type with the meta-object system. + It must be placed after the enum declaration in a namespace that + has the Q_NAMESPACE macro. It is the same as \l Q_ENUM but in a + namespace. + + Enumerations that are declared with Q_ENUM_NS have their QMetaEnum + registered in the enclosing QMetaObject. You can also use + QMetaEnum::fromType() to get the QMetaEnum. + + Registered enumerations are automatically registered also to the Qt meta + type system, making them known to QMetaType without the need to use + Q_DECLARE_METATYPE(). This will enable useful features; for example, if + used in a QVariant, you can convert them to strings. Likewise, passing them + to QDebug will print out their names. + + \sa {Qt's Property System} +*/ + + +/*! + \macro Q_FLAG_NS(...) + \since 5.8 + + This macro registers a single \l{QFlags}{flags type} with the + meta-object system. It is used in a namespace that has the + Q_NAMESPACE macro, to declare that values of a given enum can be + used as flags and combined using the bitwise OR operator. + It is the same as \l Q_FLAG but in a namespace. + + The macro must be placed after the enum declaration. + + \note The Q_FLAG_NS macro takes care of registering individual flag + values with the meta-object system, so it is unnecessary to use + Q_ENUM_NS() in addition to this macro. + + \sa {Qt's Property System} +*/ + /*! \macro Q_OBJECT @@ -4335,6 +4377,21 @@ QDebug operator<<(QDebug dbg, const QObject *o) */ /*! + \macro Q_NAMESPACE + \since 5.8 + + The Q_NAMESPACE macro can be used to add QMetaObject capabilities + to a namespace. + + Q_NAMESPACEs can have Q_CLASSINFO, Q_ENUM_NS, Q_FLAG_NS, but they + cannot have Q_ENUM, Q_FLAG, Q_PROPERTY, Q_INVOKABLE, signals nor slots. + + Q_NAMESPACE makes an external variable, \c{staticMetaObject}, available. + \c{staticMetaObject} is of type QMetaObject and provides access to the + enums declared with Q_ENUM_NS/Q_FLAG_NS. +*/ + +/*! \macro Q_SIGNALS \relates QObject @@ -4471,6 +4528,19 @@ QDebug operator<<(QDebug dbg, const QObject *o) */ /*! + \macro QT_NO_NARROWING_CONVERSIONS_IN_CONNECT + \relates QObject + \since 5.8 + + Defining this macro will disable narrowing and floating-point-to-integral + conversions between the arguments carried by a signal and the arguments + accepted by a slot, when the signal and the slot are connected using the + PMF-based syntax. + + \sa QObject::connect +*/ + +/*! \typedef QObjectList \relates QObject @@ -4776,11 +4846,12 @@ bool QObject::disconnect(const QMetaObject::Connection &connection) c->isSlotObject = false; } + c->sender->disconnectNotify(QMetaObjectPrivate::signal(c->sender->metaObject(), + c->signal_index)); + const_cast<QMetaObject::Connection &>(connection).d_ptr = 0; c->deref(); // has been removed from the QMetaObject::Connection object - // disconnectNotify() not called (the signal index is unknown). - return true; } |