1 // File: QtxIntSpinBox.cxx
2 // Author: Sergey TELKOV
4 #include "QtxIntSpinBox.h"
7 #include <qapplication.h>
9 QtxIntSpinBox::QtxIntSpinBox( QWidget* parent, const char* name )
10 : QSpinBox( parent, name ),
15 QtxIntSpinBox::QtxIntSpinBox( int min, int max, int step, QWidget* parent, const char* name )
16 : QSpinBox( min, max, step, parent, name ),
21 QtxIntSpinBox::~QtxIntSpinBox()
25 bool QtxIntSpinBox::isCleared() const
30 void QtxIntSpinBox::setCleared( const bool on )
32 if ( myCleared == on )
39 void QtxIntSpinBox::setValue( int value )
42 QSpinBox::setValue( value );
45 bool QtxIntSpinBox::eventFilter( QObject* o, QEvent* e )
47 if ( !myCleared || o != editor() || !editor()->text().stripWhiteSpace().isEmpty() )
48 return QSpinBox::eventFilter( o, e );
50 if ( e->type() == QEvent::FocusOut || e->type() == QEvent::Leave || e->type() == QEvent::Hide )
53 if ( e->type() == QEvent::KeyPress &&
54 ( ((QKeyEvent*)e)->key() == Key_Tab || ((QKeyEvent*)e)->key() == Key_BackTab ) )
56 QApplication::sendEvent( this, e );
60 return QSpinBox::eventFilter( o, e );
63 void QtxIntSpinBox::interpretText()
66 QSpinBox::interpretText();
69 void QtxIntSpinBox::updateDisplay()
71 QSpinBox::updateDisplay();
76 void QtxIntSpinBox::leaveEvent( QEvent* e )
79 QSpinBox::leaveEvent( e );
82 void QtxIntSpinBox::wheelEvent( QWheelEvent* e )
87 QSpinBox::wheelEvent( e );