+#include "qtui.h"
+
+ChatLine::ChatLine(const QModelIndex &index, QGraphicsItem *parent) : QGraphicsItem(parent) {
+ _timestampItem = new ChatItem(QPersistentModelIndex(index.sibling(index.row(), ChatLineModel::TimestampColumn)), this);
+ _senderItem = new ChatItem(QPersistentModelIndex(index.sibling(index.row(), ChatLineModel::SenderColumn)), this);
+ _contentsItem = new ChatItem(QPersistentModelIndex(index.sibling(index.row(), ChatLineModel::ContentsColumn)), this);
+
+ _timestampItem->setPos(0,0);
+ _width = _height = 0;
+ _selection = 0;
+
+ if(_contentsItem->data(MessageModel::FlagsRole).toInt() & Message::Highlight) setHighlighted(true);
+}
+
+ChatLine::~ChatLine() {
+ delete _timestampItem;
+ delete _senderItem;
+ delete _contentsItem;
+}
+
+QRectF ChatLine::boundingRect () const {
+ //return childrenBoundingRect();
+ return QRectF(0, 0, _width, _height);
+}
+
+ChatItem *ChatLine::item(ChatLineModel::ColumnType column) const {
+ switch(column) {
+ case ChatLineModel::TimestampColumn: return _timestampItem;
+ case ChatLineModel::SenderColumn: return _senderItem;
+ case ChatLineModel::ContentsColumn: return _contentsItem;
+ default: return 0;
+ }
+}
+
+qreal ChatLine::setGeometry(qreal width, qreal firstHandlePos, qreal secondHandlePos) {
+ if(width != _width) prepareGeometryChange();
+ qreal firstsep = QtUi::style()->firstColumnSeparator()/2;
+ qreal secondsep = QtUi::style()->secondColumnSeparator()/2;