Do not crash if QPA plugin does not support cursors

This was the case on Android, and caused a crash

Fixes: QTBUG-83916
Pick-to: 5.15
Change-Id: Iabc17237498091d815241730a2b14ece5a45d0b9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
bb10
Jan Arve Sæther 2020-10-20 16:58:11 +02:00
parent 05685708b7
commit 2a5afb88db
1 changed files with 4 additions and 1 deletions

View File

@ -389,7 +389,10 @@ void QTipLabel::placeTip(const QPoint &pos, QWidget *w)
const QScreen *screen = getTipScreen(pos, w);
// a QScreen's handle *should* never be null, so this is a bit paranoid
if (const QPlatformScreen *platformScreen = screen ? screen->handle() : nullptr) {
const QSize cursorSize = QHighDpi::fromNativePixels(platformScreen->cursor()->size(),
QPlatformCursor *cursor = platformScreen->cursor();
// default implementation of QPlatformCursor::size() returns QSize(16, 16)
const QSize nativeSize = cursor ? cursor->size() : QSize(16, 16);
const QSize cursorSize = QHighDpi::fromNativePixels(nativeSize,
platformScreen);
QPoint offset(2, cursorSize.height());
// assuming an arrow shape, we can just move to the side for very large cursors