Fix crash with drag cursor handling

7a7c722782 caused a regresssion in some
cases.

Change-Id: I1089a79534d811b195de663ff664d9ba5a6ac6c5
Fixes: QTBUG-74110
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Joni Poikelin 2019-02-28 09:54:20 +02:00
parent 1e4dec12d5
commit d1141b6c90

View File

@ -310,11 +310,15 @@ void QBasicDrag::updateCursor(Qt::DropAction action)
m_dndHasSetOverrideCursor = true;
} else {
QCursor *cursor = QGuiApplication::overrideCursor();
if (!pixmap.isNull()) {
if (cursor->pixmap().cacheKey() != pixmap.cacheKey())
QGuiApplication::changeOverrideCursor(QCursor(pixmap));
} else if (cursorShape != cursor->shape()) {
QGuiApplication::changeOverrideCursor(QCursor(cursorShape));
if (!cursor) {
QGuiApplication::changeOverrideCursor(pixmap.isNull() ? QCursor(cursorShape) : QCursor(pixmap));
} else {
if (!pixmap.isNull()) {
if (cursor->pixmap().cacheKey() != pixmap.cacheKey())
QGuiApplication::changeOverrideCursor(QCursor(pixmap));
} else if (cursorShape != cursor->shape()) {
QGuiApplication::changeOverrideCursor(QCursor(cursorShape));
}
}
}
#endif