summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp26
-rw-r--r--src/corelib/kernel/qcoreevent.cpp2
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib.cpp40
-rw-r--r--src/corelib/kernel/qeventdispatcher_unix.cpp2
-rw-r--r--src/corelib/kernel/qmetaobject.cpp80
-rw-r--r--src/corelib/kernel/qmetaobjectbuilder.cpp32
-rw-r--r--src/corelib/kernel/qmetatype.cpp6
-rw-r--r--src/corelib/kernel/qmimedata.cpp2
-rw-r--r--src/corelib/kernel/qobject.cpp126
-rw-r--r--src/corelib/kernel/qobjectcleanuphandler.cpp2
-rw-r--r--src/corelib/kernel/qsharedmemory.cpp2
-rw-r--r--src/corelib/kernel/qsharedmemory_systemv.cpp6
-rw-r--r--src/corelib/kernel/qsharedmemory_unix.cpp2
-rw-r--r--src/corelib/kernel/qtestsupport_core.cpp2
-rw-r--r--src/corelib/kernel/qtimer.cpp6
-rw-r--r--src/corelib/kernel/qtimerinfo_unix.cpp20
-rw-r--r--src/corelib/kernel/qtranslator.cpp38
-rw-r--r--src/corelib/kernel/qvariant.cpp2
18 files changed, 198 insertions, 198 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 32efa727b8..34f54d8f94 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -530,10 +530,10 @@ void QCoreApplicationPrivate::eventDispatcherReady()
{
}
-QBasicAtomicPointer<QThread> QCoreApplicationPrivate::theMainThread = Q_BASIC_ATOMIC_INITIALIZER(0);
+QBasicAtomicPointer<QThread> QCoreApplicationPrivate::theMainThread = Q_BASIC_ATOMIC_INITIALIZER(nullptr);
QThread *QCoreApplicationPrivate::mainThread()
{
- Q_ASSERT(theMainThread.loadRelaxed() != 0);
+ Q_ASSERT(theMainThread.loadRelaxed() != nullptr);
return theMainThread.loadRelaxed();
}
@@ -690,7 +690,7 @@ QCoreApplication::QCoreApplication(QCoreApplicationPrivate &p)
#ifdef QT_NO_QOBJECT
: d_ptr(&p)
#else
- : QObject(p, 0)
+ : QObject(p, nullptr)
#endif
{
d_func()->q_ptr = this;
@@ -1139,7 +1139,7 @@ bool QCoreApplication::notify(QObject *receiver, QEvent *event)
static bool doNotify(QObject *receiver, QEvent *event)
{
- if (receiver == 0) { // serious error
+ if (receiver == nullptr) { // serious error
qWarning("QCoreApplication::notify: Unexpected null receiver");
return true;
}
@@ -1388,7 +1388,7 @@ void QCoreApplicationPrivate::execCleanup()
if (!aboutToQuitEmitted)
emit q_func()->aboutToQuit(QCoreApplication::QPrivateSignal());
aboutToQuitEmitted = true;
- QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
}
@@ -1531,7 +1531,7 @@ void QCoreApplication::postEvent(QObject *receiver, QEvent *event, int priority)
{
Q_TRACE_SCOPE(QCoreApplication_postEvent, receiver, event, event->type());
- if (receiver == 0) {
+ if (receiver == nullptr) {
qWarning("QCoreApplication::postEvent: Unexpected null receiver");
delete event;
return;
@@ -1635,7 +1635,7 @@ bool QCoreApplication::compressEvent(QEvent *event, QObject *receiver, QPostEven
for (int i = 0; i < postedEvents->size(); ++i) {
const QPostEvent &cur = postedEvents->at(i);
if (cur.receiver != receiver
- || cur.event == 0
+ || cur.event == nullptr
|| cur.event->type() != event->type())
continue;
// found an event for this receiver
@@ -1784,7 +1784,7 @@ void QCoreApplicationPrivate::sendPostedEvents(QObject *receiver, int event_type
// null out the event so if sendPostedEvents recurses, it
// will ignore this one, as it's been re-posted.
- const_cast<QPostEvent &>(pe).event = 0;
+ const_cast<QPostEvent &>(pe).event = nullptr;
// re-post the copied event so it isn't lost
data->postEventList.addEvent(pe_copy);
@@ -1804,7 +1804,7 @@ void QCoreApplicationPrivate::sendPostedEvents(QObject *receiver, int event_type
// next, update the data structure so that we're ready
// for the next event.
- const_cast<QPostEvent &>(pe).event = 0;
+ const_cast<QPostEvent &>(pe).event = nullptr;
locker.unlock();
const auto relocker = qScopeGuard([&locker] { locker.lock(); });
@@ -1867,7 +1867,7 @@ void QCoreApplication::removePostedEvents(QObject *receiver, int eventType)
--pe.receiver->d_func()->postedEvents;
pe.event->posted = false;
events.append(pe.event);
- const_cast<QPostEvent &>(pe).event = 0;
+ const_cast<QPostEvent &>(pe).event = nullptr;
} else if (!data->postEventList.recursion) {
if (i != j)
qSwap(data->postEventList[i], data->postEventList[j]);
@@ -1929,7 +1929,7 @@ void QCoreApplicationPrivate::removePostedEvent(QEvent * event)
--pe.receiver->d_func()->postedEvents;
pe.event->posted = false;
delete pe.event;
- const_cast<QPostEvent &>(pe).event = 0;
+ const_cast<QPostEvent &>(pe).event = nullptr;
return;
}
}
@@ -2204,7 +2204,7 @@ QString QCoreApplication::translate(const char *context, const char *sourceText,
// Declared in qglobal.h
QString qtTrId(const char *id, int n)
{
- return QCoreApplication::translate(0, id, 0, n);
+ return QCoreApplication::translate(nullptr, id, nullptr, n);
}
bool QCoreApplicationPrivate::isTranslatorInstalled(QTranslator *translator)
@@ -2956,7 +2956,7 @@ QAbstractEventDispatcher *QCoreApplication::eventDispatcher()
{
if (QCoreApplicationPrivate::theMainThread.loadAcquire())
return QCoreApplicationPrivate::theMainThread.loadRelaxed()->eventDispatcher();
- return 0;
+ return nullptr;
}
/*!
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp
index 4cfc749386..e3326f00d7 100644
--- a/src/corelib/kernel/qcoreevent.cpp
+++ b/src/corelib/kernel/qcoreevent.cpp
@@ -295,7 +295,7 @@ QT_BEGIN_NAMESPACE
Contructs an event object of type \a type.
*/
QEvent::QEvent(Type type)
- : d(0), t(type), posted(false), spont(false), m_accept(true)
+ : d(nullptr), t(type), posted(false), spont(false), m_accept(true)
{
Q_TRACE(QEvent_ctor, this, t);
}
diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp
index d9746ef6e2..92f3553247 100644
--- a/src/corelib/kernel/qeventdispatcher_glib.cpp
+++ b/src/corelib/kernel/qeventdispatcher_glib.cpp
@@ -114,9 +114,9 @@ static GSourceFuncs socketNotifierSourceFuncs = {
socketNotifierSourcePrepare,
socketNotifierSourceCheck,
socketNotifierSourceDispatch,
- NULL,
- NULL,
- NULL
+ nullptr,
+ nullptr,
+ nullptr
};
struct GTimerSource
@@ -188,9 +188,9 @@ static GSourceFuncs timerSourceFuncs = {
timerSourcePrepare,
timerSourceCheck,
timerSourceDispatch,
- NULL,
- NULL,
- NULL
+ nullptr,
+ nullptr,
+ nullptr
};
struct GIdleTimerSource
@@ -227,7 +227,7 @@ static gboolean idleTimerSourceCheck(GSource *source)
static gboolean idleTimerSourceDispatch(GSource *source, GSourceFunc, gpointer)
{
GTimerSource *timerSource = reinterpret_cast<GIdleTimerSource *>(source)->timerSource;
- (void) timerSourceDispatch(&timerSource->source, 0, 0);
+ (void) timerSourceDispatch(&timerSource->source, nullptr, nullptr);
return true;
}
@@ -235,9 +235,9 @@ static GSourceFuncs idleTimerSourceFuncs = {
idleTimerSourcePrepare,
idleTimerSourceCheck,
idleTimerSourceDispatch,
- NULL,
- NULL,
- NULL
+ nullptr,
+ nullptr,
+ nullptr
};
struct GPostEventSource
@@ -267,7 +267,7 @@ static gboolean postEventSourcePrepare(GSource *s, gint *timeout)
static gboolean postEventSourceCheck(GSource *source)
{
- return postEventSourcePrepare(source, 0);
+ return postEventSourcePrepare(source, nullptr);
}
static gboolean postEventSourceDispatch(GSource *s, GSourceFunc, gpointer)
@@ -283,9 +283,9 @@ static GSourceFuncs postEventSourceFuncs = {
postEventSourcePrepare,
postEventSourceCheck,
postEventSourceDispatch,
- NULL,
- NULL,
- NULL
+ nullptr,
+ nullptr,
+ nullptr
};
@@ -372,10 +372,10 @@ QEventDispatcherGlib::~QEventDispatcherGlib()
d->timerSource->timerList.~QTimerInfoList();
g_source_destroy(&d->timerSource->source);
g_source_unref(&d->timerSource->source);
- d->timerSource = 0;
+ d->timerSource = nullptr;
g_source_destroy(&d->idleTimerSource->source);
g_source_unref(&d->idleTimerSource->source);
- d->idleTimerSource = 0;
+ d->idleTimerSource = nullptr;
// destroy socket notifier source
for (int i = 0; i < d->socketNotifierSource->pollfds.count(); ++i) {
@@ -386,19 +386,19 @@ QEventDispatcherGlib::~QEventDispatcherGlib()
d->socketNotifierSource->pollfds.~QList<GPollFDWithQSocketNotifier *>();
g_source_destroy(&d->socketNotifierSource->source);
g_source_unref(&d->socketNotifierSource->source);
- d->socketNotifierSource = 0;
+ d->socketNotifierSource = nullptr;
// destroy post event source
g_source_destroy(&d->postEventSource->source);
g_source_unref(&d->postEventSource->source);
- d->postEventSource = 0;
+ d->postEventSource = nullptr;
- Q_ASSERT(d->mainContext != 0);
+ Q_ASSERT(d->mainContext != nullptr);
#if GLIB_CHECK_VERSION (2, 22, 0)
g_main_context_pop_thread_default (d->mainContext);
#endif
g_main_context_unref(d->mainContext);
- d->mainContext = 0;
+ d->mainContext = nullptr;
}
bool QEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags)
diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp
index 2492d70005..0165ce9075 100644
--- a/src/corelib/kernel/qeventdispatcher_unix.cpp
+++ b/src/corelib/kernel/qeventdispatcher_unix.cpp
@@ -465,7 +465,7 @@ bool QEventDispatcherUNIX::processEvents(QEventLoop::ProcessEventsFlags flags)
emit awake();
auto threadData = d->threadData.loadRelaxed();
- QCoreApplicationPrivate::sendPostedEvents(0, 0, threadData);
+ QCoreApplicationPrivate::sendPostedEvents(nullptr, 0, threadData);
const bool include_timers = (flags & QEventLoop::X11ExcludeTimers) == 0;
const bool include_notifiers = (flags & QEventLoop::ExcludeSocketNotifiers) == 0;
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 5cb30a74ac..fad47eee13 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -282,14 +282,14 @@ QObject *QMetaObject::newInstance(QGenericArgument val0,
idx = indexOfConstructor(norm.constData());
}
if (idx < 0)
- return 0;
+ return nullptr;
- QObject *returnValue = 0;
+ QObject *returnValue = nullptr;
void *param[] = {&returnValue, val0.data(), val1.data(), val2.data(), val3.data(), val4.data(),
val5.data(), val6.data(), val7.data(), val8.data(), val9.data()};
if (static_metacall(CreateInstance, idx, param) >= 0)
- return 0;
+ return nullptr;
return returnValue;
}
@@ -301,7 +301,7 @@ int QMetaObject::static_metacall(Call cl, int idx, void **argv) const
Q_ASSERT(priv(d.data)->revision >= 6);
if (!d.static_metacall)
return 0;
- d.static_metacall(0, cl, idx, argv);
+ d.static_metacall(nullptr, cl, idx, argv);
return -1;
}
@@ -691,7 +691,7 @@ static void argumentTypesFromString(const char *str, const char *end,
QByteArray QMetaObjectPrivate::decodeMethodSignature(
const char *signature, QArgumentTypeArray &types)
{
- Q_ASSERT(signature != 0);
+ Q_ASSERT(signature != nullptr);
const char *lparens = strchr(signature, '(');
if (!lparens)
return QByteArray();
@@ -844,7 +844,7 @@ int QMetaObjectPrivate::indexOfConstructor(const QMetaObject *m, const QByteArra
*/
int QMetaObjectPrivate::absoluteSignalCount(const QMetaObject *m)
{
- Q_ASSERT(m != 0);
+ Q_ASSERT(m != nullptr);
int n = priv(m->d.data)->signalCount;
for (m = m->d.superdata; m; m = m->d.superdata)
n += priv(m->d.data)->signalCount;
@@ -881,7 +881,7 @@ QMetaMethod QMetaObjectPrivate::signal(const QMetaObject *m, int signal_index)
QMetaMethod result;
if (signal_index < 0)
return result;
- Q_ASSERT(m != 0);
+ Q_ASSERT(m != nullptr);
int i = signal_index;
i -= signalOffset(m);
if (i < 0 && m->d.superdata)
@@ -1031,7 +1031,7 @@ int QMetaObject::indexOfProperty(const char *name) const
QAbstractDynamicMetaObject *me =
const_cast<QAbstractDynamicMetaObject *>(static_cast<const QAbstractDynamicMetaObject *>(this));
- return me->createProperty(name, 0);
+ return me->createProperty(name, nullptr);
}
return -1;
@@ -1145,7 +1145,7 @@ QMetaProperty QMetaObject::property(int index) const
if (!result.menum.isValid()) {
const char *enum_name = type;
const char *scope_name = objectClassName(this);
- char *scope_buffer = 0;
+ char *scope_buffer = nullptr;
const char *colon = strrchr(enum_name, ':');
// ':' will always appear in pairs
@@ -1159,7 +1159,7 @@ QMetaProperty QMetaObject::property(int index) const
enum_name = colon+1;
}
- const QMetaObject *scope = 0;
+ const QMetaObject *scope = nullptr;
if (qstrcmp(scope_name, "Qt") == 0)
scope = &QObject::staticQtMetaObject;
else
@@ -1542,14 +1542,14 @@ bool QMetaObject::invokeMethodImpl(QObject *object, QtPrivate::QSlotObjectBase *
return false;
}
- QCoreApplication::postEvent(object, new QMetaCallEvent(slot, 0, -1, 1));
+ QCoreApplication::postEvent(object, new QMetaCallEvent(slot, nullptr, -1, 1));
} else if (type == Qt::BlockingQueuedConnection) {
#if QT_CONFIG(thread)
if (currentThread == objectThread)
qWarning("QMetaObject::invokeMethod: Dead lock detected");
QSemaphore semaphore;
- QCoreApplication::postEvent(object, new QMetaCallEvent(slot, 0, -1, argv, &semaphore));
+ QCoreApplication::postEvent(object, new QMetaCallEvent(slot, nullptr, -1, argv, &semaphore));
semaphore.acquire();
#endif // QT_CONFIG(thread)
} else {
@@ -1988,7 +1988,7 @@ QList<QByteArray> QMetaMethod::parameterNames() const
const char *QMetaMethod::typeName() const
{
if (!mobj)
- return 0;
+ return nullptr;
return QMetaMethodPrivate::get(this)->rawReturnTypeName();
}
@@ -2020,7 +2020,7 @@ const char *QMetaMethod::typeName() const
const char *QMetaMethod::tag() const
{
if (!mobj)
- return 0;
+ return nullptr;
return QMetaMethodPrivate::get(this)->tag().constData();
}
@@ -2303,7 +2303,7 @@ bool QMetaMethod::invoke(QObject *object,
return false;
}
- QScopedPointer<QMetaCallEvent> event(new QMetaCallEvent(idx_offset, idx_relative, callFunction, 0, -1, paramCount));
+ QScopedPointer<QMetaCallEvent> event(new QMetaCallEvent(idx_offset, idx_relative, callFunction, nullptr, -1, paramCount));
int *types = event->types();
void **args = event->args();
@@ -2340,7 +2340,7 @@ bool QMetaMethod::invoke(QObject *object,
QSemaphore semaphore;
QCoreApplication::postEvent(object, new QMetaCallEvent(idx_offset, idx_relative, callFunction,
- 0, -1, param, &semaphore));
+ nullptr, -1, param, &semaphore));
semaphore.acquire();
#endif // QT_CONFIG(thread)
}
@@ -2563,7 +2563,7 @@ bool QMetaMethod::invokeOnGadget(void* gadget, QGenericReturnArgument returnValu
const char *QMetaEnum::name() const
{
if (!mobj)
- return 0;
+ return nullptr;
return rawStringData(mobj, mobj->d.data[handle]);
}
@@ -2582,7 +2582,7 @@ const char *QMetaEnum::name() const
const char *QMetaEnum::enumName() const
{
if (!mobj)
- return 0;
+ return nullptr;
const bool rev8p = priv(mobj->d.data)->revision >= 8;
if (rev8p)
return rawStringData(mobj, mobj->d.data[handle + 1]);
@@ -2610,13 +2610,13 @@ int QMetaEnum::keyCount() const
const char *QMetaEnum::key(int index) const
{
if (!mobj)
- return 0;
+ return nullptr;
const int offset = priv(mobj->d.data)->revision >= 8 ? 3 : 2;
int count = mobj->d.data[handle + offset];
int data = mobj->d.data[handle + offset + 1];
if (index >= 0 && index < count)
return rawStringData(mobj, mobj->d.data[data + 2*index]);
- return 0;
+ return nullptr;
}
/*!
@@ -2679,7 +2679,7 @@ bool QMetaEnum::isScoped() const
*/
const char *QMetaEnum::scope() const
{
- return mobj ? objectClassName(mobj) : 0;
+ return mobj ? objectClassName(mobj) : nullptr;
}
/*!
@@ -2695,7 +2695,7 @@ const char *QMetaEnum::scope() const
*/
int QMetaEnum::keyToValue(const char *key, bool *ok) const
{
- if (ok != 0)
+ if (ok != nullptr)
*ok = false;
if (!mobj || !key)
return -1;
@@ -2715,7 +2715,7 @@ int QMetaEnum::keyToValue(const char *key, bool *ok) const
const QByteArray className = stringData(mobj, priv(mobj->d.data)->className);
if ((!scope || (className.size() == int(scope) && strncmp(qualified_key, className.constData(), scope) == 0))
&& strcmp(key, rawStringData(mobj, mobj->d.data[data + 2*i])) == 0) {
- if (ok != 0)
+ if (ok != nullptr)
*ok = true;
return mobj->d.data[data + 2*i + 1];
}
@@ -2734,14 +2734,14 @@ int QMetaEnum::keyToValue(const char *key, bool *ok) const
const char* QMetaEnum::valueToKey(int value) const
{
if (!mobj)
- return 0;
+ return nullptr;
const int offset = priv(mobj->d.data)->revision >= 8 ? 3 : 2;
int count = mobj->d.data[handle + offset];
int data = mobj->d.data[handle + offset + 1];
for (int i = 0; i < count; ++i)
if (value == (int)mobj->d.data[data + 2*i + 1])
return rawStringData(mobj, mobj->d.data[data + 2*i]);
- return 0;
+ return nullptr;
}
/*!
@@ -2756,11 +2756,11 @@ const char* QMetaEnum::valueToKey(int value) const
*/
int QMetaEnum::keysToValue(const char *keys, bool *ok) const
{
- if (ok != 0)
+ if (ok != nullptr)
*ok = false;
if (!mobj || !keys)
return -1;
- if (ok != 0)
+ if (ok != nullptr)
*ok = true;
const QString keysString = QString::fromLatin1(keys);
const QVector<QStringRef> splitKeys = keysString.splitRef(QLatin1Char('|'));
@@ -2793,7 +2793,7 @@ int QMetaEnum::keysToValue(const char *keys, bool *ok) const
}
}
if (i < 0) {
- if (ok != 0)
+ if (ok != nullptr)
*ok = false;
value |= -1;
}
@@ -2896,7 +2896,7 @@ static QByteArray qualifiedName(const QMetaEnum &e)
\internal
*/
QMetaProperty::QMetaProperty()
- : mobj(0), handle(0), idx(0)
+ : mobj(nullptr), handle(0), idx(0)
{
}
@@ -2909,7 +2909,7 @@ QMetaProperty::QMetaProperty()
const char *QMetaProperty::name() const
{
if (!mobj)
- return 0;
+ return nullptr;
int handle = priv(mobj->d.data)->propertyData + 3*idx;
return rawStringData(mobj, mobj->d.data[handle]);
}
@@ -2922,7 +2922,7 @@ const char *QMetaProperty::name() const
const char *QMetaProperty::typeName() const
{
if (!mobj)
- return 0;
+ return nullptr;
int handle = priv(mobj->d.data)->propertyData + 3*idx;
return rawTypeNameFromTypeInfo(mobj, mobj->d.data[handle + 1]);
}
@@ -3112,7 +3112,7 @@ QVariant QMetaProperty::read(const QObject *object) const
t = enumMetaTypeId;
} else {
int handle = priv(mobj->d.data)->propertyData + 3*idx;
- const char *typeName = 0;
+ const char *typeName = nullptr;
Q_ASSERT(priv(mobj->d.data)->revision >= 7);
uint typeInfo = mobj->d.data[handle + 1];
if (!(typeInfo & IsUnresolvedType))
@@ -3138,11 +3138,11 @@ QVariant QMetaProperty::read(const QObject *object) const
// changed: result stored directly in value
int status = -1;
QVariant value;
- void *argv[] = { 0, &value, &status };
+ void *argv[] = { nullptr, &value, &status };
if (t == QMetaType::QVariant) {
argv[0] = &value;
} else {
- value = QVariant(t, (void*)0);
+ value = QVariant(t, (void*)nullptr);
argv[0] = value.data();
}
if (priv(mobj->d.data)->flags & PropertyAccessInStaticMetaCall && mobj->d.static_metacall) {
@@ -3196,7 +3196,7 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const
v.convert(QVariant::Int);
} else {
int handle = priv(mobj->d.data)->propertyData + 3*idx;
- const char *typeName = 0;
+ const char *typeName = nullptr;
Q_ASSERT(priv(mobj->d.data)->revision >= 7);
uint typeInfo = mobj->d.data[handle + 1];
if (!(typeInfo & IsUnresolvedType))
@@ -3213,7 +3213,7 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const
if (!value.isValid()) {
if (isResettable())
return reset(object);
- v = QVariant(t, 0);
+ v = QVariant(t, nullptr);
} else if (!v.convert(t)) {
return false;
}
@@ -3229,7 +3229,7 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const
// the flags variable is used by the declarative module to implement
// interception of property writes.
int flags = 0;
- void *argv[] = { 0, &v, &status, &flags };
+ void *argv[] = { nullptr, &v, &status, &flags };
if (t == QMetaType::QVariant)
argv[0] = &v;
else
@@ -3254,7 +3254,7 @@ bool QMetaProperty::reset(QObject *object) const
{
if (!object || !mobj || !isResettable())
return false;
- void *argv[] = { 0 };
+ void *argv[] = { nullptr };
if (priv(mobj->d.data)->flags & PropertyAccessInStaticMetaCall && mobj->d.static_metacall)
mobj->d.static_metacall(object, QMetaObject::ResetProperty, idx, argv);
else
@@ -3638,7 +3638,7 @@ bool QMetaProperty::isEditable(const QObject *object) const
const char *QMetaClassInfo::name() const
{
if (!mobj)
- return 0;
+ return nullptr;
return rawStringData(mobj, mobj->d.data[handle]);
}
@@ -3650,7 +3650,7 @@ const char *QMetaClassInfo::name() const
const char* QMetaClassInfo::value() const
{
if (!mobj)
- return 0;
+ return nullptr;
return rawStringData(mobj, mobj->d.data[handle + 1]);
}
diff --git a/src/corelib/kernel/qmetaobjectbuilder.cpp b/src/corelib/kernel/qmetaobjectbuilder.cpp
index f77c4ce32f..4ecc340787 100644
--- a/src/corelib/kernel/qmetaobjectbuilder.cpp
+++ b/src/corelib/kernel/qmetaobjectbuilder.cpp
@@ -210,7 +210,7 @@ public:
: flags(0)
{
superClass = &QObject::staticMetaObject;
- staticMetacallFunction = 0;
+ staticMetacallFunction = nullptr;
}
bool hasRevisionedProperties() const;
@@ -749,7 +749,7 @@ void QMetaObjectBuilder::addMetaObject
Q_ASSERT(priv(prototype->d.data)->revision >= 2);
const auto *objects = prototype->d.relatedMetaObjects;
if (objects) {
- while (*objects != 0) {
+ while (*objects != nullptr) {
addRelatedMetaObject(*objects);
++objects;
}
@@ -831,7 +831,7 @@ const QMetaObject *QMetaObjectBuilder::relatedMetaObject(int index) const
if (index >= 0 && index < d->relatedMetaObjects.size())
return d->relatedMetaObjects[index];
else
- return 0;
+ return nullptr;
}
/*!
@@ -1196,8 +1196,8 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf,
ALIGN(size, int);
if (buf) {
if (!relocatable) meta->d.superdata = d->superClass;
- meta->d.relatedMetaObjects = 0;
- meta->d.extradata = 0;
+ meta->d.relatedMetaObjects = nullptr;
+ meta->d.extradata = nullptr;
meta->d.static_metacall = d->staticMetacallFunction;
}
@@ -1494,7 +1494,7 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf,
*/
QMetaObject *QMetaObjectBuilder::toMetaObject() const
{
- int size = buildMetaObject(d, 0, 0, false);
+ int size = buildMetaObject(d, nullptr, 0, false);
char *buf = reinterpret_cast<char *>(malloc(size));
memset(buf, 0, size);
buildMetaObject(d, buf, size, false);
@@ -1517,7 +1517,7 @@ QMetaObject *QMetaObjectBuilder::toMetaObject() const
*/
QByteArray QMetaObjectBuilder::toRelocatableData(bool *ok) const
{
- int size = buildMetaObject(d, 0, 0, true);
+ int size = buildMetaObject(d, nullptr, 0, true);
if (size == -1) {
if (ok) *ok = false;
return QByteArray();
@@ -1555,9 +1555,9 @@ void QMetaObjectBuilder::fromRelocatableData(QMetaObject *output,
output->d.superdata = superclass;
output->d.stringdata = reinterpret_cast<const QByteArrayData *>(buf + stringdataOffset);
output->d.data = reinterpret_cast<const uint *>(buf + dataOffset);
- output->d.extradata = 0;
- output->d.relatedMetaObjects = 0;
- output->d.static_metacall = 0;
+ output->d.extradata = nullptr;
+ output->d.relatedMetaObjects = nullptr;
+ output->d.static_metacall = nullptr;
}
/*!
@@ -1720,14 +1720,14 @@ void QMetaObjectBuilder::deserialize
d->enumerators.clear();
d->constructors.clear();
d->relatedMetaObjects.clear();
- d->staticMetacallFunction = 0;
+ d->staticMetacallFunction = nullptr;
// Read the class and super class names.
stream >> d->className;
stream >> name;
if (name.isEmpty()) {
- d->superClass = 0;
- } else if ((cl = resolveClassName(references, name)) != 0) {
+ d->superClass = nullptr;
+ } else if ((cl = resolveClassName(references, name)) != nullptr) {
d->superClass = cl;
} else {
stream.setStatus(QDataStream::ReadCorruptData);
@@ -1877,7 +1877,7 @@ QMetaMethodBuilderPrivate *QMetaMethodBuilder::d_func() const
else if (_mobj && -_index >= 1 && -_index <= int(_mobj->d->constructors.size()))
return &(_mobj->d->constructors[(-_index) - 1]);
else
- return 0;
+ return nullptr;
}
/*!
@@ -2116,7 +2116,7 @@ QMetaPropertyBuilderPrivate *QMetaPropertyBuilder::d_func() const
if (_mobj && _index >= 0 && _index < int(_mobj->d->properties.size()))
return &(_mobj->d->properties[_index]);
else
- return 0;
+ return nullptr;
}
/*!
@@ -2588,7 +2588,7 @@ QMetaEnumBuilderPrivate *QMetaEnumBuilder::d_func() const
if (_mobj && _index >= 0 && _index < int(_mobj->d->enumerators.size()))
return &(_mobj->d->enumerators[_index]);
else
- return 0;
+ return nullptr;
}
/*!
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index 356a675517..3f0b8900e4 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -1113,8 +1113,8 @@ static int registerNormalizedType(const NS(QByteArray) &normalizedTypeName,
QCustomTypeInfo inf;
inf.typeName = normalizedTypeName;
#ifndef QT_NO_DATASTREAM
- inf.loadOp = 0;
- inf.saveOp = 0;
+ inf.loadOp = nullptr;
+ inf.saveOp = nullptr;
#endif
inf.alias = -1;
inf.typedConstructor = typedConstructor;
@@ -1955,7 +1955,7 @@ public:
return Q_LIKELY(qMetaTypeWidgetsHelper)
? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].metaObject
: nullptr;
- return 0;
+ return nullptr;
}
};
diff --git a/src/corelib/kernel/qmimedata.cpp b/src/corelib/kernel/qmimedata.cpp
index 9a98db21d3..00e5183eb1 100644
--- a/src/corelib/kernel/qmimedata.cpp
+++ b/src/corelib/kernel/qmimedata.cpp
@@ -319,7 +319,7 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
Constructs a new MIME data object with no data in it.
*/
QMimeData::QMimeData()
- : QObject(*new QMimeDataPrivate, 0)
+ : QObject(*new QMimeDataPrivate, nullptr)
{
}
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index cee885c0fe..a2c5d7db75 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -109,7 +109,7 @@ static int *queuedConnectionTypes(const QList<QByteArray> &typeNames)
"(Make sure '%s' is registered using qRegisterMetaType().)",
typeName.constData(), typeName.constData());
delete [] types;
- return 0;
+ return nullptr;
}
}
types[typeNames.count()] = 0;
@@ -133,7 +133,7 @@ static int *queuedConnectionTypes(const QArgumentType *argumentTypes, int argc)
qWarning("QObject::connect: Cannot queue arguments of type '%s'\n"
"(Make sure '%s' is registered using qRegisterMetaType().)",
type.name().constData(), type.name().constData());
- return 0;
+ return nullptr;
}
}
types[argc] = 0;
@@ -160,13 +160,13 @@ extern "C" Q_CORE_EXPORT void qt_removeObject(QObject *)
{}
#endif
-void (*QAbstractDeclarativeData::destroyed)(QAbstractDeclarativeData *, QObject *) = 0;
-void (*QAbstractDeclarativeData::destroyed_qml1)(QAbstractDeclarativeData *, QObject *) = 0;
-void (*QAbstractDeclarativeData::parentChanged)(QAbstractDeclarativeData *, QObject *, QObject *) = 0;
-void (*QAbstractDeclarativeData::signalEmitted)(QAbstractDeclarativeData *, QObject *, int, void **) = 0;
-int (*QAbstractDeclarativeData::receivers)(QAbstractDeclarativeData *, const QObject *, int) = 0;
-bool (*QAbstractDeclarativeData::isSignalConnected)(QAbstractDeclarativeData *, const QObject *, int) = 0;
-void (*QAbstractDeclarativeData::setWidgetParent)(QObject *, QObject *) = 0;
+void (*QAbstractDeclarativeData::destroyed)(QAbstractDeclarativeData *, QObject *) = nullptr;
+void (*QAbstractDeclarativeData::destroyed_qml1)(QAbstractDeclarativeData *, QObject *) = nullptr;
+void (*QAbstractDeclarativeData::parentChanged)(QAbstractDeclarativeData *, QObject *, QObject *) = nullptr;
+void (*QAbstractDeclarativeData::signalEmitted)(QAbstractDeclarativeData *, QObject *, int, void **) = nullptr;
+int (*QAbstractDeclarativeData::receivers)(QAbstractDeclarativeData *, const QObject *, int) = nullptr;
+bool (*QAbstractDeclarativeData::isSignalConnected)(QAbstractDeclarativeData *, const QObject *, int) = nullptr;
+void (*QAbstractDeclarativeData::setWidgetParent)(QObject *, QObject *) = nullptr;
/*!
\fn QObjectData::QObjectData()
@@ -182,7 +182,7 @@ QMetaObject *QObjectData::dynamicMetaObject() const
}
QObjectPrivate::QObjectPrivate(int version)
- : threadData(0), currentChildBeingDeleted(0)
+ : threadData(nullptr), currentChildBeingDeleted(nullptr)
{
#ifdef QT_BUILD_INTERNAL
// Don't check the version parameter in internal builds.
@@ -195,8 +195,8 @@ QObjectPrivate::QObjectPrivate(int version)
#endif
// QObjectData initialization
- q_ptr = 0;
- parent = 0; // no parent yet. It is set by setParent()
+ q_ptr = nullptr;
+ parent = nullptr; // no parent yet. It is set by setParent()
isWidget = false; // assume not a widget object
blockSig = false; // not blocking signals
wasDeleted = false; // double-delete catcher
@@ -204,8 +204,8 @@ QObjectPrivate::QObjectPrivate(int version)
sendChildEvents = true; // if we should send ChildAdded and ChildRemoved events to parent
receiveChildEvents = true;
postedEvents = 0;
- extraData = 0;
- metaObject = 0;
+ extraData = nullptr;
+ metaObject = nullptr;
isWindow = false;
deleteLaterCalled = false;
}
@@ -926,8 +926,8 @@ QObject::QObject(QObjectPrivate &dd, QObject *parent)
d->threadData.storeRelaxed(threadData);
if (parent) {
QT_TRY {
- if (!check_parent_thread(parent, parent ? parent->d_func()->threadData.loadRelaxed() : 0, threadData))
- parent = 0;
+ if (!check_parent_thread(parent, parent ? parent->d_func()->threadData.loadRelaxed() : nullptr, threadData))
+ parent = nullptr;
if (d->isWidget) {
if (parent) {
d->parent = parent;
@@ -1095,7 +1095,7 @@ QObject::~QObject()
Q_TRACE(QObject_dtor, this);
if (d->parent) // remove it from parent object
- d->setParent_helper(0);
+ d->setParent_helper(nullptr);
}
QObjectPrivate::Connection::~Connection()
@@ -1541,7 +1541,7 @@ void QObject::moveToThread(QThread *targetThread)
return;
}
- if (d->parent != 0) {
+ if (d->parent != nullptr) {
qWarning("QObject::moveToThread: Cannot move objects with a parent");
return;
}
@@ -1618,7 +1618,7 @@ void QObjectPrivate::setThreadData_helper(QThreadData *currentData, QThreadData
if (pe.receiver == q) {
// move this post event to the targetList
targetData->postEventList.addEvent(pe);
- const_cast<QPostEvent &>(pe).event = 0;
+ const_cast<QPostEvent &>(pe).event = nullptr;
++eventsMoved;
}
}
@@ -2065,7 +2065,7 @@ void qt_qFindChildren_helper(const QObject *parent, const QRegularExpression &re
QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo, Qt::FindChildOptions options)
{
if (!parent)
- return 0;
+ return nullptr;
const QObjectList &children = parent->children();
QObject *obj;
int i;
@@ -2081,7 +2081,7 @@ QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const
return obj;
}
}
- return 0;
+ return nullptr;
}
/*!
@@ -2109,7 +2109,7 @@ void QObjectPrivate::deleteChildren()
delete currentChildBeingDeleted;
}
children.clear();
- currentChildBeingDeleted = 0;
+ currentChildBeingDeleted = nullptr;
isDeletingChildren = false;
}
@@ -2161,7 +2161,7 @@ void QObjectPrivate::setParent_helper(QObject *o)
// object hierarchies are constrained to a single thread
if (threadData != parent->d_func()->threadData) {
qWarning("QObject::setParent: Cannot set parent, new parent is in a different thread");
- parent = 0;
+ parent = nullptr;
return;
}
parent->d_func()->children.append(q);
@@ -2232,7 +2232,7 @@ void QObject::installEventFilter(QObject *obj)
d->extraData = new QObjectPrivate::ExtraData;
// clean up unused items in the list
- d->extraData->eventFilters.removeAll((QObject*)0);
+ d->extraData->eventFilters.removeAll((QObject*)nullptr);
d->extraData->eventFilters.removeAll(obj);
d->extraData->eventFilters.prepend(obj);
}
@@ -2256,7 +2256,7 @@ void QObject::removeEventFilter(QObject *obj)
if (d->extraData) {
for (int i = 0; i < d->extraData->eventFilters.count(); ++i) {
if (d->extraData->eventFilters.at(i) == obj)
- d->extraData->eventFilters[i] = 0;
+ d->extraData->eventFilters[i] = nullptr;
}
}
}
@@ -2379,7 +2379,7 @@ void QObject::deleteLater()
const char *qFlagLocation(const char *method)
{
QThreadData *currentThreadData = QThreadData::current(false);
- if (currentThreadData != 0)
+ if (currentThreadData != nullptr)
currentThreadData->flaggedSignatures.store(method);
return method;
}
@@ -2398,7 +2398,7 @@ static const char * extract_location(const char *member)
if (*location != '\0')
return location;
}
- return 0;
+ return nullptr;
}
static bool check_signal_macro(const QObject *sender, const char *signal,
@@ -2437,7 +2437,7 @@ static void err_method_notfound(const QObject *object,
case QSIGNAL_CODE: type = "signal"; break;
}
const char *loc = extract_location(method);
- if (strchr(method,')') == 0) // common typing mistake
+ if (strchr(method,')') == nullptr) // common typing mistake
qWarning("QObject::%s: Parentheses expected, %s %s::%s%s%s",
func, type, object->metaObject()->className(), method+1,
loc ? " in ": "", loc ? loc : "");
@@ -2497,7 +2497,7 @@ QObject *QObject::sender() const
return cd->currentSender->sender;
}
- return 0;
+ return nullptr;
}
/*!
@@ -2676,7 +2676,7 @@ void QMetaObjectPrivate::memberIndexes(const QObject *obj,
return;
const QMetaObject *m = obj->metaObject();
// Check that member is member of obj class
- while (m != 0 && m != member.mobj)
+ while (m != nullptr && m != member.mobj)
m = m->d.superdata;
if (!m)
return;
@@ -2787,18 +2787,18 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign
const QObject *receiver, const char *method,
Qt::ConnectionType type)
{
- if (sender == 0 || receiver == 0 || signal == 0 || method == 0) {
+ if (sender == nullptr || receiver == nullptr || signal == nullptr || method == nullptr) {
qWarning("QObject::connect: Cannot connect %s::%s to %s::%s",
sender ? sender->metaObject()->className() : "(null)",
(signal && *signal) ? signal+1 : "(null)",
receiver ? receiver->metaObject()->className() : "(null)",
(method && *method) ? method+1 : "(null)");
- return QMetaObject::Connection(0);
+ return QMetaObject::Connection(nullptr);
}
QByteArray tmp_signal_name;
if (!check_signal_macro(sender, signal, "connect", "bind"))
- return QMetaObject::Connection(0);
+ return QMetaObject::Connection(nullptr);
const QMetaObject *smeta = sender->metaObject();
const char *signal_arg = signal;
++signal; //skip code
@@ -2821,7 +2821,7 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign
if (signal_index < 0) {
err_method_notfound(sender, signal_arg, "connect");
err_info_about_objects("connect", sender, receiver);
- return QMetaObject::Connection(0);
+ return QMetaObject::Connection(nullptr);
}
signal_index = QMetaObjectPrivate::originalClone(smeta, signal_index);
signal_index += QMetaObjectPrivate::signalOffset(smeta);
@@ -2830,7 +2830,7 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign
int membcode = extract_code(method);
if (!check_method_code(membcode, receiver, method, "connect"))
- return QMetaObject::Connection(0);
+ return QMetaObject::Connection(nullptr);
const char *method_arg = method;
++method; // skip code
@@ -2873,7 +2873,7 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign
if (method_index_relative < 0) {
err_method_notfound(receiver, method_arg, "connect");
err_info_about_objects("connect", sender, receiver);
- return QMetaObject::Connection(0);
+ return QMetaObject::Connection(nullptr);
}
if (!QMetaObjectPrivate::checkConnectArgs(signalTypes.size(), signalTypes.constData(),
@@ -2882,13 +2882,13 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign
"\n %s::%s --> %s::%s",
sender->metaObject()->className(), signal,
receiver->metaObject()->className(), method);
- return QMetaObject::Connection(0);
+ return QMetaObject::Connection(nullptr);
}
- int *types = 0;
+ int *types = nullptr;
if ((type == Qt::QueuedConnection)
&& !(types = queuedConnectionTypes(signalTypes.constData(), signalTypes.size()))) {
- return QMetaObject::Connection(0);
+ return QMetaObject::Connection(nullptr);
}
#ifndef QT_NO_DEBUG
@@ -2925,8 +2925,8 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho
const QObject *receiver, const QMetaMethod &method,
Qt::ConnectionType type)
{
- if (sender == 0
- || receiver == 0
+ if (sender == nullptr
+ || receiver == nullptr
|| signal.methodType() != QMetaMethod::Signal
|| method.methodType() == QMetaMethod::Constructor) {
qWarning("QObject::connect: Cannot connect %s::%s to %s::%s",
@@ -2934,7 +2934,7 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho
signal.methodSignature().constData(),
receiver ? receiver->metaObject()->className() : "(null)",
method.methodSignature().constData() );
- return QMetaObject::Connection(0);
+ return QMetaObject::Connection(nullptr);
}
int signal_index;
@@ -2950,12 +2950,12 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho
if (signal_index == -1) {
qWarning("QObject::connect: Can't find signal %s on instance of class %s",
signal.methodSignature().constData(), smeta->className());
- return QMetaObject::Connection(0);
+ return QMetaObject::Connection(nullptr);
}
if (method_index == -1) {
qWarning("QObject::connect: Can't find method %s on instance of class %s",
method.methodSignature().constData(), rmeta->className());
- return QMetaObject::Connection(0);
+ return QMetaObject::Connection(nullptr);
}
if (!QMetaObject::checkConnectArgs(signal.methodSignature().constData(), method.methodSignature().constData())) {
@@ -2963,19 +2963,19 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho
"\n %s::%s --> %s::%s",
smeta->className(), signal.methodSignature().constData(),
rmeta->className(), method.methodSignature().constData());
- return QMetaObject::Connection(0);
+ return QMetaObject::Connection(nullptr);
}
- int *types = 0;
+ int *types = nullptr;
if ((type == Qt::QueuedConnection)
&& !(types = queuedConnectionTypes(signal.parameterTypes())))
- return QMetaObject::Connection(0);
+ return QMetaObject::Connection(nullptr);
#ifndef QT_NO_DEBUG
check_and_warn_compat(smeta, signal, rmeta, method);
#endif
QMetaObject::Connection handle = QMetaObject::Connection(QMetaObjectPrivate::connect(
- sender, signal_index, signal.enclosingMetaObject(), receiver, method_index, 0, type, types));
+ sender, signal_index, signal.enclosingMetaObject(), receiver, method_index, nullptr, type, types));
return handle;
}
@@ -3058,7 +3058,7 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho
bool QObject::disconnect(const QObject *sender, const char *signal,
const QObject *receiver, const char *method)
{
- if (sender == 0 || (receiver == 0 && method != 0)) {
+ if (sender == nullptr || (receiver == nullptr && method != nullptr)) {
qWarning("QObject::disconnect: Unexpected null parameter");
return false;
}
@@ -3130,7 +3130,7 @@ bool QObject::disconnect(const QObject *sender, const char *signal,
}
if (!method) {
- res |= QMetaObjectPrivate::disconnect(sender, signal_index, smeta, receiver, -1, 0);
+ res |= QMetaObjectPrivate::disconnect(sender, signal_index, smeta, receiver, -1, nullptr);
} else {
const QMetaObject *rmeta = receiver->metaObject();
do {
@@ -3141,7 +3141,7 @@ bool QObject::disconnect(const QObject *sender, const char *signal,
rmeta = rmeta->superClass();
if (method_index < 0)
break;
- res |= QMetaObjectPrivate::disconnect(sender, signal_index, smeta, receiver, method_index, 0);
+ res |= QMetaObjectPrivate::disconnect(sender, signal_index, smeta, receiver, method_index, nullptr);
method_found = true;
} while ((rmeta = rmeta->superClass()));
}
@@ -3193,7 +3193,7 @@ bool QObject::disconnect(const QObject *sender, const char *signal,
bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal,
const QObject *receiver, const QMetaMethod &method)
{
- if (sender == 0 || (receiver == 0 && method.mobj != 0)) {
+ if (sender == nullptr || (receiver == nullptr && method.mobj != nullptr)) {
qWarning("QObject::disconnect: Unexpected null parameter");
return false;
}
@@ -3242,7 +3242,7 @@ bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal,
return false;
}
- if (!QMetaObjectPrivate::disconnect(sender, signal_index, signal.mobj, receiver, method_index, 0))
+ if (!QMetaObjectPrivate::disconnect(sender, signal_index, signal.mobj, receiver, method_index, nullptr))
return false;
if (!signal.isValid()) {
@@ -3381,7 +3381,7 @@ QMetaObject::Connection QMetaObject::connect(const QObject *sender, int signal_i
signal_index = methodIndexToSignalIndex(&smeta, signal_index);
return Connection(QMetaObjectPrivate::connect(sender, signal_index, smeta,
receiver, method_index,
- 0, //FIXME, we could speed this connection up by computing the relative index
+ nullptr, //FIXME, we could speed this connection up by computing the relative index
type, types));
}
@@ -3457,7 +3457,7 @@ bool QMetaObject::disconnect(const QObject *sender, int signal_index,
const QMetaObject *smeta = sender->metaObject();
signal_index = methodIndexToSignalIndex(&smeta, signal_index);
return QMetaObjectPrivate::disconnect(sender, signal_index, smeta,
- receiver, method_index, 0);
+ receiver, method_index, nullptr);
}
/*!
@@ -3473,7 +3473,7 @@ bool QMetaObject::disconnectOne(const QObject *sender, int signal_index,
const QMetaObject *smeta = sender->metaObject();
signal_index = methodIndexToSignalIndex(&smeta, signal_index);
return QMetaObjectPrivate::disconnect(sender, signal_index, smeta,
- receiver, method_index, 0,
+ receiver, method_index, nullptr,
QMetaObjectPrivate::DisconnectOne);
}
@@ -3682,7 +3682,7 @@ static void queued_activate(QObject *sender, int signal, QObjectPrivate::Connect
argumentTypes = queuedConnectionTypes(m.parameterTypes());
if (!argumentTypes) // cannot queue arguments
argumentTypes = &DIRECT_CONNECTION_ONLY;
- if (!c->argumentTypes.testAndSetOrdered(0, argumentTypes)) {
+ if (!c->argumentTypes.testAndSetOrdered(nullptr, argumentTypes)) {
if (argumentTypes != &DIRECT_CONNECTION_ONLY)
delete [] argumentTypes;
argumentTypes = c->argumentTypes.loadRelaxed();
@@ -4293,10 +4293,10 @@ QObjectUserData* QObject::userData(uint id) const
{
Q_D(const QObject);
if (!d->extraData)
- return 0;
+ return nullptr;
if ((int)id < d->extraData->userData.size())
return d->extraData->userData.at(id);
- return 0;
+ return nullptr;
}
#endif // QT_NO_USERDATA
@@ -4952,7 +4952,7 @@ QMetaObject::Connection QObject::connectImpl(const QObject *sender, void **signa
if (!senderMetaObject) {
qWarning("QObject::connect: signal not found in %s", sender->metaObject()->className());
slotObj->destroyIfLastRef();
- return QMetaObject::Connection(0);
+ return QMetaObject::Connection(nullptr);
}
signal_index += QMetaObjectPrivate::signalOffset(senderMetaObject);
return QObjectPrivate::connectImpl(sender, signal_index, receiver, slot, slotObj, type, types, senderMetaObject);
@@ -5138,7 +5138,7 @@ bool QObject::disconnect(const QMetaObject::Connection &connection)
bool QObject::disconnectImpl(const QObject *sender, void **signal, const QObject *receiver, void **slot, const QMetaObject *senderMetaObject)
{
- if (sender == 0 || (receiver == 0 && slot != 0)) {
+ if (sender == nullptr || (receiver == nullptr && slot != nullptr)) {
qWarning("QObject::disconnect: Unexpected null parameter");
return false;
}
@@ -5178,7 +5178,7 @@ QMetaObject::Connection QObjectPrivate::connect(const QObject *sender, int signa
const QMetaObject *senderMetaObject = sender->metaObject();
signal_index = methodIndexToSignalIndex(&senderMetaObject, signal_index);
- return QObjectPrivate::connectImpl(sender, signal_index, sender, /*slot*/0, slotObj, type, /*types*/0, senderMetaObject);
+ return QObjectPrivate::connectImpl(sender, signal_index, sender, /*slot*/nullptr, slotObj, type, /*types*/nullptr, senderMetaObject);
}
/*!
@@ -5235,7 +5235,7 @@ QMetaObject::Connection& QMetaObject::Connection::operator=(const QMetaObject::C
Creates a Connection instance.
*/
-QMetaObject::Connection::Connection() : d_ptr(0) {}
+QMetaObject::Connection::Connection() : d_ptr(nullptr) {}
/*!
Destructor for QMetaObject::Connection.
diff --git a/src/corelib/kernel/qobjectcleanuphandler.cpp b/src/corelib/kernel/qobjectcleanuphandler.cpp
index b6c62af4b3..8bf0e1fcab 100644
--- a/src/corelib/kernel/qobjectcleanuphandler.cpp
+++ b/src/corelib/kernel/qobjectcleanuphandler.cpp
@@ -94,7 +94,7 @@ QObjectCleanupHandler::~QObjectCleanupHandler()
QObject *QObjectCleanupHandler::add(QObject* object)
{
if (!object)
- return 0;
+ return nullptr;
connect(object, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)));
cleanupObjects.insert(0, object);
diff --git a/src/corelib/kernel/qsharedmemory.cpp b/src/corelib/kernel/qsharedmemory.cpp
index 39f3002394..2d65e0bbe4 100644
--- a/src/corelib/kernel/qsharedmemory.cpp
+++ b/src/corelib/kernel/qsharedmemory.cpp
@@ -441,7 +441,7 @@ bool QSharedMemory::attach(AccessMode mode)
bool QSharedMemory::isAttached() const
{
Q_D(const QSharedMemory);
- return (0 != d->memory);
+ return (nullptr != d->memory);
}
/*!
diff --git a/src/corelib/kernel/qsharedmemory_systemv.cpp b/src/corelib/kernel/qsharedmemory_systemv.cpp
index fea4a65b5c..0ba5f65641 100644
--- a/src/corelib/kernel/qsharedmemory_systemv.cpp
+++ b/src/corelib/kernel/qsharedmemory_systemv.cpp
@@ -182,9 +182,9 @@ bool QSharedMemoryPrivate::attach(QSharedMemory::AccessMode mode)
}
// grab the memory
- memory = shmat(id, 0, (mode == QSharedMemory::ReadOnly ? SHM_RDONLY : 0));
+ memory = shmat(id, nullptr, (mode == QSharedMemory::ReadOnly ? SHM_RDONLY : 0));
if ((void*) - 1 == memory) {
- memory = 0;
+ memory = nullptr;
setErrorString(QLatin1String("QSharedMemory::attach (shmat)"));
return false;
}
@@ -216,7 +216,7 @@ bool QSharedMemoryPrivate::detach()
}
return false;
}
- memory = 0;
+ memory = nullptr;
size = 0;
// Get the number of current attachments
diff --git a/src/corelib/kernel/qsharedmemory_unix.cpp b/src/corelib/kernel/qsharedmemory_unix.cpp
index f6d7e78441..bc0f3b03ca 100644
--- a/src/corelib/kernel/qsharedmemory_unix.cpp
+++ b/src/corelib/kernel/qsharedmemory_unix.cpp
@@ -68,7 +68,7 @@ QSharedMemoryPrivate::QSharedMemoryPrivate() :
#ifndef QT_NO_QOBJECT
QObjectPrivate(),
#endif
- memory(0), size(0), error(QSharedMemory::NoError),
+ memory(nullptr), size(0), error(QSharedMemory::NoError),
#ifndef QT_NO_SYSTEMSEMAPHORE
systemSemaphore(QString()), lockedByMe(false),
#endif
diff --git a/src/corelib/kernel/qtestsupport_core.cpp b/src/corelib/kernel/qtestsupport_core.cpp
index 7bd81ed498..8498f7f025 100644
--- a/src/corelib/kernel/qtestsupport_core.cpp
+++ b/src/corelib/kernel/qtestsupport_core.cpp
@@ -55,7 +55,7 @@ Q_CORE_EXPORT void QTestPrivate::qSleep(int ms)
Sleep(uint(ms));
#else
struct timespec ts = { time_t(ms / 1000), (ms % 1000) * 1000 * 1000 };
- nanosleep(&ts, NULL);
+ nanosleep(&ts, nullptr);
#endif
}
diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp
index 948f697dc5..f843fc4236 100644
--- a/src/corelib/kernel/qtimer.cpp
+++ b/src/corelib/kernel/qtimer.cpp
@@ -277,7 +277,7 @@ protected:
};
QSingleShotTimer::QSingleShotTimer(int msec, Qt::TimerType timerType, const QObject *r, const char *member)
- : QObject(QAbstractEventDispatcher::instance()), hasValidReceiver(true), slotObj(0)
+ : QObject(QAbstractEventDispatcher::instance()), hasValidReceiver(true), slotObj(nullptr)
{
timerId = startTimer(msec, timerType);
connect(this, SIGNAL(timeout()), r, member);
@@ -290,7 +290,7 @@ QSingleShotTimer::QSingleShotTimer(int msec, Qt::TimerType timerType, const QObj
if (r && thread() != r->thread()) {
// Avoid leaking the QSingleShotTimer instance in case the application exits before the timer fires
connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, this, &QObject::deleteLater);
- setParent(0);
+ setParent(nullptr);
moveToThread(r->thread());
}
}
@@ -316,7 +316,7 @@ void QSingleShotTimer::timerEvent(QTimerEvent *)
if (Q_LIKELY(!receiver.isNull() || !hasValidReceiver)) {
// We allocate only the return type - we previously checked the function had
// no arguments.
- void *args[1] = { 0 };
+ void *args[1] = { nullptr };
slotObj->call(const_cast<QObject*>(receiver.data()), args);
}
} else {
diff --git a/src/corelib/kernel/qtimerinfo_unix.cpp b/src/corelib/kernel/qtimerinfo_unix.cpp
index 39010c19cb..b425ca3dcb 100644
--- a/src/corelib/kernel/qtimerinfo_unix.cpp
+++ b/src/corelib/kernel/qtimerinfo_unix.cpp
@@ -83,7 +83,7 @@ QTimerInfoList::QTimerInfoList()
}
#endif
- firstTimerInfo = 0;
+ firstTimerInfo = nullptr;
}
timespec QTimerInfoList::updateCurrentTime()
@@ -389,7 +389,7 @@ bool QTimerInfoList::timerWait(timespec &tm)
repairTimersIfNeeded();
// Find first waiting timer not already active
- QTimerInfo *t = 0;
+ QTimerInfo *t = nullptr;
for (QTimerInfoList::const_iterator it = constBegin(); it != constEnd(); ++it) {
if (!(*it)->activateRef) {
t = *it;
@@ -450,7 +450,7 @@ void QTimerInfoList::registerTimer(int timerId, int interval, Qt::TimerType time
t->interval = interval;
t->timerType = timerType;
t->obj = object;
- t->activateRef = 0;
+ t->activateRef = nullptr;
timespec expected = updateCurrentTime() + interval;
@@ -514,9 +514,9 @@ bool QTimerInfoList::unregisterTimer(int timerId)
// found it
removeAt(i);
if (t == firstTimerInfo)
- firstTimerInfo = 0;
+ firstTimerInfo = nullptr;
if (t->activateRef)
- *(t->activateRef) = 0;
+ *(t->activateRef) = nullptr;
delete t;
return true;
}
@@ -535,9 +535,9 @@ bool QTimerInfoList::unregisterTimers(QObject *object)
// object found
removeAt(i);
if (t == firstTimerInfo)
- firstTimerInfo = 0;
+ firstTimerInfo = nullptr;
if (t->activateRef)
- *(t->activateRef) = 0;
+ *(t->activateRef) = nullptr;
delete t;
// move back one so that we don't skip the new current item
--i;
@@ -571,7 +571,7 @@ int QTimerInfoList::activateTimers()
return 0; // nothing to do
int n_act = 0, maxCount = 0;
- firstTimerInfo = 0;
+ firstTimerInfo = nullptr;
timespec currentTime = updateCurrentTime();
// qDebug() << "Thread" << QThread::currentThreadId() << "woken up at" << currentTime;
@@ -643,11 +643,11 @@ int QTimerInfoList::activateTimers()
QCoreApplication::sendEvent(currentTimerInfo->obj, &e);
if (currentTimerInfo)
- currentTimerInfo->activateRef = 0;
+ currentTimerInfo->activateRef = nullptr;
}
}
- firstTimerInfo = 0;
+ firstTimerInfo = nullptr;
// qDebug() << "Thread" << QThread::currentThreadId() << "activated" << n_act << "timers";
return n_act;
}
diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp
index ddb96ecad6..93d75feafa 100644
--- a/src/corelib/kernel/qtranslator.cpp
+++ b/src/corelib/kernel/qtranslator.cpp
@@ -289,8 +289,8 @@ public:
#if defined(QT_USE_MMAP)
used_mmap(0),
#endif
- unmapPointer(0), unmapLength(0), resource(0),
- messageArray(0), offsetArray(0), contextArray(0), numerusRulesArray(0),
+ unmapPointer(nullptr), unmapLength(0), resource(nullptr),
+ messageArray(nullptr), offsetArray(nullptr), contextArray(nullptr), numerusRulesArray(nullptr),
messageLength(0), offsetLength(0), contextLength(0), numerusRulesLength(0) {}
#if defined(QT_USE_MMAP)
@@ -539,7 +539,7 @@ bool QTranslatorPrivate::do_load(const QString &realname, const QString &directo
ok = true;
} else {
delete resource;
- resource = 0;
+ resource = nullptr;
}
}
@@ -610,8 +610,8 @@ bool QTranslatorPrivate::do_load(const QString &realname, const QString &directo
delete [] unmapPointer;
delete d->resource;
- d->resource = 0;
- d->unmapPointer = 0;
+ d->resource = nullptr;
+ d->unmapPointer = nullptr;
d->unmapLength = 0;
return false;
@@ -874,10 +874,10 @@ bool QTranslatorPrivate::do_load(const uchar *data, qsizetype len, const QString
}
if (!ok) {
- messageArray = 0;
- contextArray = 0;
- offsetArray = 0;
- numerusRulesArray = 0;
+ messageArray = nullptr;
+ contextArray = nullptr;
+ offsetArray = nullptr;
+ numerusRulesArray = nullptr;
messageLength = 0;
contextLength = 0;
offsetLength = 0;
@@ -890,7 +890,7 @@ bool QTranslatorPrivate::do_load(const uchar *data, qsizetype len, const QString
static QString getMessage(const uchar *m, const uchar *end, const char *context,
const char *sourceText, const char *comment, uint numerus)
{
- const uchar *tn = 0;
+ const uchar *tn = nullptr;
uint tn_length = 0;
const uint sourceTextLen = uint(strlen(sourceText));
const uint contextLen = uint(strlen(context));
@@ -957,11 +957,11 @@ end:
QString QTranslatorPrivate::do_translate(const char *context, const char *sourceText,
const char *comment, int n) const
{
- if (context == 0)
+ if (context == nullptr)
context = "";
- if (sourceText == 0)
+ if (sourceText == nullptr)
sourceText = "";
- if (comment == 0)
+ if (comment == nullptr)
comment = "";
uint numerus = 0;
@@ -1076,13 +1076,13 @@ void QTranslatorPrivate::clear()
}
delete resource;
- resource = 0;
- unmapPointer = 0;
+ resource = nullptr;
+ unmapPointer = nullptr;
unmapLength = 0;
- messageArray = 0;
- contextArray = 0;
- offsetArray = 0;
- numerusRulesArray = 0;
+ messageArray = nullptr;
+ contextArray = nullptr;
+ offsetArray = nullptr;
+ numerusRulesArray = nullptr;
messageLength = 0;
contextLength = 0;
offsetLength = 0;
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index d1eb463514..455dd5069f 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -2523,7 +2523,7 @@ void QVariant::load(QDataStream &s)
return;
}
}
- create(typeId, 0);
+ create(typeId, nullptr);
d.is_null = is_null;
if (!isValid()) {