mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-31 07:37:24 +00:00
live-preview: Recursively set debug-handler
This commit is contained in:
parent
bd3c001c5d
commit
d21e6680a3
2 changed files with 15 additions and 2 deletions
|
@ -965,9 +965,10 @@ impl ComponentDefinition {
|
|||
handler: impl Fn(&Option<i_slint_compiler::diagnostics::SourceLocation>, &str) + 'static,
|
||||
_: i_slint_core::InternalToken,
|
||||
) {
|
||||
generativity::make_guard!(guard);
|
||||
let handler = Rc::new(handler);
|
||||
*self.inner.unerase(guard).debug_handler.borrow_mut() = handler;
|
||||
|
||||
generativity::make_guard!(guard);
|
||||
self.inner.unerase(guard).recursively_set_debug_handler(handler);
|
||||
}
|
||||
/// Creates a new instance of the component and returns a shared handle to it.
|
||||
pub fn create(&self) -> Result<ComponentInstance, PlatformError> {
|
||||
|
|
|
@ -703,6 +703,18 @@ impl ItemTreeDescription<'_> {
|
|||
let g = extra_data.globals.get().unwrap().get(global_name).clone();
|
||||
g.ok_or(())
|
||||
}
|
||||
|
||||
pub fn recursively_set_debug_handler(
|
||||
&self,
|
||||
handler: Rc<dyn Fn(&Option<i_slint_compiler::diagnostics::SourceLocation>, &str)>,
|
||||
) {
|
||||
*self.debug_handler.borrow_mut() = handler.clone();
|
||||
|
||||
for r in &self.repeater {
|
||||
generativity::make_guard!(guard);
|
||||
r.unerase(guard).item_tree_to_repeat.recursively_set_debug_handler(handler.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(not(feature = "ffi"), i_slint_core_macros::remove_extern)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue