Large Qt external binary resource file

こ雲淡風輕ζ 提交于 2019-12-23 02:07:12

问题


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:

  1. Is there some way to bundle files with a total file size of more than 500MB in one file?
  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!