diff --git a/Userland/Applications/Browser/BookmarksBarWidget.cpp b/Userland/Applications/Browser/BookmarksBarWidget.cpp index 32dafe048b..09f7625519 100644 --- a/Userland/Applications/Browser/BookmarksBarWidget.cpp +++ b/Userland/Applications/Browser/BookmarksBarWidget.cpp @@ -57,20 +57,15 @@ private: m_title_textbox->set_text(title); m_title_textbox->set_focus(true); m_title_textbox->select_all(); - m_title_textbox->on_return_pressed = [this] { - done(ExecResult::OK); - }; m_url_textbox = *widget.find_descendant_of_type_named("url_textbox"); m_url_textbox->set_text(url); - m_url_textbox->on_return_pressed = [this] { - done(ExecResult::OK); - }; auto& ok_button = *widget.find_descendant_of_type_named("ok_button"); ok_button.on_click = [this](auto) { done(ExecResult::OK); }; + ok_button.set_default(true); auto& cancel_button = *widget.find_descendant_of_type_named("cancel_button"); cancel_button.on_click = [this](auto) { diff --git a/Userland/Applications/HexEditor/FindDialog.cpp b/Userland/Applications/HexEditor/FindDialog.cpp index 0925e99327..6cd0e7c3d4 100644 --- a/Userland/Applications/HexEditor/FindDialog.cpp +++ b/Userland/Applications/HexEditor/FindDialog.cpp @@ -130,10 +130,6 @@ FindDialog::FindDialog() m_find_all_button->set_enabled(!m_text_editor->text().is_empty()); }; - m_text_editor->on_return_pressed = [this] { - m_find_button->click(); - }; - m_find_button->on_click = [this](auto) { auto text = m_text_editor->text(); if (!text.is_empty()) { @@ -141,6 +137,7 @@ FindDialog::FindDialog() done(ExecResult::OK); } }; + m_find_button->set_default(true); m_find_all_button->on_click = [this](auto) { m_find_all = true; diff --git a/Userland/Applications/HexEditor/GoToOffsetDialog.cpp b/Userland/Applications/HexEditor/GoToOffsetDialog.cpp index 5af68549c0..ea600cb0fc 100644 --- a/Userland/Applications/HexEditor/GoToOffsetDialog.cpp +++ b/Userland/Applications/HexEditor/GoToOffsetDialog.cpp @@ -119,13 +119,10 @@ GoToOffsetDialog::GoToOffsetDialog() m_offset_from_box->set_selected_index(0); m_offset_from_box->set_only_allow_values_from_model(true); - m_text_editor->on_return_pressed = [this] { - m_go_button->click(); - }; - m_go_button->on_click = [this](auto) { done(ExecResult::OK); }; + m_go_button->set_default(true); m_text_editor->on_change = [this]() { auto text = m_text_editor->text(); diff --git a/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp b/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp index 50601383a9..a29d8935c0 100644 --- a/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp +++ b/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp @@ -54,6 +54,7 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window) ok_button.on_click = [this](auto) { done(ExecResult::OK); }; + ok_button.set_default(true); auto& cancel_button = button_container.add("Cancel"); cancel_button.on_click = [this](auto) { @@ -68,10 +69,6 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window) m_image_size.set_height(value); }; - m_name_textbox->on_return_pressed = [this] { - done(ExecResult::OK); - }; - width_spinbox.set_range(1, 16384); height_spinbox.set_range(1, 16384); diff --git a/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp b/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp index 4b46a98271..a681c21015 100644 --- a/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp +++ b/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp @@ -53,6 +53,7 @@ CreateNewLayerDialog::CreateNewLayerDialog(Gfx::IntSize const& suggested_size, G ok_button.on_click = [this](auto) { done(ExecResult::OK); }; + ok_button.set_default(true); auto& cancel_button = button_container.add("Cancel"); cancel_button.on_click = [this](auto) { @@ -67,10 +68,6 @@ CreateNewLayerDialog::CreateNewLayerDialog(Gfx::IntSize const& suggested_size, G m_layer_size.set_height(value); }; - m_name_textbox->on_return_pressed = [this] { - done(ExecResult::OK); - }; - width_spinbox.set_range(1, 16384); height_spinbox.set_range(1, 16384); diff --git a/Userland/Applications/PixelPaint/ResizeImageDialog.cpp b/Userland/Applications/PixelPaint/ResizeImageDialog.cpp index f255d3c038..46dcb75faf 100644 --- a/Userland/Applications/PixelPaint/ResizeImageDialog.cpp +++ b/Userland/Applications/PixelPaint/ResizeImageDialog.cpp @@ -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); diff --git a/Userland/Applications/Run/RunWindow.cpp b/Userland/Applications/Run/RunWindow.cpp index 6dcc87dd48..26b8cd7a02 100644 --- a/Userland/Applications/Run/RunWindow.cpp +++ b/Userland/Applications/Run/RunWindow.cpp @@ -48,14 +48,12 @@ RunWindow::RunWindow() m_path_combo_box = *main_widget.find_descendant_of_type_named("path"); m_path_combo_box->set_model(m_path_history_model); m_path_combo_box->set_selected_index(0); - m_path_combo_box->on_return_pressed = [this] { - m_ok_button->click(); - }; m_ok_button = *main_widget.find_descendant_of_type_named("ok_button"); m_ok_button->on_click = [this](auto) { do_run(); }; + m_ok_button->set_default(true); m_cancel_button = *main_widget.find_descendant_of_type_named("cancel_button"); m_cancel_button->on_click = [this](auto) { diff --git a/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp b/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp index e349204e01..5cc4a85aff 100644 --- a/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp +++ b/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp @@ -71,21 +71,14 @@ NewProjectDialog::NewProjectDialog(GUI::Window* parent) m_name_input->on_change = [&]() { update_dialog(); }; - m_name_input->on_return_pressed = [&]() { - if (m_input_valid) - do_create_project(); - }; m_create_in_input = *main_widget.find_descendant_of_type_named("create_in_input"); m_create_in_input->on_change = [&]() { update_dialog(); }; - m_create_in_input->on_return_pressed = [&]() { - if (m_input_valid) - do_create_project(); - }; m_full_path_label = *main_widget.find_descendant_of_type_named("full_path_label"); m_ok_button = *main_widget.find_descendant_of_type_named("ok_button"); + m_ok_button->set_default(true); m_ok_button->on_click = [this](auto) { do_create_project(); };