summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorOleg Yadrov <oleg.yadrov@qt.io>2017-01-10 15:49:54 -0800
committerOleg Yadrov <oleg.yadrov@qt.io>2017-02-17 00:50:10 +0000
commitd9c3d2301dba6922e10d8509b220a795686e8fa9 (patch)
tree250e0f676d12f6e343c9a1899389ee74f5a793e9 /src/plugins/platforms
parentd9a2dd8d3b55d16d2e38d124abb0ade490963b37 (diff)
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>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/cocoa/qcocoadrag.mm4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm
index 7d11023b78..a0967750e7 100644
--- a/src/plugins/platforms/cocoa/qcocoadrag.mm
+++ b/src/plugins/platforms/cocoa/qcocoadrag.mm
@@ -201,6 +201,10 @@ QPixmap QCocoaDrag::dragPixmap(QDrag *drag, QPoint &hotSpot) const
dpr = sourceWindow->devicePixelRatio();
}
#endif
+ else {
+ if (const QWindow *focusWindow = qApp->focusWindow())
+ dpr = focusWindow->devicePixelRatio();
+ }
pm = QPixmap(width * dpr, height * dpr);
pm.setDevicePixelRatio(dpr);
QPainter p(&pm);