Import says QML module not found.
-
wrote on 25 Nov 2021, 02:26 last edited by
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 = 1and 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.
-
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 = 1and 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.
@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? -
wrote on 26 Nov 2021, 22:28 last edited by
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.
-
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.
@RangerQT
you mean importing works , but its just about the warning in QtCreator? -
wrote on 28 Nov 2021, 16:46 last edited by
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.
-
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.
@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 theQML_IMPORT_PATH
variable with a path containing a folder namedImportFltData
. This folder should contain a qmldir file. I think its enough if the qml dir file contains just themodule
specifier -
wrote on 28 Nov 2021, 17:44 last edited by
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.
-
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.
@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
-
wrote on 28 Nov 2021, 18:00 last edited by
Thanks. I'll give some of this a try.
-
@RangerQT
QML2_IMPORT_PATH
is NOT an option for your issue, btw
onlyQML_IMPORT_PATH
-
wrote on 28 Nov 2021, 18:05 last edited by
Okay. Thanks. I would have tried to use the QML2 path!
-
8/11