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.71k stars 614 forks source link

Error when using icons #1404

Closed radiohertz closed 2 years ago

radiohertz commented 2 years ago

When i use a favicon, it logs this message in the console.

Error decoding image: The image format Ico is not supported

Code

app := Window {
    title: "Some App";
    icon: @image-url("../icons/favicon.ico");
}
ogoffart commented 2 years ago

The support for ico is not enabled by default. But we use the image crate for decoding and it has a ico feature.

To enable the feature, add that to your Cargo.toml

[dependencies]
image = { version = "0.24.0", default-features = false, features = [ "ico" ] }
radiohertz commented 2 years ago

Thank you!

Enyium commented 1 month ago

@ogoffart: The slint Rust crate doesn't have the ico feature anymore. How are you supposed to use .ico files now?!

ogoffart commented 1 month ago

By enabling the feature in the image (0.24) crate

Enyium commented 1 month ago

Oh, sorry, I overlooked that it says image = on the start of the line, not slint = (same width). I used this line in Cargo.toml:

image = { version = "0.24.9", features = ["ico"] }

This works.

I think this should be documented on https://docs.rs/slint/latest/slint/docs/cargo_features/index.html. (Reopen issue?)