X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fchatitem.h;h=97a6fc06e3e9be6b13ccf7610a2aec20e85f5c63;hb=d1264c1bda04d49693975e0c21acf82b0fb5f007;hp=4ffb94426344eccde0abb772613dbc1216255b2a;hpb=70706ff642683d03ff091cab25d984ec7d9612de;p=quassel.git diff --git a/src/qtui/chatitem.h b/src/qtui/chatitem.h index 4ffb9442..97a6fc06 100644 --- a/src/qtui/chatitem.h +++ b/src/qtui/chatitem.h @@ -1,11 +1,11 @@ /*************************************************************************** - * Copyright (C) 2005-07 by the Quassel IRC Team * + * Copyright (C) 2005-08 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * + * (at your option) version 3. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * @@ -25,35 +25,42 @@ #include #include +#include "chatline.h" +#include "chatlinemodel.h" #include "uistyle.h" -class QGraphicsSceneMouseEvent; - class ChatItem : public QGraphicsItem { public: - ChatItem(QGraphicsItem *parent = 0); + ChatItem(const QPersistentModelIndex &index, QGraphicsItem *parent); virtual ~ChatItem(); - virtual QRectF boundingRect() const; + inline QPersistentModelIndex index() const { return _index; } + inline const MessageModel *model() const { return _index.isValid() ? qobject_cast(_index.model()) : 0; } + inline int row() const { return _index.isValid() ? _index.row() : 0; } + + inline virtual QRectF boundingRect() const { return _boundingRect; } virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); - QString text() const; - void setText(const UiStyle::StyledText &text); + virtual QVariant data(int role) const; + //QString text() const; + //void setText(const UiStyle::StyledText &text); - QTextOption textOption() const; - void setTextOption(const QTextOption &option); + //QTextOption textOption() const; + //void setTextOption(const QTextOption &option); - void setWidth(int width); - virtual void layout(); + // returns height + int setWidth(int width); + //virtual void layout(); protected: //void mouseMoveEvent ( QGraphicsSceneMouseEvent * event ); private: - int _width; - QTextLayout _layout; - QTextOption _textOption; + QRectF _boundingRect; + //QTextLayout _layout; + //QTextOption _textOption; + QPersistentModelIndex _index; }; #endif