Commit 646b43c4 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

SettingValue: Handle flags in the SettingValue::set

This is to ensure the value won't be incoherent, as it was only checked
in the GUI
parent 935c4bba
......@@ -35,10 +35,20 @@ SettingValue::SettingValue( SettingValue::Type type, const QVariant& defaultValu
}
void
SettingValue::set( const QVariant& val )
SettingValue::set( const QVariant& _val )
{
QVariant val = _val;
if ( val != m_val )
{
if ( ( m_flags & Clamped ) != 0 )
{
if ( m_min.isValid() && val.toDouble() < m_min.toDouble() )
val = m_min;
if ( m_max.isValid() && val.toDouble() > m_max.toDouble() )
val = m_max;
}
if ( ( m_flags & EightMultiple ) != 0 )
val = ( val.toInt() + 7 ) & ~7;
m_val = val;
emit changed( m_val );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment