mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 04:58:49 +03:00
Ctrl-Q from the main window quits the application (#69)
Ctrl-Q from the main window now quits the application. fixes #61
This commit is contained in:
parent
ed5a96341b
commit
b1214a9ae8
2 changed files with 6 additions and 1 deletions
|
@ -22,6 +22,8 @@
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
|
#include <QShortcut>
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
MainWindow *MainWindow::instance_ = nullptr;
|
MainWindow *MainWindow::instance_ = nullptr;
|
||||||
|
|
||||||
|
@ -84,6 +86,9 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
this,
|
this,
|
||||||
SLOT(showChatPage(QString, QString, QString)));
|
SLOT(showChatPage(QString, QString, QString)));
|
||||||
|
|
||||||
|
QShortcut *quitShortcut = new QShortcut(QKeySequence::Quit, this);
|
||||||
|
connect(quitShortcut, &QShortcut::activated, this, QApplication::quit);
|
||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
||||||
if (hasActiveUser()) {
|
if (hasActiveUser()) {
|
||||||
|
|
|
@ -87,7 +87,7 @@ TrayIcon::TrayIcon(const QString &filename, QWidget *parent)
|
||||||
quitAction_ = new QAction(tr("Quit"), parent);
|
quitAction_ = new QAction(tr("Quit"), parent);
|
||||||
|
|
||||||
connect(viewAction_, SIGNAL(triggered()), parent, SLOT(show()));
|
connect(viewAction_, SIGNAL(triggered()), parent, SLOT(show()));
|
||||||
connect(quitAction_, &QAction::triggered, this, [=]() { QApplication::quit(); });
|
connect(quitAction_, &QAction::triggered, this, QApplication::quit);
|
||||||
|
|
||||||
menu->addAction(viewAction_);
|
menu->addAction(viewAction_);
|
||||||
menu->addAction(quitAction_);
|
menu->addAction(quitAction_);
|
||||||
|
|
Loading…
Reference in a new issue