From 1d9270ee42c257e6df104053177653cffa76336e Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 22 Feb 2017 12:26:39 +0100 Subject: Fix DPI of QWidget with parent on a different screen If a floating QWidget has a parent on a different screen, its DPI was still inherited from the parent instead of taken from the screen. The only reason we did was in case there is a customDpi set. (customDpi is a private thing that is only used in designer to change the appearance of the previewed widget) So instead of recursing into QWidget::metric for each ancestor, just use a for loop to find if one parent has a customDpi. If no customDpi is found, then return the DPI of the right screen. Task-number: QTBUG-58959 Task-number: QTBUG-48242 Change-Id: Ie6e9e48cdd10234994c0919ba3aea9b0cdb52494 Reviewed-by: Friedemann Kleint Reviewed-by: Simon Hausmann --- tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto/widgets') diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 7afa7ca42b..5715505fd6 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -8181,7 +8181,7 @@ void tst_QWidget::customDpi() custom->logicalDpiX(); QCOMPARE(custom->metricCallCount, 1); child->logicalDpiX(); - QCOMPARE(custom->metricCallCount, 2); + QCOMPARE(custom->metricCallCount, 1); } void tst_QWidget::customDpiProperty() -- cgit v1.2.3