screengrabber: fix devicePixelRatio detection (#277)

This commit is contained in:
Peter Cai
2018-07-22 21:30:52 +08:00
committed by Dharkael
parent 1f6ac475c7
commit 21670e3344
3 changed files with 15 additions and 9 deletions

View File

@@ -85,7 +85,9 @@ QPixmap ScreenGrabber::grabEntireDesktop(bool &ok) {
geometry.width(),
geometry.height())
);
p.setDevicePixelRatio(QApplication::desktop()->devicePixelRatio());
auto screenNumber = QApplication::desktop()->screenNumber();
QScreen *screen = QApplication::screens()[screenNumber];
p.setDevicePixelRatio(screen->devicePixelRatio());
return p;
}