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.54k stars 601 forks source link

Native widgets animation #2045

Closed lucasjinreal closed 1 year ago

lucasjinreal commented 1 year ago

For example, on Windows, there are many transition animations on elements. Is that possible to support some of them?

ogoffart commented 1 year ago

Do you have any specific example of animation that Slint doesn't support. Is it when using the native style?

ogoffart commented 1 year ago

The native style that is using Qt has some animation, but these are not visible in Slint unfortunately. The technical reason is that the QStyle (that we use behind the scene) rely on the existance of a QWidget per control to store some of the animation state. But we don't have a QWidget per control with Slint. And we do not set the QStyleOption::styleObject. So right now, the native style is not animated :-/

lucasjinreal commented 1 year ago

@ogoffart thank u for reply. I'd like try slint these days.

May I ask 2 questions further?

  1. what's the strength and weakness compare with egui?
  2. can slint using pure rust to define the ui simply without the slint lang? (i'd like all things be binary and syntax more strict)
ogoffart commented 1 year ago

@jinfagang This is a bit off topic for this issue, but i'll just make a short answer.

  1. what's the strength and weakness compare with egui?

Slint provide a live preview editor extension which allow to quickly iterate over the UI (without recompiling). It is not a immediate GUI, so that makes it easier to have complex layout. It has both a visually native style, as well as ways to easily create custom widgets style or controls. Slint also work on very low-level hardware (MCU with < 300KB of RAM)

  1. can slint using pure rust to define the ui simply without the slint lang? (i'd like all things be binary and syntax more strict)

Not using the public API. But the Slint language compiles to rust which itself compiles to binary. Also, the Slint syntax is itself strict.

lucasjinreal commented 1 year ago

@ogoffart hi, looks like slint didn't support Chinese or Japanese as well:

image

tronical commented 1 year ago

@jinfagang Chinese/Japanese should work (it does for me, we've had a few issues with Korean in the past). What's your operating system? Do you have Qt installed on your system? (it's not required for CJK, just asking for narrowing)

lucasjinreal commented 1 year ago

@tronical hello, this is the wasm demo in browser, is it ok for desktop? haven't test yet.

btw, what if users want using pure rust to build ui, is there a way to support so?

Does slint must have qt installed so that it can be use?

tronical commented 1 year ago

Yes, for the wasm build we include a font in the binary that doesn't have good coverage. That's a limitation of our demo at the moment. Applications can work around it on their own wasm build if they'd like to.

On the desktop and embedded devices Slint loads the system fonts and should be able to find the glyphs for CJK.

tronical commented 1 year ago

Qt is not required. It's an optional dependency that enables (among other things) the so-called native style that ties to provide a platform-native look and feel.