From 6e1718987e0f781bfd4f7036cc404f762c2301a8 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 23 Oct 2014 17:26:29 +0200 Subject: QObject: use QDebugStateSaver in the QDebug operator<< Also remove the ending space if the object is null Change-Id: Ieb2bb903de35b4e339c812cd07555b5d108d118b Reviewed-by: Kai Koehne --- src/corelib/kernel/qobject.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index d153b2e4f9..223de0c8e0 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -4093,14 +4093,16 @@ QObjectUserData* QObject::userData(uint id) const #ifndef QT_NO_DEBUG_STREAM -QDebug operator<<(QDebug dbg, const QObject *o) { +QDebug operator<<(QDebug dbg, const QObject *o) +{ + QDebugStateSaver saver(dbg); if (!o) - return dbg << "QObject(0x0) "; + return dbg << "QObject(0x0)"; dbg.nospace() << o->metaObject()->className() << '(' << (void *)o; if (!o->objectName().isEmpty()) dbg << ", name = " << o->objectName(); dbg << ')'; - return dbg.space(); + return dbg; } #endif -- cgit v1.2.3