Skip to content

Commit

Permalink
fix(ui): use async selection in search edit
Browse files Browse the repository at this point in the history
The smart selection logic implemented for #1033, for some reason
did not work for Ctrl+K. Calling selectAll() asynchronously
fixes that.

Related to #703.
  • Loading branch information
trollixx committed Oct 5, 2023
1 parent 1d92d3c commit d5ce8a0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/libs/ui/widgets/searchedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <QKeyEvent>
#include <QLabel>
#include <QStyle>
#include <QTimer>

using namespace Zeal;
using namespace Zeal::WidgetUi;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d5ce8a0

Please sign in to comment.