Fix the default handling of cursor shape when there is no standard one

When the cursor specified is a bitmap one we cannot cache it based on
the shape as the pixmap set on the cursor may be different. Therefore
we should always create a new cursor in this instance.

Change-Id: I2c201590ff632490d76c1b423908ae32aa584eb6
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
This commit is contained in:
Andy Shaw 2013-02-15 14:44:18 +01:00 committed by The Qt Project
parent dd30f3e65b
commit 79498af6e4

View File

@ -96,10 +96,15 @@ void QCocoaCursor::changeCursor(QCursor *cursor, QWindow *window)
break; break;
case Qt::DragLinkCursor: case Qt::DragLinkCursor:
[[NSCursor dragLinkCursor] set]; [[NSCursor dragLinkCursor] set];
break;
default : { default : {
// No suitable OS cursor exist, use cursors provided // No suitable OS cursor exist, use cursors provided
// by Qt for the rest. Check for a cached cursor: // by Qt for the rest. Check for a cached cursor:
NSCursor *cocoaCursor = m_cursors.value(cursor->shape()); NSCursor *cocoaCursor = m_cursors.value(cursor->shape());
if (cocoaCursor && cursor->shape() == Qt::BitmapCursor) {
[cocoaCursor release];
cocoaCursor = 0;
}
if (cocoaCursor == 0) { if (cocoaCursor == 0) {
cocoaCursor = createCursorData(cursor); cocoaCursor = createCursorData(cursor);
if (cocoaCursor == 0) { if (cocoaCursor == 0) {