diff options
-rw-r--r-- | src/gui/itemviews/qtableview.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qtableview/tst_qtableview.cpp | 8 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index 7eefb0b..3111896 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -114,7 +114,9 @@ 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(qMin(-span->bottom(), 0)); + Index::iterator it_y = index.lowerBound(-span->bottom()); + if (it_y == index.end()) + it_y = index.find(-span->top()); // This is the only span remaining and we are deleting it. 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 7a5e68f..430712c 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -3024,6 +3024,14 @@ void tst_QTableView::spans_data() << QPoint(0, 0) << 1 << 1; + + QTest::newRow("QTBUG-6004 (follow-up): No failing Q_ASSERT, then it passes.") + << 10 << 10 + << (SpanList() << QRect(2, 2, 1, 3) << QRect(2, 2, 1, 1)) + << false + << QPoint(0, 0) + << 1 + << 1; } void tst_QTableView::spans() |