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