X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fchatline.cpp;h=cf3c3fa3e75202e3b96dca1cd4af2f7d3697ecad;hb=65d88a7f8c37e549a259aba85c52b7916b89a17d;hp=71ed2c8d53524e817f837d0b347c1c30f6f809a6;hpb=1817c8c8e2437d8aadcc1f07195fa4555cb1c17c;p=quassel.git diff --git a/src/qtui/chatline.cpp b/src/qtui/chatline.cpp index 71ed2c8d..cf3c3fa3 100644 --- a/src/qtui/chatline.cpp +++ b/src/qtui/chatline.cpp @@ -32,16 +32,31 @@ ChatLine::ChatLine(const QModelIndex &index, QGraphicsItem *parent) : QGraphicsI _senderItem = new ChatItem(QPersistentModelIndex(index.sibling(index.row(), ChatLineModel::SenderColumn)), this); _contentsItem = new ChatItem(QPersistentModelIndex(index.sibling(index.row(), ChatLineModel::ContentsColumn)), this); - _senderItem->setPos(80, 0); - _contentsItem->setPos(160, 0); + _timestampItem->setPos(0,0); + _width = _height = 0; } ChatLine::~ChatLine() { - + delete _timestampItem; + delete _senderItem; + delete _contentsItem; } QRectF ChatLine::boundingRect () const { - return childrenBoundingRect(); + //return childrenBoundingRect(); + return QRectF(0, 0, _width, _height); +} + +int ChatLine::setColumnWidths(int ts, int sender, int contents) { + _timestampItem->setWidth(ts); + _senderItem->setWidth(sender); + _height = _contentsItem->setWidth(contents); + + _senderItem->setPos(ts, 0); + _contentsItem->setPos(ts + sender, 0); + + _width = ts + sender + contents; + return _height; } void ChatLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {