X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fchatscene.cpp;h=10ebfc7a6a4253f1744bef3239763d49e03dc3be;hb=3197b8b309f09ac1f4db54fa8fa819e33b87383e;hp=b7b8cf1ee06556bf76e7aa1f9db52230b9abe3e0;hpb=8bf92d33ac84cfede11b2361832607bea98f64c8;p=quassel.git diff --git a/src/qtui/chatscene.cpp b/src/qtui/chatscene.cpp index b7b8cf1e..10ebfc7a 100644 --- a/src/qtui/chatscene.cpp +++ b/src/qtui/chatscene.cpp @@ -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(0, 0, _width, _height); + emit heightChanged(height()); } } @@ -77,8 +78,7 @@ void ChatScene::setWidth(int w) { line->setPos(0, _height); _height += line->setColumnWidths(_timestampWidth, _senderWidth, w - _timestampWidth - _senderWidth); } - qDebug() << "setting width"; - setSceneRect(0, 0, _width, _height * 2); + emit heightChanged(_height); } void ChatScene::mousePressEvent ( QGraphicsSceneMouseEvent * mouseEvent ) {