QDebugStateSaver Class
사용자 지정 QDebug 운영자를 위한 편의 클래스입니다. 더 보기...
Header: | #include <QDebugStateSaver> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) |
qmake: | QT += core |
공용 함수
QDebugStateSaver(QDebug &dbg) | |
~QDebugStateSaver() |
자세한 설명
QDebug 에서 사용한 설정을 저장하고 파괴 시 복원하며, QDebugStateSaver를 구성할 때 autoInsertSpaces()가 참이면 maybeSpace()을 호출하여 인수를 공백으로 구분합니다.
쓰기 사이에 공백을 자동으로 삽입하는 것은 현재 블록의 지속 시간 동안 QDebugStateSaver가 저장하는 설정 중 하나입니다.
내부 QTextStream 의 설정도 저장 및 복원되므로 QDebug 연산자에서 << Qt::hex 을 사용해도 다른 QDebug 연산자에 영향을 미치지 않습니다.
QDebugStateSaver는 일반적으로 디버깅을 위한 연산자<<()의 구현에 사용됩니다:
QDebug operator<<(QDebug dbg, const Message &message) { const QList<QStringView> pieces = message.body().split(u"\r\n", Qt::SkipEmptyParts); if (pieces.isEmpty()) dbg.nospace() << "Message()"; else if (pieces.size() == 1) dbg.nospace() << "Message(" << pieces.first() << ")"; else dbg.nospace() << "Message(" << pieces.first() << " ...)"; return dbg; }
멤버 함수 문서
QDebugStateSaver::QDebugStateSaver(QDebug &dbg)
현재 dbg 에서 사용하는 설정을 저장하는 QDebugStateSaver 인스턴스를 생성합니다.
QDebug::setAutoInsertSpaces() 및 QDebug::autoInsertSpaces()도 참조하세요 .
[noexcept]
QDebugStateSaver::~QDebugStateSaver()
QDebugStateSaver 인스턴스를 만들 때 사용된 설정을 복원하는 QDebugStateSaver 인스턴스를 삭제합니다.
QDebug::setAutoInsertSpaces() 및 QDebug::autoInsertSpaces()도 참조하세요 .
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.