diff --git a/Libraries/LibCore/Object.h b/Libraries/LibCore/Object.h index b76b7ff7cd..d007818b0e 100644 --- a/Libraries/LibCore/Object.h +++ b/Libraries/LibCore/Object.h @@ -120,6 +120,14 @@ public: m_parent->remove_child(*this); } + template + inline NonnullRefPtr add(Args&&... args) + { + auto t = T::construct(forward(args)...); + add_child(*t); + return t; + } + virtual bool is_visible_for_timer_purposes() const; protected: