On Tue, Oct 24, 2023 at 10:47 AM Ulf Hermann <ulf.herm...@qt.io> 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 to move these calls into plugins, or at least have some QML > > extension module link to these libraries so they can see these types. > > What am I missing ? > > You are getting this fundamentally wrong. When using qt_add_qml_module > you do not have to call any qmlRegisterType at all. qmltyperegistrar and > CMake do all of this behind the scenes and relieve you from the pain of > maintaining your plugins, type registration calls, qmltypes files, > versions, metaobject revisions and all the other cruft you have to do in > Qt5. You can easily have modules that contain both QML files and > C++-based types now, too. > That sounds great. It would be nice if this was documented a little more clearly, though, as the existing docs are a little light and obscure. How does this mechanism figure out what types should be registered / exported and under what names ? As I described in my previous mail, we have a great number of libraries, defining many classes. Some of them derive from `QObject`, and a few of those need to be made available to QML. I expect to eventually create a number of QML extension modules (following the modular structure of my application), so how can I express which headers to extract the types from, and how can I define the names I want to give to those types in QML ? Thanks, -- ...ich hab' noch einen Koffer in Berlin...
_______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest