Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QML and Pyside2 application deployment
MKCV last edited by
I am trying to develop an application using QML and PySide2. I tried to build the executable file using Pyinstaller. All my QML files are added as "datas" in the pyinstaller spec file so that after building an executable file (.exe) all QML files are copied directly into the executable folder and able to run the .exe file. If I share this executable file to other users they are able to run the application but also they are able to read the QML files.
But I am wondering is there a way to create an executable file in such a way that the users should not be able to read the QML code (may be adding qml files as binaries in the executable file). Is there a way to do this ?? . Thanks.
Hi and welcome to the forums
Normally one will add the QML files to a resource file and compile that into the exe. its also possible to have it as an external resource file and open that runtime. Im not strong in python and since there is not real exe to speak of, then
i think maybe a external resource file is the way to go.
Qt can read the file sin the ressource file like it was a normal file system.
MKCV last edited by MKCV
@mrjj , Thank you for the response.
In the link (
https://stackoverflow.com/questions/57118666/access-image-in-qresource-file-from-qml ) explained how to add the QML files in the resource file (qml.qrc ) and convert into python file using rcc (pyside2-rcc qml.qrc -o qml_rc.py) and import the generated python file (qml_rc.py) in the main.py file. This way QML files are not added directly into the executable folder.