Skip to content

Commit

Permalink
OSX: Fix selecting item with Up/Down keys when searching
Browse files Browse the repository at this point in the history
  • Loading branch information
hluk committed Apr 4, 2019
1 parent d06ffd4 commit d1cf88a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/gui/filterlineedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "gui/icons.h"
#include "gui/filtercompleter.h"

#include <QKeyEvent>
#include <QMenu>
#include <QPainter>
#include <QSettings>
Expand Down Expand Up @@ -172,6 +173,18 @@ void FilterLineEdit::loadSettings()
}
}

void FilterLineEdit::keyPressEvent(QKeyEvent *ke)
{
// Up/Down arrow keys should be passed to item list
// (on OS X this moves text cursor to the beginning/end).
if (ke->key() == Qt::Key_Down || ke->key() == Qt::Key_Up) {
ke->ignore();
return;
}

FancyLineEdit::keyPressEvent(ke);
}

void FilterLineEdit::hideEvent(QHideEvent *event)
{
FancyLineEdit::hideEvent(event);
Expand Down
1 change: 1 addition & 0 deletions src/gui/filterlineedit.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class FilterLineEdit final : public FancyLineEdit
void filterChanged(const QRegExp &);

protected:
void keyPressEvent(QKeyEvent *ke) override;
void hideEvent(QHideEvent *event) override;
void focusInEvent(QFocusEvent *event) override;
void focusOutEvent(QFocusEvent *event) override;
Expand Down

0 comments on commit d1cf88a

Please sign in to comment.