Skip to content

Menu: Add icon property #8182

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

redstrate
Copy link
Contributor

This adds an icon that is displayed to the left of the title, and is also shown for Menus are inside of a parent menu.

image

Closes #7791

@ogoffart
Copy link
Member

Thanks for this much appreciated patch.
Looks good to me, but I'm not the right person to judge the aesthetics, but I think it is ok for now.
Could you make sure that the gallery has at least one menu entry with one icon? (Also a disabled entry would be nice)

Looks like the CI is failing in the C++ tests.

   Error: /Users/runner/work/slint/cppbuild/api/cpp/generated_include/slint_builtin_structs_internal.h:139:5: error: unknown type name 'Image'
      Image icon;
      ^

This is because the builtin struct now contain an image. This header is generated in

writeln!(structs_priv, "// This file is auto-generated from {}", file!())?;
, and it should be sufficient to add an #include <slint_image.h> there.

Also the muda implementation in muda.rs is missing.

@redstrate redstrate force-pushed the work/josh/menu-icons branch 2 times, most recently from b557f29 to 595cfa5 Compare April 28, 2025 16:41
Copy link
Member

@ogoffart ogoffart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Looks good to me.

The CI seems to expose more problem with missing include in some of our headers

@redstrate redstrate force-pushed the work/josh/menu-icons branch 2 times, most recently from 31cc983 to 0f3b1fd Compare May 7, 2025 12:34
This adds an icon that is displayed to the left of the title, and is
also shown for Menus are inside of a parent menu.

Closes slint-ui#7791
@redstrate redstrate force-pushed the work/josh/menu-icons branch from 0f3b1fd to bcb05d9 Compare May 7, 2025 12:42
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

Successfully merging this pull request may close these issues.

More properties for MenuItem: icon
2 participants