mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Close search popup window on Escape pressed
This commit is contained in:
parent
a3f6d2b773
commit
14eb302c3d
2 changed files with 21 additions and 8 deletions
|
@ -17,6 +17,24 @@ SearchPopup::SearchPopup()
|
|||
this->resize(400, 600);
|
||||
}
|
||||
|
||||
void SearchPopup::setChannel(ChannelPtr channel)
|
||||
{
|
||||
this->snapshot_ = channel->getMessageSnapshot();
|
||||
this->performSearch();
|
||||
|
||||
this->setWindowTitle("Searching in " + channel->getName() + "s history");
|
||||
}
|
||||
|
||||
void SearchPopup::keyPressEvent(QKeyEvent *e)
|
||||
{
|
||||
if (e->key() == Qt::Key_Escape) {
|
||||
this->close();
|
||||
return;
|
||||
}
|
||||
|
||||
BaseWidget::keyPressEvent(e);
|
||||
}
|
||||
|
||||
void SearchPopup::initLayout()
|
||||
{
|
||||
// VBOX
|
||||
|
@ -60,14 +78,6 @@ void SearchPopup::initLayout()
|
|||
}
|
||||
}
|
||||
|
||||
void SearchPopup::setChannel(ChannelPtr channel)
|
||||
{
|
||||
this->snapshot_ = channel->getMessageSnapshot();
|
||||
this->performSearch();
|
||||
|
||||
this->setWindowTitle("Searching in " + channel->getName() + "s history");
|
||||
}
|
||||
|
||||
void SearchPopup::performSearch()
|
||||
{
|
||||
QString text = searchInput_->text();
|
||||
|
|
|
@ -22,6 +22,9 @@ public:
|
|||
|
||||
void setChannel(std::shared_ptr<Channel> channel);
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *e) override;
|
||||
|
||||
private:
|
||||
void initLayout();
|
||||
void performSearch();
|
||||
|
|
Loading…
Reference in a new issue