mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-09 19:16:02 +00:00
LibGUI+Userland: Use action text as a fallback in Action::status_tip()
Many applications already do this in their code. This change will simply move the logic to a single function to stop repeating ourselves!
This commit is contained in:
parent
2029750519
commit
4b169cf25f
Notes:
sideshowbarker
2024-07-17 00:59:43 +09:00
Author: https://github.com/krkk
Commit: 4b169cf25f
Pull-request: https://github.com/SerenityOS/serenity/pull/19257
Reviewed-by: https://github.com/AtkinsSJ ✅
13 changed files with 21 additions and 48 deletions
|
@ -11,6 +11,7 @@
|
|||
#include <LibGUI/Button.h>
|
||||
#include <LibGUI/MenuItem.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Painter.h>
|
||||
|
||||
namespace GUI {
|
||||
|
||||
|
@ -314,4 +315,12 @@ void Action::set_tooltip(DeprecatedString tooltip)
|
|||
});
|
||||
}
|
||||
|
||||
DeprecatedString Action::status_tip() const
|
||||
{
|
||||
if (!m_status_tip.is_empty())
|
||||
return m_status_tip;
|
||||
|
||||
return Gfx::parse_ampersand_string(m_text);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ public:
|
|||
DeprecatedString tooltip() const { return m_tooltip.value_or(m_text); }
|
||||
void set_tooltip(DeprecatedString);
|
||||
|
||||
DeprecatedString const& status_tip() const { return m_status_tip; }
|
||||
DeprecatedString status_tip() const;
|
||||
void set_status_tip(DeprecatedString status_tip) { m_status_tip = move(status_tip); }
|
||||
|
||||
Shortcut const& shortcut() const { return m_shortcut; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue