#include "chatitem.h"
ChatItem::ChatItem(const QPersistentModelIndex &index_, QGraphicsItem *parent) : QGraphicsItem(parent), _index(index_) {
- _width = _height = 0;
+
}
ChatItem::~ChatItem() {
QVariant ChatItem::data(int role) const {
if(!_index.isValid()) {
- qWarning() << "ChatItem::data(): Model index is invalid!";
+ qWarning() << "ChatItem::data(): Model index is invalid!" << _index;
return QVariant();
}
return _index.data(role);
}
+/*
QRectF ChatItem::boundingRect() const {
return QRectF(0, 0, _width, _height);
}
+*/
void ChatItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
Q_UNUSED(option); Q_UNUSED(widget);
int ChatItem::setWidth(int w) {
- _width = w;
- _height = 20; // FIXME
- return _height;
+ _boundingRect.setWidth(w);
+ _boundingRect.setHeight(20); // FIXME
+ return 20;
}
/*