Sanitize ChatView's scrolling behavior
[quassel.git] / src / qtui / chatscene.cpp
index 10ebfc7..72099e6 100644 (file)
@@ -67,6 +67,7 @@ void ChatScene::rowsInserted(const QModelIndex &index, int start, int end) {
     for(int i = end+1; i < _lines.count(); i++) {
       _lines.value(i)->moveBy(0, h);
     }
+    setSceneRect(QRectF(0, 0, _width, _height));
     emit heightChanged(height());
   }
 }
@@ -78,7 +79,8 @@ void ChatScene::setWidth(int w) {
     line->setPos(0, _height);
     _height += line->setColumnWidths(_timestampWidth, _senderWidth, w - _timestampWidth - _senderWidth);
   }
-  emit heightChanged(_height);
+  setSceneRect(QRectF(0, 0, w, _height));
+  emit heightChanged(height());
 }
 
 void ChatScene::mousePressEvent ( QGraphicsSceneMouseEvent * mouseEvent ) {