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. QT can't load qml controls
QtWS25 Last Chance

QT can't load qml controls

Scheduled Pinned Locked Moved Solved QML and Qt Quick
8 Posts 4 Posters 386 Views
  • 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
    FatGarfield
    wrote on last edited by
    #1

    I tried to run an application, but it seems that .qml can't be loaded correctly, the error message is:
    qrc:/main.qml:2:1: module "QtQuick.Controls" version 1.1 is not installed
    In main.qml, there is a code line: import QtQuick.Controls 1.1, and QT can't find the control with version 1.1
    But this application can run well previously.
    I searched for solutions on the web, but none of them could solve this issue.
    What should I do to resolve this problem?

    jsulmJ JoeCFDJ 2 Replies Last reply
    0
    • F FatGarfield

      @JoeCFD Thanks for your relply, I use QT 6.2.4, and according to your suggestion. I changed

      import QtQuick 2.2
      import QtQuick.Controls 1.1

      to

      import QtQuick
      import QtQuick.Controls

      error message "qrc:/main.qml:2:1: module "QtQuick.Controls" version 1.1 is not installed
      " no longer exists.

      but new error
      "QQmlApplicationEngine failed to load component
      qrc:/main.qml:64:5: TabView is not a type"
      appears.

      B Offline
      B Offline
      Bob64
      wrote on last edited by Bob64
      #7

      @FatGarfield said in QT can't load qml controls:

      but new error
      "QQmlApplicationEngine failed to load component
      qrc:/main.qml:64:5: TabView is not a type"
      appears.

      This is because while you have changed the import, the code is still referencing types that were available in Qt Quick Controls 1.

      Qt Quick Controls 1 was deprecated in Qt 5 and its functionality was largely replaced with what was initially called Qt Quick Controls 2. Although this had similar types and functionality the API was not generally compatible with Qt Quick Controls 1.

      In Qt 6, Qt Quick Controls 1 has been completely removed and what used to be called Qt Quick Controls 2 is just Qt Quick Controls. So when you modified the import to reference Qt Quick Controls, the import looks correct, but the code is still written as if it is still using Qt Quick Controls 1 and will fail.

      I would recommend that you go back to Qt 5, where Qt Quick Controls 1 is still available alongside Qt Quick Controls 2, and port your code there before attempting to port to Qt 6.

      1 Reply Last reply
      1
      • F FatGarfield

        I tried to run an application, but it seems that .qml can't be loaded correctly, the error message is:
        qrc:/main.qml:2:1: module "QtQuick.Controls" version 1.1 is not installed
        In main.qml, there is a code line: import QtQuick.Controls 1.1, and QT can't find the control with version 1.1
        But this application can run well previously.
        I searched for solutions on the web, but none of them could solve this issue.
        What should I do to resolve this problem?

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @FatGarfield said in QT can't load qml controls:

        But this application can run well previously.

        So, what changed since then?
        What Qt version do you use and how did you install it?
        See https://doc.qt.io/qt-6/qtquickcontrols-index.html

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        F 1 Reply Last reply
        0
        • F FatGarfield

          I tried to run an application, but it seems that .qml can't be loaded correctly, the error message is:
          qrc:/main.qml:2:1: module "QtQuick.Controls" version 1.1 is not installed
          In main.qml, there is a code line: import QtQuick.Controls 1.1, and QT can't find the control with version 1.1
          But this application can run well previously.
          I searched for solutions on the web, but none of them could solve this issue.
          What should I do to resolve this problem?

          JoeCFDJ Offline
          JoeCFDJ Offline
          JoeCFD
          wrote on last edited by JoeCFD
          #3

          @FatGarfield
          For Qt5 (version 5.15 )
          import QtQuick.Controls 2.15
          For Qt6(no version number is needed)
          import QtQuick.Controls

          F 1 Reply Last reply
          0
          • jsulmJ jsulm

            @FatGarfield said in QT can't load qml controls:

            But this application can run well previously.

            So, what changed since then?
            What Qt version do you use and how did you install it?
            See https://doc.qt.io/qt-6/qtquickcontrols-index.html

            F Offline
            F Offline
            FatGarfield
            wrote on last edited by
            #4

            @jsulm Thanks for your relply, I use QT 6.2.4. Nothing changed, I ran this program several years ago, and it did not work now.

            B 1 Reply Last reply
            0
            • JoeCFDJ JoeCFD

              @FatGarfield
              For Qt5 (version 5.15 )
              import QtQuick.Controls 2.15
              For Qt6(no version number is needed)
              import QtQuick.Controls

              F Offline
              F Offline
              FatGarfield
              wrote on last edited by
              #5

              @JoeCFD Thanks for your relply, I use QT 6.2.4, and according to your suggestion. I changed

              import QtQuick 2.2
              import QtQuick.Controls 1.1

              to

              import QtQuick
              import QtQuick.Controls

              error message "qrc:/main.qml:2:1: module "QtQuick.Controls" version 1.1 is not installed
              " no longer exists.

              but new error
              "QQmlApplicationEngine failed to load component
              qrc:/main.qml:64:5: TabView is not a type"
              appears.

              B 1 Reply Last reply
              0
              • F FatGarfield

                @jsulm Thanks for your relply, I use QT 6.2.4. Nothing changed, I ran this program several years ago, and it did not work now.

                B Offline
                B Offline
                Bob64
                wrote on last edited by
                #6

                @FatGarfield said in QT can't load qml controls:

                @jsulm Thanks for your relply, I use QT 6.2.4. Nothing changed, I ran this program several years ago, and it did not work now.

                Qt Quick Controls 1 has never been available in Qt 6. When you ran it several years ago it cannot have been building and running with any Qt 6 version. It would always have given an error like this with Qt 6.

                1 Reply Last reply
                1
                • F FatGarfield

                  @JoeCFD Thanks for your relply, I use QT 6.2.4, and according to your suggestion. I changed

                  import QtQuick 2.2
                  import QtQuick.Controls 1.1

                  to

                  import QtQuick
                  import QtQuick.Controls

                  error message "qrc:/main.qml:2:1: module "QtQuick.Controls" version 1.1 is not installed
                  " no longer exists.

                  but new error
                  "QQmlApplicationEngine failed to load component
                  qrc:/main.qml:64:5: TabView is not a type"
                  appears.

                  B Offline
                  B Offline
                  Bob64
                  wrote on last edited by Bob64
                  #7

                  @FatGarfield said in QT can't load qml controls:

                  but new error
                  "QQmlApplicationEngine failed to load component
                  qrc:/main.qml:64:5: TabView is not a type"
                  appears.

                  This is because while you have changed the import, the code is still referencing types that were available in Qt Quick Controls 1.

                  Qt Quick Controls 1 was deprecated in Qt 5 and its functionality was largely replaced with what was initially called Qt Quick Controls 2. Although this had similar types and functionality the API was not generally compatible with Qt Quick Controls 1.

                  In Qt 6, Qt Quick Controls 1 has been completely removed and what used to be called Qt Quick Controls 2 is just Qt Quick Controls. So when you modified the import to reference Qt Quick Controls, the import looks correct, but the code is still written as if it is still using Qt Quick Controls 1 and will fail.

                  I would recommend that you go back to Qt 5, where Qt Quick Controls 1 is still available alongside Qt Quick Controls 2, and port your code there before attempting to port to Qt 6.

                  1 Reply Last reply
                  1
                  • F Offline
                    F Offline
                    FatGarfield
                    wrote on last edited by
                    #8

                    Thank you @Bob64 @JoeCFD and @jsulm , I fallback to QT5.x, the program can run again.

                    1 Reply Last reply
                    0
                    • F FatGarfield has marked this topic as solved on

                    • Login

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