Fixes to ctrl+backspace behavior (#5013)

This commit is contained in:
Herman Stornes
2023-12-16 14:40:05 +01:00
committed by GitHub
parent 918b8ca4bd
commit b78b57b454
7 changed files with 44 additions and 4 deletions
+16
View File
@@ -227,6 +227,7 @@ EmotePopup::EmotePopup(QWidget *parent)
this->search_->setClearButtonEnabled(true);
this->search_->findChild<QAbstractButton *>()->setIcon(
QPixmap(":/buttons/clearSearch.png"));
this->search_->installEventFilter(this);
layout2->addWidget(this->search_);
layout->addLayout(layout2);
@@ -448,6 +449,21 @@ void EmotePopup::loadChannel(ChannelPtr channel)
}
}
bool EmotePopup::eventFilter(QObject *object, QEvent *event)
{
if (object == this->search_ && event->type() == QEvent::KeyPress)
{
auto *keyEvent = dynamic_cast<QKeyEvent *>(event);
if (keyEvent == QKeySequence::DeleteStartOfWord &&
this->search_->selectionLength() > 0)
{
this->search_->backspace();
return true;
}
}
return false;
}
void EmotePopup::filterTwitchEmotes(std::shared_ptr<Channel> searchChannel,
const QString &searchText)
{