QPlatformWindow::screenForGeometry(): Use mapToGlobal().
QPlatformWindow::mapToGlobal() should be used to obtain global coordinates for foreign/embedded windows. They do not have a parent QWindow, but the geometry passed in might be local to their native parent window. For normal top-level windows, this is a no-op. Task-number: QTBUG-50206 Task-number: QTBUG-41186 Change-Id: I00889b28db69ae65057f48b9e74bd4d8cfffa136 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
This commit is contained in:
parent
966e893151
commit
9915630d08
@ -484,8 +484,10 @@ QPlatformScreen *QPlatformWindow::screenForGeometry(const QRect &newGeometry) co
|
|||||||
{
|
{
|
||||||
QPlatformScreen *currentScreen = screen();
|
QPlatformScreen *currentScreen = screen();
|
||||||
QPlatformScreen *fallback = currentScreen;
|
QPlatformScreen *fallback = currentScreen;
|
||||||
//QRect::center can return a value outside the rectangle if it's empty
|
// QRect::center can return a value outside the rectangle if it's empty.
|
||||||
const QPoint center = newGeometry.isEmpty() ? newGeometry.topLeft() : newGeometry.center();
|
// Apply mapToGlobal() in case it is a foreign/embedded window.
|
||||||
|
const QPoint center =
|
||||||
|
mapToGlobal(newGeometry.isEmpty() ? newGeometry.topLeft() : newGeometry.center());
|
||||||
|
|
||||||
if (!parent() && currentScreen && !currentScreen->geometry().contains(center)) {
|
if (!parent() && currentScreen && !currentScreen->geometry().contains(center)) {
|
||||||
Q_FOREACH (QPlatformScreen* screen, currentScreen->virtualSiblings()) {
|
Q_FOREACH (QPlatformScreen* screen, currentScreen->virtualSiblings()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user