Deactivate selections on click
[quassel.git] / src / qtui / chatitem.cpp
index 286fd62..e0d3e22 100644 (file)
@@ -197,9 +197,15 @@ void ChatItem::continueSelecting(const QPointF &pos) {
 
 void ChatItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
   if(event->buttons() & Qt::LeftButton) {
-    chatScene()->setSelectingItem(this);  // removes earlier selection if exists
-    _selectionStart = _selectionEnd = posToCursor(event->pos());
-    _selectionMode = PartialSelection;
+    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();
+    }
     event->accept();
   } else {
     event->ignore();