mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:27:43 +00:00
LibGUI: Add GUI::SettingsWindow::add_tab() that takes a constructed tab
This patch adds a new add_tab() function in GUI::SettingsWindow that takes an already created NonnullRefPtr<Tab> object. This allows us to handle errors while creating the Tab object and then pass it to this function to actually add the object to the SettingsWindow.
This commit is contained in:
parent
2693745336
commit
27a1798dd9
1 changed files with 9 additions and 0 deletions
|
@ -55,6 +55,15 @@ public:
|
|||
return tab;
|
||||
}
|
||||
|
||||
ErrorOr<void> add_tab(NonnullRefPtr<Tab> const& tab, DeprecatedString title, StringView id)
|
||||
{
|
||||
tab->set_title(move(title));
|
||||
TRY(m_tab_widget->try_add_widget(*tab));
|
||||
TRY(m_tabs.try_set(id, tab));
|
||||
tab->set_settings_window(*this);
|
||||
return {};
|
||||
}
|
||||
|
||||
Optional<NonnullRefPtr<Tab>> get_tab(StringView id) const;
|
||||
void set_active_tab(StringView id);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue