From: Joel Holdsworth Date: Tue, 1 Oct 2013 16:15:24 +0000 (+0100) Subject: Fixed Header to respect the minimum drag distance X-Git-Tag: pulseview-0.2.0~276 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=728fcafc9897d3ffb4a109b6248d88b0945128f5;p=pulseview.git Fixed Header to respect the minimum drag distance --- diff --git a/pv/view/header.cpp b/pv/view/header.cpp index e084ecc9..549b7191 100644 --- a/pv/view/header.cpp +++ b/pv/view/header.cpp @@ -41,7 +41,8 @@ namespace pv { namespace view { Header::Header(View &parent) : - MarginWidget(parent) + MarginWidget(parent), + _dragging(false) { setMouseTracking(true); @@ -152,6 +153,7 @@ void Header::mouseReleaseEvent(QMouseEvent *event) { assert(event); if (event->button() == Qt::LeftButton) { + _dragging = false; _drag_traces.clear(); _view.normalize_layout(); } @@ -162,8 +164,18 @@ void Header::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; + // Move the signals if we are dragging - if (!_drag_traces.empty()) { + if (!_drag_traces.empty()) + { + _dragging = true; + const int delta = event->pos().y() - _mouse_down_point.y(); for (std::list, diff --git a/pv/view/header.h b/pv/view/header.h index 35d5d20f..02422782 100644 --- a/pv/view/header.h +++ b/pv/view/header.h @@ -73,6 +73,7 @@ signals: private: QPoint _mouse_point; QPoint _mouse_down_point; + bool _dragging; std::list, int> > _drag_traces;