From 91c9cae720004ad6bb0c7b3b7e6f64a9e6a6fcf3 Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 7 Feb 2014 16:12:35 +0100 Subject: QDebugStateSaver: call maybeSpace() in destructor. tst_qdebug didn't test adding something else after the MyLine object, so I didn't realize that a space was missing there. All debug operators should end with maybeSpace(), but with the settings of the caller, so this requires restoring the settings before calling it. To make it convenient for all << operators, the destructor of QDebugStateSaver takes care of that. Change-Id: I18ab78d99d7ee3be951082b5b5d34718ee60e21d Reviewed-by: Thiago Macieira --- src/corelib/tools/qpoint.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/corelib/tools/qpoint.cpp') diff --git a/src/corelib/tools/qpoint.cpp b/src/corelib/tools/qpoint.cpp index 565b1223fe..f154e4c612 100644 --- a/src/corelib/tools/qpoint.cpp +++ b/src/corelib/tools/qpoint.cpp @@ -451,15 +451,18 @@ QDataStream &operator>>(QDataStream &s, QPoint &p) */ #ifndef QT_NO_DEBUG_STREAM -QDebug operator<<(QDebug dbg, const QPoint &p) { +QDebug operator<<(QDebug dbg, const QPoint &p) +{ + QDebugStateSaver saver(dbg); dbg.nospace() << "QPoint(" << p.x() << ',' << p.y() << ')'; - return dbg.space(); + return dbg; } -QDebug operator<<(QDebug d, const QPointF &p) +QDebug operator<<(QDebug dbg, const QPointF &p) { - d.nospace() << "QPointF(" << p.x() << ", " << p.y() << ')'; - return d.space(); + QDebugStateSaver saver(dbg); + dbg.nospace() << "QPointF(" << p.x() << ',' << p.y() << ')'; + return dbg; } #endif -- cgit v1.2.3