- Qt 6.6
- Qt Wayland Compositor
- C++ Classes
- QWaylandCompositorExtension
- Qt Wayland Compositor | Commercial or GPLv3

# QWaylandCompositorExtension Class

QWaylandCompositorExtension is the base class for compositor extensions. More...

Header: | #include <QWaylandCompositorExtension>
CMake: | find_package(Qt6 REQUIRED COMPONENTS WaylandCompositor) target_link_libraries(mytarget PRIVATE Qt6::WaylandCompositor)
qmake: | QT += waylandcompositor
Inherits: | QWaylandObject
Inherited By: | QWaylandCompositorExtensionTemplate and QWaylandShellSurface

- List of all members, including inherited members

## Public Functions

| QWaylandCompositorExtension()
| QWaylandCompositorExtension(QWaylandObject *container)
QWaylandObject * | extensionContainer() const
virtual const struct wl_interface * | extensionInterface() const = 0
virtual void | initialize()
void | setExtensionContainer(QWaylandObject *container)

## Detailed Description

QWaylandCompositorExtension is the base class for implementing Wayland extensions on the compositor-side of the connection. If no other extension container is explicitly set, it will automatically add itself to its parent object, granted that this inherits from QWaylandObject.

For example, for registering global extensions, you can inherit from QWaylandCompositorExtension and pass the QWaylandCompositor object as extension container.

See also QWaylandCompositorExtensionTemplate and Custom Shell.

## Member Function Documentation

### QWaylandCompositorExtension::QWaylandCompositorExtension()

Creates a QWaylandCompositorExtension with no container.

See also setExtensionContainer().

### QWaylandCompositorExtension::QWaylandCompositorExtension(QWaylandObject *container)

Creates a QWaylandCompositorExtension and adds it to the extension container. The container does not become the parent of the QWaylandCompositorExtension.

The extension adds itself to container later, when initialize() is called. For this to happen automatically, an event loop must be running in the current thread.

The QWaylandCompositorExtension will remove itself again when it is destroyed.

### QWaylandObject *QWaylandCompositorExtension::extensionContainer() const

Returns the extension container for this QWaylandCompositorExtension or null if none has been set.

See also setExtensionContainer().

### `[pure virtual]` const struct wl_interface *QWaylandCompositorExtension::extensionInterface() const

A pure virtual function which should be reimplemented to return the `wl_interface` which corresponds to this QWaylandCompositorExtension.

### `[virtual]` void QWaylandCompositorExtension::initialize()

Initializes the QWaylandCompositorExtension. The default implementation adopts the parent object as extension container if none has been set, and if the parent inherits from QWaylandObject. The default implementation also adds the QWaylandCompositorExtension to the list of extensions managed by the extension container.

Override this function in subclasses to provide custom initialization code.

### void QWaylandCompositorExtension::setExtensionContainer(QWaylandObject *container)

Sets the extension container for this QWaylandCompositorExtension to container. This must be called before initialize() and cannot be changed once the QWaylandCompositorExtension has been initialized.

See also extensionContainer().