Re: [Interest] Problems with qt_add_qml_module

2023-10-25 Thread Ulf Hermann via Interest
Well ... maybe you want to read https://doc.qt.io/qt-6/qtqml-writing-a-module.html Actually, I like https://www.qt.io/blog/qml-modules-in-qt-6.2 better because it contains some history and motivation for why QML modules are what they are. For the actual examples, better refer to doc.qt.io, tho

Re: [Interest] Problems with qt_add_qml_module

2023-10-25 Thread Ulf Hermann via Interest
The first argument to the `qt_add_qml_module()` function is *not* a new target to be defined by the call. You can also give it an existing target. See all our examples that first create an executable target and then attach a QML module to it. Furthermore, the `SOURCES` argument isn't a list o

Re: [Interest] Problems with qt_add_qml_module

2023-10-24 Thread Stefan Seefeld
Hi, allow me to follow up on my own mail. I have made some progress through exploring (and reverse-engineering), and I would like to refine my questions to refocus the discussion. But perhaps it's best if I briefly describe my misunderstandings first, as that may help others as well. The first ar

Re: [Interest] Problems with qt_add_qml_module

2023-10-24 Thread Stefan Seefeld
Hi Nils, thanks a lot for your elaborate answer. That's very helpful indeed. I still have a couple of fundamental questions (see my reply to Ulf), but this gives some good hints. In fact I think the best way forward might be to set up a little toy project that has the desired structure, and which

Re: [Interest] Problems with qt_add_qml_module

2023-10-24 Thread Stefan Seefeld
On Tue, Oct 24, 2023 at 10:47 AM Ulf Hermann wrote: > > In our existing code we call `qmlRegisterType<...>(...)` in our regular > > C++ code (e.g., some shared libraries that the main application links > to). > > I thought that, to be able to use those types in stand-alone QML code, > > I'd need

Re: [Interest] Problems with qt_add_qml_module

2023-10-24 Thread Nils Jeisecke via Interest
Hi, On Tue, Oct 24, 2023 at 4:35 PM Stefan Seefeld wrote: > So it sounds like I still don't understand what `qt_add_qml_module` is doing. AFAIK it builds a bunch of cmake custom commands that use moc for c++ and some other tooling for qml files to extract all the type information. This then is t

Re: [Interest] Problems with qt_add_qml_module

2023-10-24 Thread Ulf Hermann via Interest
In our existing code we call `qmlRegisterType<...>(...)` in our regular C++ code (e.g., some shared libraries that the main application links to). I thought that, to be able to use those types in stand-alone QML code, I'd need to move these calls into plugins, or at least have some QML extension

Re: [Interest] Problems with qt_add_qml_module

2023-10-24 Thread Stefan Seefeld
On Tue, Oct 24, 2023 at 10:11 AM Ulf Hermann wrote: > > Most of the context would be injected into the QML runtime from C++ via > > calls to `setContextProperty()`, as well as by defining additional QML > > modules from C++ (via `qmlRegister...()`). > > This is where your architecture fails. By u

Re: [Interest] Problems with qt_add_qml_module

2023-10-24 Thread Ulf Hermann via Interest
Most of the context would be injected into the QML runtime from C++ via calls to `setContextProperty()`, as well as by defining additional QML modules from C++ (via `qmlRegister...()`). This is where your architecture fails. By using setContextProperty() and procedurally registering types, you

Re: [Interest] Problems with qt_add_qml_module

2023-10-24 Thread Stefan Seefeld
Hi Ulf, thank you for following up ! Yes, it's entirely possible I'm missing something fundamental, trying to approach a problem from the wrong side, so let me give some context: We are developing an application that's written mostly in C++ with a GUI done in QML. The application architecture is

Re: [Interest] Problems with qt_add_qml_module

2023-10-24 Thread Ulf Hermann via Interest
I'm trying to create a QML extension module using CMake, and I've run into some road blocks. I want to create a QML module including a "plugin", based on my own code rather than an auto-generated plugin stub. My first question is why? The most important part of a QML module is generally a back

[Interest] Problems with qt_add_qml_module

2023-10-23 Thread Stefan Seefeld
Hello, I'm trying to create a QML extension module using CMake, and I've run into some road blocks. I want to create a QML module including a "plugin", based on my own code rather than an auto-generated plugin stub. I assume I'll have to define my own plugin target and then use `target_include_di