Details
-
Task
-
Resolution: Done
-
P3: Somewhat important
-
None
-
22f9e5fb1ed643f284f50b9417bdbafdfb20566b
Description
This would affect the following functions:
- http://doc.qt.io/qt-5/qqmlengine.html#qmlRegisterExtendedUncreatableType
- http://doc.qt.io/qt-5/qqmlengine.html#qmlRegisterUncreatableMetaObject
- http://doc.qt.io/qt-5/qqmlengine.html#qmlRegisterUncreatableType
Within these functions, we can check if the reason argument is empty, and if so, provide a default message that basically says:
Foo cannot be created in QML.
My reasoning behind wanting to do this is that most people are going to use similar variations of the same message, and if you have a lot of types to register, it gets messy quickly:
qmlRegisterUncreatableType<Foo>("QmlTypes", 1, 0, "Foo", "Foo should not be created in QML"); qmlRegisterUncreatableType<Bar>("QmlTypes", 1, 0, "Bar", "Bar should not be created in QML"); qmlRegisterUncreatableType<Baz>("QmlTypes", 1, 0, "Baz", "Baz is an enum"); // and so on
It would be much nicer if the user could just use the default and override when necessary:
qmlRegisterUncreatableType<Foo>("QmlTypes", 1, 0, "Foo"); qmlRegisterUncreatableType<Bar>("QmlTypes", 1, 0, "Bar"); qmlRegisterUncreatableType<Baz>("QmlTypes", 1, 0, "Baz", "Baz is an enum");
Attachments
Issue Links
- duplicates
-
QTBUG-83842 QML_UNCREATABLE should have a default message
- Closed