Gui: [skip ci] avoid that scrolling over a spin box steals the focus

This commit is contained in:
wmayer
2020-06-03 14:07:55 +02:00
parent ebb8987455
commit caa7d4fb5b

View File

@@ -316,6 +316,15 @@ bool WheelEventFilter::eventFilter(QObject* obj, QEvent* ev)
{
if (qobject_cast<QComboBox*>(obj) && ev->type() == QEvent::Wheel)
return true;
QAbstractSpinBox* sb = qobject_cast<QAbstractSpinBox*>(obj);
if (sb) {
if (ev->type() == QEvent::Show) {
sb->setFocusPolicy(Qt::StrongFocus);
}
else if (ev->type() == QEvent::Wheel) {
return !sb->hasFocus();
}
}
return false;
}