Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Ctrl+Backspace bug after Select All in chat search popup #4536

Merged
merged 4 commits into from
May 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Bugfix: Fixed link tooltips not showing unless the thumbnail setting was enabled. (#4597)
- Bugfix: Domains starting with `http` are now parsed as links again. (#4598)
- Bugfix: Fixed click effects on buttons not being antialiased. (#4473)
- Bugfix: Fixed Ctrl+Backspace not working after Select All in chat search popup. (#4461)
- Dev: Added the ability to control the `followRedirect` mode for requests. (#4594)

## 2.4.3
Expand Down
17 changes: 17 additions & 0 deletions src/widgets/helper/SearchPopup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,22 @@ void SearchPopup::showEvent(QShowEvent *)
this->search();
}

bool SearchPopup::eventFilter(QObject *object, QEvent *event)
{
if (object == this->searchInput_ && event->type() == QEvent::KeyPress)
{
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
Mm2PL marked this conversation as resolved.
Show resolved Hide resolved
if (keyEvent->key() == Qt::Key_Backspace &&
keyEvent->modifiers() == Qt::ControlModifier &&
this->searchInput_->text() == this->searchInput_->selectedText())
{
this->searchInput_->clear();
return true;
}
}
return false;
}

void SearchPopup::search()
{
if (this->snapshot_.size() == 0)
Expand Down Expand Up @@ -279,6 +295,7 @@ void SearchPopup::initLayout()
QPixmap(":/buttons/clearSearch.png"));
QObject::connect(this->searchInput_, &QLineEdit::textChanged,
this, &SearchPopup::search);
this->searchInput_->installEventFilter(this);
}

layout1->addLayout(layout2);
Expand Down
1 change: 1 addition & 0 deletions src/widgets/helper/SearchPopup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class SearchPopup : public BasePopup
protected:
virtual void updateWindowTitle();
void showEvent(QShowEvent *event) override;
bool eventFilter(QObject *object, QEvent *event) override;

private:
void initLayout();
Expand Down