Krita Source Code Documentation
Loading...
Searching...
No Matches
WGConfig::NumericSetting< T > Struct Template Reference

#include <WGConfig.h>

Public Types

using ST = typename std::conditional_t<std::is_enum<T>::value, std::underlying_type<T>, std::remove_cv<T>>::type
 
typedef T ValueType
 

Public Member Functions

applyLimits (T value) const
 
QSize boundFunc (const QSize &min, const QSize &val, const QSize &max) const
 
boundFunc (const T &min, const T &val, const T &max) const
 
readValue (const KConfigGroup &group) const
 
void writeValue (KConfigGroup &group, const T &value) const
 

Public Attributes

defaultValue
 
bool enforceLimits {false}
 
maxValue
 
minValue
 
QString name
 

Detailed Description

template<class T>
struct WGConfig::NumericSetting< T >

Definition at line 41 of file WGConfig.h.

Member Typedef Documentation

◆ ST

template<class T >
using WGConfig::NumericSetting< T >::ST = typename std::conditional_t<std::is_enum<T>::value, std::underlying_type<T>, std::remove_cv<T>>::type

Definition at line 46 of file WGConfig.h.

◆ ValueType

template<class T >
typedef T WGConfig::NumericSetting< T >::ValueType

Definition at line 43 of file WGConfig.h.

Member Function Documentation

◆ applyLimits()

template<class T >
T WGConfig::NumericSetting< T >::applyLimits ( T value) const
inline

Definition at line 64 of file WGConfig.h.

64 {
65 if (enforceLimits) {
67 }
68 return value;
69 }
float value(const T *src, size_t ch)
T boundFunc(const T &min, const T &val, const T &max) const
Definition WGConfig.h:59

References WGConfig::NumericSetting< T >::boundFunc(), WGConfig::NumericSetting< T >::enforceLimits, WGConfig::NumericSetting< T >::maxValue, WGConfig::NumericSetting< T >::minValue, and value().

◆ boundFunc() [1/2]

QSize WGConfig::NumericSetting< QSize >::boundFunc ( const QSize & min,
const QSize & val,
const QSize & max ) const
inline

Definition at line 78 of file WGConfig.h.

79{
80 return val.expandedTo(min).boundedTo(max);
81}

◆ boundFunc() [2/2]

template<class T >
T WGConfig::NumericSetting< T >::boundFunc ( const T & min,
const T & val,
const T & max ) const
inline

Definition at line 59 of file WGConfig.h.

60 {
61 return qBound(min, val, max);
62 }

◆ readValue()

template<class T >
T WGConfig::NumericSetting< T >::readValue ( const KConfigGroup & group) const
inline

Definition at line 48 of file WGConfig.h.

49 {
50 T value = static_cast<T>(group.readEntry(name, static_cast<ST>(defaultValue)));
51 return applyLimits(value);
52 }
typename std::conditional_t< std::is_enum< T >::value, std::underlying_type< T >, std::remove_cv< T > >::type ST
Definition WGConfig.h:46
T applyLimits(T value) const
Definition WGConfig.h:64

References WGConfig::NumericSetting< T >::applyLimits(), WGConfig::NumericSetting< T >::defaultValue, WGConfig::NumericSetting< T >::name, and value().

◆ writeValue()

template<class T >
void WGConfig::NumericSetting< T >::writeValue ( KConfigGroup & group,
const T & value ) const
inline

Definition at line 54 of file WGConfig.h.

55 {
56 group.writeEntry(name, static_cast<ST>(value));
57 }

References WGConfig::NumericSetting< T >::name, and value().

Member Data Documentation

◆ defaultValue

template<class T >
T WGConfig::NumericSetting< T >::defaultValue

Definition at line 71 of file WGConfig.h.

◆ enforceLimits

template<class T >
bool WGConfig::NumericSetting< T >::enforceLimits {false}

Definition at line 74 of file WGConfig.h.

74{false};

◆ maxValue

template<class T >
T WGConfig::NumericSetting< T >::maxValue

Definition at line 73 of file WGConfig.h.

◆ minValue

template<class T >
T WGConfig::NumericSetting< T >::minValue

Definition at line 72 of file WGConfig.h.

◆ name

template<class T >
QString WGConfig::NumericSetting< T >::name

Definition at line 70 of file WGConfig.h.


The documentation for this struct was generated from the following file: