#include "QDS_SpinBox.h"
-#include <qspinbox.h>
+#include <QtxIntSpinBox.h>
+
#include <qvalidator.h>
/*!
QString QDS_SpinBox::getString() const
{
QString res;
- QSpinBox* aSpinBox = spinBox();
- if ( aSpinBox )
+ QtxIntSpinBox* aSpinBox = spinBox();
+ if ( aSpinBox && !aSpinBox->isCleared() )
{
res = aSpinBox->text();
if ( !aSpinBox->suffix().isEmpty() )
*/
void QDS_SpinBox::setString( const QString& txt )
{
- if ( spinBox() )
+ if ( !spinBox() )
+ return;
+
+ spinBox()->setCleared( txt.isEmpty() );
+ if ( !txt.isEmpty() )
spinBox()->setValue( txt.toInt() );
}
/*!
Returns pointer to QSpinBox widget.
*/
-QSpinBox* QDS_SpinBox::spinBox() const
+QtxIntSpinBox* QDS_SpinBox::spinBox() const
{
- return ::qt_cast<QSpinBox*>( controlWidget() );
+ return ::qt_cast<QtxIntSpinBox*>( controlWidget() );
}
/*!
*/
QWidget* QDS_SpinBox::createControl( QWidget* parent )
{
- QSpinBox* aSpinBox = new QSpinBox( parent );
+ QtxIntSpinBox* aSpinBox = new QtxIntSpinBox( parent );
aSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
connect( aSpinBox, SIGNAL( valueChanged( int ) ), this, SLOT( onValueChanged( int ) ) );
return aSpinBox;
#include "QDS_Datum.h"
-class QSpinBox;
+class QtxIntSpinBox;
class QDS_EXPORT QDS_SpinBox : public QDS_Datum
{
void onValueChanged( int );
protected:
- QSpinBox* spinBox() const;
+ QtxIntSpinBox* spinBox() const;
virtual QWidget* createControl( QWidget* );
{
QString res;
QtxDblSpinBox* sb = spinBox();
- if ( sb )
+ if ( sb && !sb->isCleared() )
{
bool hasFocus = sb->hasFocus();
if ( hasFocus )
*/
void QDS_SpinBoxDbl::setString( const QString& txt )
{
- if ( spinBox() )
+ if ( !spinBox() )
+ return;
+
+ spinBox()->setCleared( txt.isEmpty() );
+ if ( !txt.isEmpty() )
spinBox()->setValue( txt.toDouble() );
}
/*!
- Returns pointer to XMLGUI_SpinBoxDbl widget.
+ Returns pointer to QtxDblSpinBox widget.
*/
QtxDblSpinBox* QDS_SpinBoxDbl::spinBox() const
{