I’m using QWebView to run a web app. There are 650+ files. Placing the web app’s directory in the source directory does not result in the executable bundling the directory.
How do I include the entire web app directory so that the executable will be able to render the files.
Note: I have currently added index.html as a resource, and can access it with qrc:// – But since I cannot add the entire directory structure to a qrc (can I?), the executable does not include the other files.
You need to put an XML node into the
.qrcfile for each file you want to use using the Qt resource system.This can be done using a simple pre-build script. Take a look at
qrcgen. Quoting the blog post behind this link:In order to update the
.qrcfile whenever your directory contens change, you need to include this step into your build process:For C++/Qt projects, you can add this step in the build configuration in QtCreator or add in your qmake file a
system(...)statement. Note that such commands aren’t portable in general. (If it’s not portable, you can put some operating system conditions around multiple commands.)For PyQt/PySide projects, I don’t know how to do this, but I’m sure you find a solution for this too.