问题
I want to use a Qt external resource file as an expansion file for my Android app. The total size of the resource to be bundled in the resource file is 700+ MB. I have experienced that the resource compiler (rcc) can not handle more than about 500MB before it hangs and crash on my computer. I would really want to make on big file as this makes it a lot easier when uploading expansion files for Android.
I run the rcc tool from the commandline with the following arguments:
rcc -binary -no-compression myQrcFile.qrc -o myOutputFile
I need to use no compression to be able to play video files bundled in the resource file directly, but this is not a problem here.
I have two questions, but the first one is the primary one:
- Is there some way to bundle files with a total file size of more than 500MB in one file?
- Does the size of an external Qt resource file have an impact on the performance of the application? Larger file = slow load or similar?
回答1:
For creating a smaller resource data, you may try to change the compression (s, -compress)
For the faster loading, there seems to be two possibilities to embedd the resources in Qt.
Unless you specify explicitly to create the resources-data as an external library, the resource data is embedded in the executable and will be loaded at the application start (make sense for app-icons, fonts, etc)
If you compile the data with the -binary option
rcc -binary myresource.qrc -o myresource.rcc
you'll build the data into a dynamic library, which you may load at a later point than the application-start with the call
QResource::registerResource("/path/to/myresource.rcc");
Here is a similar quistion on SO, which however is focused on dynamic loading of resources, no on the size: How can I embed a Qt resource into a .dll file?
These links should be helpful:
http://doc.qt.io/qt-5/resources.html
http://doc.qt.io/qt-5/rcc.html
回答2:
I used MinGW which is a 32-bit compiler. I changed to MSVC 64-bit compiler and I could create large external resource files.
来源:https://stackoverflow.com/questions/32040838/large-qt-external-binary-resource-file