From 87aceebf42af5bbc7ea96ac1a60a7ba030ad3e3f Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 20 Jun 2014 14:44:48 +0200 Subject: QDebug: Add resetFormat() Similar to QTextStream::reset(), this resets the stream format to the defaults. Its primary use is inside custom operator<< implementations, where you'd want to have a fixed format regardless of the current stream state. Change-Id: I421d76c61f164579bb90cf4195cc5376e2dcf0f3 Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qdebug.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/corelib/io/qdebug.cpp') diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp index 038e9cb0a3..ef9c654266 100644 --- a/src/corelib/io/qdebug.cpp +++ b/src/corelib/io/qdebug.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -151,6 +151,21 @@ QDebug::~QDebug() very fast and never fails. */ +/*! + Resets the stream formatting options, bringing it back to its original constructed state. + + \sa space(), quote() + \since 5.4 +*/ +QDebug &QDebug::resetFormat() +{ + stream->ts.reset(); + stream->space = true; + if (stream->context.version > 1) + stream->flags = 0; + return *this; +} + /*! \fn QDebug &QDebug::space() -- cgit v1.2.3