Qt: Fix hitting enter on game list not launching game

This commit is contained in:
Connor McLaughlin 2020-10-03 11:58:52 +10:00
parent e9e3891f9e
commit e2a4129c30
2 changed files with 6 additions and 6 deletions

View File

@ -68,7 +68,7 @@ void GameListWidget::initialize(QtHostInterface* host_interface)
connect(m_table_view->selectionModel(), &QItemSelectionModel::currentChanged, this, connect(m_table_view->selectionModel(), &QItemSelectionModel::currentChanged, this,
&GameListWidget::onSelectionModelCurrentChanged); &GameListWidget::onSelectionModelCurrentChanged);
connect(m_table_view, &QTableView::doubleClicked, this, &GameListWidget::onTableViewItemDoubleClicked); connect(m_table_view, &QTableView::activated, this, &GameListWidget::onTableViewItemActivated);
connect(m_table_view, &QTableView::customContextMenuRequested, this, connect(m_table_view, &QTableView::customContextMenuRequested, this,
&GameListWidget::onTableViewContextMenuRequested); &GameListWidget::onTableViewContextMenuRequested);
connect(m_table_view->horizontalHeader(), &QHeaderView::customContextMenuRequested, this, connect(m_table_view->horizontalHeader(), &QHeaderView::customContextMenuRequested, this,
@ -94,7 +94,7 @@ void GameListWidget::initialize(QtHostInterface* host_interface)
&GameListWidget::onSelectionModelCurrentChanged); &GameListWidget::onSelectionModelCurrentChanged);
connect(m_list_view, &GameListGridListView::zoomIn, this, &GameListWidget::gridZoomIn); connect(m_list_view, &GameListGridListView::zoomIn, this, &GameListWidget::gridZoomIn);
connect(m_list_view, &GameListGridListView::zoomOut, this, &GameListWidget::gridZoomOut); connect(m_list_view, &GameListGridListView::zoomOut, this, &GameListWidget::gridZoomOut);
connect(m_list_view, &QListView::doubleClicked, this, &GameListWidget::onListViewItemDoubleClicked); connect(m_list_view, &QListView::activated, this, &GameListWidget::onListViewItemActivated);
connect(m_list_view, &QListView::customContextMenuRequested, this, &GameListWidget::onListViewContextMenuRequested); connect(m_list_view, &QListView::customContextMenuRequested, this, &GameListWidget::onListViewContextMenuRequested);
insertWidget(1, m_list_view); insertWidget(1, m_list_view);
@ -140,7 +140,7 @@ void GameListWidget::onSelectionModelCurrentChanged(const QModelIndex& current,
emit entrySelected(&entry); emit entrySelected(&entry);
} }
void GameListWidget::onTableViewItemDoubleClicked(const QModelIndex& index) void GameListWidget::onTableViewItemActivated(const QModelIndex& index)
{ {
const QModelIndex source_index = m_sort_model->mapToSource(index); const QModelIndex source_index = m_sort_model->mapToSource(index);
if (!source_index.isValid() || source_index.row() >= static_cast<int>(m_game_list->GetEntryCount())) if (!source_index.isValid() || source_index.row() >= static_cast<int>(m_game_list->GetEntryCount()))
@ -159,7 +159,7 @@ void GameListWidget::onTableViewContextMenuRequested(const QPoint& point)
emit entryContextMenuRequested(m_table_view->mapToGlobal(point), entry); emit entryContextMenuRequested(m_table_view->mapToGlobal(point), entry);
} }
void GameListWidget::onListViewItemDoubleClicked(const QModelIndex& index) void GameListWidget::onListViewItemActivated(const QModelIndex& index)
{ {
const QModelIndex source_index = m_sort_model->mapToSource(index); const QModelIndex source_index = m_sort_model->mapToSource(index);
if (!source_index.isValid() || source_index.row() >= static_cast<int>(m_game_list->GetEntryCount())) if (!source_index.isValid() || source_index.row() >= static_cast<int>(m_game_list->GetEntryCount()))

View File

@ -49,11 +49,11 @@ Q_SIGNALS:
private Q_SLOTS: private Q_SLOTS:
void onGameListRefreshed(); void onGameListRefreshed();
void onSelectionModelCurrentChanged(const QModelIndex& current, const QModelIndex& previous); void onSelectionModelCurrentChanged(const QModelIndex& current, const QModelIndex& previous);
void onTableViewItemDoubleClicked(const QModelIndex& index); void onTableViewItemActivated(const QModelIndex& index);
void onTableViewContextMenuRequested(const QPoint& point); void onTableViewContextMenuRequested(const QPoint& point);
void onTableViewHeaderContextMenuRequested(const QPoint& point); void onTableViewHeaderContextMenuRequested(const QPoint& point);
void onTableViewHeaderSortIndicatorChanged(int, Qt::SortOrder); void onTableViewHeaderSortIndicatorChanged(int, Qt::SortOrder);
void onListViewItemDoubleClicked(const QModelIndex& index); void onListViewItemActivated(const QModelIndex& index);
void onListViewContextMenuRequested(const QPoint& point); void onListViewContextMenuRequested(const QPoint& point);
public Q_SLOTS: public Q_SLOTS: