mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 22:00:05 +00:00
Expose minimum and maximum values in settings variable
This commit is contained in:
parent
9cc53bf20f
commit
ab91bf9e8d
2 changed files with 27 additions and 2 deletions
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue