From 75ec461eeaa851cb5c53f4cfffc434e3e529ed1d Mon Sep 17 00:00:00 2001 From: "Felix (xq) Queißner" Date: Mon, 22 Jun 2020 21:10:04 +0200 Subject: Restructures the project source and cleans up a bit --- src/widgets/searchbar.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/widgets/searchbar.cpp (limited to 'src/widgets/searchbar.cpp') diff --git a/src/widgets/searchbar.cpp b/src/widgets/searchbar.cpp new file mode 100644 index 0000000..4d8ea3a --- /dev/null +++ b/src/widgets/searchbar.cpp @@ -0,0 +1,26 @@ +#include "searchbar.hpp" + +#include + +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); + } +} -- cgit v1.2.3