1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 11:45:06 +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

@ -61,12 +61,12 @@ int main(int argc, char** argv)
main_widget.set_fill_with_background_color(true);
main_widget.set_layout<GUI::VerticalBoxLayout>();
auto timeline_widget = main_widget.add<ProfileTimelineWidget>(*profile);
main_widget.add<ProfileTimelineWidget>(*profile);
auto tree_view = main_widget.add<GUI::TreeView>();
tree_view->set_headers_visible(true);
tree_view->set_size_columns_to_fit_content(true);
tree_view->set_model(profile->model());
auto& tree_view = main_widget.add<GUI::TreeView>();
tree_view.set_headers_visible(true);
tree_view.set_size_columns_to_fit_content(true);
tree_view.set_model(profile->model());
auto menubar = make<GUI::MenuBar>();
auto app_menu = GUI::Menu::construct("ProfileViewer");
@ -86,7 +86,7 @@ int main(int argc, char** argv)
auto percent_action = GUI::Action::create("Show percentages", { Mod_Ctrl, Key_P }, [&](auto& action) {
action.set_checked(!action.is_checked());
profile->set_show_percentages(action.is_checked());
tree_view->update();
tree_view.update();
});
percent_action->set_checkable(true);
percent_action->set_checked(false);