-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrayicon.h
More file actions
48 lines (37 loc) · 1.25 KB
/
trayicon.h
File metadata and controls
48 lines (37 loc) · 1.25 KB
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
42
43
44
45
46
47
48
#ifndef TRAYICON_H
#define TRAYICON_H
#include <QObject>
#include <QSystemTrayIcon>
#include <QMenu>
class TrayIcon : public QObject
{
Q_OBJECT
public:
static TrayIcon *Instance();
explicit TrayIcon(QObject *parent = 0);
private:
static QScopedPointer<TrayIcon> self;
QWidget *mainWidget; //Corresponds to the owning master window
QSystemTrayIcon *trayIcon; //Tray objects
QMenu *menu; //Right-click menu
bool exitDirect;
private slots:
void iconIsActived(QSystemTrayIcon::ActivationReason reason);
public:
bool getVisible() const;
public Q_SLOTS:
//Set whether to exit directly. If not, send a signal to the main interface
void setExitDirect(bool exitDirect);
//Sets the owning master form
void setMainWidget(QWidget *mainWidget);
//Show message
void showMessage(const QString &title, const QString &msg,
QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::Information, int msecs = 5000);
void setIcon(const QString &strIcon);
void setToolTip(const QString &tip);
void setVisible(bool visible);
void closeAll();
Q_SIGNALS:
void trayIconExit();
};
#endif // TRAYICON_H