X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatline.cpp;h=1abfcfb2eb8b39dc227ef0e9fd4cd011ff31f2bb;hp=ef59fc48622c7b63a2addfed1f1fdf64bd591aa3;hb=0b9f74984780aacbe85ca04c44ec6304c86557c2;hpb=22f141be889377b07472bb967d92186dad23be3e;ds=sidebyside diff --git a/src/qtui/chatline.cpp b/src/qtui/chatline.cpp index ef59fc48..1abfcfb2 100644 --- a/src/qtui/chatline.cpp +++ b/src/qtui/chatline.cpp @@ -18,18 +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() { + +} -Chatline::Chatline(const Message &msg) : MessageItem(msg) { +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(); +} -QVariant Chatline::data(int column, int role) const { - return MessageItem::data(column, role); +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::setData(int column, const QVariant &value, int role) { + +bool ChatLine::sceneEvent ( QEvent * event ) { + qDebug() <<(void*)this<< "receiving event"; + event->ignore(); return false; } +*/ + +