From 6020dacc11d5b3719ffa0189a33ddbb1f6ce01d6 Mon Sep 17 00:00:00 2001 From: Alexandr Kondratev Date: Sat, 25 Jun 2016 00:09:50 +0300 Subject: [PATCH 1/8] highgui module: implemented QT and GTK mouse wheel callback support in linux --- modules/highgui/src/window_QT.cpp | 12 +++++++++++- modules/highgui/src/window_QT.h | 2 +- modules/highgui/src/window_gtk.cpp | 29 +++++++++++++++++++++++++++-- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/modules/highgui/src/window_QT.cpp b/modules/highgui/src/window_QT.cpp index 925bc222d4..30f99d7708 100644 --- a/modules/highgui/src/window_QT.cpp +++ b/modules/highgui/src/window_QT.cpp @@ -2629,8 +2629,18 @@ void DefaultViewPort::resizeEvent(QResizeEvent* evnt) void DefaultViewPort::wheelEvent(QWheelEvent* evnt) { - scaleView(evnt->delta() / 240.0, evnt->pos()); + int delta = evnt->delta(); + int cv_event = -1; + int flags = ((delta & 0xffff)<<16) | ((evnt->orientation() == Qt::Vertical) ? CV_EVENT_MOUSEWHEEL : CV_EVENT_MOUSEHWHEEL); + QPoint pt = evnt->pos(); + + icvmouseHandler(evnt, mouse_wheel, cv_event, flags); + icvmouseProcessing(QPoingF(pt), cv_event, flags); + + scaleView(evnt->delta() / 240.0, pt); viewport()->update(); + + QWidget::mouseWheel(evnt); } diff --git a/modules/highgui/src/window_QT.h b/modules/highgui/src/window_QT.h index c0769dcc94..7896b9f4d0 100644 --- a/modules/highgui/src/window_QT.h +++ b/modules/highgui/src/window_QT.h @@ -366,7 +366,7 @@ private slots: }; -enum type_mouse_event { mouse_up = 0, mouse_down = 1, mouse_dbclick = 2, mouse_move = 3 }; +enum type_mouse_event { mouse_up = 0, mouse_down = 1, mouse_dbclick = 2, mouse_move = 3, mouse_wheel = 3 }; static const int tableMouseButtons[][3]={ {CV_EVENT_LBUTTONUP, CV_EVENT_RBUTTONUP, CV_EVENT_MBUTTONUP}, //mouse_up {CV_EVENT_LBUTTONDOWN, CV_EVENT_RBUTTONDOWN, CV_EVENT_MBUTTONDOWN}, //mouse_down diff --git a/modules/highgui/src/window_gtk.cpp b/modules/highgui/src/window_gtk.cpp index 29172e72d1..928118e225 100644 --- a/modules/highgui/src/window_gtk.cpp +++ b/modules/highgui/src/window_gtk.cpp @@ -1066,6 +1066,8 @@ CV_IMPL int cvNamedWindow( const char* name, int flags ) G_CALLBACK(icvOnMouse), window ); g_signal_connect( window->widget, "motion-notify-event", G_CALLBACK(icvOnMouse), window ); + g_signal_connect( window->widget, "scroll-event", + G_CALLBACK(icvOnMouse), window ); g_signal_connect( window->frame, "delete-event", G_CALLBACK(icvOnClose), window ); #if defined(GTK_VERSION3) @@ -1076,7 +1078,7 @@ CV_IMPL int cvNamedWindow( const char* name, int flags ) G_CALLBACK(cvImageWidget_expose), window ); #endif //GTK_VERSION3 - gtk_widget_add_events (window->widget, GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK) ; + gtk_widget_add_events (window->widget, GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK) ; gtk_widget_show( window->frame ); gtk_window_set_title( GTK_WINDOW(window->frame), name ); @@ -1947,6 +1949,13 @@ static gboolean icvOnMouse( GtkWidget *widget, GdkEvent *event, gpointer user_da } state = event_button->state; } + else if( event->type == GDK_SCROLL ) + { + GdkEventButton* event_button = (GdkEventButton*)event; + + cv_event = CV_EVENT_MOUSEWHEEL; + state = event_button->state; + } if( cv_event >= 0 ){ // scale point if image is scaled @@ -1973,7 +1982,23 @@ static gboolean icvOnMouse( GtkWidget *widget, GdkEvent *event, gpointer user_da // if((unsigned)pt.x < (unsigned)(image_widget->original_image->width) && // (unsigned)pt.y < (unsigned)(image_widget->original_image->height) ) { - int flags = (state & GDK_SHIFT_MASK ? CV_EVENT_FLAG_SHIFTKEY : 0) | + int flags = 0; + if (state & GDK_SCROLL_MASK) { + cv_event = CV_EVENT_MOUSEMOVE; + int orient = CV_EVENT_MOUSEWHEEL; + switch(event->scroll.direction) { + case GDK_SCROLL_RIGHT: orient = CV_EVENT_MOUSEHWHEEL; + case GDK_SCROLL_UP: flags |= ((1 << 16) | orient); + break; + case GDK_SCROLL_LEFT: orient = CV_EVENT_MOUSEHWHEEL; + case GDK_SCROLL_DOWN: flags |= ((-1 << 16) | orient); + break; + case GDK_SCROLL_SMOOTH: // to prevent make warning; TODO + ; + }; + }; + flags = flags | + (state & GDK_SHIFT_MASK ? CV_EVENT_FLAG_SHIFTKEY : 0) | (state & GDK_CONTROL_MASK ? CV_EVENT_FLAG_CTRLKEY : 0) | (state & (GDK_MOD1_MASK|GDK_MOD2_MASK) ? CV_EVENT_FLAG_ALTKEY : 0) | (state & GDK_BUTTON1_MASK ? CV_EVENT_FLAG_LBUTTON : 0) | From fd78e2cc6cdcbf7844dc38fb91d05922739f8bd9 Mon Sep 17 00:00:00 2001 From: Alexandr Kondratev Date: Sat, 25 Jun 2016 00:47:22 +0300 Subject: [PATCH 2/8] highgui module: removed unused type_mouse_event mouse_wheel --- modules/highgui/src/window_QT.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/highgui/src/window_QT.h b/modules/highgui/src/window_QT.h index 7896b9f4d0..c0769dcc94 100644 --- a/modules/highgui/src/window_QT.h +++ b/modules/highgui/src/window_QT.h @@ -366,7 +366,7 @@ private slots: }; -enum type_mouse_event { mouse_up = 0, mouse_down = 1, mouse_dbclick = 2, mouse_move = 3, mouse_wheel = 3 }; +enum type_mouse_event { mouse_up = 0, mouse_down = 1, mouse_dbclick = 2, mouse_move = 3 }; static const int tableMouseButtons[][3]={ {CV_EVENT_LBUTTONUP, CV_EVENT_RBUTTONUP, CV_EVENT_MBUTTONUP}, //mouse_up {CV_EVENT_LBUTTONDOWN, CV_EVENT_RBUTTONDOWN, CV_EVENT_MBUTTONDOWN}, //mouse_down From a4e97120060bbe77aaa782e00d2e58dc308e151b Mon Sep 17 00:00:00 2001 From: Alexandr Kondratev Date: Mon, 27 Jun 2016 13:34:41 +0300 Subject: [PATCH 3/8] Compilate switch-case with GTK_SCROLL_SMOOTH since GTK>=3.4 --- modules/highgui/src/window_gtk.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/highgui/src/window_gtk.cpp b/modules/highgui/src/window_gtk.cpp index 928118e225..249d452e8d 100644 --- a/modules/highgui/src/window_gtk.cpp +++ b/modules/highgui/src/window_gtk.cpp @@ -1993,8 +1993,10 @@ static gboolean icvOnMouse( GtkWidget *widget, GdkEvent *event, gpointer user_da case GDK_SCROLL_LEFT: orient = CV_EVENT_MOUSEHWHEEL; case GDK_SCROLL_DOWN: flags |= ((-1 << 16) | orient); break; +#if (GTK_MAJOR_VERSION > 3 or (GTK_MAJOR_VERSION == 3 and GTK_MINOR_VERSION >= 4)) case GDK_SCROLL_SMOOTH: // to prevent make warning; TODO ; +#endif //GTK_MAJOR_VERSION > 3 or (GTK_MAJOR_VERSION == 3 and GTK_MINOR_VERSION >= 4) }; }; flags = flags | From 81c69ecd1644bd08dbeb73ce49d58486ee1b57d6 Mon Sep 17 00:00:00 2001 From: Alexandr Kondratev Date: Wed, 29 Jun 2016 23:01:57 +0300 Subject: [PATCH 4/8] highgui: window_gtk.cpp directive boolean operations or/and replaced by ||/&& to keep compatible with older systems --- modules/highgui/src/window_gtk.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/highgui/src/window_gtk.cpp b/modules/highgui/src/window_gtk.cpp index 249d452e8d..9e4798e889 100644 --- a/modules/highgui/src/window_gtk.cpp +++ b/modules/highgui/src/window_gtk.cpp @@ -1993,10 +1993,10 @@ static gboolean icvOnMouse( GtkWidget *widget, GdkEvent *event, gpointer user_da case GDK_SCROLL_LEFT: orient = CV_EVENT_MOUSEHWHEEL; case GDK_SCROLL_DOWN: flags |= ((-1 << 16) | orient); break; -#if (GTK_MAJOR_VERSION > 3 or (GTK_MAJOR_VERSION == 3 and GTK_MINOR_VERSION >= 4)) +#if (GTK_MAJOR_VERSION > 3 || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION >= 4)) case GDK_SCROLL_SMOOTH: // to prevent make warning; TODO ; -#endif //GTK_MAJOR_VERSION > 3 or (GTK_MAJOR_VERSION == 3 and GTK_MINOR_VERSION >= 4) +#endif //GTK_MAJOR_VERSION > 3 || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION >= 4) }; }; flags = flags | From 7dcac647e52ad16ebebca9584c01f2974643949a Mon Sep 17 00:00:00 2001 From: Alexandr Kondratev Date: Sun, 3 Jul 2016 13:31:25 +0300 Subject: [PATCH 5/8] highgui module: a bit readable onMouse flags mapping --- modules/highgui/src/window_gtk.cpp | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/modules/highgui/src/window_gtk.cpp b/modules/highgui/src/window_gtk.cpp index 9e4798e889..4949ed5467 100644 --- a/modules/highgui/src/window_gtk.cpp +++ b/modules/highgui/src/window_gtk.cpp @@ -61,6 +61,13 @@ #include #endif +#ifndef BIT_ALLIN + #define BIT_ALLIN(x,y) ( ((x)&(y)) == (y) ) +#endif +#ifndef BIT_MAP + #define BIT_MAP(x,y,z) ( ((x)&(y)) ? (z) : 0 ) +#endif + // TODO Fix the initial window size when flags=0. Right now the initial window is by default // 320x240 size. A better default would be actual size of the image. Problem // is determining desired window size with trackbars while still allowing resizing. @@ -1006,6 +1013,7 @@ CV_IMPL int cvNamedWindow( const char* name, int flags ) CvWindow* window; int len; + int b_nautosize; cvInitSystem(1,(char**)&name); if( !name ) @@ -1087,11 +1095,11 @@ CV_IMPL int cvNamedWindow( const char* name, int flags ) hg_windows->prev = window; hg_windows = window; - gtk_window_set_resizable( GTK_WINDOW(window->frame), (flags & CV_WINDOW_AUTOSIZE) == 0 ); - + int b_nautosize = ((flags & CV_WINDOW_AUTOSIZE) == 0); + gtk_window_set_resizable( GTK_WINDOW(window->frame), b_nautosize ); // allow window to be resized - if( (flags & CV_WINDOW_AUTOSIZE)==0 ){ + if( b_nautosize ){ GdkGeometry geometry; geometry.min_width = 50; geometry.min_height = 50; @@ -1819,7 +1827,7 @@ static gboolean icvOnKeyPress(GtkWidget* widget, GdkEventKey* event, gpointer us { int code = 0; - if ( (event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK && (event->keyval == GDK_s || event->keyval == GDK_S)) + if ( BIT_ALLIN(event->state, GDK_CONTROL_MASK) && (event->keyval == GDK_s || event->keyval == GDK_S)) { try { @@ -2000,12 +2008,13 @@ static gboolean icvOnMouse( GtkWidget *widget, GdkEvent *event, gpointer user_da }; }; flags = flags | - (state & GDK_SHIFT_MASK ? CV_EVENT_FLAG_SHIFTKEY : 0) | - (state & GDK_CONTROL_MASK ? CV_EVENT_FLAG_CTRLKEY : 0) | - (state & (GDK_MOD1_MASK|GDK_MOD2_MASK) ? CV_EVENT_FLAG_ALTKEY : 0) | - (state & GDK_BUTTON1_MASK ? CV_EVENT_FLAG_LBUTTON : 0) | - (state & GDK_BUTTON2_MASK ? CV_EVENT_FLAG_MBUTTON : 0) | - (state & GDK_BUTTON3_MASK ? CV_EVENT_FLAG_RBUTTON : 0); + BIT_MAP(state, GDK_SHIFT_MASK, CV_EVENT_FLAG_SHIFTKEY) | + BIT_MAP(state, GDK_CONTROL_MASK, CV_EVENT_FLAG_CTRLKEY) | + BIT_MAP(state, GDK_MOD1_MASK, CV_EVENT_FLAG_ALTKEY) | + BIT_MAP(state, GDK_MOD2_MASK, CV_EVENT_FLAG_ALTKEY) | + BIT_MAP(state, GDK_BUTTON1_MASK, CV_EVENT_FLAG_LBUTTON) | + BIT_MAP(state, GDK_BUTTON2_MASK, CV_EVENT_FLAG_MBUTTON) | + BIT_MAP(state, GDK_BUTTON3_MASK, CV_EVENT_FLAG_RBUTTON); window->on_mouse( cv_event, pt.x, pt.y, flags, window->on_mouse_param ); } } From 1f2e15905443bdb0611283bdd2683bd56a648c19 Mon Sep 17 00:00:00 2001 From: Alexandr Kondratev Date: Sun, 3 Jul 2016 15:52:59 +0300 Subject: [PATCH 6/8] highgui module: using event->scroll.delta_{x,y} instead parsing direction and added widget event mask GDK_SMOOTH_SCROLL_MASK for GTK>=3.4 --- modules/highgui/src/window_gtk.cpp | 71 ++++++++++++++++++------------ 1 file changed, 42 insertions(+), 29 deletions(-) diff --git a/modules/highgui/src/window_gtk.cpp b/modules/highgui/src/window_gtk.cpp index 4949ed5467..bde5487035 100644 --- a/modules/highgui/src/window_gtk.cpp +++ b/modules/highgui/src/window_gtk.cpp @@ -52,8 +52,11 @@ #include #if (GTK_MAJOR_VERSION == 3) - #define GTK_VERSION3 + #define GTK_VERSION3 1 #endif //GTK_MAJOR_VERSION >= 3 +#if (GTK_MAJOR_VERSION > 3 || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION >= 4)) + #define GTK_VERSION3_4 1 +#endif #ifdef HAVE_OPENGL #include @@ -1086,7 +1089,12 @@ CV_IMPL int cvNamedWindow( const char* name, int flags ) G_CALLBACK(cvImageWidget_expose), window ); #endif //GTK_VERSION3 + +#if defined(GTK_VERSION3_4) + gtk_widget_add_events (window->widget, GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK) ; +#else gtk_widget_add_events (window->widget, GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK) ; +#endif //GTK_VERSION3_4 gtk_widget_show( window->frame ); gtk_window_set_title( GTK_WINDOW(window->frame), name ); @@ -1095,7 +1103,7 @@ CV_IMPL int cvNamedWindow( const char* name, int flags ) hg_windows->prev = window; hg_windows = window; - int b_nautosize = ((flags & CV_WINDOW_AUTOSIZE) == 0); + b_nautosize = ((flags & CV_WINDOW_AUTOSIZE) == 0); gtk_window_set_resizable( GTK_WINDOW(window->frame), b_nautosize ); // allow window to be resized @@ -1911,7 +1919,7 @@ static gboolean icvOnMouse( GtkWidget *widget, GdkEvent *event, gpointer user_da CvWindow* window = (CvWindow*)user_data; CvPoint2D32f pt32f(-1., -1.); CvPoint pt(-1,-1); - int cv_event = -1, state = 0; + int cv_event = -1, state = 0, flags = 0; CvImageWidget * image_widget = CV_IMAGE_WIDGET( widget ); if( window->signature != CV_WINDOW_MAGIC_VAL || @@ -1959,17 +1967,39 @@ static gboolean icvOnMouse( GtkWidget *widget, GdkEvent *event, gpointer user_da } else if( event->type == GDK_SCROLL ) { - GdkEventButton* event_button = (GdkEventButton*)event; +#if defined(GTK_VERSION3_4) + // NOTE: in current implementation doesn't possible to put into callback function delta_x and delta_y separetely + double delta = (event->scroll.delta_x + event->scroll.delta_y); + int orient = (event->scroll.delta_y!=0) ? CV_EVENT_MOUSEHWHEEL : CV_EVENT_MOUSEWHEEL; +#else + int orient = CV_EVENT_MOUSEWHEEL; +#endif //GTK_VERSION3_4 cv_event = CV_EVENT_MOUSEWHEEL; - state = event_button->state; + state = event->scroll.state; + + switch(event->scroll.direction) { +#if defined(GTK_VERSION3_4) + case GDK_SCROLL_SMOOTH: flags |= (((int)delta << 16) | orient); + break; +#endif //GTK_VERSION3_4 + case GDK_SCROLL_LEFT: orient = CV_EVENT_MOUSEHWHEEL; + case GDK_SCROLL_UP: flags |= ((-(int)1 << 16) | orient); + break; + case GDK_SCROLL_RIGHT: orient = CV_EVENT_MOUSEHWHEEL; + case GDK_SCROLL_DOWN: flags |= (((int)1 << 16) | orient); + break; + default: ; + }; } - if( cv_event >= 0 ){ + if( cv_event >= 0 ) + { // scale point if image is scaled if( (image_widget->flags & CV_WINDOW_AUTOSIZE)==0 && image_widget->original_image && - image_widget->scaled_image ){ + image_widget->scaled_image ) + { // image origin is not necessarily at (0,0) #if defined (GTK_VERSION3) int x0 = (gtk_widget_get_allocated_width(widget) - image_widget->scaled_image->cols)/2; @@ -1983,32 +2013,15 @@ static gboolean icvOnMouse( GtkWidget *widget, GdkEvent *event, gpointer user_da pt.y = cvFloor( ((pt32f.y-y0)*image_widget->original_image->rows)/ image_widget->scaled_image->rows ); } - else{ + else + { pt = cvPointFrom32f( pt32f ); } // if((unsigned)pt.x < (unsigned)(image_widget->original_image->width) && // (unsigned)pt.y < (unsigned)(image_widget->original_image->height) ) { - int flags = 0; - if (state & GDK_SCROLL_MASK) { - cv_event = CV_EVENT_MOUSEMOVE; - int orient = CV_EVENT_MOUSEWHEEL; - switch(event->scroll.direction) { - case GDK_SCROLL_RIGHT: orient = CV_EVENT_MOUSEHWHEEL; - case GDK_SCROLL_UP: flags |= ((1 << 16) | orient); - break; - case GDK_SCROLL_LEFT: orient = CV_EVENT_MOUSEHWHEEL; - case GDK_SCROLL_DOWN: flags |= ((-1 << 16) | orient); - break; -#if (GTK_MAJOR_VERSION > 3 || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION >= 4)) - case GDK_SCROLL_SMOOTH: // to prevent make warning; TODO - ; -#endif //GTK_MAJOR_VERSION > 3 || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION >= 4) - }; - }; - flags = flags | - BIT_MAP(state, GDK_SHIFT_MASK, CV_EVENT_FLAG_SHIFTKEY) | + flags |= BIT_MAP(state, GDK_SHIFT_MASK, CV_EVENT_FLAG_SHIFTKEY) | BIT_MAP(state, GDK_CONTROL_MASK, CV_EVENT_FLAG_CTRLKEY) | BIT_MAP(state, GDK_MOD1_MASK, CV_EVENT_FLAG_ALTKEY) | BIT_MAP(state, GDK_MOD2_MASK, CV_EVENT_FLAG_ALTKEY) | @@ -2019,8 +2032,8 @@ static gboolean icvOnMouse( GtkWidget *widget, GdkEvent *event, gpointer user_da } } - return FALSE; - } + return FALSE; +} static gboolean icvAlarm( gpointer user_data ) From 4e63bd04e570993ef3d0386a692d9bd6a6920130 Mon Sep 17 00:00:00 2001 From: Alexandr Kondratev Date: Mon, 4 Jul 2016 15:02:05 +0300 Subject: [PATCH 7/8] highgui module: mouse wheel - modification keys fixed, wheel event value is CV_EVENT_MOUSEWHEEL or CV_EVENT_MOUSEHWHEEL --- modules/highgui/src/window_gtk.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/highgui/src/window_gtk.cpp b/modules/highgui/src/window_gtk.cpp index bde5487035..475f85f9f6 100644 --- a/modules/highgui/src/window_gtk.cpp +++ b/modules/highgui/src/window_gtk.cpp @@ -1975,22 +1975,22 @@ static gboolean icvOnMouse( GtkWidget *widget, GdkEvent *event, gpointer user_da int orient = CV_EVENT_MOUSEWHEEL; #endif //GTK_VERSION3_4 - cv_event = CV_EVENT_MOUSEWHEEL; state = event->scroll.state; switch(event->scroll.direction) { #if defined(GTK_VERSION3_4) - case GDK_SCROLL_SMOOTH: flags |= (((int)delta << 16) | orient); + case GDK_SCROLL_SMOOTH: flags |= (((int)delta << 16)); break; #endif //GTK_VERSION3_4 case GDK_SCROLL_LEFT: orient = CV_EVENT_MOUSEHWHEEL; - case GDK_SCROLL_UP: flags |= ((-(int)1 << 16) | orient); + case GDK_SCROLL_UP: flags |= ((-(int)1 << 16)); break; case GDK_SCROLL_RIGHT: orient = CV_EVENT_MOUSEHWHEEL; - case GDK_SCROLL_DOWN: flags |= (((int)1 << 16) | orient); + case GDK_SCROLL_DOWN: flags |= (((int)1 << 16)); break; default: ; }; + cv_event = orient; } if( cv_event >= 0 ) From 179998a8a2099e56ab8303f7e52ebfd11af71b1d Mon Sep 17 00:00:00 2001 From: Alexandr Kondratev Date: Tue, 5 Jul 2016 12:02:16 +0300 Subject: [PATCH 8/8] highgui module: window_QT mouse wheel reuse variable delta instead call evnt->delta() --- modules/highgui/src/window_QT.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/highgui/src/window_QT.cpp b/modules/highgui/src/window_QT.cpp index 30f99d7708..70f3586210 100644 --- a/modules/highgui/src/window_QT.cpp +++ b/modules/highgui/src/window_QT.cpp @@ -2637,7 +2637,7 @@ void DefaultViewPort::wheelEvent(QWheelEvent* evnt) icvmouseHandler(evnt, mouse_wheel, cv_event, flags); icvmouseProcessing(QPoingF(pt), cv_event, flags); - scaleView(evnt->delta() / 240.0, pt); + scaleView(delta / 240.0, pt); viewport()->update(); QWidget::mouseWheel(evnt);