mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-03 18:29:09 +00:00
Timer::set_interval
Don't return an Option, just return 0 when the timer is not started. As discussed in the API review, the rational is that the interval is just like a field in a struct and when the struct is default constructed, it is initialized to 0
This commit is contained in:
parent
bcdc3e1cee
commit
d2bd5366f4
5 changed files with 13 additions and 20 deletions
|
@ -1068,8 +1068,7 @@ fn generate_sub_component(
|
|||
quote!(
|
||||
if #running {
|
||||
let interval = core::time::Duration::from_millis(#interval as u64);
|
||||
let old_interval = self.#ident.interval();
|
||||
if old_interval != Some(interval) || !self.#ident.running() {
|
||||
if !self.#ident.running() || interval != self.#ident.interval() {
|
||||
let self_weak = self.self_weak.get().unwrap().clone();
|
||||
self.#ident.start(sp::TimerMode::Repeated, interval, move || {
|
||||
if let Some(self_rc) = self_weak.upgrade() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue