Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to stop QSlider being affected by mousewheel unless selected?
kitfox last edited by kitfox
I've created a control that contains a QSlider in it. This control is in turn embedded in a scroll panel. When the user mouses over the scroll panel and scrolls the mouse wheel, my entire control within the panel scrolls - until the slider moves under the mouse cursor at which point the component suddenly switches from scrolling the component to moving the slider bar.
Is there any way to avoid this? I would like to either disable mouse wheel scrolling entirely for my slider or have it so that the slider will only scroll if it is selected.
Pablo J. Rogina last edited by Pablo J. Rogina
@kitfox you may want to reimplement the wheelEvent(QWheelEvent *e) method in your QSlider
You could use an event filter that you'd disable when your widget has the focus.