X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatitem.cpp;h=1202b93fc3cc552bed74233f59c3346b37735700;hp=a677e1056a0756c23b309b298606a457a49e5264;hb=9e0b5872dcf290e375c46c016f951c6ea780fcc0;hpb=dbdca302fc349d0e3d46aa0d8091c08b2df28af5 diff --git a/src/qtui/chatitem.cpp b/src/qtui/chatitem.cpp index a677e105..1202b93f 100644 --- a/src/qtui/chatitem.cpp +++ b/src/qtui/chatitem.cpp @@ -28,9 +28,7 @@ #include "chatitem.h" ChatItem::ChatItem(const QPersistentModelIndex &index_, QGraphicsItem *parent) : QGraphicsItem(parent), _index(index_) { - //if(_wrapMode == WordWrap) { - // setFlags(QGraphicsItem::ItemClipsToShape, true); - //} + _width = _height = 0; } ChatItem::~ChatItem() { @@ -46,23 +44,27 @@ QVariant ChatItem::data(int role) const { } QRectF ChatItem::boundingRect() const { - return QRectF(0, 0, 500,20); + return QRectF(0, 0, _width, _height); } void ChatItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { Q_UNUSED(option); Q_UNUSED(widget); - painter->drawRect(boundingRect()); painter->drawText(boundingRect(), data(MessageModel::DisplayRole).toString()); + painter->setPen(Qt::DotLine); + painter->drawRect(boundingRect()); } -/* -void ChatItem::setWidth(int w) { + +int ChatItem::setWidth(int w) { _width = w; - layout(); + _height = 20; // FIXME + return _height; } +/* + void ChatItem::setTextOption(const QTextOption &option) { _textOption = option; layout();