1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

LibCore: Make Core::Object::add<ChildType> return a ChildType&

Since the returned object is now owned by the callee object, we can
simply vend a ChildType&. This allows us to use "." instead of "->"
at the call site, which is quite nice. :^)
This commit is contained in:
Andreas Kling 2020-03-04 19:07:55 +01:00
parent fb09b6a8ce
commit 028c011760
46 changed files with 1035 additions and 1039 deletions

View file

@ -62,7 +62,7 @@ int main(int argc, char** argv)
widget.set_fill_with_background_color(true);
widget.set_layout<GUI::VerticalBoxLayout>();
auto splitter = widget.add<GUI::HorizontalSplitter>();
auto& splitter = widget.add<GUI::HorizontalSplitter>();
RemoteProcess remote_process(pid);
@ -71,16 +71,16 @@ int main(int argc, char** argv)
window->set_title(String::format("Inspector: %s (%d)", remote_process.process_name().characters(), remote_process.pid()));
};
auto tree_view = splitter->add<GUI::TreeView>();
tree_view->set_model(remote_process.object_graph_model());
tree_view->set_activates_on_selection(true);
auto& tree_view = splitter.add<GUI::TreeView>();
tree_view.set_model(remote_process.object_graph_model());
tree_view.set_activates_on_selection(true);
auto properties_table_view = splitter->add<GUI::TableView>();
properties_table_view->set_size_columns_to_fit_content(true);
auto& properties_table_view = splitter.add<GUI::TableView>();
properties_table_view.set_size_columns_to_fit_content(true);
tree_view->on_activation = [&](auto& index) {
tree_view.on_activation = [&](auto& index) {
auto* remote_object = static_cast<RemoteObject*>(index.internal_data());
properties_table_view->set_model(remote_object->property_model());
properties_table_view.set_model(remote_object->property_model());
};
window->show();