mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
Simplify plotter example
Use a callback that produces the plot from a pitch as the image source.
This commit is contained in:
parent
8903adb584
commit
92655486da
2 changed files with 4 additions and 15 deletions
|
@ -85,16 +85,7 @@ pub fn main() {
|
|||
|
||||
let main_window = MainWindow::new();
|
||||
|
||||
main_window.on_redraw({
|
||||
let main_window_weak = main_window.as_weak();
|
||||
move || {
|
||||
let main_window = main_window_weak.upgrade().unwrap();
|
||||
let plot = render_plot(main_window.get_pitch());
|
||||
main_window.set_plot_image(plot);
|
||||
}
|
||||
});
|
||||
|
||||
main_window.invoke_redraw();
|
||||
main_window.on_render_plot(render_plot);
|
||||
|
||||
main_window.run();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue