]> sigrok.org Git - pulseview.git/commitdiff
Fixed Header to respect the minimum drag distance
authorJoel Holdsworth <redacted>
Tue, 1 Oct 2013 16:15:24 +0000 (17:15 +0100)
committerJoel Holdsworth <redacted>
Sun, 13 Oct 2013 10:05:22 +0000 (11:05 +0100)
pv/view/header.cpp
pv/view/header.h

index e084ecc94e55fe4a7390a0bc3f76aae2002e63e7..549b71918627b4bd1a6d0e01f2e20f6fe17994f6 100644 (file)
@@ -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<std::pair<boost::weak_ptr<Trace>,
index 35d5d20f49f7b5bcf89f1ca1c91a127188d07abb..024227820b6635008216b38b290ec230fce528d8 100644 (file)
@@ -73,6 +73,7 @@ signals:
 private:
        QPoint _mouse_point;
        QPoint _mouse_down_point;
+       bool _dragging;
 
        std::list<std::pair<boost::weak_ptr<Trace>, int> >
                _drag_traces;