ChatView now uses MessageFilter to display only messages for its buffer.
[quassel.git] / src / qtui / chatscene.cpp
index d425555..10ebfc7 100644 (file)
@@ -27,7 +27,7 @@
 #include "chatscene.h"
 #include "quasselui.h"
 
-ChatScene::ChatScene(MessageModel *model, QObject *parent) : QGraphicsScene(parent), _model(model) {
+ChatScene::ChatScene(QAbstractItemModel *model, QObject *parent) : QGraphicsScene(parent), _model(model) {
   _width = 0;
   _timestampWidth = 60;
   _senderWidth = 80;
@@ -37,6 +37,7 @@ ChatScene::ChatScene(MessageModel *model, QObject *parent) : QGraphicsScene(pare
     _lines.append(line);
     addItem(line);
   }
+  emit heightChanged(height());
 }
 
 ChatScene::~ChatScene() {
@@ -66,7 +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());
   }
 }
 
@@ -77,7 +78,7 @@ void ChatScene::setWidth(int w) {
     line->setPos(0, _height);
     _height += line->setColumnWidths(_timestampWidth, _senderWidth, w - _timestampWidth - _senderWidth);
   }
-  setSceneRect(QRectF(0, 0, _width, _height));
+  emit heightChanged(_height);
 }
 
 void ChatScene::mousePressEvent ( QGraphicsSceneMouseEvent * mouseEvent ) {