- version 0.1.3 - show context menu on single click
This commit is contained in:
parent
f245f5aef0
commit
f6762c5946
@ -4,7 +4,7 @@
|
|||||||
// App version
|
// App version
|
||||||
#define QBREAK_VERSION_MAJOR 0
|
#define QBREAK_VERSION_MAJOR 0
|
||||||
#define QBREAK_VERSION_MINOR 1
|
#define QBREAK_VERSION_MINOR 1
|
||||||
#define QBREAK_VERSION_SUFFIX 2
|
#define QBREAK_VERSION_SUFFIX 3
|
||||||
|
|
||||||
// How often UI is updated - interval in seconds
|
// How often UI is updated - interval in seconds
|
||||||
#define INTERVAL_UPDATE_UI (60)
|
#define INTERVAL_UPDATE_UI (60)
|
||||||
|
|||||||
@ -252,6 +252,8 @@ void MainWindow::createTrayIcon()
|
|||||||
mTrayIcon->setIcon(getTrayIcon());
|
mTrayIcon->setIcon(getTrayIcon());
|
||||||
mTrayIcon->setToolTip(AppName);
|
mTrayIcon->setToolTip(AppName);
|
||||||
mTrayIcon->show();
|
mTrayIcon->show();
|
||||||
|
connect(mTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
|
||||||
|
this, SLOT(onTrayIconActivated(QSystemTrayIcon::ActivationReason)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int msec2min(int msec)
|
static int msec2min(int msec)
|
||||||
@ -462,3 +464,20 @@ void MainWindow::onExit()
|
|||||||
this->close();
|
this->close();
|
||||||
QApplication::exit();
|
QApplication::exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::onTrayIconActivated(QSystemTrayIcon::ActivationReason reason)
|
||||||
|
{
|
||||||
|
switch(reason)
|
||||||
|
{
|
||||||
|
// Show context menu on single click
|
||||||
|
case QSystemTrayIcon::Trigger:
|
||||||
|
mTrayIcon->contextMenu()->popup(QCursor::pos());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case QSystemTrayIcon::Unknown:
|
||||||
|
case QSystemTrayIcon::Context:
|
||||||
|
case QSystemTrayIcon::DoubleClick:
|
||||||
|
case QSystemTrayIcon::MiddleClick:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -67,5 +67,7 @@ public slots:
|
|||||||
void onSettings();
|
void onSettings();
|
||||||
void onAbout();
|
void onAbout();
|
||||||
void onExit();
|
void onExit();
|
||||||
|
|
||||||
|
void onTrayIconActivated(QSystemTrayIcon::ActivationReason reason);
|
||||||
};
|
};
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user