このページでは

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 を返してください。

例:

classMyShellIntegration :publicQWaylandQuickShellIntegration
{
    Q_OBJECT
public:
    MyShellIntegration(QObject*parent =nullptr);

protected:
    booleventFilter(QObject*object,QEvent*event) override;
};

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

boolMyShellIntegration::eventFilter(QObject*object,QEvent*event)
{
    QWaylandQuickShellSurfaceItem*shellSurfaceItem =qobject_cast<QWaylandQuickShellSurfaceItem*>(object);
    if(!shellSurfaceItem)
        returnQWaylandQuickShellIntegration::eventFilter(object,event);

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

    returnQWaylandQuickShellIntegration::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.