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

LibGUI: Make GUI::TabWidget tab creation APIs take String

Ultimately we'd like the caller to provide a String if possible (instead
of a StringView) as we're going to end up storing it.
This commit is contained in:
Andreas Kling 2021-11-27 17:30:46 +01:00
parent 8a11e986e5
commit 8359975ff3
2 changed files with 10 additions and 10 deletions

View file

@ -44,9 +44,9 @@ TabWidget::~TabWidget()
{
}
ErrorOr<void> TabWidget::try_add_widget(StringView title, Widget& widget)
ErrorOr<void> TabWidget::try_add_widget(String title, Widget& widget)
{
m_tabs.append({ title, nullptr, &widget });
m_tabs.append({ move(title), nullptr, &widget });
add_child(widget);
update_focus_policy();
if (on_tab_count_change)
@ -54,9 +54,9 @@ ErrorOr<void> TabWidget::try_add_widget(StringView title, Widget& widget)
return {};
}
void TabWidget::add_widget(StringView title, Widget& widget)
void TabWidget::add_widget(String title, Widget& widget)
{
MUST(try_add_widget(title, widget));
MUST(try_add_widget(move(title), widget));
}
void TabWidget::remove_widget(Widget& widget)