mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 22:30:31 +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
Notes:
sideshowbarker
2024-07-17 04:01:41 +09:00
Author: https://github.com/Baitinq
Commit: 27a1798dd9
Pull-request: https://github.com/SerenityOS/serenity/pull/16503
Reviewed-by: https://github.com/AtkinsSJ ✅
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