summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-03-30 14:24:21 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-03-30 12:59:58 +0000
commit3203ac3f4e245427902bd912cb0c644c7e870657 (patch)
tree9c5bf3dc0b22d59bc683a5cbccadc2a82e27644b /src/gui/kernel
parentc7b003ea3b8b4b7124d4971df7d910f2bc3fc4fa (diff)
Use QDebugStateSaver to restore space setting in stream operators.
Returning dbg.space() breaks formatting on streams that already have nospace() set. Change-Id: I55e38b018679a67eb40be6b4664505483a3a7d8e Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qcursor.cpp3
-rw-r--r--src/gui/kernel/qkeysequence.cpp3
-rw-r--r--src/gui/kernel/qpalette.cpp3
-rw-r--r--src/gui/kernel/qshortcutmap.cpp6
-rw-r--r--src/gui/kernel/qsurfaceformat.cpp3
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp6
6 files changed, 16 insertions, 8 deletions
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index 7e073370f2..6ed750eda1 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.cpp
@@ -601,8 +601,9 @@ QCursor::operator QVariant() const
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QCursor &c)
{
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QCursor(Qt::CursorShape(" << c.shape() << "))";
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index bdf401aa2d..23d5f06aa2 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -1601,8 +1601,9 @@ QDataStream &operator>>(QDataStream &s, QKeySequence &keysequence)
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QKeySequence &p)
{
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QKeySequence(" << p.toString() << ')';
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index 58bcc2cc5b..cf17e1b5aa 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -1152,6 +1152,7 @@ QDebug operator<<(QDebug dbg, const QPalette &p)
"BrightText", "ButtonText", "Base", "Window", "Shadow", "Highlight",
"HighlightedText", "Link", "LinkVisited", "AlternateBase", "NoRole",
"ToolTipBase","ToolTipText" };
+ QDebugStateSaver saver(dbg);
QDebug nospace = dbg.nospace();
const uint mask = p.resolve();
nospace << "QPalette(resolve=" << hex << showbase << mask << ',';
@@ -1171,7 +1172,7 @@ QDebug operator<<(QDebug dbg, const QPalette &p)
}
}
nospace << ')' << noshowbase << dec;
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp
index 16d278b473..0ff5c36119 100644
--- a/src/gui/kernel/qshortcutmap.cpp
+++ b/src/gui/kernel/qshortcutmap.cpp
@@ -88,14 +88,16 @@ struct QShortcutEntry
/*! \internal
QDebug operator<< for easy debug output of the shortcut entries.
*/
-static QDebug &operator<<(QDebug &dbg, const QShortcutEntry *se) {
+static QDebug &operator<<(QDebug &dbg, const QShortcutEntry *se)
+{
+ QDebugStateSaver saver(dbg);
if (!se)
return dbg << "QShortcutEntry(0x0)";
dbg.nospace()
<< "QShortcutEntry(" << se->keyseq
<< "), id(" << se->id << "), enabled(" << se->enabled << "), autorepeat(" << se->autorepeat
<< "), owner(" << se->owner << ')';
- return dbg.space();
+ return dbg;
}
#endif // QT_NO_DEBUGSTREAM
diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp
index d5f5b358b3..d078336d73 100644
--- a/src/gui/kernel/qsurfaceformat.cpp
+++ b/src/gui/kernel/qsurfaceformat.cpp
@@ -812,6 +812,7 @@ bool operator!=(const QSurfaceFormat& a, const QSurfaceFormat& b)
QDebug operator<<(QDebug dbg, const QSurfaceFormat &f)
{
const QSurfaceFormatPrivate * const d = f.d;
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QSurfaceFormat("
<< "version " << d->major << '.' << d->minor
@@ -828,7 +829,7 @@ QDebug operator<<(QDebug dbg, const QSurfaceFormat &f)
<< ", profile " << d->profile
<< ')';
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 73b1a84005..b17978cb7d 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -781,10 +781,12 @@ void QWindowSystemInterface::handleEnterWhatsThisEvent()
#endif
#ifndef QT_NO_DEBUG_STREAM
-Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QWindowSystemInterface::TouchPoint &p) {
+Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QWindowSystemInterface::TouchPoint &p)
+{
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "TouchPoint(" << p.id << " @" << p.area << " normalized " << p.normalPosition
<< " press " << p.pressure << " vel " << p.velocity << " state " << (int)p.state;
- return dbg.space();
+ return dbg;
}
#endif