]> sigrok.org Git - pulseview.git/commitdiff
TraceView: Fix still-highlighted trace after closing popup
authorSoeren Apel <redacted>
Sat, 18 Jan 2020 22:01:15 +0000 (23:01 +0100)
committerSoeren Apel <redacted>
Sat, 18 Jan 2020 22:01:54 +0000 (23:01 +0100)
pv/views/trace/marginwidget.cpp
pv/views/trace/marginwidget.hpp
pv/views/trace/viewwidget.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);
 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();
 }
        if (p)
                p->show();
 }
@@ -80,6 +83,17 @@ void MarginWidget::keyPressEvent(QKeyEvent *event)
     ViewWidget::keyPressEvent(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
 } // namespace trace
 } // namespace views
 } // namespace pv
index 9a0686aa4c93e1ffd4448411ee2b035c7330a742..ef5e6350fe1cd1e4b1f6b9ba0ddfd01e4dc7ce6f 100644 (file)
@@ -61,10 +61,12 @@ protected:
         */
        void show_popup(const shared_ptr<ViewItem> &item);
 
         */
        void show_popup(const shared_ptr<ViewItem> &item);
 
-protected:
+protected Q_SLOTS:
        virtual void contextMenuEvent(QContextMenuEvent *event);
 
        virtual void keyPressEvent(QKeyEvent *event);
        virtual void contextMenuEvent(QContextMenuEvent *event);
 
        virtual void keyPressEvent(QKeyEvent *event);
+
+       virtual void on_popup_closed();
 };
 
 } // namespace trace
 };
 
 } // namespace trace
index 5d496325d875c09e285b4636fd46c2a53bdfdcaf..5a85c15d5c52d25e29aeff47e1af3e70dc0ec60d 100644 (file)
@@ -357,6 +357,7 @@ void ViewWidget::leaveEvent(QEvent*)
 
        mouse_modifiers_ = Qt::NoModifier;
        item_hover(nullptr, QPoint());
 
        mouse_modifiers_ = Qt::NoModifier;
        item_hover(nullptr, QPoint());
+
        update();
 }
 
        update();
 }