Improve keyboard navigation in game list (#1132)

* Improve keyboard navigation

* don't start game in elf viewer mode or gridview mode with empty item selected

* fix eventFilter return
This commit is contained in:
tGecko 2024-09-28 20:04:47 +02:00 committed by GitHub
parent 7b5d66e5c1
commit dc96338c2e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 67 additions and 38 deletions

View file

@ -41,7 +41,7 @@ GameListFrame::GameListFrame(std::shared_ptr<GameInfoClass> game_info_get, QWidg
this->horizontalHeader()->setSectionResizeMode(3, QHeaderView::Fixed);
PopulateGameList();
connect(this, &QTableWidget::itemClicked, this, &GameListFrame::SetListBackgroundImage);
connect(this, &QTableWidget::currentCellChanged, this, &GameListFrame::onCurrentCellChanged);
connect(this->verticalScrollBar(), &QScrollBar::valueChanged, this,
&GameListFrame::RefreshListBackgroundImage);
connect(this->horizontalScrollBar(), &QScrollBar::valueChanged, this,
@ -69,6 +69,16 @@ GameListFrame::GameListFrame(std::shared_ptr<GameInfoClass> game_info_get, QWidg
});
}
void GameListFrame::onCurrentCellChanged(int currentRow, int currentColumn, int previousRow,
int previousColumn) {
QTableWidgetItem* item = this->item(currentRow, currentColumn);
if (!item) {
return;
}
SetListBackgroundImage(item);
PlayBackgroundMusic(item);
}
void GameListFrame::PlayBackgroundMusic(QTableWidgetItem* item) {
if (!item) {
BackgroundMusicPlayer::getInstance().stopMusic();