Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Import says QML module not found.
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.
Are you creating a QML plugin or do you simply register the QML type directly in your application and intend to use it there?
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).
you mean importing works , but its just about the warning in QtCreator?
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.
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_PATHvariable 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
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.
as i said you can ignore this warning, it actually has not much of a meaning.
QML_IMPORT_PATHis a qmake variable only used by QtCreator
QML2_IMPORT_PATHis an environment variable used by the qml engine during runtime.
modulespecifier and also the folder must be named according to your import path ->
Thanks. I'll give some of this a try.
QML2_IMPORT_PATHis NOT an option for your issue, btw
Okay. Thanks. I would have tried to use the QML2 path!