이 페이지에서

QWaylandQuickShellIntegration Class

QtQuick 와의 셸 표면 통합을 지원합니다. 더 보기...

헤더: #include <QWaylandQuickShellIntegration>
CMake: find_package(Qt6 REQUIRED COMPONENTS WaylandCompositor)
target_link_libraries(mytarget PRIVATE Qt6::WaylandCompositor)
qmake: QT += waylandcompositor
상속: QObject

상세 설명

셸 표면 구현체는 셸 표면과 QtQuick 간의 통합을 제공하기 위해 이 클래스를 상속받아야 합니다.

셸 통합은 QWaylandQuickShellSurfaceItem 에 대한 이벤트 필터로 설치됩니다. 이벤트를 필터링하려는 경우 이벤트 필터 메서드를 재구현하여 ` true `를 반환하고, 그렇지 않은 경우 ` false`를 반환하십시오.

예시:

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

protected:
    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);
}

QWaylandQuickShellSurfaceItem 및 QObject::eventFilter()도 참조하십시오 .

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