Using Qt 6.5 I have created a brand new Qt Quick Application from the Create Project button in the Welcome menu.
This new project creates some base files by default when I keep the "Create a project that you can open in Qt Design Studio" button checked:
Approaching this as a first time user of Quick, this directory structure is very confusing for me. Especially since the Qt6 docs have this seemingly simple example of how to call C++ functions from QML: enter link description here
The docs link says that I should also be creating a qt_add_qml_module into some CMake file so that I can import <MyModule>. In the project template that is generated for me, which CMake file do I add this too, and what exactly am I supposed to add?
Further, because this template that is generated upon project creation includes a ui.qml and you can't call functions from ui.qml files, what exactly should I be doing here?
I've tried to compare and contrast the example hangman quick project, which does include calling C++ functions. Since this example project does not include any ui.qml files, though, it is difficult to translate the concepts to this default project of mine.
Can someone explain how to do this? I truly need the "Explain it to me like I'm 5".

Although I did not implement it in the test project I posted above, I ultimately did the following to access c++ classes in QML:
.h/.cppfile. Add QObject as the base class, include QObject, Add Q_OBJECT, and Add QML_ELEMENT.hfile, addQ_INVOKABLEbefore the function you'd like to call in QML. Add#include <QtQml>as it is needed to accessQ_INVOKABLE. For example:In my
CMakeLists.txt, find theqt_add_qml_modulefunction that is generated for you. Copy theURIvalue.At the top of my
Main.qmlfile,import <qml-module-URI>Now you can add a QML object of your class. For example: