QObject: use QDebugStateSaver in the QDebug operator<<

Also remove the ending space if the object is null

Change-Id: Ieb2bb903de35b4e339c812cd07555b5d108d118b
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
This commit is contained in:
Olivier Goffart 2014-10-23 17:26:29 +02:00 committed by Kai Koehne
parent 89ae5c03a2
commit 6e1718987e

View File

@ -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