QDebugStateSaver 类

方便类为自定义 QDebug 运算符。 更多...

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

该类在 Qt 5.1 引入。

公共函数

QDebugStateSaver (QDebug & dbg )
~QDebugStateSaver ()

详细描述

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 << Qt::hex QDebug operator doesn't affect other QDebug 运算符。

成员函数文档编制

QDebugStateSaver:: QDebugStateSaver ( QDebug & dbg )

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

另请参阅 QDebug::setAutoInsertSpaces () 和 QDebug::autoInsertSpaces ().

QDebugStateSaver:: ~QDebugStateSaver ()

销毁 QDebugStateSaver instance, which restores the settings used when the QDebugStateSaver instance was created.

另请参阅 QDebug::setAutoInsertSpaces () 和 QDebug::autoInsertSpaces ().