- virtual QRectF boundingRect () const;
- virtual void paint (QPainter * painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
- void layout();
+ virtual inline QRectF boundingRect() const { return QRectF(0, 0, _width, _height); }
+
+ inline QModelIndex index() const { return model()->index(row(), 0); }
+ inline MsgId msgId() const { return index().data(MessageModel::MsgIdRole).value<MsgId>(); }
+ inline Message::Type msgType() const { return (Message::Type)index().data(MessageModel::TypeRole).toInt(); }
+
+ inline int row() const { return _row; }
+ inline void setRow(int row) { _row = row; }
+
+ inline const QAbstractItemModel *model() const { return _model; }
+ inline ChatScene *chatScene() const { return qobject_cast<ChatScene *>(scene()); }
+ inline ChatView *chatView() const { return chatScene() ? chatScene()->chatView() : 0; }
+
+ inline qreal width() const { return _width; }
+ inline qreal height() const { return _height; }
+
+ ChatItem *item(ChatLineModel::ColumnType);
+ ChatItem *itemAt(const QPointF &pos);
+ inline ChatItem *timestampItem() { return &_timestampItem; }
+ inline ChatItem *senderItem() { return &_senderItem; }
+ inline ContentsChatItem *contentsItem() { return &_contentsItem; }
+
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+ enum { Type = ChatScene::ChatLineType };
+ virtual inline int type() const { return Type; }