From af9daa9e467218efc281abc89ac4745910a50f12 Mon Sep 17 00:00:00 2001 From: Tomas Pavlicek Date: Sat, 9 Oct 2021 00:30:28 +0200 Subject: [PATCH] TechDraw - Balloon updates - improve hospot calculation --- src/Mod/TechDraw/Gui/QGVPage.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Mod/TechDraw/Gui/QGVPage.cpp b/src/Mod/TechDraw/Gui/QGVPage.cpp index a977ae0589..903f9354fc 100644 --- a/src/Mod/TechDraw/Gui/QGVPage.cpp +++ b/src/Mod/TechDraw/Gui/QGVPage.cpp @@ -1262,6 +1262,7 @@ double QGVPage::getDevicePixelRatio() const { QPixmap QGVPage::prepareCursorPixmap(const char *iconName, QPoint &hotspot) { + QPointF floatHotspot(hotspot); double pixelRatio = getDevicePixelRatio(); // Due to impossibility to query cursor size via Qt API, we stick to (32x32)*device_pixel_ratio @@ -1273,17 +1274,18 @@ QPixmap QGVPage::prepareCursorPixmap(const char *iconName, QPoint &hotspot) { // The default (and here expected) SVG cursor graphics size is 64x64 pixels, thus we must adjust // the 64x64 based hotspot position for our 32x32 based cursor pixmaps accordingly - hotspot /= 2; + floatHotspot *= 0.5; #if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC) // On XCB platform, the pixmap device pixel ratio is not taken into account for cursor hot spot, // therefore we must take care of the transformation ourselves... // Refer to QTBUG-68571 - https://bugreports.qt.io/browse/QTBUG-68571 if (qGuiApp->platformName() == QLatin1String("xcb")) { - hotspot *= pixelRatio; + floatHotspot *= pixelRatio; } #endif + hotspot = floatHotspot.toPoint(); return pixmap; }