From c9501685cc628d91277a2bc8fc1d84908ae99320 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Pe=C3=B1aranda?= Date: Fri, 25 Jan 2013 09:54:26 -0200 Subject: [PATCH] change fov_max with shift+wheel --- openglcanvas.cpp | 9 +++++++-- openglcanvas.h | 1 + panowindow1.ui | 21 +++++++++++++++++++-- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/openglcanvas.cpp b/openglcanvas.cpp index 28fe0a1..d61036b 100644 --- a/openglcanvas.cpp +++ b/openglcanvas.cpp @@ -101,6 +101,7 @@ void OpenGLCanvas::change_fov_max(int new_fov_max){ scale=log(exp(1.f)+(1.f-exp(1.f))*(fov-fov_max)/(360.-2*fov_max)); } fprintf(stderr,"change fov_max=%f, new scale=%f\n",fov_max,scale); + emit max_fov_changed((int)fov_max); updateGL(); } @@ -674,7 +675,11 @@ void OpenGLCanvas::mouseMoveEvent(QMouseEvent *event){ void OpenGLCanvas::wheelEvent(QWheelEvent *event){ if(event->orientation()==Qt::Vertical){ - change_fov(fov+((double)event->delta())/60); + if(event->modifiers()==Qt::ControlModifier){ + change_fov_max(fov_max+((double)event->delta())/30); + }else{ + change_fov(fov+((double)event->delta())/30); + } } } @@ -725,7 +730,7 @@ void OpenGLCanvas::paintGL(){ time_fps = time_frames/dt; time_frames = 0; time_time.reset(); - emit fps(QString("%1 fps").arg((int)(time_fps+0.5))); + //emit fps(QString("%1 fps").arg((int)(time_fps+0.5))); printf("fps = %d ", (int)(time_fps+0.5)); // } // } diff --git a/openglcanvas.h b/openglcanvas.h index 388298a..2ca440f 100644 --- a/openglcanvas.h +++ b/openglcanvas.h @@ -62,6 +62,7 @@ protected: signals: void fps(QString newFPS); void fov_changed(int new_fov); + void max_fov_changed(int new_max_fov); public slots: void change_fov(double f); diff --git a/panowindow1.ui b/panowindow1.ui index 018716d..9f8ba6e 100644 --- a/panowindow1.ui +++ b/panowindow1.ui @@ -157,10 +157,10 @@ - 10 + 1 - 180 + 359 60 @@ -187,6 +187,7 @@ 1 fov_changed(int) + max_fov_changed(int) change_fov(double) change_scale(double) change_center_lambda(double) @@ -330,5 +331,21 @@ + + GLCanvas + max_fov_changed(int) + changefovmax + setValue(int) + + + 250 + 249 + + + 532 + 262 + + + -- GitLab