macOS: Pass on QCursor pixmap with original scale
There's no need to scale the cursor down to 1x, since we're now passing the correct device pixel ratio on to the NSImage by setting its size. Letting macOS deal with the scaling produces a higher resolution cursor. Change-Id: Icdb3d59998f9a32094c2973c3b222cf22b6398ac Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
059c3ae66a
commit
67c3999e02
@ -335,17 +335,8 @@ NSCursor *QCocoaCursor::createCursorFromBitmap(const QBitmap *bitmap, const QBit
|
||||
NSCursor *QCocoaCursor::createCursorFromPixmap(const QPixmap pixmap, const QPoint hotspot)
|
||||
{
|
||||
NSPoint hotSpot = NSMakePoint(hotspot.x(), hotspot.y());
|
||||
NSImage *nsimage;
|
||||
if (pixmap.devicePixelRatio() > 1.0) {
|
||||
QSize layoutSize = pixmap.size() / pixmap.devicePixelRatio();
|
||||
QPixmap scaledPixmap = pixmap.scaled(layoutSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
scaledPixmap.setDevicePixelRatio(1.0);
|
||||
nsimage = [NSImage imageFromQImage:scaledPixmap.toImage()];
|
||||
} else {
|
||||
nsimage = [NSImage imageFromQImage:pixmap.toImage()];
|
||||
}
|
||||
|
||||
return [[NSCursor alloc] initWithImage:nsimage hotSpot:hotSpot];
|
||||
auto *image = [NSImage imageFromQImage:pixmap.toImage()];
|
||||
return [[NSCursor alloc] initWithImage:image hotSpot:hotSpot];
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
Loading…
Reference in New Issue
Block a user