Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

declare property of non-createble C++ type



  • I expose my C++ object into qml using function:
    qmlRegisterUncreatableType<MyObj>("myapp", 1, 0, "MyObj", "");

    This object can not be created directly, but returned from other functions. Like this:

    property var obj;
    ...
    obj = test.getMyObj();
    

    I'm trying to declare property type (to get context help)

    property MyObj obj: undefined
    

    but get qml error "Element is not creatable."

    Is it possible to declare property of non-createble C++ type?



  • Duplicate. As I can see here https://forum.qt.io/topic/25200/using-non-creatable-type-in-qml it isn't possible. But I don't understand why the way qml initialize objects makes this thing impossible.


Log in to reply