summaryrefslogtreecommitdiff
path: root/src/corelib/kernel/qvariant.cpp
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@theqtcompany.com>2015-01-23 16:19:11 +0100
committerKai Koehne <kai.koehne@theqtcompany.com>2015-02-09 11:30:02 +0000
commit868201155fd677dbc6d14346f5ea61e82ebce27b (patch)
tree75d02a144c205d659e5851f95f306e3a12b0ff5e /src/corelib/kernel/qvariant.cpp
parent6389160f04322449c34bd1ecfe53983e3b588943 (diff)
downloadqtbase-868201155fd677dbc6d14346f5ea61e82ebce27b.tar.gz
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 <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/corelib/kernel/qvariant.cpp')
-rw-r--r--src/corelib/kernel/qvariant.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index df1b4ed872..9e61813e20 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -3424,10 +3424,11 @@ bool QVariant::isNull() const
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QVariant &v)
{
+ QDebugStateSaver saver(dbg);
const uint typeId = v.d.type;
dbg.nospace() << "QVariant(";
if (typeId != QMetaType::UnknownType) {
- dbg.nospace() << QMetaType::typeName(typeId) << ", ";
+ dbg << QMetaType::typeName(typeId) << ", ";
bool userStream = false;
bool canConvertToString = false;
if (typeId >= QMetaType::User) {
@@ -3439,19 +3440,20 @@ QDebug operator<<(QDebug dbg, const QVariant &v)
else if (!userStream)
handlerManager[typeId]->debugStream(dbg, v);
} else {
- dbg.nospace() << "Invalid";
+ dbg << "Invalid";
}
- dbg.nospace() << ')';
- return dbg.space();
+ dbg << ')';
+ return dbg;
}
QDebug operator<<(QDebug dbg, const QVariant::Type p)
{
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QVariant::"
<< (int(p) != int(QMetaType::UnknownType)
? QMetaType::typeName(p)
: "Invalid");
- return dbg.space();
+ return dbg;
}
#endif