1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-31 20:15:34 +00:00
openmw/apps/opencs/model/prefs/intsetting.hpp

49 lines
981 B
C++
Raw Normal View History

2015-12-08 16:21:58 +00:00
#ifndef CSM_PREFS_INTSETTING_H
#define CSM_PREFS_INTSETTING_H
#include "setting.hpp"
class QSpinBox;
2022-10-19 17:02:00 +00:00
class QMutex;
class QObject;
class QWidget;
2015-12-08 16:21:58 +00:00
namespace CSMPrefs
{
2022-10-19 17:02:00 +00:00
class Category;
2023-11-11 23:52:09 +00:00
class IntSetting final : public TypedSetting<int>
2015-12-08 16:21:58 +00:00
{
2022-09-22 18:26:05 +00:00
Q_OBJECT
2015-12-08 16:21:58 +00:00
2022-09-22 18:26:05 +00:00
int mMin;
int mMax;
std::string mTooltip;
QSpinBox* mWidget;
2015-12-08 16:21:58 +00:00
2022-09-22 18:26:05 +00:00
public:
2023-11-11 23:52:09 +00:00
explicit IntSetting(
Category* parent, QMutex* mutex, std::string_view key, const QString& label, Settings::Index& index);
2015-12-08 16:21:58 +00:00
2022-09-22 18:26:05 +00:00
// defaults to [0, std::numeric_limits<int>::max()]
IntSetting& setRange(int min, int max);
2015-12-08 16:21:58 +00:00
2022-09-22 18:26:05 +00:00
IntSetting& setMin(int min);
2015-12-08 16:21:58 +00:00
2022-09-22 18:26:05 +00:00
IntSetting& setMax(int max);
2015-12-08 16:21:58 +00:00
2022-09-22 18:26:05 +00:00
IntSetting& setTooltip(const std::string& tooltip);
2015-12-08 16:21:58 +00:00
2022-09-22 18:26:05 +00:00
/// Return label, input widget.
SettingWidgets makeWidgets(QWidget* parent) override;
2015-12-08 16:21:58 +00:00
2022-09-22 18:26:05 +00:00
void updateWidget() override;
2015-12-08 16:21:58 +00:00
2022-09-22 18:26:05 +00:00
private slots:
2022-09-22 18:26:05 +00:00
void valueChanged(int value);
2015-12-08 16:21:58 +00:00
};
}
#endif