summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qdebug.cpp
diff options
context:
space:
mode:
authorKai Köhne <kai.koehne@qt.io>2022-03-12 11:05:12 +0100
committerKai Köhne <kai.koehne@qt.io>2022-03-16 15:56:17 +0100
commit9f5f64e9dbd916679bd881ee0331da9a3dacac32 (patch)
tree974128adff667bd9c6c7c886846be706ab87c756 /src/corelib/io/qdebug.cpp
parent21bffeec9031bc1b5e1cb518508650fe4ad04225 (diff)
Use QDebugStateSaver in example operator<<()
This makes sure that changes in the debug stream - like nospace() - do not "leak". Also use the example snippet in QDebugStateSaver documentation. Pick-to: 6.2 6.3 Change-Id: I934976d2c7c2335abfec68c763526a5cbb0e6f1e Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/corelib/io/qdebug.cpp')
-rw-r--r--src/corelib/io/qdebug.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp
index a7ce66ad148..4956b2a59c9 100644
--- a/src/corelib/io/qdebug.cpp
+++ b/src/corelib/io/qdebug.cpp
@@ -961,6 +961,10 @@ QDebug &QDebug::resetFormat()
so that using << Qt::hex in a QDebug operator doesn't affect other QDebug
operators.
+ QDebugStateSaver is typically used in the implementation of an operator<<() for debugging:
+
+ \snippet tools/customtype/message.cpp custom type streaming operator
+
\since 5.1
*/