QWaylandQuickShellIntegration Class
Bietet Unterstützung für die Integration der Shell-Oberfläche in „ QtQuick “. Mehr...
| Überschrift: | #include <QWaylandQuickShellIntegration> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS WaylandCompositor) target_link_libraries(mytarget PRIVATE Qt6::WaylandCompositor) |
| qmake: | QT += waylandcompositor |
| Erbt von: | QObject |
Ausführliche Beschreibung
Implementierungen von Shell-Oberflächen sollten von dieser Klasse erben, um eine Integration zwischen der Shell-Oberfläche und QtQuick zu gewährleisten.
Die Shell-Integration wird als Ereignisfilter für ein ` QWaylandQuickShellSurfaceItem` installiert. Implementieren Sie die Ereignisfilter-Methode neu und geben Sie ` true ` zurück, wenn Sie das Ereignis herausfiltern möchten; andernfalls geben Sie ` false` zurück.
Beispiel:
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*>(Objekt);
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(Objekt, Ereignis);
}Siehe auch QWaylandQuickShellSurfaceItem und 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.