X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatline.cpp;h=237fad68fbae63aaca7570a1caebeae046f14676;hp=edb89f14e9f2411e688abaf4f0a90660de637821;hb=39e2a78383295f86c5aa2dadbeac6f02b53eb7a4;hpb=f3fc0324c8860dff6af722dafbeb05fcb69a0c41 diff --git a/src/qtui/chatline.cpp b/src/qtui/chatline.cpp index edb89f14..237fad68 100644 --- a/src/qtui/chatline.cpp +++ b/src/qtui/chatline.cpp @@ -18,11 +18,51 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#include +#include +#include + +#include "bufferinfo.h" +#include "chatitem.h" #include "chatline.h" +#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; +} + +ChatLine::~ChatLine() { + delete _timestampItem; + delete _senderItem; + delete _contentsItem; +} + +QRectF ChatLine::boundingRect () const { + //return childrenBoundingRect(); + return QRectF(0, 0, _width, _height); +} -Chatline::Chatline(const QMessage &msg) : MessageItem(msg) { +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; + _timestampItem->setWidth(firstHandlePos - firstsep); + _senderItem->setWidth(secondHandlePos - firstHandlePos - (firstsep+secondsep)); + _height = _contentsItem->setWidth(width - secondHandlePos - secondsep); + _senderItem->setPos(firstHandlePos + firstsep, 0); + _contentsItem->setPos(secondHandlePos + secondsep, 0); + + _width = width; + return _height; } +void ChatLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { +}