Important: Please read the Qt Code of Conduct -

QML and Pyside2 application deployment

  • 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.

  • Lifetime Qt Champion

    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.

  • @mrjj , Thank you for the response.
    In the link ( ) 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 and import the generated python file ( in the file. This way QML files are not added directly into the executable folder.

Log in to reply