Fix Pick Screen Color with multiple monitors
QScreen::grabWindow expects screen coordinates, not global ones, use QScreen::geometry() to compute them. Fixes: QTBUG-99472 Change-Id: Ic4b99577b8cb394e6cd0a2d3f554bb3ec8250afa Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Zhang Hao <zhanghao@uniontech.com> (cherry picked from commit da6c8b2fc6bc1a29b8a88c4ecce53eaf811eb06c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
c08842daea
commit
22f682d620
@ -1566,7 +1566,9 @@ QColor QColorDialogPrivate::grabScreenColor(const QPoint &p)
|
|||||||
QScreen *screen = QGuiApplication::screenAt(p);
|
QScreen *screen = QGuiApplication::screenAt(p);
|
||||||
if (!screen)
|
if (!screen)
|
||||||
screen = QGuiApplication::primaryScreen();
|
screen = QGuiApplication::primaryScreen();
|
||||||
const QPixmap pixmap = screen->grabWindow(0, p.x(), p.y(), 1, 1);
|
const QRect screenRect = screen->geometry();
|
||||||
|
const QPixmap pixmap =
|
||||||
|
screen->grabWindow(0, p.x() - screenRect.x(), p.y() - screenRect.y(), 1, 1);
|
||||||
const QImage i = pixmap.toImage();
|
const QImage i = pixmap.toImage();
|
||||||
return i.pixel(0, 0);
|
return i.pixel(0, 0);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user