Nominate our 2022 Qt Champions!

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 it isn't possible. But I don't understand why the way qml initialize objects makes this thing impossible.

Log in to reply