36 lines
795 B
C++
36 lines
795 B
C++
// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#ifndef NUMBERTEXTEDIT_H
|
|
#define NUMBERTEXTEDIT_H
|
|
|
|
#include <QLineEdit>
|
|
#include <QDoubleSpinBox>
|
|
|
|
class NumberLineEdit : public QDoubleSpinBox {
|
|
Q_OBJECT
|
|
QString toString(float value) const;
|
|
|
|
int decimalCount;
|
|
float savedValue;
|
|
public:
|
|
NumberLineEdit(float minVal,
|
|
float maxVal,
|
|
float def_value = 0.0,
|
|
int decimals = 2,
|
|
const QString &units = "",
|
|
QWidget* parent = nullptr);
|
|
|
|
signals:
|
|
void newValue(float value);
|
|
|
|
public slots:
|
|
void updateValue(float val);
|
|
|
|
private slots:
|
|
void onEditingFinished();
|
|
|
|
};
|
|
|
|
#endif // NUMBERLINEEDIT_H
|