From: Manuel Nickschas Date: Wed, 20 Aug 2008 14:01:54 +0000 (+0200) Subject: Fixing the remaining crash that might have happened while selecting X-Git-Tag: 0.3.0~19 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=a2cd05a6a6cc379d830ee3974b70c86041e52ba2;ds=sidebyside Fixing the remaining crash that might have happened while selecting --- diff --git a/src/qtui/chatitem.cpp b/src/qtui/chatitem.cpp index 602a2c9e..127d3bad 100644 --- a/src/qtui/chatitem.cpp +++ b/src/qtui/chatitem.cpp @@ -153,10 +153,8 @@ void ChatItem::setFullSelection() { } void ChatItem::clearSelection() { - if(_selectionMode != NoSelection) { - _selectionMode = NoSelection; - update(); - } + _selectionMode = NoSelection; + update(); } void ChatItem::continueSelecting(const QPointF &pos) { @@ -195,15 +193,10 @@ QList ChatItem::findWords(const QString &searchWord, Qt::CaseSensitivity void ChatItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { if(event->buttons() == Qt::LeftButton) { - if(_selectionMode == NoSelection) { - chatScene()->setSelectingItem(this); // removes earlier selection if exists - _selectionStart = _selectionEnd = posToCursor(event->pos()); - //_selectionMode = PartialSelection; - } else { - chatScene()->setSelectingItem(0); - _selectionMode = NoSelection; - update(); - } + chatScene()->setSelectingItem(this); + _selectionStart = _selectionEnd = posToCursor(event->pos()); + _selectionMode = NoSelection; // will be set to PartialSelection by mouseMoveEvent + update(); event->accept(); } else { event->ignore(); @@ -216,8 +209,7 @@ void ChatItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { qint16 end = posToCursor(event->pos()); if(end != _selectionEnd) { _selectionEnd = end; - if(_selectionStart != _selectionEnd) _selectionMode = PartialSelection; - else _selectionMode = NoSelection; + _selectionMode = (_selectionStart != _selectionEnd ? PartialSelection : NoSelection); update(); } } else {