X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatline.cpp;h=cf3c3fa3e75202e3b96dca1cd4af2f7d3697ecad;hp=921258b16030328cef741c8231908136dd5d2fde;hb=da2b5b2e4e2b0ea1847a0a5f0cb4a3752fc655c9;hpb=4fdf00a414eba03fb95cade3aca3ba53705c7b97 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) {