diff options
author | Jan Arve Sæther <jan-arve.saether@qt.io> | 2020-10-20 16:58:11 +0200 |
---|---|---|
committer | Jan Arve Sæther <jan-arve.saether@qt.io> | 2020-10-21 08:37:15 +0200 |
commit | 2a5afb88dbf675c39e0671b11870596fdb3b6725 (patch) | |
tree | 81e5834a409dd4667fe6a44dba086b2c71877bb0 /src | |
parent | 05685708b78b43713fbfc59ff78160340a38e2d1 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/kernel/qtooltip.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp index a57ede6059..ca29cdcc9c 100644 --- a/src/widgets/kernel/qtooltip.cpp +++ b/src/widgets/kernel/qtooltip.cpp @@ -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 |