Qt World Summit: Submit your Presentation

Do I really have to deploy 700 files with my QML application?

  • I am deploying a relatively small QML application on Windows using Qt 5.12.9. I have deployed QtWidget apps before but this is my first QML app. It is a pretty simple dialog app with a ComboBox, a FileDialog, and a ScrollView. I used the windeployqt tool (with the --qmldir and --release options) to gather the dependencies. The good news is I was able to successfully install and launch the app on a clean computer. The bad news is there are over 700 files in the dependency list generated by windeployqt that I now have to get into an existing installer with other apps. The bulk of these files (651 of them) are under the folder QtQuick. Most of them are .qml and .qmc files.

    My questions are:

    1. Am I doing something wrong that all of these files are being included?
    2. If I have to include them in the deployment, is there a way to move these dependencies to a location other than the directory containing the executable? I tried to use qt.conf but that did not seem to apply to these dependencies.


  • use qrc to store qml files which are not needed to be included in deployment.

  • @JoeCFD I am using qrc to store my QML files. These are files like "ApplicationWindow.qml" "ComboBox.qml" etc. Part of Qt infrastructure; not stuff I wrote. Are you saying there is a way to get all of this packaged in the qrc?

  • @David_S right. Put all of them into one qrc file. Use qml files from qrc. Then they will not be needed for deployment. Same as ui files.

  • @JoeCFD Is there a utility to do this? There are literally over 700 files in nested folders.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    How many different QtQuick modules are you using ?
    Maybe a silly question but did you point qmldir to your application sources ?

  • @SGaist Thanks.
    I only have one QML file and it imports
    QtQuick 2.12
    QtQuick.Window 2.12
    QtQuick.Controls 2.12
    QtQuick.Layouts 1.3
    QtQuick.Dialogs 1.0

    The rest is C++.

    I pointed the --qmldir to my source code directory.

    So I take it this is uncommon?

  • Moderators

    @JoeCFD said in Do I really have to deploy 700 files with my QML application?:

    @David_S right. Put all of them into one qrc file. Use qml files from qrc. Then they will not be needed for deployment. Same as ui files.

    omg, just dont do it.... how can you give such a terrible advise?!
    Beside that it wont work anyway afterall ...

  • I built the "Qt Quick Layouts - Basic Example" in release and then ran windeployqt on it. It pulled in almost 450 files. So I guess this is something we just have to deal with when deploying QML?

  • Moderators

    @David_S The thing is, the windepolyqt tool is not perfect.

    it will parse your project, it sees Oh you're using layouts! Let me get EVERYTHING layout related! when in fact, you only use it for one row layout or something.

    The tool errors on the side of caution. Same with dlls actually, Oh, you're loading an Image, let me get all the image formats dll's even if you only use pngs!

    It gets the job done, you hardly ever have to add something from the Qt directory by hand, when you used the tool(correctly)

    On the up side: Your application folder, from now on, will hardly grow bigger, compared to its current size. As long as you do not add additional modules or such.

    On the down side: If you actually want to ship a minimalistic folder, you'll have to manually check the content folder and remove unneeded stuff.

    Make sure to test the application after each removal. The problem with this is also, that a bunch of QML stuff is not loaded/needed on start up and you may only later on, notice this, deep inside the application on page 215 when 20 other conditions are met.

    So, be cautious!

  • @J-Hilk Thanks for the reply. This adds a bit of complexity to my WIX installer since I don't want to list all 700+ files individually. Do you know if there is anyway to deploy these files in a folder other than where the executable is located? I would like to dump all of the QT dependencies in one folder (which can have subfolders) but I need to be able to "blow away" all of the Qt related dependencies by deleting one directory while being confident that I didn't delete anything but Qt dependencies.