Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Why does my QML Plugin fails to load when deployed, while it works inside the build dir?
Forum Updated to NodeBB v4.3 + New Features

Why does my QML Plugin fails to load when deployed, while it works inside the build dir?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 2 Posters 406 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    fama_lab3d
    wrote on 9 Mar 2023, 11:17 last edited by
    #1

    Hello,
    I have a QML plugin that is loaded at runtime.
    If I run the app from the build dir, it works flawlessly.
    If I do the same with the deployed application, it fails.

    The build dir is structured like that:

    build\
        MyApp.exe
        GUI\
          Something\
            Other\
              GUI_SOMETHING_OTHERplugin.dll
    

    While the deploy is generated by Qt's deploy script (CMAKE):

    deploy\
      bin\
        <files deployed by qt deploy script>
        MyApp.exe
      qml\
        GUI\
          Something\
            Other\
              GUI_SOMETHING_OTHERplugin.dll
    <other files by qt>
    

    When it starts, the engine import paths are the following:

    • qrc:/
    • <deploy-dir>/bin
    • qrc:/qt-project.org/imports
    • C:/Qt/6.4.2/msvc2019_64/qml
    • <deploy-dir>/qml

    The warning it gives is the following:

    Warning: QQmlApplicationEngine failed to load component
    Warning: qrc:/MillManager/main.qml:7:1: Cannot load library <deploy-dir>\qml\GUI\Something\Other\GUI_SOMETHING_OTHERplugin.dll: The specified module could not be found.
    

    It's strange, because the .dll exists! And it's in that path!

    D 1 Reply Last reply 9 Mar 2023, 13:10
    0
    • F fama_lab3d
      9 Mar 2023, 11:17

      Hello,
      I have a QML plugin that is loaded at runtime.
      If I run the app from the build dir, it works flawlessly.
      If I do the same with the deployed application, it fails.

      The build dir is structured like that:

      build\
          MyApp.exe
          GUI\
            Something\
              Other\
                GUI_SOMETHING_OTHERplugin.dll
      

      While the deploy is generated by Qt's deploy script (CMAKE):

      deploy\
        bin\
          <files deployed by qt deploy script>
          MyApp.exe
        qml\
          GUI\
            Something\
              Other\
                GUI_SOMETHING_OTHERplugin.dll
      <other files by qt>
      

      When it starts, the engine import paths are the following:

      • qrc:/
      • <deploy-dir>/bin
      • qrc:/qt-project.org/imports
      • C:/Qt/6.4.2/msvc2019_64/qml
      • <deploy-dir>/qml

      The warning it gives is the following:

      Warning: QQmlApplicationEngine failed to load component
      Warning: qrc:/MillManager/main.qml:7:1: Cannot load library <deploy-dir>\qml\GUI\Something\Other\GUI_SOMETHING_OTHERplugin.dll: The specified module could not be found.
      

      It's strange, because the .dll exists! And it's in that path!

      D Offline
      D Offline
      dheerendra
      Qt Champions 2022
      wrote on 9 Mar 2023, 13:10 last edited by
      #2

      May be your library depends on some other library. This may be missing in path.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      F 1 Reply Last reply 9 Mar 2023, 13:35
      1
      • D dheerendra
        9 Mar 2023, 13:10

        May be your library depends on some other library. This may be missing in path.

        F Offline
        F Offline
        fama_lab3d
        wrote on 9 Mar 2023, 13:35 last edited by
        #3

        @dheerendra it's actually just 1 .qml file built with qt_add_qml_module, nothing else.

        D 1 Reply Last reply 10 Mar 2023, 07:40
        0
        • F fama_lab3d
          9 Mar 2023, 13:35

          @dheerendra it's actually just 1 .qml file built with qt_add_qml_module, nothing else.

          D Offline
          D Offline
          dheerendra
          Qt Champions 2022
          wrote on 10 Mar 2023, 07:40 last edited by
          #4

          what is the import statement in main.qml ?

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          F 1 Reply Last reply 10 Mar 2023, 08:20
          1
          • D dheerendra
            10 Mar 2023, 07:40

            what is the import statement in main.qml ?

            F Offline
            F Offline
            fama_lab3d
            wrote on 10 Mar 2023, 08:20 last edited by
            #5

            @dheerendra I'm generating a QML file at runtime and load it with a Loader:

            ListView {
              delegate: Loader {
                sourceComponent: Qt.createComponent(model.qmlFile)
              }
            }
            

            The generated file is very simple:

            import GUI.Something.Other
            
            GUI {
            }
            
            1 Reply Last reply
            0

            1/5

            9 Mar 2023, 11:17

            • Login

            • Login or register to search.
            1 out of 5
            • First post
              1/5
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved