1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModuleBase_DoubleSpinBox.h
4 // Author: Sergey BELASH
6 #ifndef MODULEBASE_DOUBLESPINBOX_H_
7 #define MODULEBASE_DOUBLESPINBOX_H_
9 #include "ModuleBase.h"
11 #include <QDoubleSpinBox>
17 * An extension and customization of QDoubleSpinBox class
19 class MODULEBASE_EXPORT ModuleBase_DoubleSpinBox : public QDoubleSpinBox
24 explicit ModuleBase_DoubleSpinBox( QWidget* theParent = 0, int thePrecision = -12 );
25 virtual ~ModuleBase_DoubleSpinBox();
27 /// Returns true if the control is clear
28 bool isCleared() const;
31 virtual void setCleared(const bool);
33 /// Returns current precision
34 int getPrecision() const;
37 void setPrecision(const int);
40 virtual void stepBy(int);
42 /// Converts value from string to double
43 virtual double valueFromText(const QString&) const;
45 /// Convert value from double to string
46 virtual QString textFromValue(double) const;
48 /// Validate current value
49 virtual QValidator::State validate(QString&, int&) const;
52 /// Called on text changed
53 virtual void onTextChanged(const QString&);
56 /// Removes extra trailing zero symbols
57 QString removeTrailingZeroes(const QString&) const;