QWaylandQuickShellIntegration Class

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

Header: #include <QWaylandQuickShellIntegration>
qmake: QT += waylandcompositor
Since: Qt 5.14
Inherits: QObject

Public Functions

QWaylandQuickShellIntegration(QObject *parent = nullptr)
virtual ~QWaylandQuickShellIntegration() override
  • 34 public functions inherited from QObject

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 2 signals inherited from QObject
  • 1 public variable inherited from QObject
  • 10 static public members inherited from QObject
  • 9 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

Provides support for shell surface integration with QtQuick.

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.

Example:


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

See also QWaylandQuickShellSurfaceItem and QObject::eventFilter().

Member Function Documentation

QWaylandQuickShellIntegration::QWaylandQuickShellIntegration(QObject *parent = nullptr)

Default constructs an instance of QWaylandQuickShellIntegration.

[override virtual] QWaylandQuickShellIntegration::~QWaylandQuickShellIntegration()

Destroys the instance of QWaylandQuickShellIntegration. The destructor is virtual.