X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fchatline.cpp;h=cf3c3fa3e75202e3b96dca1cd4af2f7d3697ecad;hb=85c2a2a853e4f4d4488344672d47c2aa77172f69;hp=921258b16030328cef741c8231908136dd5d2fde;hpb=9e0b5872dcf290e375c46c016f951c6ea780fcc0;p=quassel.git diff --git a/src/qtui/chatline.cpp b/src/qtui/chatline.cpp index 921258b1..cf3c3fa3 100644 --- a/src/qtui/chatline.cpp +++ b/src/qtui/chatline.cpp @@ -33,6 +33,7 @@ ChatLine::ChatLine(const QModelIndex &index, QGraphicsItem *parent) : QGraphicsI _contentsItem = new ChatItem(QPersistentModelIndex(index.sibling(index.row(), ChatLineModel::ContentsColumn)), this); _timestampItem->setPos(0,0); + _width = _height = 0; } ChatLine::~ChatLine() { @@ -41,20 +42,21 @@ ChatLine::~ChatLine() { delete _contentsItem; } -// FIXME make more efficient by caching width/height 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); - int h = _contentsItem->setWidth(contents); + _height = _contentsItem->setWidth(contents); _senderItem->setPos(ts, 0); _contentsItem->setPos(ts + sender, 0); - return h; + _width = ts + sender + contents; + return _height; } void ChatLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {