yolobs-studio/UI/slider-ignorewheel.cpp

23 lines
465 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,
2019-09-22 21:19:10 +00:00
QWidget *parent)
2019-07-27 12:47:10 +00:00
: QSlider(parent)
{
setFocusPolicy(Qt::StrongFocus);
setOrientation(orientation);
}
void SliderIgnoreScroll::wheelEvent(QWheelEvent *event)
{
if (!hasFocus())
event->ignore();
else
QSlider::wheelEvent(event);
}