From ba53384387dcfd2606a513b114eff488d3fdb940 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 16 Oct 2018 09:18:02 +0200 Subject: Compositor: Add const version of QWaylandQuickItem::inputRegionContains Change-Id: I649149e2cee24f8296bf24a22ee8bb865feea9c6 Reviewed-by: Paul Olav Tvete --- src/compositor/compositor_api/qwaylandquickitem.cpp | 12 +++++++++++- src/compositor/compositor_api/qwaylandquickitem.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp index fd9b1b80..a5de3a90 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.cpp +++ b/src/compositor/compositor_api/qwaylandquickitem.cpp @@ -1036,13 +1036,23 @@ void QWaylandQuickItem::setFocusOnClick(bool focus) * Returns \c true if the input region of this item's surface contains the * position given by \a localPosition. */ -bool QWaylandQuickItem::inputRegionContains(const QPointF &localPosition) +bool QWaylandQuickItem::inputRegionContains(const QPointF &localPosition) const { if (QWaylandSurface *s = surface()) return s->inputRegionContains(mapToSurface(localPosition).toPoint()); return false; } +// Qt 6: Remove the non-const version +/*! + * Returns \c true if the input region of this item's surface contains the + * position given by \a localPosition. + */ +bool QWaylandQuickItem::inputRegionContains(const QPointF &localPosition) +{ + return const_cast(this)->inputRegionContains(localPosition); +} + /*! * Maps the given \a point in this item's coordinate system to the equivalent * point within the Wayland surface's coordinate system, and returns the mapped diff --git a/src/compositor/compositor_api/qwaylandquickitem.h b/src/compositor/compositor_api/qwaylandquickitem.h index 653440ae..23708353 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.h +++ b/src/compositor/compositor_api/qwaylandquickitem.h @@ -99,6 +99,7 @@ public: bool focusOnClick() const; void setFocusOnClick(bool focus); + bool inputRegionContains(const QPointF &localPosition) const; bool inputRegionContains(const QPointF &localPosition); Q_INVOKABLE QPointF mapToSurface(const QPointF &point) const; -- cgit v1.2.1