-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSystemTrayIcon.cpp
35 lines (28 loc) · 964 Bytes
/
SystemTrayIcon.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "SystemTrayIcon.h"
#include "DBApi.h"
#define SIGNUM(x) ((x > 0) - (x < 0))
SystemTrayIcon::SystemTrayIcon(QObject *parent) : QSystemTrayIcon(parent) {
connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(onActivated(QSystemTrayIcon::ActivationReason)));
}
bool SystemTrayIcon::event(QEvent *event) {
if (event->type() == QEvent::Wheel) {
QWheelEvent *wheelevent = (QWheelEvent *)event;
// TODO
//emit wheelScroll(SIGNUM(wheelevent->delta()));
event->accept();
return true;
}
else
return QSystemTrayIcon::event(event);
}
void SystemTrayIcon::onActivated(QSystemTrayIcon::ActivationReason reason) {
if (reason == QSystemTrayIcon::Trigger) {
emit singleClick();
}
else if (reason == QSystemTrayIcon::DoubleClick) {
emit doubleClick();
}
else if (reason == QSystemTrayIcon::MiddleClick) {
emit middleClick();
}
}