summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI/Widget.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-03-05 09:21:46 +0100
committerAndreas Kling <kling@serenityos.org>2020-03-05 09:22:43 +0100
commit849fdc1c0b2be599932447c3751dbc303d634ae1 (patch)
tree930c8afbce853bdf080f153e7e5cbd30cfa17c10 /Libraries/LibGUI/Widget.cpp
parentecc39678f59e7b40be20a491770ffac19d1a25a4 (diff)
downloadserenity-849fdc1c0b2be599932447c3751dbc303d634ae1.zip
LibGUI: Make Layout a Core::Object and add basic serialization
This allows you to view layouts (as data) in Inspector.
Diffstat (limited to 'Libraries/LibGUI/Widget.cpp')
-rw-r--r--Libraries/LibGUI/Widget.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/Libraries/LibGUI/Widget.cpp b/Libraries/LibGUI/Widget.cpp
index 6020d65c50..08d2273f57 100644
--- a/Libraries/LibGUI/Widget.cpp
+++ b/Libraries/LibGUI/Widget.cpp
@@ -242,12 +242,15 @@ void Widget::handle_paint_event(PaintEvent& event)
second_paint_event(event);
}
-void Widget::set_layout(OwnPtr<Layout>&& layout)
+void Widget::set_layout(NonnullRefPtr<Layout> layout)
{
- if (m_layout)
+ if (m_layout) {
m_layout->notify_disowned({}, *this);
+ m_layout->remove_from_parent();
+ }
m_layout = move(layout);
if (m_layout) {
+ add_child(*m_layout);
m_layout->notify_adopted({}, *this);
do_layout();
} else {