qt_noo_utf8_source
防止强制将 Windows 源文件视为 UTF-8。
该属性在 Qt 6.0 中引入。
当使用某些 Windows 编译器构建时,链接到 Qt 库的目标将使用强制编译器将其源文件处理为 UTF-8 的标志。目前,Visual Studio 和英特尔编译器已实现了这一功能。您可以将该属性设置为TRUE
,从而在每个目标上禁用此行为:
set_property(TARGET target_name PROPERTY QT_NO_UTF8_SOURCE TRUE)
注意: 这不会改变QString 等类的运行时行为(其来自const char *
的构造函数需要正确编码的 UTF-8 输入)。请使用QT_NO_CAST_FROM_ASCII 和QT_RESTRICTED_CAST_FROM_ASCII
宏帮助识别此类代码。
另请参阅 qt_disable_unicode_defines()和qt6_allow_non_utf8_sources()。
© 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.