From: Joel Holdsworth Date: Wed, 25 Dec 2013 19:46:37 +0000 (+0000) Subject: Added double-click zoom behaviour X-Git-Tag: pulseview-0.2.0~185 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=903038a8c9496b23d29535dd8c41a6c207c0831b;p=pulseview.git Added double-click zoom behaviour --- diff --git a/pv/view/viewport.cpp b/pv/view/viewport.cpp index a06c8888..145f040f 100644 --- a/pv/view/viewport.cpp +++ b/pv/view/viewport.cpp @@ -111,6 +111,16 @@ void Viewport::mouseMoveEvent(QMouseEvent *event) } } +void Viewport::mouseDoubleClickEvent(QMouseEvent *event) +{ + assert(event); + + if (event->buttons() & Qt::LeftButton) + _view.zoom(2.0, event->x()); + else if (event->buttons() & Qt::RightButton) + _view.zoom(-2.0, event->x()); +} + void Viewport::wheelEvent(QWheelEvent *event) { assert(event); diff --git a/pv/view/viewport.h b/pv/view/viewport.h index 4add1ccf..0474b7ee 100644 --- a/pv/view/viewport.h +++ b/pv/view/viewport.h @@ -48,6 +48,7 @@ protected: private: void mousePressEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); + void mouseDoubleClickEvent(QMouseEvent * event); void wheelEvent(QWheelEvent *event); private slots: