QWaylandQuickShellIntegration Class

为壳表面与QtQuick 集成提供支持。更多

头文件: #include <QWaylandQuickShellIntegration>
CMake: find_package(Qt6 REQUIRED COMPONENTS WaylandCompositor)
target_link_libraries(mytarget PRIVATE Qt6::WaylandCompositor)
qmake: QT += waylandcompositor
继承: QObject

详细说明

壳表面实现应继承于该类,以便提供壳表面与QtQuick 之间的集成。

Shell 整合是作为QWaylandQuickShellSurfaceItem 的事件过滤器安装的。重新实现事件过滤器方法,并在要过滤掉事件时返回true ,否则返回false

示例

classMyShellIntegration :public QWaylandQuickShellIntegration{ Q_OBJECTpublic: MyShellIntegration(QObject*parent =nullptr);protected:booleventFilter(QObject*object QEvent*event) override; }; MyShellIntegration::MyShellIntegration(QObject*parent) QWaylandQuickShellIntegration(parent) { }boolMyShellIntegration::eventFilter(QObject*object QEvent*事件 { QWaylandQuickShellSurfaceItem*shellSurfaceItem =  qobject_cast<QWaylandQuickShellSurfaceItem*>(object);if(!shellSurfaceItem)return QWaylandQuickShellIntegration::eventFilter(object,event);if(event->type()==QEvent鼠标移动){        QMouseEvent*mouseEvent =  static_cast<QMouseEvent*>(event);        qDebug() << "Mouse moved on" << shellSurfaceItem << "pos:" << mouseEvent->pos();
       return true; }return QWaylandQuickShellIntegration::eventFilter(object,event); }

另请参阅 QWaylandQuickShellSurfaceItemQObject::eventFilter()。

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