X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatline.cpp;h=71ed2c8d53524e817f837d0b347c1c30f6f809a6;hp=edb89f14e9f2411e688abaf4f0a90660de637821;hb=1817c8c8e2437d8aadcc1f07195fa4555cb1c17c;hpb=f3fc0324c8860dff6af722dafbeb05fcb69a0c41 diff --git a/src/qtui/chatline.cpp b/src/qtui/chatline.cpp index edb89f14..71ed2c8d 100644 --- a/src/qtui/chatline.cpp +++ b/src/qtui/chatline.cpp @@ -18,11 +18,66 @@ * 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); + + _senderItem->setPos(80, 0); + _contentsItem->setPos(160, 0); +} -Chatline::Chatline(const QMessage &msg) : MessageItem(msg) { +ChatLine::~ChatLine() { + +} + +QRectF ChatLine::boundingRect () const { + return childrenBoundingRect(); +} + +void ChatLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + +} + +/* +void ChatLine::setColumnWidths(int tsColWidth, int senderColWidth, int textColWidth) { + if(tsColWidth >= 0) { + _tsColWidth = tsColWidth; + _tsItem->setWidth(tsColWidth); + } + if(senderColWidth >= 0) { + _senderColWidth = senderColWidth; + _senderItem->setWidth(senderColWidth); + } + if(textColWidth >= 0) { + _textColWidth = textColWidth; + _textItem->setWidth(textColWidth); + } + layout(); +} + +void ChatLine::layout() { + prepareGeometryChange(); + _tsItem->setPos(QPointF(0, 0)); + _senderItem->setPos(QPointF(_tsColWidth + QtUi::style()->sepTsSender(), 0)); + _textItem->setPos(QPointF(_tsColWidth + QtUi::style()->sepTsSender() + _senderColWidth + QtUi::style()->sepSenderText(), 0)); +} +bool ChatLine::sceneEvent ( QEvent * event ) { + qDebug() <<(void*)this<< "receiving event"; + event->ignore(); + return false; } +*/