aboutsummaryrefslogtreecommitdiff
path: root/examples/GuiClient
diff options
context:
space:
mode:
Diffstat (limited to 'examples/GuiClient')
-rw-r--r--examples/GuiClient/mainDialog.cpp17
-rw-r--r--examples/GuiClient/mainDialog.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/examples/GuiClient/mainDialog.cpp b/examples/GuiClient/mainDialog.cpp
index ae12b06a..74635f0f 100644
--- a/examples/GuiClient/mainDialog.cpp
+++ b/examples/GuiClient/mainDialog.cpp
@@ -572,6 +572,10 @@ void mainDialog::createTrayIconAndMenu()
bool check = connect(&m_quitAction, SIGNAL(triggered()), SLOT(action_quit()));
Q_ASSERT(check);
+ check = connect(&m_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
+ SLOT(action_trayIconActivated(QSystemTrayIcon::ActivationReason)));
+ Q_ASSERT(check);
+
m_trayIconMenu.addAction(&m_quitAction);
m_trayIcon.setContextMenu(&m_trayIconMenu);
m_trayIcon.show();
@@ -582,3 +586,16 @@ void mainDialog::closeEvent(QCloseEvent *event)
hide();
event->ignore();
}
+
+void mainDialog::action_trayIconActivated(QSystemTrayIcon::ActivationReason reason)
+{
+ switch(reason)
+ {
+ case QSystemTrayIcon::Trigger:
+ case QSystemTrayIcon::DoubleClick:
+ show();
+ break;
+ default:
+ ;
+ }
+}
diff --git a/examples/GuiClient/mainDialog.h b/examples/GuiClient/mainDialog.h
index 3e675293..39fb903b 100644
--- a/examples/GuiClient/mainDialog.h
+++ b/examples/GuiClient/mainDialog.h
@@ -85,6 +85,7 @@ private slots:
void addAccountToCache();
void action_quit();
+ void action_trayIconActivated(QSystemTrayIcon::ActivationReason reason);
private:
void loadAccounts();