aboutsummaryrefslogtreecommitdiff
path: root/src/widgets/searchbar.cpp
blob: 4d8ea3a34fb509180bdbb5623b8969d19ab3b33b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "searchbar.hpp"

#include <QKeyEvent>

SearchBar::SearchBar(QWidget *parent) : QLineEdit(parent)
{

}

void SearchBar::keyPressEvent(QKeyEvent *event)
{
    if(event->key() == Qt::Key_Escape) {
        emit this->escapePressed();
    } else {
        QLineEdit::keyPressEvent(event);
    }
}

void SearchBar::keyReleaseEvent(QKeyEvent *event)
{
    if(event->key() == Qt::Key_Escape) {
        // Eat the event
    } else {
        QLineEdit::keyReleaseEvent(event);
    }
}