return model()->data(index, role);
}
-qreal ChatItem::setWidth(qreal w) {
+qreal ChatItem::setGeometry(qreal w, qreal h) {
if(w == _boundingRect.width()) return _boundingRect.height();
prepareGeometryChange();
_boundingRect.setWidth(w);
- qreal h = computeHeight();
+ if(h < 0) h = computeHeight();
_boundingRect.setHeight(h);
if(haveLayout()) updateLayout();
return h;
}
void ChatItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
- if(_selectionMode != NoSelection && event->buttons() == Qt::LeftButton) {
+ if(_selectionMode != NoSelection && !event->buttons() & Qt::LeftButton) {
_selectionEnd = posToCursor(event->pos());
QString selection
= data(MessageModel::DisplayRole).toString().mid(qMin(_selectionStart, _selectionEnd), qAbs(_selectionStart - _selectionEnd));