QT_DISCARD_FILE_CONTENTS

Specifies that the given files should be empty in the resource file system

This property was introduced in Qt 6.6.

Note: This property is in technology preview and may change in future releases.

When using the target-based variant of qt_add_resources or qt_add_qml_module, setting this property to TRUE causes the file contents to be omitted when creating the resource file system. The file name is retained.

This is useful if you want to strip QML source code from the binary.

Note: If you omit the QML source code from the binary, the QML engine has to rely on the compilation units created by qmlcachegen or qmlsc. Those are tied to the specific version of Qt they were built with. If you change the version of Qt your application uses, they can't be loaded anymore.

See also The Qt Resource System.

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