X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fview%2Fmarginwidget.cpp;h=fcbb31bf0174bb1944286005b11d0d978d715126;hb=1dffa582704bb6acb144a3e89bd6eb0e2ccf4f25;hp=d96d3aba66f315bf1483f7b4f3045ce96552a7f6;hpb=e47b69882ca7299041123c664dbcc8b552c5db99;p=pulseview.git diff --git a/pv/view/marginwidget.cpp b/pv/view/marginwidget.cpp index d96d3aba..fcbb31bf 100644 --- a/pv/view/marginwidget.cpp +++ b/pv/view/marginwidget.cpp @@ -34,8 +34,7 @@ namespace pv { namespace view { MarginWidget::MarginWidget(View &parent) : - QWidget(&parent), - view_(parent), + ViewWidget(parent), dragging_(false) { setAttribute(Qt::WA_NoSystemBackground, true); @@ -132,6 +131,28 @@ void MarginWidget::mouseReleaseEvent(QMouseEvent *event) mouse_down_item_ = nullptr; } +void MarginWidget::mouseMoveEvent(QMouseEvent *event) +{ + assert(event); + mouse_point_ = event->pos(); + + if (!(event->buttons() & Qt::LeftButton)) + return; + + if ((event->pos() - mouse_down_point_).manhattanLength() < + QApplication::startDragDistance()) + return; + + if (!accept_drag()) + return; + + // Do the drag + dragging_ = true; + drag_items(event->pos() - mouse_down_point_); + + update(); +} + void MarginWidget::leaveEvent(QEvent*) { mouse_point_ = QPoint(-1, -1);