From d5ce8a0f04dfc4d609cfcab75cc53135ba1a9557 Mon Sep 17 00:00:00 2001 From: Oleg Shparber Date: Thu, 5 Oct 2023 02:57:57 -0400 Subject: [PATCH] fix(ui): use async selection in search edit The smart selection logic implemented for #1033, for some reason did not work for Ctrl+K. Calling selectAll() asynchronously fixes that. Related to #703. --- src/libs/ui/widgets/searchedit.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libs/ui/widgets/searchedit.cpp b/src/libs/ui/widgets/searchedit.cpp index 6de7300..fb9590a 100644 --- a/src/libs/ui/widgets/searchedit.cpp +++ b/src/libs/ui/widgets/searchedit.cpp @@ -29,6 +29,7 @@ #include #include #include +#include using namespace Zeal; using namespace Zeal::WidgetUi; @@ -82,7 +83,8 @@ void SearchEdit::selectQuery() return; } - selectAll(); + // Avoid some race condition which breaks Ctrl+K shortcut. + QTimer::singleShot(0, this, &QLineEdit::selectAll); } bool SearchEdit::event(QEvent *event)