Skip to content

Commit

Permalink
Gui: [skip ci] must set device pixel ratio to QBitmaps on Windows whe…
Browse files Browse the repository at this point in the history
…n using for cursor as otherwise garbage is shown
  • Loading branch information
wwmayer committed Jan 18, 2021
1 parent 6719e86 commit 254ed95
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Gui/View3DInventorViewer.cpp
Expand Up @@ -77,6 +77,7 @@
# include <Inventor/VRMLnodes/SoVRMLGroup.h>
# include <Inventor/nodes/SoPickStyle.h>
# include <Inventor/nodes/SoTransparencyType.h>
# include <QApplication>
# include <QEventLoop>
# include <QKeyEvent>
# include <QWheelEvent>
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 254ed95

Please sign in to comment.