yolobs-studio/UI/slider-ignorewheel.cpp

23 lines
456 B
C++
Raw Normal View History

2019-07-27 12:47:10 +00:00
#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);
}