Ctrl-Q from the main window quits the application (#69)

Ctrl-Q from the main window now quits the application.

fixes #61
pull/1/head
Max Sandholm 7 years ago committed by mujx
parent ed5a96341b
commit b1214a9ae8
  1. 5
      src/MainWindow.cc
  2. 2
      src/TrayIcon.cc

@ -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…
Cancel
Save