-
Notifications
You must be signed in to change notification settings - Fork 1
/
trayicon.h
78 lines (69 loc) · 1.49 KB
/
trayicon.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef TRAYICON_H
#define TRAYICON_H
#include "libda_global.h"
#include <QtWidgets>
LDA_BEGIN_NAMESPACE
/**
* @brief The TrayIcon class
*/
class LIBDA_SHARED_EXPORT TrayIcon : public QObject
{
Q_OBJECT
public:
explicit TrayIcon(QObject *parent = nullptr);
~TrayIcon();
/**
* @brief Get the tray menu being used.
* @return The menu
*/
QMenu *trayMenu();
/**
* @brief Get tray's title.
* @return The title
*/
QString trayTitle();
QIcon trayIcon();
bool isTrayVisible();
public Q_SLOTS:
/**
* @brief Change the tray's icon.
* @param icon
*/
void setTrayIcon(QIcon icon);
/**
* @brief Change the tray's title.
* @param str
*/
void setTrayTitle(QString str);
/**
* @brief Change the tray's menu to another one.
* @param m
*/
void setTrayMenu(QMenu *m);
/**
* @brief Enable or disable if the menu has to be shown.
* @param enable
*/
void enableContextMenu(bool enable);
/**
* @brief Change tray's visibility.
* @param visible
*/
void setTrayVisible(bool visible);
/**
* @brief Handles tray's activations.
* @param reason
*/
virtual void iconActivated(QSystemTrayIcon::ActivationReason reason);
Q_SIGNALS:
/**
* @brief Emitted on tray icon click.
*/
void clicked();
private:
QSystemTrayIcon *m_trayIcon;
QMenu *m_menu;
bool enabled = true;
};
LDA_END_NAMESPACE
#endif // TRAYICON_H