mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 00:25:12 +00:00
LibGUI: Make Action::set_text() update any associated menu items
Now you can change the text of an action and it will actually show up in the menu. :^)
This commit is contained in:
@@ -343,4 +343,14 @@ void Action::set_icon(const Gfx::Bitmap* icon)
|
||||
m_icon = icon;
|
||||
}
|
||||
|
||||
void Action::set_text(String text)
|
||||
{
|
||||
if (m_text == text)
|
||||
return;
|
||||
m_text = move(text);
|
||||
for_each_menu_item([&](auto& menu_item) {
|
||||
menu_item.update_from_action({});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user