summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPier Luigi Fiorini <pierluigi.fiorini@liri.io>2019-10-23 23:52:34 +0200
committerPier Luigi Fiorini <pierluigi.fiorini@liri.io>2020-01-10 11:40:08 +0100
commit9e637d9718d52075a74eeb6b7d9ae21fa9105a52 (patch)
tree9c9a90ff14a403fb25ad1118310db2433778d64c /src
parent2b903baaf07b14bc58263e1968c5e4adf7580e3e (diff)
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 <shawn.rutledge@qt.io> Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.cpp10
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.h3
-rw-r--r--src/compositor/extensions/qwaylandxdgshell.h4
-rw-r--r--src/compositor/extensions/qwaylandxdgshellv6.h4
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