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
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();
event->accept();
return;
} else if (event->key() == Qt::Key_Up) {
break;
}
case Qt::Key_Backtab:
case Qt::Key_Up: {
emit selectPreviousCompletion();
event->accept();
return;
break;
}
default:
TextField::keyPressEvent(event);
}
TextField::keyPressEvent(event);
}
void

View file

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