Commit bc52d0df authored by Frédéric Larue's avatar Frédéric Larue
Browse files

Keyboard input of GradientWidget stop values now restrained to the range [0,1].

parent 33383a9c
......@@ -387,11 +387,19 @@ void GradientWidget::keyPressEvent( QKeyEvent *evt )
QString tmp = m_KeyboardInputValue + (char) evt->key();
if( tmp == "." )
tmp = "0.";
tmp.toFloat( &ok );
float value = tmp.toFloat( &ok );
if( ok )
{
m_KeyboardInputValue = tmp;
update();
if( value >= 2.0f )
{
m_KeyboardInputValue = "0." + tmp;
update();
}
else if( value <= 1.0f )
{
m_KeyboardInputValue = tmp;
update();
}
}
break;
}
......@@ -434,7 +442,6 @@ void GradientWidget::keyPressEvent( QKeyEvent *evt )
}
default: QWidget::keyPressEvent( evt );
}
}
......
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