]> sigrok.org Git - pulseview.git/commitdiff
Make change performed in 79b53a1ae actually work
authorSoeren Apel <redacted>
Sun, 21 Oct 2018 20:12:19 +0000 (22:12 +0200)
committerSoeren Apel <redacted>
Sun, 21 Oct 2018 20:12:19 +0000 (22:12 +0200)
ViewWidget::mouse_down_point_ indeed should contain the position
of the last mouse click but since we ignore right clicks, it
doesn't.

pv/views/trace/viewwidget.cpp

index d5b949c0dabcf89e196dadeeb35bf37a230c2cf2..73c361f47d802dd469b8ad59f9a2f4e47f285060 100644 (file)
@@ -252,17 +252,21 @@ void ViewWidget::mousePressEvent(QMouseEvent *event)
 {
        assert(event);
 
-       /* Ignore right click events as they will open context menus when
+       if (event->button() & Qt::LeftButton) {
+               mouse_down_point_ = event->pos();
+               mouse_down_item_ = get_mouse_over_item(event->pos());
+               mouse_left_press_event(event);
+       }
+
+       /* Don't forward right click events as they will open context menus when
         * used on trace labels. Those menus prevent ViewWidget::mouseReleaseEvent()
         * to be triggered upon button release, making mouse_down_item_
         * hold the last reference to a view item that might have been deleted
         * from the context menu, preventing it from being freed as intended.
+        * TODO Remove this once context menus are handled separately
         */
-       if (event->button() & Qt::LeftButton) {
+       if (event->button() & Qt::RightButton)
                mouse_down_point_ = event->pos();
-               mouse_down_item_ = get_mouse_over_item(event->pos());
-               mouse_left_press_event(event);
-       }
 }
 
 void ViewWidget::mouseReleaseEvent(QMouseEvent *event)