X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fchatitem.cpp;h=63d92e689397bf1c440a8753c1dbd1d7f98c4f29;hb=d42123b2f56292e10bf4ad4a710950149af824d0;hp=1e086059fd95c84d0c5d8c54e0062309b919d2d2;hpb=32b5e6447458a8e6e8074c40988b2d06f327094f;p=quassel.git diff --git a/src/qtui/chatitem.cpp b/src/qtui/chatitem.cpp index 1e086059..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(); @@ -78,7 +82,7 @@ QString ChatItem::text() const { void ChatItem::setText(const UiStyle::StyledText &text) { _layout.setText(text.text); - _layout.setAdditionalFormats(text.formats); + _layout.setAdditionalFormats(text.formatList); layout(); }