[Interest] using a C++ class in QML in Qt6

ekke ekke at ekkes-corner.org
Sat Aug 31 23:16:54 CEST 2024


Am 31.08.24 um 23:06 schrieb Dirk Hohndel via Interest:
> Yeah, I need one place where I can load my "main" QML file, and I need 
> a way to make my C++ classes visible from within those QML files.
> So I'm not sure how I'd do that with only one "load"...
>
> In Qt5 I used the "load" to get the main.qml file and then 
> RegisterType to get my C++ classes visible inside the QML code.
> In your example, how do you load your QML file?

|engine.*loadFromModule*("Ekke/Apps/Main", "Main"); from my Main.qml I 
can access all my other qml files as listed in qt_add_qml_module() and 
also work with QML_ELEMENT and QML_SINGLETON ekke |

>
> /D
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20240831/7dbe3d9e/attachment.htm>


More information about the Interest mailing list