How to register a custom QML type in a visual studio project?
-
I'm trying to replicate the code in the tutorial Writing QML Extensions with C++ in a visual studio project (with Qt VS tools extension). But I can not find the correct way to register the newly created QML type.
Inside the tutorial, it's using qmake code blow to register the QML type:
CONFIG += qmltypes QML_IMPORT_NAME = Charts QML_IMPORT_MAJOR_VERSION = 1
But I didn't find the counterpart settings inside the visual studio project settings, and extra qmake commands are not found either. How could I register the type?
-
The 5.15 way is very inflexible. I don't like it at all.
https://doc.qt.io/qt-5/qqmlengine.htmlYou would do better finding the docs for 5.12 for how to register qml types. It shows how to use qqmlengine better. [https://doc.qt.io/archives/qt-5.12//qtqml-tutorials-extending-qml-example.html(https://doc.qt.io/archives/qt-5.12//qtqml-tutorials-extending-qml-example.html).
As far as I know the "new way" is not going to replace the "old way".
We register multiple QML modules that we define. I struggled to see how to do that with the new way.