From 0923e2b733a645ba4a3744852c9f260a63ab5e09 Mon Sep 17 00:00:00 2001 From: tux3 Date: Fri, 5 Jun 2015 15:45:43 +0200 Subject: [PATCH] Add quit (CTRL+Q) shortcut to login screen --- src/widget/loginscreen.cpp | 4 +++- src/widget/loginscreen.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/widget/loginscreen.cpp b/src/widget/loginscreen.cpp index d50eace5e..dbaa5e870 100644 --- a/src/widget/loginscreen.cpp +++ b/src/widget/loginscreen.cpp @@ -10,10 +10,12 @@ LoginScreen::LoginScreen(QWidget *parent) : QWidget(parent), - ui(new Ui::LoginScreen) + ui(new Ui::LoginScreen), + quitShortcut{QKeySequence(Qt::CTRL + Qt::Key_Q), this} { ui->setupUi(this); + connect(&quitShortcut, &QShortcut::activated, this, &LoginScreen::close); connect(ui->newProfilePgbtn, &QPushButton::clicked, this, &LoginScreen::onNewProfilePageClicked); connect(ui->loginPgbtn, &QPushButton::clicked, this, &LoginScreen::onLoginPageClicked); connect(ui->createAccountButton, &QPushButton::clicked, this, &LoginScreen::onCreateNewProfile); diff --git a/src/widget/loginscreen.h b/src/widget/loginscreen.h index 9782ce68e..4bb53d6cc 100644 --- a/src/widget/loginscreen.h +++ b/src/widget/loginscreen.h @@ -2,6 +2,7 @@ #define LOGINSCREEN_H #include +#include namespace Ui { class LoginScreen; @@ -29,6 +30,7 @@ private slots: private: Ui::LoginScreen *ui; + QShortcut quitShortcut; }; #endif // LOGINSCREEN_H