Fix tst_QStyleSheetStyle crash on uncommon multi-screen setup

It would crash if there is no screen at 0,0.

Change-Id: Ic84d75b3d8b917fe3696530cbe843e82923ba676
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
bb10
Allan Sandfeld Jensen 2018-11-23 17:59:49 +01:00
parent 4e01b85115
commit d1f924bbce
1 changed files with 2 additions and 1 deletions

View File

@ -2085,7 +2085,8 @@ void tst_QStyleSheetStyle::highdpiImages()
QFETCH(QColor, color);
QWidget w;
QScreen *screen = QGuiApplication::screenAt(w.pos());
QScreen *screen = QGuiApplication::primaryScreen();
w.move(screen->availableGeometry().topLeft());
QHighDpiScaling::setScreenFactor(screen, screenFactor);
w.setStyleSheet("QWidget { background-image: url(\":/images/testimage.png\"); }");
w.show();