diff options
author | Kari Hautamäki <kari.hautamaki@theqtcompany.com> | 2015-04-21 08:44:24 +0300 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@theqtcompany.com> | 2016-02-24 05:56:00 +0000 |
commit | fb2710a7f182ffb910f6b121e8bc125a4f61dcdf (patch) | |
tree | 757a0f40df12e683a7085f844d42f10344aa62c1 /src/quick/items/qquickitem.cpp | |
parent | 4e7f570f921671c627040537b4dd8cdb77bda3d1 (diff) |
Determine QQuickItem::childAt() correctly
[ChangeLog][QtQuick][QQuickItem] Fix to wrong calculation of child at a
given point. Previously coordinates of width+1 and height+1 were counted
as a child. That caused a child Rect of (0, 0, 100, 100) to be reported
as a child at (100, 100), which is wrong (correct max coordinate is (99, 99).)
Task-number: QTBUG-41833
Change-Id: I6124a275a5dc1a38eab448235102d563e2a8b0ca
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Diffstat (limited to 'src/quick/items/qquickitem.cpp')
-rw-r--r-- | src/quick/items/qquickitem.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 4bd95d5520..f2a6e570c0 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -4579,9 +4579,9 @@ QQuickItem *QQuickItem::childAt(qreal x, qreal y) const // Map coordinates to the child element's coordinate space QPointF point = mapToItem(child, QPointF(x, y)); if (child->isVisible() && point.x() >= 0 - && child->width() >= point.x() + && child->width() > point.x() && point.y() >= 0 - && child->height() >= point.y()) + && child->height() > point.y()) return child; } return 0; |