]> sigrok.org Git - pulseview.git/commitdiff
Added double-click zoom behaviour
authorJoel Holdsworth <redacted>
Wed, 25 Dec 2013 19:46:37 +0000 (19:46 +0000)
committerJoel Holdsworth <redacted>
Wed, 25 Dec 2013 19:46:37 +0000 (19:46 +0000)
pv/view/viewport.cpp
pv/view/viewport.h

index a06c8888761f6c1237ffde3c5aecc8ceb2ff5df1..145f040fc93be7413d23458e6383c971304073a8 100644 (file)
@@ -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);
index 4add1ccfbd4c1d1bb614993d84cf1f9270004ef9..0474b7eefe4dd7fde0752d28fd8ea417214f01c6 100644 (file)
@@ -48,6 +48,7 @@ protected:
 private:
        void mousePressEvent(QMouseEvent *event);
        void mouseMoveEvent(QMouseEvent *event);
+       void mouseDoubleClickEvent(QMouseEvent * event);
        void wheelEvent(QWheelEvent *event);
 
 private slots: