[Solved] Qt Quick qml widgets in Widget application are missing when deployed?



  • Hi,

    I have a desktop Qt Widget client application, where I have added a qml start/stop button, and added to the layout by doing the following:
    startStopWidget_ = new WidgetStartStop();
    startStopWidget_->setObjectName(QStringLiteral("startStopWidget"));
    startStopWidget_->setResizeMode(QQuickWidget::SizeRootObjectToView);
    startStopWidget_->setSource(QUrl(QStringLiteral("qrc:/res/qml/buttonstartstop.qml")));

    When running the application from anywhere on my development PC, the qml widget is properly displayed. But if I deploy the application to another machine, not having IDE environments installed, the widget is empty. I'm not copying the qml file with the exe file since I assume, that it's part of the resources compiled into the exe. At least on the development PC I don't need to copy the qml file with the exe.

    I'm using mainly the Visual Studio plugin to develop the application.

    Any input is appreciated.

    Thanks

    Carsten


  • Moderators

    Hi @panch,

    How did you deploy your compiled files? Are all the dependencies in place?

    See http://wiki.qt.io/Deploy_an_Application_on_Windows



  • I will have a look at the wiki page you linked to - haven't seen that one before. So I guess that something may be missed there.
    But please enlighten me; if I have added the qml to the resource file, and use the qml by calling qrc:// shouldn't it then be embedded in the exe file?

    That's what I'd assume, because that was the whole point in adding it to the resources. I wouldn't like to deploy qml files with my application...


  • Moderators

    @panch said:

    But please enlighten me; if I have added the qml to the resource file, and use the qml by calling qrc:// shouldn't it then be embedded in the exe file?

    Yes, that's correct.

    That's what I'd assume, because that was the whole point in adding it to the resources. I wouldn't like to deploy qml files with my application...

    Perhaps you're missing other files required for deployment (I don't mean .qml files)



  • Hi again,

    The problem has been resolved. What I needed to do was to add a qml-directory in the executable folder of the program, consisting of these 3 folders copied from the Qt install directory:

    • QtGraphicalEffects
    • QtQuick
    • QtQuick.2

    Apart from that, I apparently needed a qt.conf file next to the executable with the following i the file:
    [Paths]
    Prefix=.

    I'm not fully aware, why I need the qt.conf file, since I assumed that the default directory for the qml dll's already was in the same directory as the executable.

    But this works, I'll edit the headline to Solved right away.

    And yes, there is no need for the qml files in the deployed directory.

    Thanks for the help!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.