porymap/ui/noscrollspinbox.cpp
2018-09-24 18:49:44 -05:00

16 lines
378 B
C++

#include "noscrollspinbox.h"
NoScrollSpinBox::NoScrollSpinBox(QWidget *parent)
: QSpinBox(parent)
{
// Don't let scrolling hijack focus.
setFocusPolicy(Qt::StrongFocus);
}
void NoScrollSpinBox::wheelEvent(QWheelEvent *event)
{
// Only allow scrolling to modify contents when it explicitly has focus.
if (hasFocus())
QSpinBox::wheelEvent(event);
}