QTreeView: fix Private::intersectedRect()
Don't try to update the left and right boundaries when no valid idxRect
was found.
Also fix the early exit check - we can exit when the idxRect is
completely below *or* completely above the current viewport.
This amends 2f9c72028d.
Fixes: QTBUG-132670
Task-number: QTBUG-124173
Change-Id: I51f9e12c66268318e597facfbe4df74367d1089a
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 9d4b5fa017199627a42477a842a4e1ef349bb1ae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit c74f0ccf1552271cc7a01bd9baa3567091894623)
bb10
parent
d4e2c76ae8
commit
a156bdc9ad
|
|
@ -1440,7 +1440,7 @@ QRect QTreeViewPrivate::intersectedRect(const QRect rect, const QModelIndex &top
|
|||
if (idxRect.isNull())
|
||||
continue;
|
||||
// early exit when complete row is out of viewport
|
||||
if (idxRect.top() > rect.bottom() && idxRect.bottom() < rect.top())
|
||||
if (idxRect.top() > rect.bottom() || idxRect.bottom() < rect.top())
|
||||
break;
|
||||
if (!idxRect.intersects(rect))
|
||||
continue;
|
||||
|
|
@ -1448,8 +1448,10 @@ QRect QTreeViewPrivate::intersectedRect(const QRect rect, const QModelIndex &top
|
|||
if (rowRect.left() < rect.left() && rowRect.right() > rect.right())
|
||||
break;
|
||||
}
|
||||
left = std::min(left, rowRect.left());
|
||||
right = std::max(right, rowRect.right());
|
||||
if (rowRect.isValid()) {
|
||||
left = std::min(left, rowRect.left());
|
||||
right = std::max(right, rowRect.right());
|
||||
}
|
||||
}
|
||||
updateRect = updateRect.united(rowRect);
|
||||
if (updateRect.contains(rect)) // already full rect covered?
|
||||
|
|
|
|||
Loading…
Reference in New Issue