Details
-
Bug
-
Resolution: Duplicate
-
P3: Somewhat important
-
5.15.2, 6.0.0
Description
When exposing a C++ type to QML (with e.g. QML_ELEMENT), it's possible to run into this error message:
Element is not creatable.
This means that the type cannot be created in C++. An example of this is forgetting to implement some virtual functions in an QAbstractItemModel subclass. It's not unusual for C++ types like models to be written purely for the sake of being exposed to QML, and hence never directly constructed in C++ in the application code.
I think that the error message in this case should be more descriptive, even if a type not being creatable is valid C++ (e.g. intentionally missing a constructor or unimplemented virtual functions for classes that are intended to be subclassed). For example:
Type Foo is not creatable because QQuickFoo is an abstract type.
Attachments
Issue Links
- duplicates
-
QTBUG-104899 QML(_NAMED)_ELEMENT should generate a clear error if the type in not default constructible
- Closed
- relates to
-
QTBUG-106093 No specific warning when trying to expose a C++ type to QML which has no default constructor
- Closed