From 9e637d9718d52075a74eeb6b7d9ae21fa9105a52 Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Wed, 23 Oct 2019 23:52:34 +0200 Subject: Implement missing changed signals to properties QML cannot do property binding with properties without CONSTANT or NOTIFY. Also emit changed signal where it's not. Change-Id: I5117383e22085af08589f6aa05892676c24f3846 Reviewed-by: Shawn Rutledge Reviewed-by: Johan Helsing --- src/compositor/compositor_api/qwaylandquickitem.cpp | 10 +++++++++- src/compositor/compositor_api/qwaylandquickitem.h | 3 ++- src/compositor/extensions/qwaylandxdgshell.h | 4 ++-- src/compositor/extensions/qwaylandxdgshellv6.h | 4 ++-- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp index 357805393..c9a2e9fc2 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.cpp +++ b/src/compositor/compositor_api/qwaylandquickitem.cpp @@ -413,11 +413,14 @@ QWaylandSurface *QWaylandQuickItem::surface() const void QWaylandQuickItem::setSurface(QWaylandSurface *surface) { Q_D(QWaylandQuickItem); + QWaylandSurface *oldSurf = d->view->surface(); QWaylandCompositor *oldComp = d->view->surface() ? d->view->surface()->compositor() : nullptr; d->view->setSurface(surface); QWaylandCompositor *newComp = d->view->surface() ? d->view->surface()->compositor() : nullptr; if (oldComp != newComp) emit compositorChanged(); + if (oldSurf != surface) + emit surfaceChanged(); update(); } @@ -1200,7 +1203,12 @@ bool QWaylandQuickItem::paintEnabled() const void QWaylandQuickItem::setPaintEnabled(bool enabled) { Q_D(QWaylandQuickItem); - d->paintEnabled = enabled; + + if (enabled != d->paintEnabled) { + d->paintEnabled = enabled; + emit paintEnabledChanged(); + } + update(); } diff --git a/src/compositor/compositor_api/qwaylandquickitem.h b/src/compositor/compositor_api/qwaylandquickitem.h index 7731933e7..cc1704f63 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.h +++ b/src/compositor/compositor_api/qwaylandquickitem.h @@ -53,7 +53,7 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickItem : public QQuickItem Q_DECLARE_PRIVATE(QWaylandQuickItem) Q_PROPERTY(QWaylandCompositor *compositor READ compositor NOTIFY compositorChanged) Q_PROPERTY(QWaylandSurface *surface READ surface WRITE setSurface NOTIFY surfaceChanged) - Q_PROPERTY(bool paintEnabled READ paintEnabled WRITE setPaintEnabled) + Q_PROPERTY(bool paintEnabled READ paintEnabled WRITE setPaintEnabled NOTIFY paintEnabledChanged) Q_PROPERTY(bool touchEventsEnabled READ touchEventsEnabled WRITE setTouchEventsEnabled NOTIFY touchEventsEnabledChanged) Q_PROPERTY(QWaylandSurface::Origin origin READ origin NOTIFY originChanged) Q_PROPERTY(bool inputEventsEnabled READ inputEventsEnabled WRITE setInputEventsEnabled NOTIFY inputEventsEnabledChanged) @@ -168,6 +168,7 @@ private Q_SLOTS: Q_SIGNALS: void surfaceChanged(); void compositorChanged(); + void paintEnabledChanged(); void touchEventsEnabledChanged(); void originChanged(); void surfaceDestroyed(); diff --git a/src/compositor/extensions/qwaylandxdgshell.h b/src/compositor/extensions/qwaylandxdgshell.h index c79b22350..0535f8e4d 100644 --- a/src/compositor/extensions/qwaylandxdgshell.h +++ b/src/compositor/extensions/qwaylandxdgshell.h @@ -234,8 +234,8 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPopup : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QWaylandXdgPopup) - Q_PROPERTY(QWaylandXdgSurface *xdgSurface READ xdgSurface) - Q_PROPERTY(QWaylandXdgSurface *parentXdgSurface READ parentXdgSurface) + Q_PROPERTY(QWaylandXdgSurface *xdgSurface READ xdgSurface CONSTANT) + Q_PROPERTY(QWaylandXdgSurface *parentXdgSurface READ parentXdgSurface CONSTANT) Q_PROPERTY(QRect configuredGeometry READ configuredGeometry NOTIFY configuredGeometryChanged) // Positioner properties diff --git a/src/compositor/extensions/qwaylandxdgshellv6.h b/src/compositor/extensions/qwaylandxdgshellv6.h index 71f82521a..f280880bc 100644 --- a/src/compositor/extensions/qwaylandxdgshellv6.h +++ b/src/compositor/extensions/qwaylandxdgshellv6.h @@ -215,8 +215,8 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPopupV6 : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QWaylandXdgPopupV6) - Q_PROPERTY(QWaylandXdgSurfaceV6 *xdgSurface READ xdgSurface) - Q_PROPERTY(QWaylandXdgSurfaceV6 *parentXdgSurface READ parentXdgSurface) + Q_PROPERTY(QWaylandXdgSurfaceV6 *xdgSurface READ xdgSurface CONSTANT) + Q_PROPERTY(QWaylandXdgSurfaceV6 *parentXdgSurface READ parentXdgSurface CONSTANT) Q_PROPERTY(QRect configuredGeometry READ configuredGeometry NOTIFY configuredGeometryChanged) // Positioner properties -- cgit v1.2.3