summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-08-31 14:01:12 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-08-31 19:14:55 +0200
commit90358f6042d1fe2db849e17e1b0c875fb0560b20 (patch)
tree493e57226970f613c18871d086ae88031b091fde /tests/auto/widgets
parent8028474e62c584ed3d5bb0f662b9690ca029f028 (diff)
Deprecate and remove uses of AA_DisableHighDpiScaling
Change-Id: Ibadce68775858c524b998aacad310905ba2c2e8e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
index b61faf6c2b..a751fae05d 100644
--- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -72,8 +72,6 @@ class tst_QStyleSheetStyle : public QObject
public:
tst_QStyleSheetStyle();
- static void initMain();
-
private slots:
void init();
void cleanup();
@@ -173,12 +171,6 @@ private:
QSize m_testSize;
};
-// highdpiImages() tests HighDPI scaling; disable initially.
-void tst_QStyleSheetStyle::initMain()
-{
- QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
-}
-
tst_QStyleSheetStyle::tst_QStyleSheetStyle()
{
const int testSize = qMax(200, m_availableGeometry.width() / 10);
@@ -2215,8 +2207,9 @@ void tst_QStyleSheetStyle::highdpiImages()
w.setWindowTitle(QLatin1String(QTest::currentTestFunction()) + QLatin1String("::")
+ QLatin1String(QTest::currentDataTag()));
QScreen *screen = QGuiApplication::primaryScreen();
+ auto inverseDpr = 1 / screen->devicePixelRatio();
w.move(screen->availableGeometry().topLeft());
- QHighDpiScaling::setScreenFactor(screen, screenFactor);
+ QHighDpiScaling::setScreenFactor(screen, inverseDpr * screenFactor);
w.setStyleSheet("QWidget { background-image: url(\":/images/testimage.png\"); }");
w.show();