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
qsystemtrayicon_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QSYSTEMTRAYICON_P_H
6#define QSYSTEMTRAYICON_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtWidgets/private/qtwidgetsglobal_p.h>
21#include "private/qobject_p.h"
22
23#ifndef QT_NO_SYSTEMTRAYICON
24
25#if QT_CONFIG(menu)
26#include "QtWidgets/qmenu.h"
27#endif
28#include "QtWidgets/qwidget.h"
29#include "QtGui/qpixmap.h"
30#include <qpa/qplatformsystemtrayicon.h>
31#include "QtCore/qbasictimer.h"
32#include "QtCore/qstring.h"
33#include "QtCore/qpointer.h"
34
36
39class QPlatformSystemTrayIcon;
40class QToolButton;
41class QLabel;
42
44{
45 Q_DECLARE_PUBLIC(QSystemTrayIcon)
46
47public:
50
51 void install_sys();
52 void remove_sys();
53 void updateIcon_sys();
54 void updateToolTip_sys();
55 void updateMenu_sys();
56 QRect geometry_sys() const;
57 void showMessage_sys(const QString &title, const QString &msg, const QIcon &icon,
58 QSystemTrayIcon::MessageIcon msgIcon, int msecs);
59
60 void destroyIcon();
61
62 static bool isSystemTrayAvailable_sys();
63 static bool supportsMessages_sys();
64
65 void _q_emitActivated(QPlatformSystemTrayIcon::ActivationReason reason);
66
71 QPlatformSystemTrayIcon *qpa_sys;
72 bool visible;
74
75private:
76 void install_sys_qpa();
77 void remove_sys_qpa();
78
79 void addPlatformMenu(QMenu *menu) const;
80};
81
82class QBalloonTip : public QWidget
83{
85public:
86 static void showBalloon(const QIcon &icon, const QString &title,
88 const QPoint &pos, int timeout, bool showArrow = true);
89 static void hideBalloon();
90 static bool isBalloonVisible();
91 static void updateBalloonPosition(const QPoint& pos);
92
93private:
94 QBalloonTip(const QIcon &icon, const QString &title,
95 const QString &msg, QSystemTrayIcon *trayIcon);
96 ~QBalloonTip();
97 void balloon(const QPoint&, int, bool);
98
99protected:
100 void paintEvent(QPaintEvent *) override;
101 void resizeEvent(QResizeEvent *) override;
102 void mousePressEvent(QMouseEvent *e) override;
103 void timerEvent(QTimerEvent *e) override;
104
105private:
106 QSystemTrayIcon *trayIcon;
107 QPixmap pixmap;
108 QBasicTimer timer;
109 bool showArrow;
110};
111
112QT_END_NAMESPACE
113
114#endif // QT_NO_SYSTEMTRAYICON
115
116#endif // QSYSTEMTRAYICON_P_H
static void hideBalloon()
static bool isBalloonVisible()
static void updateBalloonPosition(const QPoint &pos)
void timerEvent(QTimerEvent *e) override
This event handler can be reimplemented in a subclass to receive timer events for the object.
void mousePressEvent(QMouseEvent *e) override
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events...
void paintEvent(QPaintEvent *) override
This event handler can be reimplemented in a subclass to receive paint events passed in event.
void resizeEvent(QResizeEvent *) override
This event handler can be reimplemented in a subclass to receive widget resize events which are passe...
\inmodule QtGui
Definition qbitmap.h:16
QPainter(QPaintDevice *)
Constructs a painter that begins painting the paint device immediately.
\inmodule QtCore\reentrant
Definition qpoint.h:29
QSystemTrayIconSys * sys
static bool isSystemTrayAvailable_sys()
QSystemTrayWatcher * trayWatcher
void _q_emitActivated(QPlatformSystemTrayIcon::ActivationReason reason)
QPlatformSystemTrayIcon * qpa_sys
void showMessage_sys(const QString &title, const QString &msg, const QIcon &icon, QSystemTrayIcon::MessageIcon msgIcon, int msecs)
The QSystemTrayIcon class provides an icon for an application in the system tray.
static QBalloonTip * theSolitaryBalloonTip