aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/handlers
diff options
context:
space:
mode:
authorFushan Wen <qydwhotmail@gmail.com>2024-03-16 02:58:08 +0800
committerFushan Wen <qydwhotmail@gmail.com>2024-03-16 13:16:06 +0800
commit9089292c495970b00728398f49e8f66bab1f4f32 (patch)
treed141275a5482af6c052cb13305205f24dd8ef73d /src/quick/handlers
parent44553e9b402392311e5425e82c0f9620fef819ba (diff)
Fix PointHandler rejecting click events near window edge with HiDPI
When using HiDPI and a click happens near the window edge, the global position might have fractional parts, but after the global position is converted to QPoint, the position can be rounded so it happens to stay at the window edge, so the window geometry will not contain the rounded position. Related bugreport: https://bugs.kde.org/show_bug.cgi?id=482580 Pick-to: 6.6 6.7 Change-Id: I51a26f955fd58f2a135c64ceb32ee881a03fcaf8 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/handlers')
-rw-r--r--src/quick/handlers/qquickpointerhandler.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/quick/handlers/qquickpointerhandler.cpp b/src/quick/handlers/qquickpointerhandler.cpp
index c01cbd039f..a29c8ae2d3 100644
--- a/src/quick/handlers/qquickpointerhandler.cpp
+++ b/src/quick/handlers/qquickpointerhandler.cpp
@@ -560,10 +560,10 @@ bool QQuickPointerHandler::parentContains(const QPointF &scenePosition) const
{
if (QQuickItem *par = parentItem()) {
if (par->window()) {
- QRect windowGeometry = par->window()->geometry();
+ QRectF 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());
+ windowGeometry = QRectF(QWindowPrivate::get(par->window())->globalPosition(), par->window()->size());
+ QPointF screenPosition = par->window()->mapToGlobal(scenePosition);
if (!windowGeometry.contains(screenPosition))
return false;
}