summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-03-31 15:49:08 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-04-01 04:28:08 +0000
commitf53621af053f313eff7fa7b204b5cceff675cb64 (patch)
treef1f49abf2a7494c028fadda9eb36f0e40794692f /src
parent7c2360b762817743484ddc5bc9ba3f48a7b68d84 (diff)
Update documentation snippets related to QDebug.
Use QDebugStateSaver to store the formatting state and fix the return statement to return the unmodified stream. Change-Id: I476d13c5487a89f263dcc11334fc67c85d9433f5 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/doc/snippets/qdebug/qdebugsnippet.cpp7
-rw-r--r--src/corelib/doc/snippets/qloggingcategory/main.cpp7
2 files changed, 8 insertions, 6 deletions
diff --git a/src/corelib/doc/snippets/qdebug/qdebugsnippet.cpp b/src/corelib/doc/snippets/qdebug/qdebugsnippet.cpp
index f71d61ed47..a9ab83f5bf 100644
--- a/src/corelib/doc/snippets/qdebug/qdebugsnippet.cpp
+++ b/src/corelib/doc/snippets/qdebug/qdebugsnippet.cpp
@@ -51,11 +51,12 @@ public:
};
//! [0]
-QDebug operator<<(QDebug dbg, const Coordinate &c)
+QDebug operator<<(QDebug debug, const Coordinate &c)
{
- dbg.nospace() << "(" << c.x() << ", " << c.y() << ")";
+ QDebugStateSaver saver(debug);
+ debug.nospace() << '(' << c.x() << ", " << c.y() << ')';
- return dbg.space();
+ return debug;
}
//! [0]
diff --git a/src/corelib/doc/snippets/qloggingcategory/main.cpp b/src/corelib/doc/snippets/qloggingcategory/main.cpp
index 6b66424875..8d76c5736e 100644
--- a/src/corelib/doc/snippets/qloggingcategory/main.cpp
+++ b/src/corelib/doc/snippets/qloggingcategory/main.cpp
@@ -59,10 +59,11 @@ struct UsbEntry {
int classtype;
};
-QDebug operator<<(QDebug &dbg, const UsbEntry &entry)
+QDebug operator<<(QDebug &debug, const UsbEntry &entry)
{
- dbg.nospace() << "" << entry.id << " (" << entry.classtype << ")";
- return dbg.space();
+ QDebugStateSaver saver(debug);
+ debug.nospace() << "" << entry.id << " (" << entry.classtype << ')';
+ return debug;
}
QList<UsbEntry> usbEntries() {