slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.6k stars 604 forks source link

Provide means to implement global singleton earlier #6235

Open Enyium opened 1 month ago

Enyium commented 1 month ago

I'm using Rust.

When you call callbacks from a global singleton in a component's init callback, they aren't yet implemented, even if the first thing you do after AppWindow::new() is to implement the global singleton. This limits you.

Would it be possible to provide another constructor function with_...() or so on window components that maybe demands an FnOnce closure where you can call through to your function that implements the window's global singletons?

ogoffart commented 1 month ago

Indeed. And we also need a way to share globals accross windows.