MarginWidget: Moved in leaveEvent
[pulseview.git] / pv / view / marginwidget.cpp
index e44233c80291c8a1cb1bdd2a5078ef9d505d6211..b4b12140276c0b4faf11f9dab36a4d6a6ed7c117 100644 (file)
 
 #include "marginwidget.hpp"
 
+#include <pv/widgets/popup.hpp>
+
+using std::shared_ptr;
+
 namespace pv {
 namespace view {
 
@@ -31,6 +35,21 @@ MarginWidget::MarginWidget(View &parent) :
        dragging_(false)
 {
        setAttribute(Qt::WA_NoSystemBackground, true);
+       setFocusPolicy(Qt::ClickFocus);
+       setMouseTracking(true);
+}
+
+void MarginWidget::show_popup(const shared_ptr<ViewItem> &item)
+{
+       pv::widgets::Popup *const p = item->create_popup(this);
+       if (p)
+               p->show();
+}
+
+void MarginWidget::leaveEvent(QEvent*)
+{
+       mouse_point_ = QPoint(-1, -1);
+       update();
 }
 
 void MarginWidget::clear_selection()