mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-03 15:14:35 +00:00
Get rid of the context in properties/signal
This commit is contained in:
parent
ab7ae9f3e2
commit
e00491811b
25 changed files with 389 additions and 653 deletions
|
@ -4,16 +4,17 @@ sixtyfps::include_modules!();
|
|||
|
||||
fn main() {
|
||||
let app = Hello::new();
|
||||
|
||||
app.plus_clicked.set_handler(|context, ()| {
|
||||
let app = context.get_component::<Hello>().unwrap();
|
||||
let counter = Hello::field_offsets().counter.apply_pin(app);
|
||||
counter.set(counter.get(context) + 1);
|
||||
let app_weak = sixtyfps::re_exports::WeakPin::downgrade(app.clone());
|
||||
app.plus_clicked.set_handler(move |()| {
|
||||
let app = app_weak.upgrade().unwrap();
|
||||
let counter = Hello::field_offsets().counter.apply_pin(app.as_ref());
|
||||
counter.set(counter.get() + 1);
|
||||
});
|
||||
app.minus_clicked.set_handler(|context, ()| {
|
||||
let app = context.get_component::<Hello>().unwrap();
|
||||
let counter = Hello::field_offsets().counter.apply_pin(app);
|
||||
counter.set(counter.get(context) - 1);
|
||||
let app_weak = sixtyfps::re_exports::WeakPin::downgrade(app.clone());
|
||||
app.minus_clicked.set_handler(move |()| {
|
||||
let app = app_weak.upgrade().unwrap();
|
||||
let counter = Hello::field_offsets().counter.apply_pin(app.as_ref());
|
||||
counter.set(counter.get() - 1);
|
||||
});
|
||||
app.run();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue