forked from zserge/tray
-
Notifications
You must be signed in to change notification settings - Fork 16
/
QtTrayMenu.h
41 lines (32 loc) · 1.09 KB
/
QtTrayMenu.h
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
36
37
38
39
40
41
#ifndef TRAYMENU_H
#define TRAYMENU_H
#include <QSystemTrayIcon>
#include <QMenu>
#include <QObject>
#include "tray.h"
class QtTrayMenu : public QObject
{
Q_OBJECT
public:
QtTrayMenu();
~QtTrayMenu();
virtual bool eventFilter(QObject *watched, QEvent *event) override;
int init(struct tray *tray);
void update(struct tray *tray);
int loop(int blocking);
void exit();
private:
void createMenu(struct tray_menu_item *items, QMenu *menu);
void onTrayActivated(QSystemTrayIcon::ActivationReason reason);
void onMenuItemTriggered();
QApplication *app;
QSystemTrayIcon *trayIcon;
struct tray *trayStruct;
bool continueRunning;
struct tray_menu_item *getTrayMenuItem(QAction *action);
signals:
void exitRequested();
private slots:
void onExitRequested();
};
#endif // TRAYMENU_H