Salome HOME
Merge branch 'master' of newgeom:newgeom.git
[modules/shaper.git] / src / ModuleBase / ModuleBase_DoubleSpinBox.h
1 // File:      ModuleBase_DoubleSpinBox.h
2 // Author:    Sergey TELKOV
3 //
4 #ifndef MODULEBASE_DOUBLESPINBOX_H_
5 #define MODULEBASE_DOUBLESPINBOX_H_
6
7 #include "ModuleBase.h"
8
9 #include <QDoubleSpinBox>
10 #include <QValidator>
11
12 class MODULEBASE_EXPORT ModuleBase_DoubleSpinBox : public QDoubleSpinBox
13 {
14 Q_OBJECT
15
16  public:
17   ModuleBase_DoubleSpinBox(QWidget* = 0, int thePrecision = 6);
18   virtual ~ModuleBase_DoubleSpinBox();
19
20   bool isCleared() const;
21   virtual void setCleared(const bool);
22
23   int getPrecision() const;
24   void setPrecision(const int);
25
26   virtual void stepBy(int);
27
28   virtual double valueFromText(const QString&) const;
29   virtual QString textFromValue(double) const;
30
31   virtual QValidator::State validate(QString&, int&) const;
32
33  protected slots:
34   virtual void onTextChanged(const QString&);
35
36  protected:
37   QString removeTrailingZeroes(const QString&) const;
38
39  private:
40   bool myCleared;
41   int myPrecision;
42 };
43
44 #endif