Browse Source

resize screen grabber window to pixmap size

pull/2297/head
Nils Fenner 10 years ago
parent
commit
7b2610e4fb
No known key found for this signature in database
GPG Key ID: 9591A163FF9BE04C
  1. 24
      src/widget/tool/screenshotgrabber.cpp
  2. 2
      src/widget/tool/screenshotgrabber.h

24
src/widget/tool/screenshotgrabber.cpp

@ -76,7 +76,14 @@ void ScreenshotGrabber::showGrabber() @@ -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() @@ -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();

2
src/widget/tool/screenshotgrabber.h

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

Loading…
Cancel
Save