mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 06:48:49 +00:00
LibGUI: Tweak AbstractButton and subclass constructors
Taking a "const StringView&" for the initial text does not achieve anything useful. Just take a "String" and move it into storage.
This commit is contained in:
parent
476911e1f9
commit
cd9ad6a05e
Notes:
sideshowbarker
2024-07-19 00:29:58 +09:00
Author: https://github.com/awesomekling
Commit: cd9ad6a05e
9 changed files with 25 additions and 21 deletions
|
@ -32,9 +32,10 @@
|
|||
|
||||
namespace GUI {
|
||||
|
||||
AbstractButton::AbstractButton(const StringView& text)
|
||||
: m_text(text)
|
||||
AbstractButton::AbstractButton(String text)
|
||||
{
|
||||
set_text(move(text));
|
||||
|
||||
set_focus_policy(GUI::FocusPolicy::StrongFocus);
|
||||
set_background_role(Gfx::ColorRole::Button);
|
||||
set_foreground_role(Gfx::ColorRole::ButtonText);
|
||||
|
@ -54,11 +55,11 @@ AbstractButton::~AbstractButton()
|
|||
{
|
||||
}
|
||||
|
||||
void AbstractButton::set_text(const StringView& text)
|
||||
void AbstractButton::set_text(String text)
|
||||
{
|
||||
if (m_text == text)
|
||||
return;
|
||||
m_text = text;
|
||||
m_text = move(text);
|
||||
update();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue