QtBase  v6.3.1
Public Member Functions | List of all members
QDebugStateSaver Class Reference

Convenience class for custom QDebug operators. More...

#include <qdebug.h>

Public Member Functions

 QDebugStateSaver (QDebug &dbg)
 
 ~QDebugStateSaver ()
 

Detailed Description

Convenience class for custom QDebug operators.

\inmodule QtCore

Saves the settings used by QDebug, and restores them upon destruction, then calls \l {QDebug::maybeSpace()}{maybeSpace()}, to separate arguments with a space if \l {QDebug::autoInsertSpaces()}{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 << Qt::hex in a QDebug operator doesn't affect other QDebug operators.

QDebugStateSaver is typically used in the implementation of an operator<<() for debugging:

Since
5.1

Definition at line 175 of file qdebug.h.

Constructor & Destructor Documentation

◆ QDebugStateSaver()

QDebugStateSaver::QDebugStateSaver ( QDebug dbg)

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

See also
QDebug::setAutoInsertSpaces(), QDebug::autoInsertSpaces()

Definition at line 1016 of file qdebug.cpp.

◆ ~QDebugStateSaver()

QDebugStateSaver::~QDebugStateSaver ( )

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

See also
QDebug::setAutoInsertSpaces(), QDebug::autoInsertSpaces()

Definition at line 1027 of file qdebug.cpp.


The documentation for this class was generated from the following files: