2020-09-16 00:35:12 +01:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2010 Volker Lanz <vl@fidra.de>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*/
|
2010-04-27 12:41:35 +01:00
|
|
|
|
2017-09-11 16:27:51 +01:00
|
|
|
#if !defined(FORMATTEDSPINBOX_H)
|
2010-04-27 12:41:35 +01:00
|
|
|
|
2017-09-11 16:27:51 +01:00
|
|
|
#define FORMATTEDSPINBOX_H
|
2010-04-27 12:41:35 +01:00
|
|
|
|
|
|
|
#include <QDoubleSpinBox>
|
|
|
|
|
|
|
|
class FormattedSpinBox : public QDoubleSpinBox
|
|
|
|
{
|
2015-07-13 15:17:41 +01:00
|
|
|
public:
|
2019-12-09 16:33:04 +00:00
|
|
|
explicit FormattedSpinBox(QWidget* parent = nullptr) : QDoubleSpinBox(parent) {}
|
2010-04-27 12:41:35 +01:00
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
public:
|
2016-05-17 18:03:28 +01:00
|
|
|
QString textFromValue(double value) const override;
|
|
|
|
double valueFromText(const QString& text) const override;
|
2010-05-23 15:05:57 +01:00
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
private:
|
2022-01-18 20:30:48 +00:00
|
|
|
QString stripped(const QString &t, int *pos = nullptr) const;
|
2010-04-27 12:41:35 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|