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. Import QtQml.Models 2.1 issue
Forum Updated to NodeBB v4.3 + New Features

Import QtQml.Models 2.1 issue

Scheduled Pinned Locked Moved QML and Qt Quick
17 Posts 6 Posters 11.6k 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.
  • B Offline
    B Offline
    Balzarus
    wrote on last edited by
    #1

    I recently installed QtCreator 3.1.0 (based on Qt 5.2.1) on Windows 7 and am having issues with the following code snippet which is extracted from a Qt example:
    @import QtQuick 2.0 import QtQml.Models 2.1
    Rectangle {
    ObjectModel {
    id: itemModel
    Rectangle { height: 30; width: 80; color: "red" }
    Rectangle { height: 30; width: 80; color: "green" }
    Rectangle { height: 30; width: 80; color: "blue" }
    }

    ListView {
        anchors.fill: parent
        model: itemModel
    }
    

    }@

    Before I even try to build, I get the following error:

    QML module does not contain information about components contained in plugins.

    Module path: C:/Qt/5.2.1/msvc2010/qml/QtQml/Models.2
    See "Using QML Modules with Plugins" in the documentation.

    Automatic type dump of QML module failed.

    Errors:
    "C:\Qt\5.2.1\msvc2010\bin\qmlplugindump.exe" returned exit code 3.
    Arguments: -relocatable QtQml.Models 2.0 C:/Qt/5.2.1/msvc2010/qml
    QQmlComponent: Component is not ready
    "file:///C:/Qt/5.2.1/msvc2010/qml/typelist.qml:2:1: module "QtQml.Models" version 2.0 is not installed"

    I verified QtCreator installation, its environment and even reinstalled it without success. Note that I managed to run the same code snippet under Ubuntu without any issues so it seems Windows-related. Also note that I created multiple projects with various compilers (e.g. MinGW 4.8 and MSVC10) to check this out without success.

    Any idea what could be causing this issue? I found some posts discussing about installing missing plugins under Ubuntu, which is the resolution for the same problem under Ubuntu, but this resolution does not seem to be applicable to a Windows environment.

    Thanks in advance for any kind of information that could help me out!

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jsprenkle
      wrote on last edited by
      #2

      I notice the import statement has optional items that may follow the name of the module. It's a wild guess but it may be confused by your syntax.
      You might try putting your import statements on separate lines.

      1 Reply Last reply
      0
      • J Offline
        J Offline
        Jawad
        wrote on last edited by
        #3

        I am experiencing the same thing...

        import QtQml.Models 2.0

        module "QtQml.Models" version 2.0 is not installed

        Do we need to add something in the .pro file?

        1 Reply Last reply
        0
        • B Offline
          B Offline
          Balzarus
          wrote on last edited by
          #4

          jsprenkle: Thanks for the note. It is a copy-paste mistake here that the import statements are on the same line. In the original code, there are not. Thanks anyway! :)

          Jawad: I tried to look for some info wrt .pro file but without success. Let me know if you find something on your side.

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jsprenkle
            wrote on last edited by
            #5

            try looking where you installed your Qt to see if the structure Qt uses to find plugins is present. Here's the directory structure on my box:

            Directory:
            YOURQTINSTALLPATH\qml\QtQml\Models.2

            There should be a file named "qmldir" there and some dll files.

            My qmldir file contains the text:

            module QtQml.Models
            plugin modelsplugin

            1 Reply Last reply
            0
            • B Offline
              B Offline
              Balzarus
              wrote on last edited by
              #6

              jsprenkle: I looked into my Qt install path, i.e. "C:\Qt\5.2.1", and each project type folder, e.g. "mingw48_32" and "msvc2010" (I tried multiple project type thinking it might be the cause of the issue), and I do find the structure "qml\QtQml\Models.2" containing the file "qmldir". Each instance of this file contains the lines:
              "
              module QtQml.Models
              plugin modelsplugin
              classname QtQmlModelsPlugin
              "

              1 Reply Last reply
              0
              • J Offline
                J Offline
                jsprenkle
                wrote on last edited by
                #7

                Did you try setting the version number down? Perhaps you don't have version 2.1 but do have version 2.0?

                @import QtQml.Models 2.0@

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  Balzarus
                  wrote on last edited by
                  #8

                  I initially tried that and failed. Based on the information I found, QtQml.Models started at version 2.1 anyway...

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    jalomann
                    wrote on last edited by
                    #9

                    I am using Linux but I have the same issue. I found a hint that I shall install
                    @qtdeclarative5-models-plugin@

                    but it wasn't found when I tried.

                    I am looking at StocQt example on Sailfish SDK. The example imports 2.1

                    1 Reply Last reply
                    0
                    • J Offline
                      J Offline
                      jalomann
                      wrote on last edited by
                      #10

                      I got it working in Linux. If I deploy it as RPM package, it resolves the package dependencies itself.

                      1 Reply Last reply
                      0
                      • J Offline
                        J Offline
                        jalomann
                        wrote on last edited by
                        #11

                        And after reading readme, I found out that installing qt5-qtdeclarative-import-models2 is the missing package.

                        @pkcon install qt5-qtdeclarative-import-models2@

                        1 Reply Last reply
                        0
                        • B Offline
                          B Offline
                          Balzarus
                          wrote on last edited by
                          #12

                          Thanks everyone for the replies. Turns out it's something wrong with Qt Creator and/or its environment. I've switched everything to Visual Studio 2010 and now everything works perfectly.

                          1 Reply Last reply
                          0
                          • M Offline
                            M Offline
                            mehrdad
                            wrote on last edited by
                            #13

                            Hi,

                            i cant install that in ubuntu...
                            my error..
                            Command failed: This tool could not find any available package: Package name qt5.3-qtdeclarative-import-models2 could not be resolved.

                            1 Reply Last reply
                            0
                            • M Offline
                              M Offline
                              mehrdad
                              wrote on last edited by
                              #14

                              Hi,

                              i cant install that in ubuntu...
                              my error..
                              Command failed: This tool could not find any available package: Package name qt5.3-qtdeclarative-import-models2 could not be resolved.

                              1 Reply Last reply
                              0
                              • J Offline
                                J Offline
                                jalomann
                                wrote on last edited by
                                #15

                                Try to launch as rpm-package, not as binary.

                                1 Reply Last reply
                                0
                                • J Offline
                                  J Offline
                                  jalomann
                                  wrote on last edited by
                                  #16

                                  Try to launch as rpm-package, not as binary.

                                  1 Reply Last reply
                                  0
                                  • A Offline
                                    A Offline
                                    advent
                                    wrote on last edited by
                                    #17

                                    I'm using QtCreator 3.4.1 and still have this issue.

                                    @jalomann said:

                                    And after reading readme, I found out that installing qt5-qtdeclarative-import-models2 is the missing package.

                                    @pkcon install qt5-qtdeclarative-import-models2@

                                    @jalomann how do I get and install this "qt5-qtdeclarative-import-models2"? I'm using Windows btw. Can you give me the link to the readme file?

                                    1 Reply Last reply
                                    0

                                    • Login

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