I have a QScrollArea with a set of custom sliders arranged on it. I have noticed that when trying to scroll through the scroll area, one of the sliders often ends up moving instead, which is not desirable.

To make the custom sliders ignore the scroll wheel, I think I need to override QAbstractSlider::wheelEvent and just call ignore in there. This might be a silly question, but is there a way to get this behavior without deriving yet another slider-related class?

有帮助吗?

解决方案

You may install an event filter on each of the sliders. When your filter receives a wheel event, just return true to filter this event out.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top