Qt/GameList: Implement SelectionChanged()
This commit is contained in:
parent
3f33b95375
commit
4163ee42bc
|
@ -74,6 +74,10 @@ void GameList::MakeListView()
|
||||||
m_list->setWordWrap(false);
|
m_list->setWordWrap(false);
|
||||||
|
|
||||||
connect(m_list, &QTableView::customContextMenuRequested, this, &GameList::ShowContextMenu);
|
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_PLATFORM, !SConfig::GetInstance().m_showSystemColumn);
|
||||||
m_list->setColumnHidden(GameListModel::COL_ID, !SConfig::GetInstance().m_showIDColumn);
|
m_list->setColumnHidden(GameListModel::COL_ID, !SConfig::GetInstance().m_showIDColumn);
|
||||||
|
@ -137,6 +141,10 @@ void GameList::MakeGridView()
|
||||||
m_grid->setContextMenuPolicy(Qt::CustomContextMenu);
|
m_grid->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
m_grid->setFrameStyle(QFrame::NoFrame);
|
m_grid->setFrameStyle(QFrame::NoFrame);
|
||||||
connect(m_grid, &QTableView::customContextMenuRequested, this, &GameList::ShowContextMenu);
|
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&)
|
void GameList::ShowContextMenu(const QPoint&)
|
||||||
|
|
|
@ -32,6 +32,7 @@ signals:
|
||||||
void EmulationStarted();
|
void EmulationStarted();
|
||||||
void EmulationStopped();
|
void EmulationStopped();
|
||||||
void NetPlayHost(const QString& game_id);
|
void NetPlayHost(const QString& game_id);
|
||||||
|
void SelectionChanged(QSharedPointer<GameFile> game_file);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ShowContextMenu(const QPoint&);
|
void ShowContextMenu(const QPoint&);
|
||||||
|
|
Loading…
Reference in New Issue