QWaylandCompositorExtensionTemplate Class

template <typename T> class QWaylandCompositorExtensionTemplate

QWaylandCompositorExtensionTemplate is a convenience class for subclassing QWaylandCompositorExtension. More...

Header: #include <QWaylandCompositorExtensionTemplate>
CMake: find_package(Qt6 REQUIRED COMPONENTS Waylandcompositor)
target_link_libraries(mytarget PRIVATE Qt6::Waylandcompositor)
qmake: QT += waylandcompositor
Since: Qt 5.8
Inherits: QWaylandCompositorExtension
Inherited By:

QWaylandIdleInhibitManagerV1, QWaylandIviApplication, QWaylandPresentationTime, QWaylandQtTextInputMethodManager, QWaylandTextInputManager, QWaylandViewporter, QWaylandXdgDecorationManagerV1, and QWaylandXdgOutputManagerV1

Public Functions

Reimplemented Public Functions

virtual const struct wl_interface *extensionInterface() const override

Static Public Members

T *findIn(QWaylandObject *container)

Protected Functions

QWaylandCompositorExtensionTemplate(QWaylandCompositorExtensionPrivate &dd)
QWaylandCompositorExtensionTemplate(QWaylandObject *container, QWaylandCompositorExtensionPrivate &dd)

Detailed Description

QWaylandCompositorExtensionTemplate is a template class which inherits QWaylandCompositorExtension and is convenience for building custom Wayland extensions with Qt.

It provides the connection between Qt Wayland Compositor and the class generated by qtwaylandscanner, based on the XML description of the extension protocol.

It provides two specific pieces of convenience:

  • A reimplementation of QWaylandCompositorExtension::extensionInterface() which returns the wl_interface pointer for the qtwaylandscanner-generated base class.
  • A static findIn() function which searches for an instance of the extension in a provided container, and returns this if it is found.

Typically, a new extension will dual-inherit QWaylandCompositorExtensionTemplate and the class generated by qtwaylandscanner.

QWaylandCompositorExtensionTemplate should be parameterized with the subclass itself:

class MyExtension
    : public QWaylandCompositorExtensionTemplate<MyExtension>
    , QtWaylandServer::my_extension

In this example, MyExtension is an implementation of the generated interface my_extension.

See also Qt Wayland Compositor Examples - Custom Shell.

Member Function Documentation

QWaylandCompositorExtensionTemplate::QWaylandCompositorExtensionTemplate()

Default constructs an instance of QWaylandCompositorExtensionTemplate.

QWaylandCompositorExtensionTemplate::QWaylandCompositorExtensionTemplate(QWaylandObject *container)

Default constructs an instance of QWaylandCompositorExtensionTemplate.

[protected] QWaylandCompositorExtensionTemplate::QWaylandCompositorExtensionTemplate(QWaylandCompositorExtensionPrivate &dd)

Default constructs an instance of QWaylandCompositorExtensionTemplate.

[protected] QWaylandCompositorExtensionTemplate::QWaylandCompositorExtensionTemplate(QWaylandObject *container, QWaylandCompositorExtensionPrivate &dd)

Default constructs an instance of QWaylandCompositorExtensionTemplate.

[override virtual] const struct wl_interface *QWaylandCompositorExtensionTemplate::extensionInterface() const

[static] T *QWaylandCompositorExtensionTemplate::findIn(QWaylandObject *container)

If any instance of the interface has been registered with container, this is returned. Otherwise null is returned. The look-up is based on the generated interfaceName() which matches the interface name in the protocol description.

© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.