1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

resize screen grabber window to pixmap size

This commit is contained in:
Nils Fenner 2015-09-25 14:25:14 +02:00
parent cf9ed8d580
commit 7b2610e4fb
No known key found for this signature in database
GPG Key ID: 9591A163FF9BE04C
2 changed files with 8 additions and 18 deletions

View File

@ -76,7 +76,14 @@ void ScreenshotGrabber::showGrabber()
this->window->show();
this->window->setFocus();
this->window->grabKeyboard();
adjustWindowSize();
QRect fullGrabbedRect = screenGrab.rect();
qDebug() << "adjusting grabber size to" << fullGrabbedRect;
this->window->setGeometry(fullGrabbedRect);
this->window->scene()->setSceneRect(fullGrabbedRect);
this->overlay->setRect(fullGrabbedRect);
adjustTooltipPosition();
}
@ -191,21 +198,6 @@ void ScreenshotGrabber::reject()
Widget::getInstance()->setVisible(true); // show window if it was hidden
}
QRect ScreenshotGrabber::getSystemScreenRect()
{
return QApplication::primaryScreen()->virtualGeometry();
}
void ScreenshotGrabber::adjustWindowSize()
{
QRect systemScreenRect = getSystemScreenRect();
qDebug() << "adjusting grabber size to" << systemScreenRect;
this->window->setGeometry(systemScreenRect);
this->window->scene()->setSceneRect(systemScreenRect);
this->overlay->setRect(systemScreenRect);
}
QPixmap ScreenshotGrabber::grabScreen()
{
QScreen* screen = QApplication::primaryScreen();

View File

@ -71,8 +71,6 @@ private:
bool handleKeyPress(QKeyEvent* event);
void reject();
QRect getSystemScreenRect();
void adjustWindowSize();
QPixmap grabScreen();
void beginRectChooser(QGraphicsSceneMouseEvent* event);