diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-04-01 15:31:16 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-04-06 18:28:00 +0000 |
commit | e4e62496ac62deab0e8f6ae9f064cf153b31d2fa (patch) | |
tree | 7e709997add53c627a3ca0686c8b2dec4736ee64 /src/plugins | |
parent | 2a282551ac7735538d9627537941c58de266f2c4 (diff) |
Windows QPA: Scale hotspot of custom cursors correctly.
Separate factors in QWindowsCursor::createPixmapCursor()
and apply factor to the hotspot.
Task-number: QTBUG-52276
Change-Id: Ia5a5db39ddc2bc4215a23ff8625431af9b4a76d8
Reviewed-by: Adam Light <aclight@gmail.com>
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/windows/qwindowscursor.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp index cda741c226..844fe23517 100644 --- a/src/plugins/platforms/windows/qwindowscursor.cpp +++ b/src/plugins/platforms/windows/qwindowscursor.cpp @@ -97,9 +97,9 @@ QWindowsPixmapCursorCacheKey::QWindowsPixmapCursorCacheKey(const QCursor &c) HCURSOR QWindowsCursor::createPixmapCursor(QPixmap pixmap, const QPoint &hotSpot, qreal scaleFactor) { HCURSOR cur = 0; - scaleFactor /= pixmap.devicePixelRatioF(); - if (!qFuzzyCompare(scaleFactor, 1)) { - pixmap = pixmap.scaled((scaleFactor * QSizeF(pixmap.size())).toSize(), + const qreal pixmapScaleFactor = scaleFactor / pixmap.devicePixelRatioF(); + if (!qFuzzyCompare(pixmapScaleFactor, 1)) { + pixmap = pixmap.scaled((pixmapScaleFactor * QSizeF(pixmap.size())).toSize(), Qt::KeepAspectRatio, Qt::SmoothTransformation); } QBitmap mask = pixmap.mask(); @@ -113,8 +113,8 @@ HCURSOR QWindowsCursor::createPixmapCursor(QPixmap pixmap, const QPoint &hotSpot ICONINFO ii; ii.fIcon = 0; - ii.xHotspot = DWORD(hotSpot.x()); - ii.yHotspot = DWORD(hotSpot.y()); + ii.xHotspot = DWORD(qRound(hotSpot.x() * scaleFactor)); + ii.yHotspot = DWORD(qRound(hotSpot.y() * scaleFactor)); ii.hbmMask = im; ii.hbmColor = ic; |