summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qplatformwindow.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2016-01-06 16:10:11 +0100
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2016-02-12 18:57:19 +0000
commit9915630d0886434e8984904b1cadedc81dc78ca0 (patch)
treeb582adfeb8e999a429356da422b055969dfecad1 /src/gui/kernel/qplatformwindow.cpp
parent966e893151952d19131f21738861c483b8af042c (diff)
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>
Diffstat (limited to 'src/gui/kernel/qplatformwindow.cpp')
-rw-r--r--src/gui/kernel/qplatformwindow.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index aea029b7f5..04532e82aa 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.cpp
@@ -484,8 +484,10 @@ QPlatformScreen *QPlatformWindow::screenForGeometry(const QRect &newGeometry) co
{
QPlatformScreen *currentScreen = screen();
QPlatformScreen *fallback = currentScreen;
- //QRect::center can return a value outside the rectangle if it's empty
- const QPoint center = newGeometry.isEmpty() ? newGeometry.topLeft() : newGeometry.center();
+ // QRect::center can return a value outside the rectangle if it's empty.
+ // 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)) {
Q_FOREACH (QPlatformScreen* screen, currentScreen->virtualSiblings()) {