src/gui/itemviews/qtableview.cpp
changeset 22 79de32ba3296
parent 19 fcece45ef507
child 30 5dc02b23752f
--- a/src/gui/itemviews/qtableview.cpp	Mon May 03 13:17:34 2010 +0300
+++ b/src/gui/itemviews/qtableview.cpp	Fri May 14 16:40:13 2010 +0300
@@ -114,15 +114,14 @@
         }
     } 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());
-        if (it_y == index.end())
-            it_y = index.find(-span->top());    // This is the only span remaining and we are deleting it.
+        Index::iterator it_y = index.lowerBound(-qMax(span->bottom(), span->top())); //qMax usefull if height is 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()) {
-                (*it_y).remove(-span->left());
+                int removed = (*it_y).remove(-span->left());
+                Q_ASSERT(removed == 1); Q_UNUSED(removed);
                 if (it_y->isEmpty()) {
-                    it_y = index.erase(it_y) - 1;
+                    it_y = index.erase(it_y);
                 }
             }
             if(it_y == index.begin())