mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
Timer: make the interval
property mandatory
A default of 0 is not a great default because that's way too often
This commit is contained in:
parent
3f3ac7e347
commit
bcdc3e1cee
3 changed files with 17 additions and 1 deletions
|
@ -42,6 +42,14 @@ fn lower_timer(
|
|||
return;
|
||||
}
|
||||
|
||||
if !timer_element.borrow().is_binding_set("interval", true) {
|
||||
diag.push_error(
|
||||
"Timer must have a binding set for its 'interval' property".into(),
|
||||
&*timer_element.borrow(),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the timer_element from its parent
|
||||
let old_size = parent_element.borrow().children.len();
|
||||
parent_element.borrow_mut().children.retain(|child| !Rc::ptr_eq(child, timer_element));
|
||||
|
|
|
@ -11,4 +11,12 @@ export component Def {
|
|||
// ^error{Timer cannot be directly repeated or conditional}
|
||||
|
||||
if false: Abc {}
|
||||
|
||||
Timer {
|
||||
// ^error{Timer must have a binding set for its 'interval' property}
|
||||
running: false;
|
||||
}
|
||||
|
||||
Timer {}
|
||||
// ^error{Timer must have a binding set for its 'interval' property}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue