Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.5.1, 6.6.0 Beta1
-
c45c32af3 (dev), bc2ae5a70 (dev), 7d01e7ef8 (dev)
Description
Code
// cppbase.h, in submodule #include <QQmlEngine> class CppBase : public QObject { Q_OBJECT QML_ELEMENT public: explicit CppBase(QObject* parent = nullptr) : QObject(parent) {} };
// cppderived.h, in "main" module #include "MyModule/cppbase.h" class CppDerived : public CppBase { Q_OBJECT QML_ELEMENT public: explicit CppDerived(QObject* parent = nullptr) : CppBase(parent) {} };
Compiler output
Warning: Main.qml: Object type CppDerived is not derived from QObject or QQmlComponent. You may need to fully qualify all names in C++ so that moc can see them. You may also need to add qt_extract_metatypes(<target containing >). [compiler]
Workaround
Instead of linking to the plugin target, link directly to the backing target. In other words, replace this...
target_link_libraries(appCrossModuleDerivation PRIVATE Qt6::Quick MyModuleplugin )
...with this:
target_link_libraries(appCrossModuleDerivation PRIVATE Qt6::Quick MyModule )
Attachments
Issue Links
- mentioned in
-
Page Loading...