diff --git a/src/LibraryWidget.cpp b/src/LibraryWidget.cpp index 87be2ff..9dcd71e 100644 --- a/src/LibraryWidget.cpp +++ b/src/LibraryWidget.cpp @@ -22,15 +22,26 @@ #include #include #include +#include namespace UDJ{ +bool LibraryWidget::eventFilter(QObject *obj, QEvent *event) { + if (obj->inherits("QLineEdit") && event->type() == QEvent::KeyRelease) + return true; + else + return false; +} + LibraryWidget::LibraryWidget(DataStore* dataStore, QWidget* parent): QWidget(parent), dataStore(dataStore) { libraryView = new LibraryView(dataStore, this); searchEdit = new QLineEdit(this); + + searchEdit->installEventFilter(this); + QLabel *searchLabel = new QLabel(tr("Search:"),this); setFocusPolicy(Qt::TabFocus); diff --git a/src/LibraryWidget.hpp b/src/LibraryWidget.hpp index a399f6f..ff8f10f 100644 --- a/src/LibraryWidget.hpp +++ b/src/LibraryWidget.hpp @@ -74,6 +74,8 @@ Q_OBJECT //@} +protected: + bool eventFilter(QObject *obj, QEvent *event); };