From 1c44804600ad3dbeb60d1f5209ce9cf937d30ab3 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 16 Jan 2020 13:45:15 +0100 Subject: Add PointerHandler.cursorShape property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also, QQuickItemPrivate::setHasCursorInChild() was unable to check the QQuickItemPrivate::hasCursor variable, because the function argument hasCursor was shadowing that, even though the comment "nope! sorry, I have a cursor myself" hints that the intention was to check that. So this change exposed a problem there, and we have to fix that too, in order to keep the tst_qquickwindow::cursor() test passing. [ChangeLog][Event Handlers] Pointer Handlers now have a cursorShape property to set the cursor when the handler is active and the mouse is hovering, and restore to the previous cursor when the mouse leaves. Fixes: QTBUG-68073 Change-Id: Ib5c66bd59c4691c4210ee5465e1c95e7bdcf5ae1 Reviewed-by: Jan Arve Sæther --- src/quick/handlers/qquickpointerhandler_p.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/quick/handlers/qquickpointerhandler_p.h') diff --git a/src/quick/handlers/qquickpointerhandler_p.h b/src/quick/handlers/qquickpointerhandler_p.h index 34ae9ce2c2..7262f4bcd3 100644 --- a/src/quick/handlers/qquickpointerhandler_p.h +++ b/src/quick/handlers/qquickpointerhandler_p.h @@ -72,6 +72,9 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPointerHandler : public QObject, public QQmlP Q_PROPERTY(GrabPermissions grabPermissions READ grabPermissions WRITE setGrabPermissions NOTIFY grabPermissionChanged) Q_PROPERTY(qreal margin READ margin WRITE setMargin NOTIFY marginChanged) Q_PROPERTY(int dragThreshold READ dragThreshold WRITE setDragThreshold RESET resetDragThreshold NOTIFY dragThresholdChanged REVISION 15) +#if QT_CONFIG(cursor) + Q_PROPERTY(Qt::CursorShape cursorShape READ cursorShape WRITE setCursorShape RESET resetCursorShape NOTIFY cursorShapeChanged REVISION 15) +#endif QML_NAMED_ELEMENT(PointerHandler) QML_UNCREATABLE("PointerHandler is an abstract base class.") @@ -119,6 +122,13 @@ public: void setDragThreshold(int t); void resetDragThreshold(); +#if QT_CONFIG(cursor) + Qt::CursorShape cursorShape() const; + void setCursorShape(Qt::CursorShape shape); + void resetCursorShape(); + bool isCursorShapeExplicitlySet() const; +#endif + Q_SIGNALS: void enabledChanged(); void activeChanged(); @@ -128,6 +138,9 @@ Q_SIGNALS: void grabChanged(QQuickEventPoint::GrabTransition transition, QQuickEventPoint *point); void grabPermissionChanged(); void canceled(QQuickEventPoint *point); +#if QT_CONFIG(cursor) + Q_REVISION(15) void cursorShapeChanged(); +#endif protected: QQuickPointerHandler(QQuickPointerHandlerPrivate &dd, QQuickItem *parent); -- cgit v1.2.3