[][src]Function qt_qml::qml_register_uncreatable_meta_object

pub unsafe fn qml_register_uncreatable_meta_object(
    static_meta_object: impl CastInto<Ref<QMetaObject>>,
    uri: *const c_char,
    version_major: c_int,
    version_minor: c_int,
    qml_name: *const c_char,
    reason: impl CastInto<Ref<QString>>
) -> c_int

This function registers the staticMetaObject and its extension in the QML system with the name qmlName in the library imported from uri having version number composed from versionMajor and versionMinor.

Calls C++ function: int qmlRegisterUncreatableMetaObject(const QMetaObject& staticMetaObject, const char* uri, int versionMajor, int versionMinor, const char* qmlName, const QString& reason).

C++ documentation:

This function registers the staticMetaObject and its extension in the QML system with the name qmlName in the library imported from uri having version number composed from versionMajor and versionMinor.

An instance of the meta object cannot be created. An error message with the given reason is printed if the user attempts to create it.

This function is useful for registering Q_NAMESPACE namespaces.

Returns the QML type id.

For example:

namespace MyNamespace { Q_NAMESPACE enum MyEnum { Key1, Key2, }; Q_ENUMS(MyEnum) }

//... qmlRegisterUncreatableMetaObject(MyNamespace::staticMetaObject, "io.qt", 1, 0, "MyNamespace", "Access to enums & flags only");

On the QML side, you can now use the registered enums:

Component.onCompleted: console.log(MyNamespace.Key2)

This function was introduced in Qt 5.8.