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. Submodule QML module not found (MySubmoduleName)
Qt 6.11 is out! See what's new in the release blog

Submodule QML module not found (MySubmoduleName)

Scheduled Pinned Locked Moved Solved QML and Qt Quick
6 Posts 3 Posters 417 Views 2 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.
  • D Offline
    D Offline
    DSpUz
    wrote last edited by
    #1

    Hello fellow Qt Devs,

    I was following this tutorial "QML Modules": https://academy.qt.io/content-details/338477721/2
    and ran into the issue where text processor throws an error(which is also visible in the tutorial):
    preprocessor_error.png
    and of course then the methods described in that module do not get highlighted:
    noHighlighting.png
    however when I build everything runs fine as expected and the submodules contents get loaded and built libraries are there.

    Cheers, DSU

    JKSHJ 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote last edited by
      #2

      Hi,

      You need to add some details:

      • Which version of Qt Creator are you using ?
      • Which version of Qt ?
      • Did you change any settings related to the code model ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D DSpUz

        Hello fellow Qt Devs,

        I was following this tutorial "QML Modules": https://academy.qt.io/content-details/338477721/2
        and ran into the issue where text processor throws an error(which is also visible in the tutorial):
        preprocessor_error.png
        and of course then the methods described in that module do not get highlighted:
        noHighlighting.png
        however when I build everything runs fine as expected and the submodules contents get loaded and built libraries are there.

        Cheers, DSU

        JKSHJ Online
        JKSHJ Online
        JKSH
        Moderators
        wrote last edited by
        #3

        @DSpUz That error comes from the old QML code model.

        Please enable the new QML Language Server: https://doc.qt.io/qtcreator/creator-how-to-use-qml-language-server.html

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DSpUz
          wrote last edited by
          #4

          @SGaist QtCreator 20.0.1, in this case its Qt 6.11.1 but same error occurs with Qt 6.9.3. I did reset code model same as in video, but that error persists so it doesnt really matter.
          @JKSH I did enable QML Language Server as you said, and it went from red to yellow :)
          preprocessor_error2.png
          Also another warning popped up where it claims QQuickItem doesnt have pressed property for the button:
          preprocessor_error3.png

          JKSHJ 1 Reply Last reply
          0
          • D DSpUz

            @SGaist QtCreator 20.0.1, in this case its Qt 6.11.1 but same error occurs with Qt 6.9.3. I did reset code model same as in video, but that error persists so it doesnt really matter.
            @JKSH I did enable QML Language Server as you said, and it went from red to yellow :)
            preprocessor_error2.png
            Also another warning popped up where it claims QQuickItem doesnt have pressed property for the button:
            preprocessor_error3.png

            JKSHJ Online
            JKSHJ Online
            JKSH
            Moderators
            wrote last edited by
            #5

            @DSpUz said in Submodule QML module not found (MySubmoduleName):

            @SGaist QtCreator 20.0.1, in this case its Qt 6.11.1 but same error occurs with Qt 6.9.3. I did reset code model same as in video, but that error persists so it doesnt really matter.

            The old code model doesn't understand the CMake outputs for the QML modules; no amount of resetting will help. You need to use the new QML Language Server instead.

            @JKSH I did enable QML Language Server as you said, and it went from red to yellow :)

            Great! That proves that the QML Language Server is active.

            Next:

            1. Have you built and run your project? You need to build at least once for the module files to be generated for the QML Language Server to see.
            2. I see that the tutorial uses a slightly complex folder structure, and sets QT_QML_OUTPUT_DIRECTORY to compensate. Have you done the same?

            (Note: Ideally you shouldn't need to set additional fields, but there are currently some limitations in the QML tools. See https://qt-project.atlassian.net/browse/QTBUG-137199 for the nitty gritty details)

            Also another warning popped up where it claims QQuickItem doesnt have pressed property for the button:

            Yes, that is correct. parent's type is Item. Item has many properties, but pressed is not one of them: https://doc.qt.io/qt-6/qml-qtquick-item.html#properties

            I suggest giving an ID to your Button (for example, id: btn) and then write color: btn.pressed ? ...

            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

            1 Reply Last reply
            1
            • D Offline
              D Offline
              DSpUz
              wrote last edited by
              #6

              @JKSH
              the QT_QML_OUTPUT_DIRECTORY is setting is not covered in the video tutorial itself, it is only in the github repository, one of the recent rating comments does hint at this:
              import_issue_fix_hint.png

              I think if one includes it in the CMake file then it is enough (though i didn't test it), no need to use QML Language Server.

              Also your identifier tip solved the other warning, thanks.

              1 Reply Last reply
              0
              • D DSpUz has marked this topic as solved

              • Login

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