mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 02:39:28 +00:00
WIP: formatting implementation of translate in rust and C++
This commit is contained in:
parent
a3855f1bcb
commit
cf746ddf8d
8 changed files with 80 additions and 4 deletions
|
@ -16,7 +16,7 @@ use std::rc::{Rc, Weak};
|
|||
pub use crate::namedreference::NamedReference;
|
||||
pub use crate::passes::resolving;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
/// A function built into the run-time
|
||||
pub enum BuiltinFunction {
|
||||
GetWindowScaleFactor,
|
||||
|
|
|
@ -2834,7 +2834,7 @@ fn compile_builtin_function_call(
|
|||
}
|
||||
}
|
||||
BuiltinFunction::Translate => {
|
||||
format!("slint::private_api::translate({});", a.join(","))
|
||||
format!("slint::private_api::translate({})", a.join(","))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2442,7 +2442,7 @@ fn compile_builtin_function_call(
|
|||
quote!(slint::private_unstable_api::re_exports::WindowInner::from_pub(#window_adapter_tokens.window()).set_text_input_focused(#(#a)*))
|
||||
}
|
||||
BuiltinFunction::Translate => {
|
||||
todo!("BuiltinFunction::Translate in rust")
|
||||
quote!(slint::private_unstable_api::translate(#(#a),*))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,7 +117,13 @@ pub fn lower_expression(
|
|||
lower_show_popup(arguments, ctx)
|
||||
}
|
||||
tree_Expression::BuiltinFunctionReference(f, _) => {
|
||||
let arguments = arguments.iter().map(|e| lower_expression(e, ctx)).collect::<_>();
|
||||
let mut arguments =
|
||||
arguments.iter().map(|e| lower_expression(e, ctx)).collect::<Vec<_>>();
|
||||
if *f == BuiltinFunction::Translate {
|
||||
if let llr_Expression::Array { as_model, .. } = &mut arguments[3] {
|
||||
*as_model = false;
|
||||
}
|
||||
}
|
||||
llr_Expression::BuiltinFunctionCall { function: f.clone(), arguments }
|
||||
}
|
||||
tree_Expression::CallbackReference(nr, _) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue