Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image button #692

Closed
ruza-net opened this issue Jan 9, 2021 · 2 comments
Closed

Image button #692

ruza-net opened this issue Jan 9, 2021 · 2 comments

Comments

@ruza-net
Copy link

ruza-net commented Jan 9, 2021

How do you make an image button?

When I try

iced::Button::new(
    &mut state,
    iced::Image::new("a/path/img.svg"),
)

... it doesn't compile:

error[E0277]: the trait bound `iced_wgpu::backend::Backend: iced_graphics::backend::Image` is not satisfied
  --> src/components/general/floating_frame.rs:74:28
   |
74 |         let collapse_btn = iced::Button::new(
   |                            ^^^^^^^^^^^^^^^^^ the trait `iced_graphics::backend::Image` is not implemented for `iced_wgpu::backend::Backend`
   |
   = note: required because of the requirements on the impl of `iced_native::widget::image::Renderer` for `iced_graphics::renderer::Renderer<iced_wgpu::backend::Backend>`
   = note: required because of the requirements on the impl of `From<Image>` for `iced_native::element::Element<'_, _, iced_graphics::renderer::Renderer<iced_wgpu::backend::Backend>>`
   = note: required because of the requirements on the impl of `Into<iced_native::element::Element<'_, _, iced_graphics::renderer::Renderer<iced_wgpu::backend::Backend>>>` for `Image`
   = note: required by `iced_native::widget::button::Button::<'a, Message, Renderer>::new`

Do I need to use Image from a specific crate (other than iced)?

@yusdacra
Copy link
Contributor

yusdacra commented Jan 9, 2021

Do you have the image feature enabled on iced?

@ruza-net
Copy link
Author

ruza-net commented Jan 9, 2021

Thank you, it works now.

@ruza-net ruza-net closed this as completed Jan 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants