QWaylandQuickShellIntegration Class

Provides support for shell surface integration with QtQuick. More...

Header: #include <QWaylandQuickShellIntegration>
CMake: find_package(Qt6 COMPONENTS Waylandcompositor REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::Waylandcompositor)
qmake: QT += waylandcompositor
Since: Qt 5.14
Inherits: QObject

Detailed Description

Shell surface implementations should inherit from this class in order to provide an integration between the shell surface and QtQuick.

Shell integration is installed as an event filter for a QWaylandQuickShellSurfaceItem. Reimplement the event filter method and return true when you want to filter the event out, otherwise return false.


class MyShellIntegration : public QWaylandQuickShellIntegration
    MyShellIntegration(QObject *parent = nullptr);

    bool eventFilter(QObject *object, QEvent *event) override;

MyShellIntegration::MyShellIntegration(QObject *parent)
    : QWaylandQuickShellIntegration(parent)

bool MyShellIntegration::eventFilter(QObject *object, QEvent *event)
    QWaylandQuickShellSurfaceItem *shellSurfaceItem = qobject_cast<QWaylandQuickShellSurfaceItem *>(object);
    if (!shellSurfaceItem)
        return QWaylandQuickShellIntegration::eventFilter(object, event);

    if (event->type() == QEvent::MouseMove) {
        QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
        qDebug() << "Mouse moved on" << shellSurfaceItem << "pos:" << mouseEvent->pos();
        return true;

    return QWaylandQuickShellIntegration::eventFilter(object, event);

See also QWaylandQuickShellSurfaceItem and QObject::eventFilter().

© 2021 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.