Default to the first item in room selection menu

- Add backwards navigation with backtab

fixes #316
This commit is contained in:
Konstantinos Sideris 2018-05-03 15:19:28 +03:00
parent f1b355f7a7
commit d6ac72ab3f
2 changed files with 15 additions and 6 deletions

View file

@ -31,17 +31,22 @@ RoomSearchInput::RoomSearchInput(QWidget *parent)
void void
RoomSearchInput::keyPressEvent(QKeyEvent *event) RoomSearchInput::keyPressEvent(QKeyEvent *event)
{ {
if (event->key() == Qt::Key_Tab || event->key() == Qt::Key_Down) { switch (event->key()) {
case Qt::Key_Tab:
case Qt::Key_Down: {
emit selectNextCompletion(); emit selectNextCompletion();
event->accept(); event->accept();
return; break;
} else if (event->key() == Qt::Key_Up) { }
case Qt::Key_Backtab:
case Qt::Key_Up: {
emit selectPreviousCompletion(); emit selectPreviousCompletion();
event->accept(); event->accept();
return; break;
}
default:
TextField::keyPressEvent(event);
} }
TextField::keyPressEvent(event);
} }
void void

View file

@ -136,6 +136,8 @@ SuggestionsPopup::addRooms(const std::vector<RoomSearchResult> &rooms)
adjustSize(); adjustSize();
resize(geometry().width(), 40 * rooms.size()); resize(geometry().width(), 40 * rooms.size());
selectNextSuggestion();
} }
void void
@ -158,6 +160,8 @@ SuggestionsPopup::addUsers(const QVector<SearchResult> &users)
adjustSize(); adjustSize();
resize(geometry().width(), 40 * users.size()); resize(geometry().width(), 40 * users.size());
selectNextSuggestion();
} }
void void