2015-07-29 04:41:23 +00:00
|
|
|
#include "WIntegralSpinBox.h"
|
2015-07-30 03:53:24 +00:00
|
|
|
#include <QLineEdit>
|
2015-07-29 04:41:23 +00:00
|
|
|
#include <QWheelEvent>
|
|
|
|
|
|
|
|
WIntegralSpinBox::WIntegralSpinBox(QWidget *pParent) : QSpinBox(pParent)
|
|
|
|
{
|
2015-07-30 03:53:24 +00:00
|
|
|
lineEdit()->installEventFilter(this);
|
2015-07-29 04:41:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
WIntegralSpinBox::~WIntegralSpinBox()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void WIntegralSpinBox::wheelEvent(QWheelEvent *pEvent)
|
|
|
|
{
|
|
|
|
if (!hasFocus()) pEvent->ignore();
|
|
|
|
else QSpinBox::wheelEvent(pEvent);
|
|
|
|
}
|
2015-07-30 03:53:24 +00:00
|
|
|
|
2015-11-24 10:22:37 +00:00
|
|
|
bool WIntegralSpinBox::eventFilter(QObject* /*pObj*/, QEvent *pEvent)
|
2015-07-30 03:53:24 +00:00
|
|
|
{
|
|
|
|
if (pEvent->type() == QEvent::MouseButtonPress)
|
|
|
|
setFocus();
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|