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:
parent
cf9ed8d580
commit
7b2610e4fb
|
@ -76,7 +76,14 @@ void ScreenshotGrabber::showGrabber()
|
||||||
this->window->show();
|
this->window->show();
|
||||||
this->window->setFocus();
|
this->window->setFocus();
|
||||||
this->window->grabKeyboard();
|
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();
|
adjustTooltipPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,21 +198,6 @@ void ScreenshotGrabber::reject()
|
||||||
Widget::getInstance()->setVisible(true); // show window if it was hidden
|
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()
|
QPixmap ScreenshotGrabber::grabScreen()
|
||||||
{
|
{
|
||||||
QScreen* screen = QApplication::primaryScreen();
|
QScreen* screen = QApplication::primaryScreen();
|
||||||
|
|
|
@ -71,8 +71,6 @@ private:
|
||||||
bool handleKeyPress(QKeyEvent* event);
|
bool handleKeyPress(QKeyEvent* event);
|
||||||
void reject();
|
void reject();
|
||||||
|
|
||||||
QRect getSystemScreenRect();
|
|
||||||
void adjustWindowSize();
|
|
||||||
QPixmap grabScreen();
|
QPixmap grabScreen();
|
||||||
|
|
||||||
void beginRectChooser(QGraphicsSceneMouseEvent* event);
|
void beginRectChooser(QGraphicsSceneMouseEvent* event);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user