import ModelViewDelegate fails
-
i think you should use
"import Qt.labs.qmlmodels"
can you tell me which model you are using and which view -
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:

How do I import it if its not on my system by default for some reason?Cheers,
DSU@DSpUz said in import ModelViewDelegate fails:
the submodule is not mine but from the
QML basics tutorialI'm not familiar with this tutorial. Can you please share a link to it?
-
@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

so the App gets frozen on locations retrieval -
@JKSH It is this one https://academy.qt.io/content-details/337375027/2
@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:

How do I import it if its not on my system by default for some reason?That project's QML files can use
import ModelViewDelegatebecause 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) -
@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. -
D DSpUz has marked this topic as solved
-
@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.@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 thanQML_IMPORT_PATH(deprecated since Qt 6.5, or some might say Qt 6.2). -
@DSpUz my laptop was bad so i couldnt reply