Skip to content

Commit

Permalink
Qt: Set focus to Game Library for improved keyboard navigation (#11719)
Browse files Browse the repository at this point in the history
Improved keyboard navigation. Users can navigate the Library and play/exit games with just the arrow keys and Enter/Esc.
  • Loading branch information
deanff authored Aug 24, 2024
1 parent 517fba3 commit 1131db7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pcsx2-qt/GameList/GameListWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ void GameListWidget::initialize()
else
m_ui.stack->setCurrentIndex(0);

setFocusProxy(m_ui.stack->currentWidget());

updateToolbar();
resizeTableViewColumnsToFit();
}
Expand Down Expand Up @@ -294,7 +296,10 @@ void GameListWidget::onRefreshProgress(const QString& status, int current, int t
{
// switch away from the placeholder while we scan, in case we find anything
if (m_ui.stack->currentIndex() == 2)
{
m_ui.stack->setCurrentIndex(Host::GetBaseBoolSettingValue("UI", "GameListGridView", false) ? 1 : 0);
setFocusProxy(m_ui.stack->currentWidget());
}

m_model->refresh();
emit refreshProgress(status, current, total);
Expand All @@ -312,7 +317,10 @@ void GameListWidget::onRefreshComplete()

// if we still had no games, switch to the helper widget
if (m_model->rowCount() == 0)
{
m_ui.stack->setCurrentIndex(2);
setFocusProxy(nullptr);
}
}

void GameListWidget::onSelectionModelCurrentChanged(const QModelIndex& current, const QModelIndex& previous)
Expand Down Expand Up @@ -436,6 +444,7 @@ void GameListWidget::showGameList()
Host::SetBaseBoolSettingValue("UI", "GameListGridView", false);
Host::CommitBaseSettingChanges();
m_ui.stack->setCurrentIndex(0);
setFocusProxy(m_ui.stack->currentWidget());
resizeTableViewColumnsToFit();
updateToolbar();
emit layoutChange();
Expand All @@ -453,6 +462,7 @@ void GameListWidget::showGameGrid()
Host::SetBaseBoolSettingValue("UI", "GameListGridView", true);
Host::CommitBaseSettingChanges();
m_ui.stack->setCurrentIndex(1);
setFocusProxy(m_ui.stack->currentWidget());
updateToolbar();
emit layoutChange();
}
Expand Down

0 comments on commit 1131db7

Please sign in to comment.