1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:17:45 +00:00

Userland: Use default buttons instead of manually handling return press

Besides simplifying the code, this will also draw outline for these
buttons as a cue for a user!
This commit is contained in:
Karol Kosek 2022-05-27 19:36:06 +02:00 committed by Andreas Kling
parent a232395b77
commit 9f1f1b8472
8 changed files with 8 additions and 39 deletions

View file

@ -48,9 +48,6 @@ ResizeImageDialog::ResizeImageDialog(Gfx::IntSize const& suggested_size, GUI::Wi
}
m_desired_size.set_width(value);
};
width_spinbox->on_return_pressed = [this]() {
done(ExecResult::OK);
};
height_spinbox->set_value(m_desired_size.height());
height_spinbox->on_change = [this, width_spinbox, keep_aspect_ratio_checkbox](int value) {
@ -61,9 +58,6 @@ ResizeImageDialog::ResizeImageDialog(Gfx::IntSize const& suggested_size, GUI::Wi
}
m_desired_size.set_height(value);
};
height_spinbox->on_return_pressed = [this]() {
done(ExecResult::OK);
};
keep_aspect_ratio_checkbox->on_checked = [this, height_spinbox](bool is_checked) {
if (is_checked) {
@ -102,6 +96,7 @@ ResizeImageDialog::ResizeImageDialog(Gfx::IntSize const& suggested_size, GUI::Wi
ok_button->on_click = [this](auto) {
done(ExecResult::OK);
};
ok_button->set_default(true);
cancel_button->on_click = [this](auto) {
done(ExecResult::Cancel);