TechDraw - Balloon updates - improve hospot calculation

This commit is contained in:
Tomas Pavlicek
2021-10-09 00:30:28 +02:00
parent f43226f1f6
commit b485155c33

View File

@@ -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;
}