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
5#ifndef QPLATFORMSYSTEMTRAYICON_H
6#define QPLATFORMSYSTEMTRAYICON_H
7
8#include <QtGui/qtguiglobal.h>
9#include <qpa/qplatformscreen.h>
10
11#include <QtCore/qobject.h>
12
13#ifndef QT_NO_SYSTEMTRAYICON
14
15QT_BEGIN_NAMESPACE
16
17class QPlatformMenu;
18class QIcon;
19class QString;
20class QRect;
21
22class Q_GUI_EXPORT QPlatformSystemTrayIcon : public QObject
23{
24 Q_OBJECT
25public:
26 enum ActivationReason {
27 Unknown,
28 Context,
29 DoubleClick,
30 Trigger,
31 MiddleClick
32 };
33 Q_ENUM(ActivationReason)
34
35 enum MessageIcon { NoIcon, Information, Warning, Critical };
36 Q_ENUM(MessageIcon)
37
38 QPlatformSystemTrayIcon();
39 ~QPlatformSystemTrayIcon();
40
41 virtual void init() = 0;
42 virtual void cleanup() = 0;
43 virtual void updateIcon(const QIcon &icon) = 0;
44 virtual void updateToolTip(const QString &tooltip) = 0;
45 virtual void updateMenu(QPlatformMenu *menu) = 0;
46 virtual QRect geometry() const = 0;
47 virtual void showMessage(const QString &title, const QString &msg,
48 const QIcon &icon, MessageIcon iconType, int msecs) = 0;
49
50 virtual bool isSystemTrayAvailable() const = 0;
51 virtual bool supportsMessages() const = 0;
52
53 virtual QPlatformMenu *createMenu() const;
54
55Q_SIGNALS:
56 void activated(QPlatformSystemTrayIcon::ActivationReason reason);
57 void contextMenuRequested(QPoint globalPos, const QPlatformScreen *screen);
58 void messageClicked();
59};
60
61QT_END_NAMESPACE
62
63#endif // QT_NO_SYSTEMTRAYICON
64
65#endif // QSYSTEMTRAYICON_P_H