]> sigrok.org Git - pulseview.git/blobdiff - pv/views/trace/marginwidget.cpp
TraceView: Fix still-highlighted trace after closing popup
[pulseview.git] / pv / views / trace / marginwidget.cpp
index c2d443651f2c740369ff0d3678d096b049ee5eaf..537ffe5ef298ad29b1cc6dd00a9ab5bab1992fd5 100644 (file)
@@ -47,6 +47,9 @@ void MarginWidget::item_clicked(const shared_ptr<ViewItem> &item)
 void MarginWidget::show_popup(const shared_ptr<ViewItem> &item)
 {
        pv::widgets::Popup *const p = item->create_popup(this);
+
+       connect(p, SIGNAL(closed()), this, SLOT(on_popup_closed()));
+
        if (p)
                p->show();
 }
@@ -80,6 +83,17 @@ void MarginWidget::keyPressEvent(QKeyEvent *event)
     ViewWidget::keyPressEvent(event);
 }
 
+void MarginWidget::on_popup_closed()
+{
+       bool cursor_above_widget = rect().contains(mapFromGlobal(QCursor::pos()));
+
+       if (!cursor_above_widget)
+               mouse_point_ = QPoint(INT_MIN, INT_MIN);
+
+       update();
+}
+
+
 } // namespace trace
 } // namespace views
 } // namespace pv