1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:58:11 +00:00

PixelPaint: Make tool properties widget construction non-fallible

`Tool::get_properties_widget()` now also returns a NNRP to a widget
rather than a raw pointer.
This commit is contained in:
Tim Ledbetter 2023-09-22 23:15:36 +01:00 committed by Andreas Kling
parent 5df88dab07
commit f34b1c7a7e
41 changed files with 72 additions and 85 deletions

View file

@ -184,10 +184,10 @@ bool PolygonalSelectTool::on_keydown(GUI::KeyEvent& key_event)
return Tool::on_keydown(key_event);
}
ErrorOr<GUI::Widget*> PolygonalSelectTool::get_properties_widget()
NonnullRefPtr<GUI::Widget> PolygonalSelectTool::get_properties_widget()
{
if (m_properties_widget)
return m_properties_widget.ptr();
return *m_properties_widget.ptr();
auto properties_widget = GUI::Widget::construct();
properties_widget->set_layout<GUI::VerticalBoxLayout>();
@ -236,7 +236,7 @@ ErrorOr<GUI::Widget*> PolygonalSelectTool::get_properties_widget()
};
m_properties_widget = properties_widget;
return m_properties_widget.ptr();
return *m_properties_widget;
}
Gfx::IntPoint PolygonalSelectTool::point_position_to_preferred_cell(Gfx::FloatPoint position) const