Do no longer react to right mouse button presses
authorManuel Nickschas <sputnick@quassel-irc.org>
Mon, 11 Aug 2008 19:20:41 +0000 (21:20 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Wed, 13 Aug 2008 10:24:28 +0000 (12:24 +0200)
src/qtui/chatitem.cpp
src/qtui/chatscene.cpp

index 14fd3ad..655d1fd 100644 (file)
@@ -204,7 +204,7 @@ void ChatItem::continueSelecting(const QPointF &pos) {
 }
 
 void ChatItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
-  if(event->buttons() & Qt::LeftButton) {
+  if(event->buttons() == Qt::LeftButton) {
     if(_selectionMode == NoSelection) {
       chatScene()->setSelectingItem(this);  // removes earlier selection if exists
       _selectionStart = _selectionEnd = posToCursor(event->pos());
@@ -221,20 +221,25 @@ void ChatItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
 }
 
 void ChatItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
-  if(contains(event->pos())) {
-    qint16 end = posToCursor(event->pos());
-    if(end != _selectionEnd) {
-      _selectionEnd = end;
-      update();
+  if(event->buttons() == Qt::LeftButton) {
+    if(contains(event->pos())) {
+      qint16 end = posToCursor(event->pos());
+      if(end != _selectionEnd) {
+        _selectionEnd = end;
+        update();
+      }
+    } else {
+      setFullSelection();
+      chatScene()->startGlobalSelection(this, event->pos());
     }
+    event->accept();
   } else {
-    setFullSelection();
-    chatScene()->startGlobalSelection(this, event->pos());
+    event->ignore();
   }
 }
 
 void ChatItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
-  if(_selectionMode != NoSelection) {
+  if(_selectionMode != NoSelection && event->buttons() == Qt::LeftButton) {
     _selectionEnd = posToCursor(event->pos());
     QString selection
         = data(MessageModel::DisplayRole).toString().mid(qMin(_selectionStart, _selectionEnd), qAbs(_selectionStart - _selectionEnd));
@@ -266,17 +271,17 @@ void ChatItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) {
 
 void ChatItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event) {
   //qDebug() << (void*)this << "entering";
-
+  event->ignore();
 }
 
 void ChatItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) {
   //qDebug() << (void*)this << "leaving";
-
+  event->ignore();
 }
 
 void ChatItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) {
   //qDebug() << (void*)this << event->pos();
-
+  event->ignore();
 }
 
 
index 8bf8add..1af7e85 100644 (file)
@@ -233,7 +233,7 @@ void ChatScene::updateSelection(const QPointF &pos) {
 }
 
 void ChatScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
-  if(_isSelecting && event->buttons() & Qt::LeftButton) {
+  if(_isSelecting && event->buttons() == Qt::LeftButton) {
     updateSelection(event->scenePos());
     event->accept();
   } else {
@@ -242,7 +242,7 @@ void ChatScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
 }
 
 void ChatScene::mousePressEvent(QGraphicsSceneMouseEvent *event) {
-  if(event->buttons() & Qt::LeftButton && _selectionStart >= 0) {
+  if(event->buttons() == Qt::LeftButton && _selectionStart >= 0) {
     for(int l = qMin(_selectionStart, _selectionEnd); l <= qMax(_selectionStart, _selectionEnd); l++) {
       _lines[l]->setSelected(false);
     }
@@ -254,7 +254,7 @@ void ChatScene::mousePressEvent(QGraphicsSceneMouseEvent *event) {
 }
 
 void ChatScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
-  if(_isSelecting) {
+  if(_isSelecting && event->buttons() == Qt::LeftButton) {
 #   ifdef Q_WS_X11
       QApplication::clipboard()->setText(selectionToString(), QClipboard::Selection);
 #   endif