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 ModelViewDelegate fails
Qt 6.11 is out! See what's new in the release blog

import ModelViewDelegate fails

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

    Hello fellow Qt Devs,

    importing ModelViewDelegate fails both on Qt 6.9.3 and on 6.11.1, and the submodule is not mine but from the
    QML basics tutorial:
    ModelViewDelegate_fail.png
    How do I import it if its not on my system by default for some reason?

    Cheers,
    DSU

    JKSHJ 1 Reply Last reply
    0
    • A Offline
      A Offline
      AwesomeProgrammer
      wrote last edited by AwesomeProgrammer
      #2

      i think you should use
      "import Qt.labs.qmlmodels"
      can you tell me which model you are using and which view

      1 Reply Last reply
      0
      • D DSpUz

        Hello fellow Qt Devs,

        importing ModelViewDelegate fails both on Qt 6.9.3 and on 6.11.1, and the submodule is not mine but from the
        QML basics tutorial:
        ModelViewDelegate_fail.png
        How do I import it if its not on my system by default for some reason?

        Cheers,
        DSU

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

        @DSpUz said in import ModelViewDelegate fails:

        the submodule is not mine but from the
        QML basics tutorial

        I'm not familiar with this tutorial. Can you please share a link to it?

        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

          @JKSH It is this one https://academy.qt.io/content-details/337375027/2

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

            @AwesomeProgrammer ListModel is being used in the LiveWeatherModel submodule, and ListView is being used in the Main, but main already has the appropriate include "import Qt.labs.folderlistmodel"
            By changing ModelViewDelegate import to "import Qt.labs.qmlmodels" I was at least able to build and run it however some other issue appeared where in LiveLocationModel Requesters function does not get recognized for some reason
            requester_error.png
            so the App gets frozen on locations retrieval

            1 Reply Last reply
            0
            • D DSpUz

              @JKSH It is this one https://academy.qt.io/content-details/337375027/2

              JKSHJ Offline
              JKSHJ Offline
              JKSH
              Moderators
              wrote last edited by
              #6

              @DSpUz said in import ModelViewDelegate fails:

              @JKSH It is this one https://academy.qt.io/content-details/337375027/2

              The example code for that tutorial is at https://github.com/qt-learning/Model-View-Delegate

              @DSpUz said in import ModelViewDelegate fails:

              ModelViewDelegate_fail.png
              How do I import it if its not on my system by default for some reason?

              That project's QML files can use import ModelViewDelegate because there is a project-specific QML module (see https://github.com/qt-learning/Model-View-Delegate/blob/main/00_InitialProject/CMakeLists.txt#L28-L29 ):

              qt_add_qml_module(appModelViewDelegate
                  URI ModelViewDelegate
                  ...
              )
              

              One more thing: What version of Qt Creator are you using? Your screenshot shows that it's recommending that you set QML_IMPORT_PATH, but that was deprecated long ago. If Qt Creator is too old, it won't know how to find your project-specific module. (If this is the case, you'll see invalid errors/warnings in your code editor, but your project can still run fine)

              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 DSpUz
                #7

                @JKSH I am using Qt Creator 20.0.1, that QML_IMPORT_PATH is set because when i choose 6.8 and up (instead of 6.10 and up), there is a checkbox for that QML_IMPORT_PATH which is selected automatically.
                Anyways, I changed the applications name to a custom one (not ModelViewDelegate), and thus I should have changed that import to import {customAppName}, doing it like that resolves the build errors.
                Still the "Property 'sendRequest' of object Requester is not a function" run-time error is not resolved, but that is for another post.

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

                  @JKSH I am using Qt Creator 20.0.1, that QML_IMPORT_PATH is set because when i choose 6.8 and up (instead of 6.10 and up), there is a checkbox for that QML_IMPORT_PATH which is selected automatically.
                  Anyways, I changed the applications name to a custom one (not ModelViewDelegate), and thus I should have changed that import to import {customAppName}, doing it like that resolves the build errors.
                  Still the "Property 'sendRequest' of object Requester is not a function" run-time error is not resolved, but that is for another post.

                  JKSHJ Offline
                  JKSHJ Offline
                  JKSH
                  Moderators
                  wrote last edited by JKSH
                  #8

                  @DSpUz said in import ModelViewDelegate fails:

                  Anyways, I changed the applications name to a custom one (not ModelViewDelegate), and thus I should have changed that import to import {customAppName}, doing it like that resolves the build errors.
                  Still the "Property 'sendRequest' of object Requester is not a function" run-time error is not resolved, but that is for another post.

                  👍

                  I am using Qt Creator 20.0.1, that QML_IMPORT_PATH is set because when i choose 6.8 and up (instead of 6.10 and up), there is a checkbox for that QML_IMPORT_PATH which is selected automatically.

                  My bad, I misdiagnosed the message. That particular appeared because the QML Language Server is disabled (see https://doc.qt.io/qtcreator/creator-how-to-use-qml-language-server.html )

                  The checkbox is for QT_QML_GENERATE_QMLLS_INI (deprecated since Qt 6.10), rather than QML_IMPORT_PATH (deprecated since Qt 6.5, or some might say Qt 6.2).

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

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    AwesomeProgrammer
                    wrote last edited by
                    #9

                    @DSpUz my laptop was bad so i couldnt reply

                    1 Reply Last reply
                    1

                    • Login

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