obs-studio/UI/slider-ignorewheel.cpp
akapar dbd30a8131 UI: Do not allow mouse wheel for volume slider
This commit fixes the issue of being able to scroll through the mixer
with the mouse wheel without modifying the volume slider.  This
functionality can be temporarily restored by holding a click on the
volume meter.
2019-04-19 06:56:55 -07:00

28 lines
529 B
C++

#include "slider-ignorewheel.hpp"
SliderIgnoreScroll::SliderIgnoreScroll(QWidget *parent) : QSlider(parent)
{
setFocusPolicy(Qt::StrongFocus);
}
SliderIgnoreScroll::SliderIgnoreScroll(Qt::Orientation orientation,
QWidget *parent)
: QSlider(parent)
{
setFocusPolicy(Qt::StrongFocus);
setOrientation(orientation);
}
void SliderIgnoreScroll::wheelEvent(QWheelEvent * event)
{
if (!hasFocus())
event->ignore();
else
QSlider::wheelEvent(event);
}
void SliderIgnoreScroll::leaveEvent(QEvent * event)
{
clearFocus();
}