mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:47:35 +00:00
LibGUI: Make GUI::TabWidget::add_tab<T>() return a T&
Since the newly constructed sub-widget is owned by the TabWidget, we can simply return a T& here. :^)
This commit is contained in:
parent
37af1d74cc
commit
2463a285ee
6 changed files with 41 additions and 41 deletions
|
@ -55,11 +55,11 @@ public:
|
|||
void add_widget(const StringView&, Widget&);
|
||||
|
||||
template<class T, class... Args>
|
||||
inline NonnullRefPtr<T> add_tab(const StringView& title, Args&&... args)
|
||||
T& add_tab(const StringView& title, Args&&... args)
|
||||
{
|
||||
auto t = T::construct(forward<Args>(args)...);
|
||||
add_widget(title, *t);
|
||||
return t;
|
||||
return *t;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue