1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:37:34 +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:
Andreas Kling 2021-05-08 21:15:38 +02:00
parent 161568103e
commit bfd2ec88f4
3 changed files with 13 additions and 1 deletions

View file

@ -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({});
});
}
}