From ca4c33a886fb4cec50f1a4140fc29ec731240ecb Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Date: Tue, 9 Feb 2016 14:15:58 +0100
Subject: [PATCH] Manual High DPI test: Create Dnd pixmap with device pixel
 ratio.

Apply the device pixel ratio from the widget unless Shift is pressed.

Task-number: QTBUG-46068
Task-number: QTBUG-50938
Change-Id: Ib806b7e545fa228043566800d22d1002728732bf
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
---
 tests/manual/highdpi/dragwidget.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/manual/highdpi/dragwidget.cpp b/tests/manual/highdpi/dragwidget.cpp
index b2035666965..193a90cd185 100644
--- a/tests/manual/highdpi/dragwidget.cpp
+++ b/tests/manual/highdpi/dragwidget.cpp
@@ -168,7 +168,11 @@ void DragWidget::mousePressEvent(QMouseEvent *event)
     mimeData->setData("application/x-hotspot",
                       QByteArray::number(hotSpot.x()) + " " + QByteArray::number(hotSpot.y()));
 
-    QPixmap pixmap(child->size());
+    const qreal dpr = devicePixelRatioF() > 1 && !(QGuiApplication::keyboardModifiers() & Qt::ShiftModifier)
+        ? devicePixelRatioF() : 1;
+
+    QPixmap pixmap(child->size() * dpr);
+    pixmap.setDevicePixelRatio(dpr);
     child->render(&pixmap);
 
     QDrag *drag = new QDrag(this);
-- 
GitLab