Mercurial > trustbridge
changeset 2:cf88cc432b9d
Add quit action
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 10 Feb 2014 16:23:15 +0000 |
parents | 524cd4908656 |
children | b684e25adbbb |
files | ui/mainwindow.cpp ui/mainwindow.h |
diffstat | 2 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/ui/mainwindow.cpp Mon Feb 10 16:14:55 2014 +0000 +++ b/ui/mainwindow.cpp Mon Feb 10 16:23:15 2014 +0000 @@ -6,6 +6,7 @@ #include <QAction> #include <QDialog> #include <QMenu> +#include <QApplication> MainWindow::MainWindow() { createActions(); @@ -45,15 +46,17 @@ { mCheckUpdates = new QAction(tr("Check for Updates"), this); connect(mCheckUpdates, SIGNAL(triggered()), this, SLOT(manualCheck())); + mQuitAction = new QAction(tr("Quit"), this); + connect(mQuitAction, SIGNAL(triggered()), qApp, SLOT(quit())); } void MainWindow::createTrayIcon() { QIcon trayImg = QIcon(":/img/tray_22.png"); - qDebug() << "Creating tray icon"; mTrayMenu = new QMenu(this); mTrayMenu->addAction(mCheckUpdates); + mTrayMenu->addAction(mQuitAction); mTrayIcon = new QSystemTrayIcon(this); mTrayIcon->setContextMenu(mTrayMenu);
--- a/ui/mainwindow.h Mon Feb 10 16:14:55 2014 +0000 +++ b/ui/mainwindow.h Mon Feb 10 16:23:15 2014 +0000 @@ -24,12 +24,14 @@ private: void createTrayIcon(); void createActions(); - + QString mCurMessage; QSystemTrayIcon *mTrayIcon; + QMenu *mTrayMenu; QAction *mCheckUpdates; + QAction *mQuitAction; }; #endif // MAINWINDOW_H