From f53621af053f313eff7fa7b204b5cceff675cb64 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 31 Mar 2015 15:49:08 +0200 Subject: 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 --- src/corelib/doc/snippets/qdebug/qdebugsnippet.cpp | 7 ++++--- src/corelib/doc/snippets/qloggingcategory/main.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src/corelib') 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 usbEntries() { -- cgit v1.2.3