Important: Please read the Qt Code of Conduct -

QML source code visible in executable.

  • Hi,

    Apologies if this is a simple question, as I am new to QT.

    Could anyone advise me if it is possible to hide the QML source code in the compiled exe/app file, so you can't view it using a text editor etc?

    Thank you for your kind advice.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You can use Qt's resource system. It's described "here":

    Hope it helps

  • Hi,

    Thank you for your advice, it's good to be here.

    I have tried using this method but the source of the qml file is still readable from inside the executable with a text editor. I does however compile all the c++ code and and qml together into a self contained executable.

    Is there a method that with encode the plain text of the qml file so simple viewing of the executable would not reveal the full qml source code.

    My application uses some c++ but most of the logic and interface is qml, so I would prefer it to be obscured in some way.

    Kind regards,


  • Hi again,

    I have had some success adjusting the resource compression threshold flag, although not perfect it would stop some eager eyes from viewing the qml code. Is this the best solution available?

    Thank you for your time.

    Kind regards,


  • Moderators


    The only solution for this currently is to use "QtQuickCompiler": But unfortunately this is not available in Qt Open Source. If you have an enterprise license you can use it.

Log in to reply