From e65aed8ba9337501d13cd9572521ea982a341419 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Tue, 2 Aug 2022 03:36:49 +0200 Subject: [PATCH] Correctly send wheel events to widgets that handle them when the associated control is a proxy. [GB.QT4] * BUG: Correctly send wheel events to widgets that handle them when the associated control is a proxy. [GB.QT5] * BUG: Correctly send wheel events to widgets that handle them when the associated control is a proxy. --- gb.qt4/src/CWidget.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gb.qt4/src/CWidget.cpp b/gb.qt4/src/CWidget.cpp index 0863288eb..1a9ffb223 100644 --- a/gb.qt4/src/CWidget.cpp +++ b/gb.qt4/src/CWidget.cpp @@ -417,7 +417,7 @@ void CWIDGET_set_allow_focus(void *_object, bool f) { if (f) { - WIDGET->setFocusPolicy(GB.CanRaise(THIS, EVENT_MouseWheel) ? Qt::WheelFocus : Qt::StrongFocus); + WIDGET->setFocusPolicy(THIS->flag.wheel | GB.CanRaise(THIS, EVENT_MouseWheel) ? Qt::WheelFocus : Qt::StrongFocus); WIDGET->setAttribute(Qt::WA_InputMethodEnabled, true); } else @@ -3066,6 +3066,7 @@ bool CWidget::eventFilter(QObject *widget, QEvent *event) __MOUSE_WHEEL: { QWheelEvent *ev = (QWheelEvent *)event; + bool eat_wheel; //qDebug("Event on %p %s%s%s", widget, // real ? "REAL " : "", design ? "DESIGN " : "", child ? "CHILD " : ""); @@ -3073,8 +3074,12 @@ bool CWidget::eventFilter(QObject *widget, QEvent *event) if (!original) goto _DESIGN; + eat_wheel = control->flag.wheel; + __MOUSE_WHEEL_TRY_PROXY: + //fprintf(stderr, "wheel on %p %s\n", control, control->name); + if (design || QWIDGET(control)->isEnabled()) { if (GB.CanRaise(control, EVENT_MouseWheel)) @@ -3132,7 +3137,7 @@ bool CWidget::eventFilter(QObject *widget, QEvent *event) return true; } } - + if (EXT(control) && EXT(control)->proxy_for) { control = (CWIDGET *)(EXT(control)->proxy_for); @@ -3140,7 +3145,7 @@ bool CWidget::eventFilter(QObject *widget, QEvent *event) } } - if (!control->flag.wheel) + if (!eat_wheel) { control = (CWIDGET *)CWIDGET_get_parent(control); if (control)