diff --git a/app/dialog/actionsearch/actionsearch.cpp b/app/dialog/actionsearch/actionsearch.cpp index ac632f415..e2732460b 100644 --- a/app/dialog/actionsearch/actionsearch.cpp +++ b/app/dialog/actionsearch/actionsearch.cpp @@ -20,10 +20,10 @@ #include "actionsearch.h" -#include #include -#include #include +#include +#include namespace olive { @@ -228,21 +228,35 @@ void ActionSearch::move_selection_down() { ActionSearchEntry::ActionSearchEntry(QWidget *parent) : QLineEdit(parent) {} -void ActionSearchEntry::keyPressEvent(QKeyEvent * event) { - - // Listen for up/down, otherwise pass the key event to the base class. - - switch (event->key()) { - case Qt::Key_Up: - emit moveSelectionUp(); +bool ActionSearchEntry::event(QEvent *e) +{ + switch (e->type()) { + case QEvent::ShortcutOverride: + switch (static_cast(e)->key()) { + case Qt::Key_Up: + case Qt::Key_Down: + e->accept(); + return true; + } break; - case Qt::Key_Down: - emit moveSelectionDown(); + case QEvent::KeyPress: + // Listen for up/down, otherwise pass the key event to the base class. + switch (static_cast(e)->key()) { + case Qt::Key_Up: + e->accept(); + emit moveSelectionUp(); + return true; + case Qt::Key_Down: + e->accept(); + emit moveSelectionDown(); + return true; + } break; default: - QLineEdit::keyPressEvent(event); + break; } + return QLineEdit::event(e); } ActionSearchList::ActionSearchList(QWidget *parent) : QListWidget(parent) {} diff --git a/app/dialog/actionsearch/actionsearch.h b/app/dialog/actionsearch/actionsearch.h index ecb446955..96829e579 100644 --- a/app/dialog/actionsearch/actionsearch.h +++ b/app/dialog/actionsearch/actionsearch.h @@ -169,7 +169,8 @@ protected: * @brief Override of QLineEdit's key press event that listens for up/down key presses. * @param event */ - void keyPressEvent(QKeyEvent * event); + virtual bool event(QEvent *e) override; + signals: /** * @brief Emitted when the user presses the up arrow key.