From 254ed951f924687e3dffb325288bbc0333980b9c Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 18 Jan 2021 15:20:57 +0100 Subject: [PATCH] Gui: [skip ci] must set device pixel ratio to QBitmaps on Windows when using for cursor as otherwise garbage is shown --- src/Gui/View3DInventorViewer.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index 35cee0fdcd36..9c6de05ef1f9 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -77,6 +77,7 @@ # include # include # include +# include # include # include # include @@ -599,16 +600,31 @@ void View3DInventorViewer::init() } //create the cursors +#if defined(Q_OS_WIN32) + qreal dpr = qApp->devicePixelRatio(); +#endif QBitmap cursor = QBitmap::fromData(QSize(ROTATE_WIDTH, ROTATE_HEIGHT), rotate_bitmap); QBitmap mask = QBitmap::fromData(QSize(ROTATE_WIDTH, ROTATE_HEIGHT), rotate_mask_bitmap); +#if defined(Q_OS_WIN32) + cursor.setDevicePixelRatio(dpr); + mask.setDevicePixelRatio(dpr); +#endif spinCursor = QCursor(cursor, mask, ROTATE_HOT_X, ROTATE_HOT_Y); cursor = QBitmap::fromData(QSize(ZOOM_WIDTH, ZOOM_HEIGHT), zoom_bitmap); mask = QBitmap::fromData(QSize(ZOOM_WIDTH, ZOOM_HEIGHT), zoom_mask_bitmap); +#if defined(Q_OS_WIN32) + cursor.setDevicePixelRatio(dpr); + mask.setDevicePixelRatio(dpr); +#endif zoomCursor = QCursor(cursor, mask, ZOOM_HOT_X, ZOOM_HOT_Y); cursor = QBitmap::fromData(QSize(PAN_WIDTH, PAN_HEIGHT), pan_bitmap); mask = QBitmap::fromData(QSize(PAN_WIDTH, PAN_HEIGHT), pan_mask_bitmap); +#if defined(Q_OS_WIN32) + cursor.setDevicePixelRatio(dpr); + mask.setDevicePixelRatio(dpr); +#endif panCursor = QCursor(cursor, mask, PAN_HOT_X, PAN_HOT_Y); naviCube = new NaviCube(this); naviCubeEnabled = true;