Added setFromDouble

This commit is contained in:
Christoph Holzheuer
2026-01-13 16:29:02 +01:00
parent beae1c1b3d
commit 95dd9d18e6
4 changed files with 40 additions and 11 deletions

View File

@@ -63,19 +63,47 @@ bool BCValue::isReadOnly() const
return _valueFlags.testFlag(BCValue::Flag::ReadOnly);
}
bool BCValue::testFlag( BCValue::Flag flag ) const
{
return _valueFlags.testFlag( flag );
}
void BCValue::setFlag( BCValue::Flag flag, bool state) const
{
_valueFlags.setFlag( flag, state );
}
void BCValue::setFromDouble( double value )
{
if( _optMin.has_value() && _optMax.has_value() )
//if( _isReadOnly)
switch(_valueType)
{
double min = _optMin.value();
double max = _optMax.value();
// wir betrachten plain
value = qBound( min,value,max);
case ValueType::Bool :
_rawValue = value >0 ? 1 : 0;
break;
case ValueType::Plain :
case ValueType::Number:
case ValueType::Float:
if( _optMin.has_value() && _optMax.has_value() )
{
double min = _optMin.value();
double max = _optMax.value();
value = qBound( min,value,max);
}
_rawValue = value / _factor;
default :
break;
}
_rawValue = value / _factor;
}