summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/itemviews/qtableview.cpp2
-rw-r--r--tests/auto/qtableview/tst_qtableview.cpp8
2 files changed, 9 insertions, 1 deletions
diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp
index a3877b7..d27e693 100644
--- a/src/gui/itemviews/qtableview.cpp
+++ b/src/gui/itemviews/qtableview.cpp
@@ -114,7 +114,7 @@ void QSpanCollection::updateSpan(QSpanCollection::Span *span, int old_height)
}
} else if (old_height > span->height()) {
//remove the span from all the subspans lists that intersect the columns not covered anymore
- Index::iterator it_y = index.lowerBound(-span->bottom());
+ Index::iterator it_y = index.lowerBound(qMin(-span->bottom(), 0));
Q_ASSERT(it_y != index.end()); //it_y must exist since the span is in the list
while (-it_y.key() <= span->top() + old_height -1) {
if (-it_y.key() > span->bottom()) {
diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp
index 46c3fb6..50d6c67 100644
--- a/tests/auto/qtableview/tst_qtableview.cpp
+++ b/tests/auto/qtableview/tst_qtableview.cpp
@@ -3016,6 +3016,14 @@ void tst_QTableView::spans_data()
<< QPoint(2, 0)
<< 1
<< 2;
+
+ QTest::newRow("QTBUG-6004: No failing Q_ASSERT, then it passes.")
+ << 5 << 5
+ << (SpanList() << QRect(0, 0, 2, 2) << QRect(0, 0, 1, 1))
+ << false
+ << QPoint(0, 0)
+ << 1
+ << 1;
}
void tst_QTableView::spans()