W3cubDocs

/Qt 5.13

QDebugStateSaver Class

Convenience class for custom QDebug operators. More...

Header: #include <QDebugStateSaver>
qmake: QT += core
Since: Qt 5.1

This class was introduced in Qt 5.1.

Public Functions

QDebugStateSaver(QDebug &dbg)
~QDebugStateSaver()

Detailed Description

Saves the settings used by QDebug, and restores them upon destruction, then calls maybeSpace(), to separate arguments with a space if autoInsertSpaces() was true at the time of constructing the QDebugStateSaver.

The automatic insertion of spaces between writes is one of the settings that QDebugStateSaver stores for the duration of the current block.

The settings of the internal QTextStream are also saved and restored, so that using << hex in a QDebug operator doesn't affect other QDebug operators.

Member Function Documentation

QDebugStateSaver::QDebugStateSaver(QDebug &dbg)

Creates a QDebugStateSaver instance, which saves the settings currently used by dbg.

See also QDebug::setAutoInsertSpaces() and QDebug::autoInsertSpaces().

QDebugStateSaver::~QDebugStateSaver()

Destroys a QDebugStateSaver instance, which restores the settings used when the QDebugStateSaver instance was created.

See also QDebug::setAutoInsertSpaces() and QDebug::autoInsertSpaces().

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-5.13/qdebugstatesaver.html