]> sigrok.org Git - pulseview.git/commitdiff
ViewWidget: Added mouse_down
authorJoel Holdsworth <redacted>
Sun, 28 Dec 2014 16:31:07 +0000 (16:31 +0000)
committerJoel Holdsworth <redacted>
Mon, 29 Dec 2014 12:24:23 +0000 (12:24 +0000)
pv/view/viewwidget.cpp
pv/view/viewwidget.hpp

index 57053298d00a81d0495f2ce290a5aa3cdea77ac8..e2b2d17295f3295bc429f550548d95545c3ca1f3 100644 (file)
@@ -86,6 +86,12 @@ bool ViewWidget::accept_drag() const
        return false;
 }
 
+bool ViewWidget::mouse_down() const
+{
+       return mouse_down_point_.x() != INT_MIN &&
+               mouse_down_point_.y() != INT_MIN;
+}
+
 void ViewWidget::drag_items(const QPoint &delta)
 {
        // Drag the row items
@@ -191,6 +197,7 @@ void ViewWidget::mouseReleaseEvent(QMouseEvent *event)
        if (event->button() & Qt::LeftButton)
                mouse_left_release_event(event);
 
+       mouse_down_point_ = QPoint(INT_MIN, INT_MIN);
        mouse_down_item_ = nullptr;
 }
 
index 1d50832b030c7856a9d71ec47a7c48db42fbc579..65434f65e1720913ab2589f3cfd932fe1c873b46 100644 (file)
@@ -52,6 +52,11 @@ protected:
         */
        bool accept_drag() const;
 
+       /**
+        * Returns true if the mouse button is down.
+        */
+       bool mouse_down() const;
+
        /**
         * Drag the dragging items by the delta offset.
         * @param delta the drag offset in pixels.