summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/kernel/qobject.cpp')
-rw-r--r--src/corelib/kernel/qobject.cpp54
1 files changed, 29 insertions, 25 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index cf838b6947..15955e1665 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -1763,7 +1763,7 @@ void QObject::killTimer(int id)
\fn template<typename T> T *QObject::findChild(const QString &name, Qt::FindChildOptions options) const
Returns the child of this object that can be cast into type T and
- that is called \a name, or 0 if there is no such object.
+ that is called \a name, or \nullptr if there is no such object.
Omitting the \a name argument causes all object names to be matched.
The search is performed recursively, unless \a options specifies the
option FindDirectChildrenOnly.
@@ -1824,12 +1824,15 @@ void QObject::killTimer(int id)
/*!
\fn template<typename T> QList<T> QObject::findChildren(const QRegExp &regExp, Qt::FindChildOptions options) const
\overload findChildren()
+ \obsolete
Returns the children of this object that can be cast to type T
and that have names matching the regular expression \a regExp,
or an empty list if there are no such objects.
The search is performed recursively, unless \a options specifies the
option FindDirectChildrenOnly.
+
+ Use the findChildren overload taking a QRegularExpression instead.
*/
/*!
@@ -2148,7 +2151,8 @@ void QObject::removeEventFilter(QObject *obj)
\fn void QObject::destroyed(QObject *obj)
This signal is emitted immediately before the object \a obj is
- destroyed, and can not be blocked.
+ destroyed, after any instances of QPointer have been notified,
+ and cannot be blocked.
All the objects's children are destroyed immediately after this
signal is emitted.
@@ -2930,8 +2934,8 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho
0 may be used as a wildcard, meaning "any signal", "any receiving
object", or "any slot in the receiving object", respectively.
- The \a sender may never be 0. (You cannot disconnect signals from
- more than one object in a single call.)
+ The \a sender may never be \nullptr. (You cannot disconnect signals
+ from more than one object in a single call.)
If \a signal is 0, it disconnects \a receiver and \a method from
any signal. If not, only the specified signal is disconnected.
@@ -2942,8 +2946,8 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho
If \a method is 0, it disconnects anything that is connected to \a
receiver. If not, only slots named \a method will be disconnected,
- and all other slots are left alone. The \a method must be 0 if \a
- receiver is left out, so you cannot disconnect a
+ and all other slots are left alone. The \a method must be \nullptr
+ if \a receiver is left out, so you cannot disconnect a
specifically-named slot on all objects.
\sa connect()
@@ -3282,7 +3286,7 @@ QMetaObject::Connection QMetaObject::connect(const QObject *sender, int signal_i
\internal
Same as the QMetaObject::connect, but \a signal_index must be the result of QObjectPrivate::signalIndex
- method_index is relative to the rmeta metaobject, if rmeta is null, then it is absolute index
+ method_index is relative to the rmeta metaobject, if rmeta is \nullptr, then it is absolute index
the QObjectPrivate::Connection* has a refcount of 2, so it must be passed to a QMetaObject::Connection
*/
@@ -3675,10 +3679,12 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
return;
}
- void *empty_argv[] = { 0 };
+ void *empty_argv[] = { nullptr };
+ if (!argv)
+ argv = empty_argv;
+
if (qt_signal_spy_callback_set.signal_begin_callback != 0) {
- qt_signal_spy_callback_set.signal_begin_callback(sender, signal_index,
- argv ? argv : empty_argv);
+ qt_signal_spy_callback_set.signal_begin_callback(sender, signal_index, argv);
}
Q_TRACE(QMetaObject_activate_begin_signal, sender, signal_index);
@@ -3741,7 +3747,7 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
// put into the event queue
if ((c->connectionType == Qt::AutoConnection && !receiverInSameThread)
|| (c->connectionType == Qt::QueuedConnection)) {
- queued_activate(sender, signal_index, c, argv ? argv : empty_argv, locker);
+ queued_activate(sender, signal_index, c, argv, locker);
continue;
#if QT_CONFIG(thread)
} else if (c->connectionType == Qt::BlockingQueuedConnection) {
@@ -3753,8 +3759,8 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
}
QSemaphore semaphore;
QMetaCallEvent *ev = c->isSlotObject ?
- new QMetaCallEvent(c->slotObj, sender, signal_index, 0, 0, argv ? argv : empty_argv, &semaphore) :
- new QMetaCallEvent(c->method_offset, c->method_relative, c->callFunction, sender, signal_index, 0, 0, argv ? argv : empty_argv, &semaphore);
+ new QMetaCallEvent(c->slotObj, sender, signal_index, 0, 0, argv, &semaphore) :
+ new QMetaCallEvent(c->method_offset, c->method_relative, c->callFunction, sender, signal_index, 0, 0, argv, &semaphore);
QCoreApplication::postEvent(receiver, ev);
locker.unlock();
semaphore.acquire();
@@ -3773,7 +3779,7 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
QScopedPointer<QtPrivate::QSlotObjectBase, QSlotObjectBaseDeleter> obj(c->slotObj);
locker.unlock();
Q_TRACE(QMetaObject_activate_begin_slot_functor, obj.data());
- obj->call(receiver, argv ? argv : empty_argv);
+ obj->call(receiver, argv);
Q_TRACE(QMetaObject_activate_end_slot_functor, obj.data());
// Make sure the slot object gets destroyed before the mutex is locked again, as the
@@ -3789,10 +3795,10 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
const auto callFunction = c->callFunction;
locker.unlock();
if (qt_signal_spy_callback_set.slot_begin_callback != 0)
- qt_signal_spy_callback_set.slot_begin_callback(receiver, methodIndex, argv ? argv : empty_argv);
+ qt_signal_spy_callback_set.slot_begin_callback(receiver, methodIndex, argv);
Q_TRACE(QMetaObject_activate_begin_slot, receiver, methodIndex);
- callFunction(receiver, QMetaObject::InvokeMetaMethod, method_relative, argv ? argv : empty_argv);
+ callFunction(receiver, QMetaObject::InvokeMetaMethod, method_relative, argv);
Q_TRACE(QMetaObject_activate_end_slot, receiver, methodIndex);
if (qt_signal_spy_callback_set.slot_end_callback != 0)
@@ -3803,13 +3809,11 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
locker.unlock();
if (qt_signal_spy_callback_set.slot_begin_callback != 0) {
- qt_signal_spy_callback_set.slot_begin_callback(receiver,
- method,
- argv ? argv : empty_argv);
+ qt_signal_spy_callback_set.slot_begin_callback(receiver, method, argv);
}
Q_TRACE(QMetaObject_activate_begin_slot, receiver, method);
- metacall(receiver, QMetaObject::InvokeMetaMethod, method, argv ? argv : empty_argv);
+ metacall(receiver, QMetaObject::InvokeMetaMethod, method, argv);
Q_TRACE(QMetaObject_activate_end_slot, receiver, method);
if (qt_signal_spy_callback_set.slot_end_callback != 0)
@@ -3854,7 +3858,7 @@ void QMetaObject::activate(QObject *sender, int signal_index, void **argv)
It is different from QMetaObject::indexOfSignal(): indexOfSignal is the same as indexOfMethod
while QObjectPrivate::signalIndex is smaller because it doesn't give index to slots.
- If \a meta is not 0, it is set to the meta-object where the signal was found.
+ If \a meta is not \nullptr, it is set to the meta-object where the signal was found.
*/
int QObjectPrivate::signalIndex(const char *signalName,
const QMetaObject **meta) const
@@ -4987,8 +4991,8 @@ bool QObject::disconnect(const QMetaObject::Connection &connection)
0 may be used as a wildcard, meaning "any signal", "any receiving
object", or "any slot in the receiving object", respectively.
- The \a sender may never be 0. (You cannot disconnect signals from
- more than one object in a single call.)
+ The \a sender may never be \nullptr. (You cannot disconnect signals
+ from more than one object in a single call.)
If \a signal is 0, it disconnects \a receiver and \a method from
any signal. If not, only the specified signal is disconnected.
@@ -4999,8 +5003,8 @@ bool QObject::disconnect(const QMetaObject::Connection &connection)
If \a method is 0, it disconnects anything that is connected to \a
receiver. If not, only slots named \a method will be disconnected,
- and all other slots are left alone. The \a method must be 0 if \a
- receiver is left out, so you cannot disconnect a
+ and all other slots are left alone. The \a method must be \nullptr
+ if \a receiver is left out, so you cannot disconnect a
specifically-named slot on all objects.
\note It is not possible to use this overload to diconnect signals