diff --git a/Libraries/LibGUI/TabWidget.cpp b/Libraries/LibGUI/TabWidget.cpp index 384a57d682..11af7af46d 100644 --- a/Libraries/LibGUI/TabWidget.cpp +++ b/Libraries/LibGUI/TabWidget.cpp @@ -259,4 +259,18 @@ int TabWidget::active_tab_index() const } return -1; } + +void TabWidget::set_tab_title(Widget& tab, const StringView& title) +{ + for (auto& t : m_tabs) { + if (t.widget == &tab) { + if (t.title != title) { + t.title = title; + update(); + } + return; + } + } +} + } diff --git a/Libraries/LibGUI/TabWidget.h b/Libraries/LibGUI/TabWidget.h index 9aa4987c80..997c6c139a 100644 --- a/Libraries/LibGUI/TabWidget.h +++ b/Libraries/LibGUI/TabWidget.h @@ -65,7 +65,9 @@ public: void remove_tab(Widget& tab) { remove_widget(tab); } - Function on_change; + void set_tab_title(Widget& tab, const StringView& title); + + Function on_change; protected: TabWidget();