本页内容

QMessageLogContext Class

QMessageLogContext 类提供了有关日志消息的更多信息。更多内容...

头文件: #include <QMessageLogContext>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core

详细描述

该类提供了有关qDebug()、qInfo()、qWarning()、qCritical()或qFatal()消息生成时源代码位置的信息。

注意:默认情况下 ,此信息仅在调试版本中记录。您可以通过定义QT_MESSAGELOGCONTEXT 或QT_NO_MESSAGELOGCONTEXT 来显式覆盖此设置。

另请参阅 QMessageLogger 、QtMessageHandler 以及qInstallMessageHandler()。

© 2026 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.