2015-12-10 09:58:38 +00:00
|
|
|
#ifndef CSM_PREFS_DOUBLESETTING_H
|
|
|
|
#define CSM_PREFS_DOUBLESETTING_H
|
|
|
|
|
|
|
|
#include "setting.hpp"
|
|
|
|
|
2017-05-09 07:50:16 +00:00
|
|
|
class QDoubleSpinBox;
|
|
|
|
|
2015-12-10 09:58:38 +00:00
|
|
|
namespace CSMPrefs
|
|
|
|
{
|
2022-10-19 17:02:00 +00:00
|
|
|
class Category;
|
|
|
|
|
2023-11-11 23:52:09 +00:00
|
|
|
class DoubleSetting final : public TypedSetting<double>
|
2015-12-10 09:58:38 +00:00
|
|
|
{
|
2022-09-22 18:26:05 +00:00
|
|
|
Q_OBJECT
|
2015-12-10 09:58:38 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
int mPrecision;
|
|
|
|
double mMin;
|
|
|
|
double mMax;
|
|
|
|
std::string mTooltip;
|
|
|
|
QDoubleSpinBox* mWidget;
|
2015-12-10 09:58:38 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
public:
|
2023-11-11 23:52:09 +00:00
|
|
|
explicit DoubleSetting(
|
2023-11-15 22:45:56 +00:00
|
|
|
Category* parent, QMutex* mutex, std::string_view key, const QString& label, Settings::Index& index);
|
2015-12-10 09:58:38 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
DoubleSetting& setPrecision(int precision);
|
2015-12-10 09:58:38 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
// defaults to [0, std::numeric_limits<double>::max()]
|
|
|
|
DoubleSetting& setRange(double min, double max);
|
2016-03-26 18:35:03 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
DoubleSetting& setMin(double min);
|
2015-12-10 09:58:38 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
DoubleSetting& setMax(double max);
|
2015-12-10 09:58:38 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
DoubleSetting& setTooltip(const std::string& tooltip);
|
2015-12-10 09:58:38 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
/// Return label, input widget.
|
2023-11-10 12:28:10 +00:00
|
|
|
SettingWidgets makeWidgets(QWidget* parent) override;
|
2015-12-10 09:58:38 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
void updateWidget() override;
|
2015-12-10 09:58:38 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
private slots:
|
2017-05-09 07:50:16 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
void valueChanged(double value);
|
2015-12-10 09:58:38 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|