1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:57:35 +00:00

LibGUI: Allow overriding toolbar button tooltips

The EmojiInputDialog, for example, will want its toolbar buttons to have
a tooltip which differs from its text. If no tooltip override has been
provided, we fall back to the button text still.
This commit is contained in:
Timothy Flynn 2023-03-04 12:50:28 -05:00 committed by Andreas Kling
parent f8a0365002
commit 153218ed76
3 changed files with 18 additions and 1 deletions

View file

@ -296,4 +296,17 @@ void Action::set_text(DeprecatedString text)
});
}
void Action::set_tooltip(DeprecatedString tooltip)
{
if (m_tooltip == tooltip)
return;
m_tooltip = move(tooltip);
for_each_toolbar_button([&](auto& button) {
button.set_tooltip(*m_tooltip);
});
for_each_menu_item([&](auto& menu_item) {
menu_item.update_from_action({});
});
}
}