diff options
| author | Alexey Edelev <alexey.edelev@qt.io> | 2021-05-04 17:42:30 +0200 |
|---|---|---|
| committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2021-05-11 15:47:49 +0000 |
| commit | c740a9d30571079fa22fd26cb8e72df6ca28c7b2 (patch) | |
| tree | ef2c5606f43da5304a40698bd716112b52d55680 /src/quick/handlers/qquickpointerhandler.cpp | |
| parent | 82bf2eeb341ecc6b252e7a575bed8bf4bd329e96 (diff) | |
Map window coordinates to the same coordinate system as the QPointerEvent point
If the window has parent windows its geometry should be mapped to the
global coordinates before check if it contains the point coordinates.
Fixes: QTBUG-91716
Pick-to: 5.15 6.1
Change-Id: I300547361dbe895b67caeee0d47f416426444552
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/quick/handlers/qquickpointerhandler.cpp')
| -rw-r--r-- | src/quick/handlers/qquickpointerhandler.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/quick/handlers/qquickpointerhandler.cpp b/src/quick/handlers/qquickpointerhandler.cpp index 492b20b7a2..1624cb4985 100644 --- a/src/quick/handlers/qquickpointerhandler.cpp +++ b/src/quick/handlers/qquickpointerhandler.cpp @@ -517,8 +517,11 @@ bool QQuickPointerHandler::parentContains(const QPointF &scenePosition) const { if (QQuickItem *par = parentItem()) { if (par->window()) { + QRect windowGeometry = par->window()->geometry(); + if (!par->window()->isTopLevel()) + windowGeometry = QRect(QWindowPrivate::get(par->window())->globalPosition(), par->window()->size()); QPoint screenPosition = par->window()->mapToGlobal(scenePosition.toPoint()); - if (!par->window()->geometry().contains(screenPosition)) + if (!windowGeometry.contains(screenPosition)) return false; } QPointF p = par->mapFromScene(scenePosition); |
