Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.11.0, 6.0.0
-
None
-
10e4dcc0cf8141f896829e999402ad78591533b3 (qt/qtdeclarative/dev) 6d332987ef5525f0b673e858ddd5b506ff87c231 (qt/qtdeclarative/6.2)
Description
QQuickItem API that involves coordinates of children or bounds tests in general should use containmentMask.
For example, QQuickItem::childAt():
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index ccd1168278..f849361634 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -4820,10 +4820,7 @@ QQuickItem *QQuickItem::childAt(qreal x, qreal y) const QQuickItem *child = children.at(i); // 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() - && point.y() >= 0 - && child->height() > point.y()) + if (child->contains(point)) return child; } return nullptr;
Attachments
Issue Links
- is required for
-
QTBUG-82678 Make SplitView use the touch area for hit testing
- Closed
- resulted from
-
QTBUG-82678 Make SplitView use the touch area for hit testing
- Closed
- resulted in
-
QTBUG-89375 No C++ documentation for containmentMask
- Closed
For Gerrit Dashboard: QTBUG-89376 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
352792,14 | Change QQuickItem childAt bounds check behavior | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
357833,2 | Change QQuickItem childAt bounds check behavior | 6.2 | qt/qtdeclarative | Status: MERGED | +2 | 0 |