File indexing completed on 2024-04-28 05:46:32

0001 /*
0002     SPDX-FileCopyrightText: 2010 Volker Lanz <vl@fidra.de>
0003 
0004     SPDX-License-Identifier: GPL-3.0-or-later
0005 */
0006 
0007 #if !defined(FORMATTEDSPINBOX_H)
0008 
0009 #define FORMATTEDSPINBOX_H
0010 
0011 #include <QDoubleSpinBox>
0012 
0013 class FormattedSpinBox : public QDoubleSpinBox
0014 {
0015 public:
0016     explicit FormattedSpinBox(QWidget* parent = nullptr) : QDoubleSpinBox(parent) {}
0017 
0018 public:
0019     QString textFromValue(double value) const override;
0020     double valueFromText(const QString& text) const override;
0021 
0022 private:
0023     QString stripped(const QString &t, int *pos = nullptr) const;
0024 };
0025 
0026 #endif