setValidator( new Validator( this, "double_spinbox_validator" ) );
rangeChange();
updateDisplay();
+
+ connect( editor(), SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChanged( const QString& ) ) );
}
QtxDblSpinBox::QtxDblSpinBox( double min, double max, double step, QWidget* parent, const char* name )
setValidator( new Validator( this, "double_spinbox_validator" ) );
rangeChange();
updateDisplay();
+
+ connect( editor(), SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChanged( const QString& ) ) );
}
QtxDblSpinBox::~QtxDblSpinBox()
double QtxDblSpinBox::value() const
{
+ QSpinBox::value();
+
return myValue;
}
{
if ( myBlocked )
return;
-
+
+ bool upd = editor()->isUpdatesEnabled();
+ editor()->setUpdatesEnabled( false );
+
bool isBlock = myBlocked;
myBlocked = true;
QSpinBox::setValue( QSpinBox::minValue() );
else
QSpinBox::setValue( ( QSpinBox::minValue() + QSpinBox::maxValue() ) / 2 );
-
+
QSpinBox::updateDisplay();
-
+
+ editor()->setUpdatesEnabled( upd );
+
editor()->setText( myCleared ? QString::null : txt );
-
+ if ( !myCleared )
+ {
+ if ( editor()->text() == specialValueText() )
+ editor()->selectAll();
+ else
+ editor()->setSelection( prefix().length(), editor()->text().length() - prefix().length() - suffix().length() );
+ }
+
myBlocked = isBlock;
}
void QtxDblSpinBox::valueChange()
{
updateDisplay();
- emit valueChanged( value() );
+ emit valueChanged( myValue );
emit valueChanged( currentValueText() );
}
QSpinBox::wheelEvent( e );
updateDisplay();
}
+
+void QtxDblSpinBox::onTextChanged( const QString& str )
+{
+ if ( !myBlocked )
+ myCleared = false;
+}