Make the screen size calculation work for Win too

Fixes #9
This commit is contained in:
ArsenArsen 2017-07-05 16:51:02 +02:00
parent 698d123815
commit e609a1a9a5
1 changed files with 5 additions and 4 deletions

View File

@ -21,17 +21,18 @@ QPixmap screenshotutil::fullscreen(bool cursor) {
painter.begin(&image);
} else {
#endif
int height = qAbs(smallestCoordinate.y()), width = qAbs(smallestCoordinate.x()); // qute abs
int height = 0, width = 0;
int ox = smallestCoordinate.x() * -1, oy = smallestCoordinate.y() * -1;
for (QScreen *screen : QApplication::screens()) {
QRect geo = screen->geometry();
width = qMax(geo.left() + geo.width(), width);
height = qMax(geo.top() + geo.height(), height);
width = qMax(ox + geo.left() + geo.width(), width);
height = qMax(oy + geo.top() + geo.height(), height); // qute abs
}
image = QPixmap(width, height);
image.fill(Qt::transparent);
width = 0;
painter.begin(&image);
painter.translate(qAbs(smallestCoordinate.x()), qAbs(smallestCoordinate.y()));
painter.translate(ox, oy);
for (QScreen *screen : QApplication::screens()) {
QPixmap currentScreen = window(0, screen);