mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 02:39:28 +00:00
C++: explicitly cast to float when generating gradiant stop
To avoid the error `error: narrowing conversion of`
This commit is contained in:
parent
764b902957
commit
a7f0fdcd93
2 changed files with 18 additions and 2 deletions
|
@ -3343,7 +3343,7 @@ fn compile_expression(expr: &llr::Expression, ctx: &EvaluationContext) -> String
|
|||
let mut stops_it = stops.iter().map(|(color, stop)| {
|
||||
let color = compile_expression(color, ctx);
|
||||
let position = compile_expression(stop, ctx);
|
||||
format!("slint::private_api::GradientStop{{ {}, {}, }}", color, position)
|
||||
format!("slint::private_api::GradientStop{{ {}, float({}), }}", color, position)
|
||||
});
|
||||
format!(
|
||||
"[&] {{ const slint::private_api::GradientStop stops[] = {{ {} }}; return slint::Brush(slint::private_api::LinearGradientBrush({}, stops, {})); }}()",
|
||||
|
@ -3354,7 +3354,7 @@ fn compile_expression(expr: &llr::Expression, ctx: &EvaluationContext) -> String
|
|||
let mut stops_it = stops.iter().map(|(color, stop)| {
|
||||
let color = compile_expression(color, ctx);
|
||||
let position = compile_expression(stop, ctx);
|
||||
format!("slint::private_api::GradientStop{{ {}, {}, }}", color, position)
|
||||
format!("slint::private_api::GradientStop{{ {}, float({}), }}", color, position)
|
||||
});
|
||||
format!(
|
||||
"[&] {{ const slint::private_api::GradientStop stops[] = {{ {} }}; return slint::Brush(slint::private_api::RadialGradientBrush(stops, {})); }}()",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue