obs-studio/UI/comboBox-ignorewheel.cpp

19 lines
368 B
C++
Raw Normal View History

#include "comboBox-ignorewheel.hpp"
ComboBoxIgnoreScroll::ComboBoxIgnoreScroll(QWidget *parent) : QComboBox(parent)
{
setFocusPolicy(Qt::StrongFocus);
}
void ComboBoxIgnoreScroll::wheelEvent(QWheelEvent * event)
{
if (!hasFocus())
event->ignore();
else
QComboBox::wheelEvent(event);
}
void ComboBoxIgnoreScroll::leaveEvent(QEvent * event)
{
clearFocus();
}