Qt/GameList: Implement SelectionChanged()

This commit is contained in:
spycrab 2017-08-27 13:54:37 +02:00
parent 3f33b95375
commit 4163ee42bc
2 changed files with 9 additions and 0 deletions

View File

@ -74,6 +74,10 @@ void GameList::MakeListView()
m_list->setWordWrap(false);
connect(m_list, &QTableView::customContextMenuRequested, this, &GameList::ShowContextMenu);
connect(m_list->selectionModel(), &QItemSelectionModel::selectionChanged,
[this](const QItemSelection&, const QItemSelection&) {
emit SelectionChanged(GetSelectedGame());
});
m_list->setColumnHidden(GameListModel::COL_PLATFORM, !SConfig::GetInstance().m_showSystemColumn);
m_list->setColumnHidden(GameListModel::COL_ID, !SConfig::GetInstance().m_showIDColumn);
@ -137,6 +141,10 @@ void GameList::MakeGridView()
m_grid->setContextMenuPolicy(Qt::CustomContextMenu);
m_grid->setFrameStyle(QFrame::NoFrame);
connect(m_grid, &QTableView::customContextMenuRequested, this, &GameList::ShowContextMenu);
connect(m_grid->selectionModel(), &QItemSelectionModel::selectionChanged,
[this](const QItemSelection&, const QItemSelection&) {
emit SelectionChanged(GetSelectedGame());
});
}
void GameList::ShowContextMenu(const QPoint&)

View File

@ -32,6 +32,7 @@ signals:
void EmulationStarted();
void EmulationStopped();
void NetPlayHost(const QString& game_id);
void SelectionChanged(QSharedPointer<GameFile> game_file);
private:
void ShowContextMenu(const QPoint&);