changeset 474:8bdc8f27d19c

Use contextMenuEvent instead of right-click in mousePressEvent to call up changeset item context menu. Appears to fix #201, though I'm cautious as I don't understand the reason
author Chris Cannam
date Tue, 26 Jul 2011 13:41:56 +0100
parents 2d57b81671de
children dec4695f64e0
files src/changesetitem.cpp src/changesetitem.h
diffstat 2 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/changesetitem.cpp	Thu Jul 14 13:56:20 2011 +0100
+++ b/src/changesetitem.cpp	Tue Jul 26 13:41:56 2011 +0100
@@ -101,17 +101,16 @@
         } else {
             showDetail();
         }
-    } else if (e->button() == Qt::RightButton) {
-        if (m_detail) {
-            hideDetail();
-        }
-        activateMenu();
     }
 }
 
 void
-ChangesetItem::activateMenu()
+ChangesetItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *)
 {
+    if (m_detail) {
+        hideDetail();
+    }
+
     m_parentDiffActions.clear();
     m_summaryActions.clear();
 
@@ -201,9 +200,9 @@
     QAction *tag = menu->addAction(tr("Add tag..."));
     connect(tag, SIGNAL(triggered()), this, SLOT(tagActivated()));
 
+    ungrabMouse();
+
     menu->exec(QCursor::pos());
-
-    ungrabMouse();
 }
 
 void
--- a/src/changesetitem.h	Thu Jul 14 13:56:20 2011 +0100
+++ b/src/changesetitem.h	Tue Jul 26 13:41:56 2011 +0100
@@ -85,6 +85,7 @@
 
 protected:
     virtual void mousePressEvent(QGraphicsSceneMouseEvent *);
+    virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *);
 
 private:
     void activateMenu();