QQmlExtensionPlugin Class

The QQmlExtensionPlugin class provides an abstract base for custom QML extension plugins with custom type registration functions. More...

Header: #include <QQmlExtensionPlugin>
CMake: find_package(Qt6 REQUIRED COMPONENTS Qml)
target_link_libraries(mytarget PRIVATE Qt6::Qml)
qmake: QT += qml
Inherits: QObject

Public Functions

(since 6.0) virtual void unregisterTypes()

Reimplemented Public Functions

virtual void initializeEngine(QQmlEngine *engine, const char *uri) override

Detailed Description

Note: If you need to write a plugin manually (which is rare) you should always use QQmlEngineExtensionPlugin. QQmlExtensionPlugin only provides the registerTypes() and unregisterTypes() functions in addition. You should not use them, but rather declare your types with QML_ELEMENT and friends and have the build system take care of the registration.

Member Function Documentation

[override virtual] void QQmlExtensionPlugin::initializeEngine(QQmlEngine *engine, const char *uri)

Initializes the extension from the uri using the engine. Here an application plugin might, for example, expose some data or objects to QML, as context properties on the engine's root context.

[virtual, since 6.0] void QQmlExtensionPlugin::unregisterTypes()

Override this method to unregister types manually registered in registerTypes.

This function was introduced in Qt 6.0.