- Qt 6.9
- Qt Qml
- QQmlEngine Proxy Page
- Qt 6.9.3 Reference Documentation

# QQmlEngine Proxy Page

## Macros

| QML_NAMESPACE_EXTENDED(EXTENSION_NAMESPACE)

## Macro Documentation

### QML_NAMESPACE_EXTENDED(EXTENSION_NAMESPACE)

Behaves the same way as QML_EXTENDED_NAMESPACE with the distinction that what is being extended is a namespace and not a type.

Declares that the enclosing namespace uses EXTENSION_NAMESPACE as an extension to provide further enumerations in QML. This takes effect if the extended namespace is exposed to QML using a QML_ELEMENT or QML_NAMED_ELEMENT() macro. The enumerations need to be exposed to the metaobject system for this to work.

For example, in the following C++ code,

     namespace NS2 {
         Q_NAMESPACE

         enum class E2 { D = 3, E, F };
         Q_ENUM_NS(E2)
     }

     namespace NS1 {
         Q_NAMESPACE
         QML_ELEMENT

         enum class E1 { A, B, C };
         Q_ENUM_NS(E1)

         // Extends NS1 with NS2
         QML_NAMESPACE_EXTENDED(NS2)
     }

the namespace `NS1` is extended with `NS2` and the `E2` enum becomes available within `NS1` from QML.

     Item {
         Component.onCompleted: console.log(NS1.E1.A, NS1.E2.D)
     }

Note: EXTENSION_NAMESPACE can also be a QObject or QGadget; in that case - and in contrast to QML_EXTENDED, which also exposes methods and properties - only its enumerations are exposed.

Note: EXTENSION_NAMESPACE must have a metaobject; i.e. it must either be a namespace which contains the Q_NAMESPACE macro or a QObject/QGadget.

Note: The class name needs to be fully qualified, even if you're already inside the namespace.

See also QML_EXTENDED_NAMESPACE(), QML_ELEMENT, QML_NAMED_ELEMENT(), QML_EXTENDED(), Registering Extension Objects, Q_ENUM, and Q_ENUM_NS.