Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qplatformsystemtrayicon.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// Copyright (C) 2012 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com>
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4// Qt-Security score:significant reason:default
5
6#ifndef QPLATFORMSYSTEMTRAYICON_H
7#define QPLATFORMSYSTEMTRAYICON_H
8
9#include <QtGui/qtguiglobal.h>
10#include <qpa/qplatformscreen.h>
11
12#include <QtCore/qobject.h>
13
14#ifndef QT_NO_SYSTEMTRAYICON
15
16QT_BEGIN_NAMESPACE
17
18class QPlatformMenu;
19class QIcon;
20class QString;
21class QRect;
22
23class Q_GUI_EXPORT QPlatformSystemTrayIcon : public QObject
24{
25 Q_OBJECT
26public:
27 enum ActivationReason {
28 Unknown,
29 Context,
30 DoubleClick,
31 Trigger,
32 MiddleClick
33 };
34 Q_ENUM(ActivationReason)
35
36 enum MessageIcon { NoIcon, Information, Warning, Critical };
37 Q_ENUM(MessageIcon)
38
39 QPlatformSystemTrayIcon();
40 ~QPlatformSystemTrayIcon();
41
42 virtual void init() = 0;
43 virtual void cleanup() = 0;
44 virtual void updateIcon(const QIcon &icon) = 0;
45 virtual void updateToolTip(const QString &tooltip) = 0;
46 virtual void updateMenu(QPlatformMenu *menu) = 0;
47 virtual QRect geometry() const = 0;
48 virtual void showMessage(const QString &title, const QString &msg,
49 const QIcon &icon, MessageIcon iconType, int msecs) = 0;
50
51 virtual bool isSystemTrayAvailable() const = 0;
52 virtual bool supportsMessages() const = 0;
53
54 virtual QPlatformMenu *createMenu() const;
55
56Q_SIGNALS:
57 void activated(QPlatformSystemTrayIcon::ActivationReason reason);
58 void contextMenuRequested(QPoint globalPos, const QPlatformScreen *screen);
59 void messageClicked();
60};
61
62QT_END_NAMESPACE
63
64#endif // QT_NO_SYSTEMTRAYICON
65
66#endif // QSYSTEMTRAYICON_P_H
Combined button and popup list for selecting options.