1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 14:47:35 +00:00

Userland: Use non-fallible EventReceiver::add() where possible

This commit is contained in:
Tim Ledbetter 2023-09-22 22:28:59 +01:00 committed by Andreas Kling
parent 707ca984bd
commit b4e134cb52
54 changed files with 934 additions and 934 deletions

View file

@ -67,22 +67,22 @@ ErrorOr<GUI::Widget*> BucketTool::get_properties_widget()
auto properties_widget = GUI::Widget::construct();
properties_widget->set_layout<GUI::VerticalBoxLayout>();
auto threshold_container = TRY(properties_widget->try_add<GUI::Widget>());
threshold_container->set_fixed_height(20);
threshold_container->set_layout<GUI::HorizontalBoxLayout>();
auto& threshold_container = properties_widget->add<GUI::Widget>();
threshold_container.set_fixed_height(20);
threshold_container.set_layout<GUI::HorizontalBoxLayout>();
auto threshold_label = TRY(threshold_container->try_add<GUI::Label>("Threshold:"_string));
threshold_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
threshold_label->set_fixed_size(80, 20);
auto& threshold_label = threshold_container.add<GUI::Label>("Threshold:"_string);
threshold_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
threshold_label.set_fixed_size(80, 20);
auto threshold_slider = TRY(threshold_container->try_add<GUI::ValueSlider>(Orientation::Horizontal, "%"_string));
threshold_slider->set_range(0, 100);
threshold_slider->set_value(m_threshold);
auto& threshold_slider = threshold_container.add<GUI::ValueSlider>(Orientation::Horizontal, "%"_string);
threshold_slider.set_range(0, 100);
threshold_slider.set_value(m_threshold);
threshold_slider->on_change = [this](int value) {
threshold_slider.on_change = [this](int value) {
m_threshold = value;
};
set_primary_slider(threshold_slider);
set_primary_slider(&threshold_slider);
m_properties_widget = properties_widget;
}