Is it possible to use a cross-platform QRC file?

Is it possible to have platform sections in a QRC file, how can we do with a QT.Pro file? (e.g. macx, win32, etc.)

I was wondering if I can divide Mac, windows, linux specific resources into sections in the QRC file itself or have three QRC files for each platform and execute conditional sections of the platform from the .pro file that link to them.

+4
source share
1 answer

The resource system is intended only for packaging binary files with an executable file, you cannot distinguish it in order to make which resources are packed, but yes, you can make several .qrc packages and add them on the platform to your .pro

RESOURCES += common.qrc win32:RESOURCES += windows.qrc linux:RESOURCES += linux.qrc mac:RESOURCE += mac.qrc 

Alternatively, you can have platform prefixes in your .qrc and refer to resources such as: / (set platform line) /resource/file.end. The first method is more accurate, since only resources in the .qrc files that you add to the assembly will be added to the application executable file.

+9
source

Source: https://habr.com/ru/post/1336211/


All Articles