Merge pull request #3532 from rukai/enterOpenGame

Qt - Enter key opens selected game in the game list.
This commit is contained in:
Matthew Parlane 2016-05-11 08:45:29 +12:00
commit 670a1c2694
2 changed files with 10 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#include <QDesktopServices> #include <QDesktopServices>
#include <QHeaderView> #include <QHeaderView>
#include <QKeyEvent>
#include <QMenu> #include <QMenu>
#include <QUrl> #include <QUrl>
@ -164,3 +165,10 @@ void GameList::ConsiderViewChange()
setCurrentWidget(m_empty); setCurrentWidget(m_empty);
} }
} }
void GameList::keyReleaseEvent(QKeyEvent* event)
{
if (event->key() == Qt::Key_Return)
emit GameSelected();
else
QStackedWidget::keyReleaseEvent(event);
}

View File

@ -55,4 +55,6 @@ private:
QTableView* m_table; QTableView* m_table;
QLabel* m_empty; QLabel* m_empty;
bool m_prefer_table; bool m_prefer_table;
protected:
void keyReleaseEvent(QKeyEvent* event) override;
}; };