Add generic "Create marker here" context menu entry
[pulseview.git] / pv / views / trace / viewwidget.cpp
index a14c4fd224395eb95bc8c46d97766051a7ec0e51..c3461614ab637db740659666482d6b12ee24445c 100644 (file)
@@ -50,9 +50,10 @@ void ViewWidget::clear_selection()
                i->select(false);
 }
 
                i->select(false);
 }
 
-void ViewWidget::item_hover(const shared_ptr<ViewItem> &item)
+void ViewWidget::item_hover(const shared_ptr<ViewItem> &item, QPoint pos)
 {
        (void)item;
 {
        (void)item;
+       (void)pos;
 }
 
 void ViewWidget::item_clicked(const shared_ptr<ViewItem> &item)
 }
 
 void ViewWidget::item_clicked(const shared_ptr<ViewItem> &item)
@@ -180,7 +181,7 @@ void ViewWidget::mouse_left_press_event(QMouseEvent *event)
        bool item_dragged = false;
        const auto items = this->items();
        for (auto &i : items)
        bool item_dragged = false;
        const auto items = this->items();
        for (auto &i : items)
-               if (i->selected()) {
+               if (i->selected() && i->is_draggable(event->pos())) {
                        item_dragged = true;
                        i->drag();
                }
                        item_dragged = true;
                        i->drag();
                }
@@ -281,7 +282,7 @@ void ViewWidget::mouseMoveEvent(QMouseEvent *event)
        mouse_point_ = event->pos();
 
        if (!event->buttons())
        mouse_point_ = event->pos();
 
        if (!event->buttons())
-               item_hover(get_mouse_over_item(event->pos()));
+               item_hover(get_mouse_over_item(event->pos()), event->pos());
        else if (event->buttons() & Qt::LeftButton) {
                if (!item_dragging_) {
                        if ((event->pos() - mouse_down_point_).manhattanLength() <
        else if (event->buttons() & Qt::LeftButton) {
                if (!item_dragging_) {
                        if ((event->pos() - mouse_down_point_).manhattanLength() <