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.