Sur cette page

QWaylandQuickShellIntegration Class

Prise en charge de l'intégration de la surface de la coque avec QtQuick. Plus...

En-tête : #include <QWaylandQuickShellIntegration>
CMake : find_package(Qt6 REQUIRED COMPONENTS WaylandCompositor)
target_link_libraries(mytarget PRIVATE Qt6::WaylandCompositor)
qmake : QT += waylandcompositor
Hérite : QObject

Description détaillée

Les implémentations de la surface de la coquille devraient hériter de cette classe afin de fournir une intégration entre la surface de la coquille et QtQuick.

L'intégration du shell est installée en tant que filtre d'événement pour un QWaylandQuickShellSurfaceItem. Réimplémentez la méthode de filtre d'événement et renvoyez true si vous souhaitez filtrer l'événement, sinon renvoyez false.

Exemple :

class MyShellIntegration : public QWaylandQuickShellIntegration
{ Q_OBJECTpublic: MyShellIntegration(QObject *parent = nullptr) ;protected: bool eventFilter(QObject*object, QEvent *event) override ; } ; MyShellIntegration::MyShellIntegration(QObject *parent) : QWaylandQuickShellIntegration(parent) { }bool MyShellIntegration::eventFilter(QObject*objet, 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) ; }

Voir aussi QWaylandQuickShellSurfaceItem et 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.