Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
6.8.0
-
None
Description
Given this very basic example:
// customitem.h #pragma once #include <QObject> #include <QQuickItem> #include <QtQml> class CustomItem : public QQuickItem { Q_OBJECT QML_ELEMENT public: CustomItem(); signals: };
// Main.qml import QtQuick import com.mycompany.qmlcomponents Window { Item {} width: 640 height: 480 visible: true title: qsTr("Hello World") CustomItem {} }
And you configure your CMakeLists.txt like this:
qt_add_qml_module(appjust_qml URI com.mycompany.qmlcomponents VERSION 1.0 QML_FILES Main.qml SOURCES customitem.h customitem.cpp )
You get warnings from qmlls:
QQuickItem was not found. Did you add all imports and dependencies? [import]
Type CustomItem is used but it is not resolved [unresolved-type]
This makes no sense at all (Qt Creator even offers a convenient option to directly inherit from QQuickItem when creating new class). If you change it to instead inherit from QObject then the warning is gone.