From ca4c33a886fb4cec50f1a4140fc29ec731240ecb Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 9 Feb 2016 14:15:58 +0100 Subject: 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 --- tests/manual/highdpi/dragwidget.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/manual/highdpi/dragwidget.cpp b/tests/manual/highdpi/dragwidget.cpp index b203566696..193a90cd18 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); -- cgit v1.2.3