From caa7d4fb5b808275b10ea07af7143a61368118ed Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 3 Jun 2020 14:07:55 +0200 Subject: [PATCH] Gui: [skip ci] avoid that scrolling over a spin box steals the focus --- src/Gui/GuiApplication.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Gui/GuiApplication.cpp b/src/Gui/GuiApplication.cpp index 9a49556195..9b435015e3 100644 --- a/src/Gui/GuiApplication.cpp +++ b/src/Gui/GuiApplication.cpp @@ -316,6 +316,15 @@ bool WheelEventFilter::eventFilter(QObject* obj, QEvent* ev) { if (qobject_cast(obj) && ev->type() == QEvent::Wheel) return true; + QAbstractSpinBox* sb = qobject_cast(obj); + if (sb) { + if (ev->type() == QEvent::Show) { + sb->setFocusPolicy(Qt::StrongFocus); + } + else if (ev->type() == QEvent::Wheel) { + return !sb->hasFocus(); + } + } return false; }