diff options
author | Igor Bugaev <freedbrt@gmail.com> | 2021-06-08 00:00:11 +0300 |
---|---|---|
committer | Igor Bugaev <freedbrt@gmail.com> | 2021-07-01 14:25:56 +0300 |
commit | 37540467ca516c3732bd276f49e27db824b4ea0b (patch) | |
tree | a102abe355a029e224465744326922ef074c55db /tests/auto/quick/qquickitem | |
parent | bb524622820cdb09066f7f0a2f3fedf81200ac6d (diff) |
QQuickItem change contains function behavior
QQuickItem::contains() and QQuickItem::childAt() were different:
QQuickItem::contains() included edges, but QQuickItem::childAt()
did not. Because of this, it is impossible to replace the condition
at QQuickItem::childAt() function whether the point belongs to an item,
to function QQuickItem::contains() (this is necessary to start using
containment mask), without breaking the childAt function, because it
would start to consider the edges.
This change prohibits delivery of events to zero-size items, and fixes
the case when the same point could otherwise be inside multiple items:
for example (0,0,10,10), (10,10,20,20) and the point (10,10).
[ChangeLog][Important Behavior Changes][QQuickItem] Item.contains() now
checks for coordinates less than the width and height, for consistency
with childAt(), and because the item is drawn from (0,0) to
(width-1, height-1).
Pick-to: 6.2
Fixes: QTBUG-55958
Change-Id: I1556cc14038cef4d2a6bb1ab7d28aa449cfd7a25
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/quick/qquickitem')
-rw-r--r-- | tests/auto/quick/qquickitem/tst_qquickitem.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp index aecaadd65d..f1680de331 100644 --- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp @@ -2049,7 +2049,8 @@ void tst_qquickitem::contains_data() QTest::newRow("(50, 0) = false") << 50 << 0 << false; QTest::newRow("(0, 50) = false") << 0 << 50 << false; QTest::newRow("(50, 50) = true") << 50 << 50 << true; - QTest::newRow("(100, 100) = true") << 100 << 100 << true; + QTest::newRow("(99, 99) = true") << 99 << 99 << true; + QTest::newRow("(100, 100) = false") << 100 << 100 << false; QTest::newRow("(150, 150) = false") << 150 << 150 << false; } |