From 419296133aa68a317838e047b22513f1e5508b47 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Wed, 25 Jul 2012 14:04:47 +1000 Subject: Fix resolution of cursor when items are overlapping. If MouseArea with cursorShapes are overlapping then cursor shape of the foremost item under the mouse cursor should be shown, but because the hover events are delivered to the foremost items first the opposite is occuring. This makes QQuickWindow responsible for correctly setting its own cursor instead of relying on items to work it out amongst themselves. Change-Id: Iedf144c583dfa3d1ff441e19db9601b5e171902a Reviewed-by: Martin Jones --- src/quick/items/qquickmousearea.cpp | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'src/quick/items/qquickmousearea.cpp') diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp index 5cfd62ff8f..85a224fc93 100644 --- a/src/quick/items/qquickmousearea.cpp +++ b/src/quick/items/qquickmousearea.cpp @@ -1136,15 +1136,6 @@ void QQuickMouseArea::setHovered(bool h) d->hovered = h; emit hoveredChanged(); d->hovered ? emit entered() : emit exited(); -#ifndef QT_NO_CURSOR - if (d->cursor) { - if (d->hovered) { - window()->setCursor(QCursor(*d->cursor)); - } else { - window()->unsetCursor(); - } - } -#endif } } @@ -1274,19 +1265,19 @@ bool QQuickMouseArea::setPressed(Qt::MouseButton button, bool p) #ifndef QT_NO_CURSOR Qt::CursorShape QQuickMouseArea::cursorShape() const { - Q_D(const QQuickMouseArea); - if (d->cursor) - return d->cursor->shape(); - return Qt::ArrowCursor; + return cursor().shape(); } void QQuickMouseArea::setCursorShape(Qt::CursorShape shape) { - Q_D(QQuickMouseArea); - setHoverEnabled(true); - delete d->cursor; - d->cursor = new QCursor(shape); + if (cursor().shape() == shape) + return; + + setCursor(shape); + + emit cursorShapeChanged(); } + #endif /*! -- cgit v1.2.3