QDebugStateSaver 類

方便類為自定義 QDebug operators 更多...

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

公共函數

QDebugStateSaver (QDebug & dbg )
~QDebugStateSaver ()

詳細描述

方便類為自定義 QDebug operators

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 運算符。

成員函數文檔編製

QDebugStateSaver:: QDebugStateSaver ( QDebug & dbg )

創建 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 ().