qt_discard_file_contents

指定资源文件系统中的给定文件应为空

此属性在 Qt 6.6 中引入。

注意: 此属性为技术预览版,在未来版本中可能会更改。

当使用基于目标的qt_add_resourcesqt_add_qml_module 变体时,将此属性设置为TRUE 会导致在创建资源文件系统时省略文件内容。文件名将保留。

如果你想从二进制文件中剥离 QML 源代码,这很有用。

注意: 如果从二进制文件中省略 QML 源代码,QML 引擎就必须依赖qmlcachegenqmlsc 创建的编译单元。这些单元与它们构建时使用的特定 Qt 版本相关。如果更改了应用程序使用的 Qt 版本,它们就无法再被加载。

另请参阅 Qt 资源系统

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