X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fchatitem.cpp;h=63d92e689397bf1c440a8753c1dbd1d7f98c4f29;hb=d42123b2f56292e10bf4ad4a710950149af824d0;hp=a677e1056a0756c23b309b298606a457a49e5264;hpb=cc7f376eb105f7bf931fb7f96c9601a7b3f69511;p=quassel.git diff --git a/src/qtui/chatitem.cpp b/src/qtui/chatitem.cpp index a677e105..63d92e68 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); - //} + } ChatItem::~ChatItem() { @@ -39,30 +37,36 @@ ChatItem::~ChatItem() { QVariant ChatItem::data(int role) const { if(!_index.isValid()) { - qWarning() << "ChatItem::data(): Model index is invalid!"; + qWarning() << "ChatItem::data(): Model index is invalid!" << _index; return QVariant(); } return _index.data(role); } +/* 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) { - _width = w; - layout(); + +int ChatItem::setWidth(int w) { + _boundingRect.setWidth(w); + _boundingRect.setHeight(20); // FIXME + return 20; } +/* + void ChatItem::setTextOption(const QTextOption &option) { _textOption = option; layout();