summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Arve Sæther <jan-arve.saether@qt.io>2020-10-20 16:58:11 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-10-21 10:10:26 +0000
commit087d7891aa54084236a27b5b77767e9d5106e108 (patch)
tree31c05063c2e6c0c5bf675ba99d4c9f85e56b6191
parent5bd0fc1d5d5e61a54ea191480c2697d1c8e89fe7 (diff)
Do not crash if QPA plugin does not support cursors5.15
This was the case on Android, and caused a crash Fixes: QTBUG-83916 Change-Id: Iabc17237498091d815241730a2b14ece5a45d0b9 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 2a5afb88dbf675c39e0671b11870596fdb3b6725) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/widgets/kernel/qtooltip.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp
index 661568dcad..0c9db61f91 100644
--- a/src/widgets/kernel/qtooltip.cpp
+++ b/src/widgets/kernel/qtooltip.cpp
@@ -406,7 +406,10 @@ void QTipLabel::placeTip(const QPoint &pos, QWidget *w)
QGuiApplication::primaryScreen());
// 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