Improve mouse button detection for mouse release events
authorManuel Nickschas <sputnick@quassel-irc.org>
Thu, 15 Jan 2009 20:11:59 +0000 (21:11 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Thu, 15 Jan 2009 20:11:59 +0000 (21:11 +0100)
This might be a solution to the strange behavior when clicking links in Windows
(as described in Bug 483). Please test and feedback.

src/qtui/chatitem.cpp
src/qtui/chatscene.cpp

index fc45b77..9b7c220 100644 (file)
@@ -278,7 +278,7 @@ void ChatItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
 }
 
 void ChatItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
-  if(_selectionMode != NoSelection && !event->buttons() & Qt::LeftButton) {
+  if(_selectionMode != NoSelection && event->button() == Qt::LeftButton) {
     chatScene()->selectionToClipboard(QClipboard::Selection);
     event->accept();
   } else
index 0dc3ec6..60f3f1b 100644 (file)
@@ -653,7 +653,7 @@ void ChatScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) {
 }
 
 void ChatScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
-  if(!event->buttons() & Qt::LeftButton) {
+  if(event->button() == Qt::LeftButton && _leftButtonPressed) {
     _leftButtonPressed = false;
     if(_clickMode != NoClick) {
       if(_clickMode == SingleClick)