2 * Code copied from http://www.matthiaspospiech.de/blog/2009/01/03/qt-spinbox-widget-with-scientific-notation/
4 #ifndef __QScienceSpinBox_H__
5 #define __QScienceSpinBox_H__
7 #include <QDoubleSpinBox>
8 #include <QDoubleValidator>
10 #include <QtCore/QVariant>
11 #include <QtCore/QDebug>
12 #include <QtCore/QString>
15 class QScienceSpinBox
: public QDoubleSpinBox
{
18 QScienceSpinBox(QWidget
*parent
= 0);
21 void setDecimals(int value
);
23 QString
textFromValue(double value
) const;
24 double valueFromText(const QString
& text
) const;
25 static bool isIntermediateValueHelper(qint64 num
, qint64 minimum
, qint64 maximum
, qint64
*match
= 0);
29 QChar delimiter
, thousand
;
34 void initLocalValues(QWidget
*parent
);
35 bool isIntermediateValue(const QString
&str
) const;
36 QVariant
validateAndInterpret(QString
&input
, int &pos
, QValidator::State
&state
) const;
37 QValidator::State
validate(QString
&text
, int &pos
) const;
38 void fixup(QString
&input
) const;
39 QString
stripped(const QString
&t
, int *pos
) const;
40 double round(double value
) const;
41 void stepBy(int steps
);
48 #endif // ifndef __QScienceSpinBox_H__