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.
QtWS25 Last Chance

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 Offline
    R Offline
    RangerQT
    wrote on 25 Nov 2021, 02:26 last edited by
    #1

    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.

    R 1 Reply Last reply 26 Nov 2021, 11:01
    0
    • R RangerQT
      25 Nov 2021, 02:26

      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.

      R Offline
      R Offline
      raven-worx
      Moderators
      wrote on 26 Nov 2021, 11:01 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 26 Nov 2021, 22:28 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.

        R 1 Reply Last reply 28 Nov 2021, 09:08
        0
        • R RangerQT
          26 Nov 2021, 22:28

          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.

          R Offline
          R Offline
          raven-worx
          Moderators
          wrote on 28 Nov 2021, 09:08 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 28 Nov 2021, 16:46 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.

            R 1 Reply Last reply 28 Nov 2021, 17:12
            0
            • R RangerQT
              28 Nov 2021, 16:46

              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.

              R Offline
              R Offline
              raven-worx
              Moderators
              wrote on 28 Nov 2021, 17:12 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 28 Nov 2021, 17:44 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.

                R 1 Reply Last reply 28 Nov 2021, 17:46
                0
                • R RangerQT
                  28 Nov 2021, 17:44

                  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.

                  R Offline
                  R Offline
                  raven-worx
                  Moderators
                  wrote on 28 Nov 2021, 17:46 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 28 Nov 2021, 18:00 last edited by
                    #9

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

                    R 1 Reply Last reply 28 Nov 2021, 18:02
                    0
                    • R RangerQT
                      28 Nov 2021, 18:00

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

                      R Offline
                      R Offline
                      raven-worx
                      Moderators
                      wrote on 28 Nov 2021, 18:02 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 28 Nov 2021, 18:05 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 30 Mar 2023, 23:57

                        8/11

                        28 Nov 2021, 17:46

                        • Login

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