Expose minimum and maximum values in settings variable

This commit is contained in:
Dan Paulat 2022-12-20 14:33:55 -06:00
parent 9cc53bf20f
commit ab91bf9e8d
2 changed files with 27 additions and 2 deletions

View file

@ -3,8 +3,6 @@
#include <scwx/qt/settings/settings_variable.hpp>
#include <scwx/util/logger.hpp>
#include <optional>
#include <boost/json.hpp>
#include <fmt/ostream.h>
#include <QAbstractButton>
@ -199,12 +197,24 @@ void SettingsVariable<T>::SetMinimum(const T& value)
p->minimum_ = value;
}
template<class T>
std::optional<T> SettingsVariable<T>::GetMinimum() const
{
return p->minimum_;
}
template<class T>
void SettingsVariable<T>::SetMaximum(const T& value)
{
p->maximum_ = value;
}
template<class T>
std::optional<T> SettingsVariable<T>::GetMaximum() const
{
return p->maximum_;
}
template<class T>
void SettingsVariable<T>::SetValidator(std::function<bool(const T&)> validator)
{

View file

@ -3,6 +3,7 @@
#include <scwx/qt/settings/settings_variable_base.hpp>
#include <functional>
#include <optional>
class QAbstractButton;
class QWidget;
@ -104,6 +105,20 @@ public:
*/
void SetDefault(const T& value);
/**
* Gets the minimum value of the settings variable, if defined.
*
* @return Optional minimum value
*/
std::optional<T> GetMinimum() const;
/**
* Gets the maximum value of the settings variable, if defined.
*
* @return Optional maximum value
*/
std::optional<T> GetMaximum() const;
/**
* Sets the minimum value of the settings variable.
*