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 says QML module not found.

Import says QML module not found.

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
11 Posts 2 Posters 3.7k 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.
  • R RangerQT

    I decided to try and use the new method of reqistering so I added QML_ELEMENT to my C++ header file for the class ImportData.

    Then I added to my pro file

    CONFIG += qmltypes
    QML_IMPORT_NAME = ImportFltData
    QML_IMPORT_MAJOR_VERSION = 1

    and added import ImportFltData to the qml file but QML complains QML module not found (ImportFltData) but the application runs. I also tried putting the class name ImportData for the import name and that does not run at all.

    I've seen posts saying set QML2_IMPORT_PATH but they never tell you what to set it to.

    So how do I get rid of this error other than going back to the QMLRegisterType.

    raven-worxR Offline
    raven-worxR Offline
    raven-worx
    Moderators
    wrote on last edited by
    #2

    @RangerQT
    Are you creating a QML plugin or do you simply register the QML type directly in your application and intend to use it there?

    --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
    If you have a question please use the forum so others can benefit from the solution in the future

    1 Reply Last reply
    0
    • R Offline
      R Offline
      RangerQT
      wrote on last edited by
      #3

      I register it in my application with the RegisterType<> and use it there. I was trying to use what the docs said was the most current practice for my version (5.15.7).

      Thanks.

      raven-worxR 1 Reply Last reply
      0
      • R RangerQT

        I register it in my application with the RegisterType<> and use it there. I was trying to use what the docs said was the most current practice for my version (5.15.7).

        Thanks.

        raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by
        #4

        @RangerQT
        you mean importing works , but its just about the warning in QtCreator?

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        0
        • R Offline
          R Offline
          RangerQT
          wrote on last edited by
          #5

          Importing works fine but I still get the warning. I was concerned I'm missing something as it shouldn't be giving me that warning.

          raven-worxR 1 Reply Last reply
          0
          • R RangerQT

            Importing works fine but I still get the warning. I was concerned I'm missing something as it shouldn't be giving me that warning.

            raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by
            #6

            @RangerQT
            basically you can ignore this warning, since it is only created by QtCreator, which cant find the module in the the default import paths.
            In you .pro file you can set the QML_IMPORT_PATH variable with a path containing a folder named ImportFltData. This folder should contain a qmldir file. I think its enough if the qml dir file contains just the module specifier

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            0
            • R Offline
              R Offline
              RangerQT
              wrote on last edited by
              #7

              Okay. Do I use QML_IMPORT_PATH or QML2_IMPORT_PATH. I've seen references to both but there were a bunch of different answers on what to do and all conflicting.

              The ImportFltData is the cpp file that's in the same file as the main.cpp, qml files, header files so I point it to that I assume?

              I'll have to look up qmldir with the link you gave and see what it does. I've not used that. Hmm. I was assuming I could just define it in the pro file and it would find it but I guess QtCreator needs to be fixed to do that. If that was all that was needed that makes things simpler but if I had to create the qmldir file and all that is in it then I can just use RegisterType until it's fixed if it ever is.

              Thanks. I appreciate the help.

              raven-worxR 1 Reply Last reply
              0
              • R RangerQT

                Okay. Do I use QML_IMPORT_PATH or QML2_IMPORT_PATH. I've seen references to both but there were a bunch of different answers on what to do and all conflicting.

                The ImportFltData is the cpp file that's in the same file as the main.cpp, qml files, header files so I point it to that I assume?

                I'll have to look up qmldir with the link you gave and see what it does. I've not used that. Hmm. I was assuming I could just define it in the pro file and it would find it but I guess QtCreator needs to be fixed to do that. If that was all that was needed that makes things simpler but if I had to create the qmldir file and all that is in it then I can just use RegisterType until it's fixed if it ever is.

                Thanks. I appreciate the help.

                raven-worxR Offline
                raven-worxR Offline
                raven-worx
                Moderators
                wrote on last edited by raven-worx
                #8

                @RangerQT
                as i said you can ignore this warning, it actually has not much of a meaning.

                QML_IMPORT_PATH is a qmake variable only used by QtCreator
                QML2_IMPORT_PATH is an environment variable used by the qml engine during runtime.

                The module specifier and also the folder must be named according to your import path -> ImportFltData

                --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                If you have a question please use the forum so others can benefit from the solution in the future

                1 Reply Last reply
                0
                • R Offline
                  R Offline
                  RangerQT
                  wrote on last edited by
                  #9

                  Thanks. I'll give some of this a try.

                  raven-worxR 1 Reply Last reply
                  0
                  • R RangerQT

                    Thanks. I'll give some of this a try.

                    raven-worxR Offline
                    raven-worxR Offline
                    raven-worx
                    Moderators
                    wrote on last edited by raven-worx
                    #10

                    @RangerQT
                    QML2_IMPORT_PATH is NOT an option for your issue, btw
                    only QML_IMPORT_PATH

                    --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                    If you have a question please use the forum so others can benefit from the solution in the future

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      RangerQT
                      wrote on last edited by
                      #11

                      Okay. Thanks. I would have tried to use the QML2 path!

                      1 Reply Last reply
                      0
                      • B bluesanta referenced this topic on

                      • Login

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