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:
parent
89ae5c03a2
commit
6e1718987e
@ -4093,14 +4093,16 @@ QObjectUserData* QObject::userData(uint id) const
|
|||||||
|
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG_STREAM
|
#ifndef QT_NO_DEBUG_STREAM
|
||||||
QDebug operator<<(QDebug dbg, const QObject *o) {
|
QDebug operator<<(QDebug dbg, const QObject *o)
|
||||||
|
{
|
||||||
|
QDebugStateSaver saver(dbg);
|
||||||
if (!o)
|
if (!o)
|
||||||
return dbg << "QObject(0x0) ";
|
return dbg << "QObject(0x0)";
|
||||||
dbg.nospace() << o->metaObject()->className() << '(' << (void *)o;
|
dbg.nospace() << o->metaObject()->className() << '(' << (void *)o;
|
||||||
if (!o->objectName().isEmpty())
|
if (!o->objectName().isEmpty())
|
||||||
dbg << ", name = " << o->objectName();
|
dbg << ", name = " << o->objectName();
|
||||||
dbg << ')';
|
dbg << ')';
|
||||||
return dbg.space();
|
return dbg;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user