X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatitem.cpp;h=051151c5e3a5566e662670515c05094be9224417;hp=7a11a6653a8c3cd863ce1cdabbc7757b03dfd83e;hb=c95e8cea9060b25fa5115d19090b51f03290adc5;hpb=16192b6fb8ddce1f3c1202eef709edc45e0e2c27 diff --git a/src/qtui/chatitem.cpp b/src/qtui/chatitem.cpp index 7a11a665..051151c5 100644 --- a/src/qtui/chatitem.cpp +++ b/src/qtui/chatitem.cpp @@ -60,11 +60,11 @@ QVariant ChatItem::data(int role) const { 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; @@ -208,7 +208,7 @@ void ChatItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { if(_selectionMode == NoSelection) { chatScene()->setSelectingItem(this); // removes earlier selection if exists _selectionStart = _selectionEnd = posToCursor(event->pos()); - _selectionMode = PartialSelection; + //_selectionMode = PartialSelection; } else { chatScene()->setSelectingItem(0); _selectionMode = NoSelection; @@ -226,6 +226,8 @@ void ChatItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { qint16 end = posToCursor(event->pos()); if(end != _selectionEnd) { _selectionEnd = end; + if(_selectionStart != _selectionEnd) _selectionMode = PartialSelection; + else _selectionMode = NoSelection; update(); } } else { @@ -243,7 +245,7 @@ void ChatItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { _selectionEnd = posToCursor(event->pos()); QString selection = data(MessageModel::DisplayRole).toString().mid(qMin(_selectionStart, _selectionEnd), qAbs(_selectionStart - _selectionEnd)); - QApplication::clipboard()->setText(selection, QClipboard::Clipboard); // TODO configure where selections should go + chatScene()->putToClipboard(selection); event->accept(); } else { event->ignore();