Thanks for the help, I appreciate it. First time using modules and I'm learning a lot
What I've learnt so far:
Using qt_add_qml_module automatically makes a qmldir and QResources file
Cmake file for our project needs this to include a module with our library
add_subdirectory(<FolderOfModule>)
target_link_libraries(<applicationLibrary>
PRIVATE <UriOfModule>plugin)
Our module needs to be in it's own folder. Put CMake file, QML files, and resource files we're using for that module
Cmake file for our QML module needs this
qt_add_qml_module(<NameOfModule>)
URI <ImportNameOfModule>
VERSION <VersionNumber>
RESOURCE_PREFIX <Prefix>
QML_FILES <QML_Files>
RESOURCES <Resource_Files>
Perhaps it also needs this
qt_add_library(<NameOfModule> STATIC)
set_target_properties(<NameOfModule> PROPERTIES AUTOMOC ON)
target_link_libraries(<NameOfModule> PRIVATE
Qt6::Quick
)
Can optionally specify an output directory too it seems
QML file where we include our module needs this
import <ImportNameOfModule> <VersionNumber>
Then if we want to use a custom QML element from our module, we refer to it by it's like filename without the extension
Will also need to make this addition to our main.cpp file
engine.addImportPath("qrc:/");
Without this, we'll get a "is not a type" error
If there's anything else I might not know about modules, let me know and I'll check it out. Think I've made some progress with them now at least. Was using import paths before but modules are what I'm trying to replace all of that with
Got a module in one's actual project to work as opposed to a project consisting merely of a test module. So many things to get right between the cpp, qml, cmakelists, auto generated QResourceFile, and sci file too in this case
My module was a text input module. It has a text input base QML file and email text input QML file that inherits from this base. And it uses a border image so that's why there's a .sci resource for that
3a53f14c-ef31-44a7-aa3d-a8f8b5469bf9-image.png
Now I'll have to do all of the other modules too