This commit is contained in:
Chenwenxuan
2024-03-06 14:54:30 +08:00
commit edac2715f0
1525 changed files with 809982 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
#include "dmdoublespinbox.h"
#include "eventfilterwheel.h"
#include <QDebug>
#include <QEvent>
DMDoubleSpinBox::DMDoubleSpinBox(QWidget *parent) :
QDoubleSpinBox(parent)
{
installEventFilter(new EventFilterWheel());
// 只有在鼠标点击或按下tab键时获取焦点
setFocusPolicy(Qt::StrongFocus);
setKeyboardTracking(false);
installEventFilter(this);
}
#ifdef QT_DEBUG
bool DMDoubleSpinBox::eventFilter(QObject *watched, QEvent *event)
{
// Q_UNUSED(watched)
// QDoubleSpinBox *castSBox = static_cast<QDoubleSpinBox*>(watched);
if(event->type()==QEvent::Timer)
{
QTimerEvent *tEvent = static_cast<QTimerEvent*>(event);
if(tEvent)
qDebug() << "<--QEvent::Timer-->" << tEvent->timerId();
return true;
}
return QObject::eventFilter(watched,event);
}
#endif