From 868201155fd677dbc6d14346f5ea61e82ebce27b Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 23 Jan 2015 16:19:11 +0100 Subject: QtCore: Use QDebugStateSaver in (almost) all QDebug operator<< Unify the behavior of the different operator<< by always using QDebugStateSaver (appending an optional space at exit), and making sure that the space(), nospace() setting isn't 'leaked'. Change-Id: I38e4f82fa6f7419d8b5edfc4dc37495af497e8ac Reviewed-by: Alex Blasche --- src/corelib/tools/qlocale.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/corelib/tools/qlocale.cpp') diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 78334563dd..f589777e65 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -3583,10 +3583,12 @@ QString QLocale::nativeCountryName() const #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug dbg, const QLocale &l) { - dbg.nospace() << "QLocale(" << qPrintable(QLocale::languageToString(l.language())) - << ", " << qPrintable(QLocale::scriptToString(l.script())) - << ", " << qPrintable(QLocale::countryToString(l.country())) << ')'; - return dbg.space(); + QDebugStateSaver saver(dbg); + dbg.nospace().noquote() + << "QLocale(" << QLocale::languageToString(l.language()) + << ", " << QLocale::scriptToString(l.script()) + << ", " << QLocale::countryToString(l.country()) << ')'; + return dbg; } #endif QT_END_NAMESPACE -- cgit v1.2.3