From: Joel Holdsworth Date: Sun, 28 Dec 2014 16:31:07 +0000 (+0000) Subject: ViewWidget: Added mouse_down X-Git-Tag: pulseview-0.3.0~299 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=1f1edc092680e9182be07a760ad03d00b8c5ca06;p=pulseview.git ViewWidget: Added mouse_down --- diff --git a/pv/view/viewwidget.cpp b/pv/view/viewwidget.cpp index 57053298..e2b2d172 100644 --- a/pv/view/viewwidget.cpp +++ b/pv/view/viewwidget.cpp @@ -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; } diff --git a/pv/view/viewwidget.hpp b/pv/view/viewwidget.hpp index 1d50832b..65434f65 100644 --- a/pv/view/viewwidget.hpp +++ b/pv/view/viewwidget.hpp @@ -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.