1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModuleBase_DoubleSpinBox.h
4 // Author: Sergey TELKOV
6 #ifndef MODULEBASE_DOUBLESPINBOX_H_
7 #define MODULEBASE_DOUBLESPINBOX_H_
9 #include "ModuleBase.h"
11 #include <QDoubleSpinBox>
16 * An extension and customozation of QDoubleSpinBox class
18 class MODULEBASE_EXPORT ModuleBase_DoubleSpinBox : public QDoubleSpinBox
23 ModuleBase_DoubleSpinBox(QWidget* theParent = 0, int thePrecision = 6);
24 virtual ~ModuleBase_DoubleSpinBox();
26 /// Returns true if the control is clear
27 bool isCleared() const;
30 virtual void setCleared(const bool);
32 /// Returns current precision
33 int getPrecision() const;
36 void setPrecision(const int);
39 virtual void stepBy(int);
41 /// Converts value from string to double
42 virtual double valueFromText(const QString&) const;
44 /// Convert value from double to string
45 virtual QString textFromValue(double) const;
47 /// Validate current value
48 virtual QValidator::State validate(QString&, int&) const;
51 /// Called on text changed
52 virtual void onTextChanged(const QString&);
55 /// Removes extra trailing zero symbols
56 QString removeTrailingZeroes(const QString&) const;