#include <QMouseWheelAdjustementGuard.h>
Filter qt events to allows wheel event to only be accepted when the widget has focus. More...
Filter qt events to allows wheel event to only be accepted when the widget has focus.
To use it you need to do: myWidget->setFocusPolicy(Qt::StrongFocus); myWidget->installEventFilter(new MouseWheelWidgetAdjustmentGuard(ui.comboBox));
This code is grabbed from: https://stackoverflow.com/questions/5821802/qspinbox-inside-a-qscrollarea-how-to-prevent-spin-box-from-stealing-focus-when
Public Member Functions | |
QMouseWheelAdjustmentGuard (QObject *parent) | |
Protected Member Functions | |
bool | eventFilter (QObject *o, QEvent *e) override |
|
explicit |