LP-311 Remove basic/advanced stabilization tab auto-switch (autotune/txpid lock issues)
[librepilot.git] / ground / gcs / src / libs / qscispinbox / QScienceSpinBox.h
blobdb89d95adeac326a483464a756ab16f79988a181
1 /**
2 * Code copied from http://www.matthiaspospiech.de/blog/2009/01/03/qt-spinbox-widget-with-scientific-notation/
3 */
4 #ifndef __QScienceSpinBox_H__
5 #define __QScienceSpinBox_H__
7 #include <QDoubleSpinBox>
8 #include <QDoubleValidator>
9 #include <QLineEdit>
10 #include <QtCore/QVariant>
11 #include <QtCore/QDebug>
12 #include <QtCore/QString>
15 class QScienceSpinBox : public QDoubleSpinBox {
16 Q_OBJECT
17 public:
18 QScienceSpinBox(QWidget *parent = 0);
20 int decimals() const;
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);
27 private:
28 int dispDecimals;
29 QChar delimiter, thousand;
30 QDoubleValidator *v;
33 private:
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);
43 public slots:
44 void stepDown();
45 void stepUp();
48 #endif // ifndef __QScienceSpinBox_H__