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

Merge pull request #2324 from antis81:ngf/fix/screen-grabber

This commit is contained in:
Nils Fenner 2015-10-03 10:22:04 +02:00
commit cfe6462fef
No known key found for this signature in database
GPG Key ID: 9591A163FF9BE04C

View File

@ -181,14 +181,20 @@ void ScreenshotGrabber::chooseHelperTooltipText(QRect rect)
useRegionSelectedTooltip();
}
/**
* @internal
*
* Align the tooltip centred at top of screen with the mouse cursor.
*/
void ScreenshotGrabber::adjustTooltipPosition()
{
QRectF size = this->helperToolbox->childrenBoundingRect();
QRect screenRect = QApplication::desktop()->screen()->rect();
// Align the toolbox center-top.
helperToolbox->setX(screenRect.x() + (screenRect.width() - size.width() + size.x()) / 2);
helperToolbox->setY(screenRect.y());
QRect recGL = QGuiApplication::primaryScreen()->virtualGeometry();
QRect rec = qApp->desktop()->screenGeometry(QCursor::pos());
const QRectF ttRect = this->helperToolbox->childrenBoundingRect();
int x = abs(recGL.x()) + rec.x() + ((rec.width() - ttRect.width()) / 2);
int y = abs(recGL.y()) + rec.y();
helperToolbox->setX(x);
helperToolbox->setY(y);
}
void ScreenshotGrabber::reject()