macOS: use active window device pixel ratio for drag pixmap
In QCocoaDrag::dragPixmap, it treats QDrag::source as a QWindow, but it is not - it's just a generic QObject* of some kind (which QQuickDrag sets to the originating QQuickItem, and the widgets stack sets to a QWidget). This failure means that dpr stayed at 1.0. Unfortunately it’s not possible to receive a pointer on QWindow directly from QQuickItem because QtWidgets and QtQuick do not share the sources, but we can use the same dpr as current focused window has because drag can only start from active window - press on a window which is not focused should activate it first. Task-number: QTBUG-57942 Change-Id: Id358c181d03d519188caaa83fb4226033b8ed1ea Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
This commit is contained in:
parent
d9a2dd8d3b
commit
d9c3d2301d
@ -201,6 +201,10 @@ QPixmap QCocoaDrag::dragPixmap(QDrag *drag, QPoint &hotSpot) const
|
|||||||
dpr = sourceWindow->devicePixelRatio();
|
dpr = sourceWindow->devicePixelRatio();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
else {
|
||||||
|
if (const QWindow *focusWindow = qApp->focusWindow())
|
||||||
|
dpr = focusWindow->devicePixelRatio();
|
||||||
|
}
|
||||||
pm = QPixmap(width * dpr, height * dpr);
|
pm = QPixmap(width * dpr, height * dpr);
|
||||||
pm.setDevicePixelRatio(dpr);
|
pm.setDevicePixelRatio(dpr);
|
||||||
QPainter p(&pm);
|
QPainter p(&pm);
|
||||||
|
Loading…
Reference in New Issue
Block a user