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
35#include <chrono>
36
37QT_BEGIN_NAMESPACE
38
39class QSystemTrayIconSys;
41class QPlatformSystemTrayIcon;
42class QToolButton;
43class QLabel;
44
46{
47 Q_DECLARE_PUBLIC(QSystemTrayIcon)
48
49public:
52
53 void install_sys();
54 void remove_sys();
55 void updateIcon_sys();
56 void updateToolTip_sys();
57 void updateMenu_sys();
58 QRect geometry_sys() const;
59 void showMessage_sys(const QString &title, const QString &msg, const QIcon &icon,
60 QSystemTrayIcon::MessageIcon msgIcon, std::chrono::milliseconds msecs);
61
62 void destroyIcon();
63
64 static bool isSystemTrayAvailable_sys();
65 static bool supportsMessages_sys();
66
67 void _q_emitActivated(QPlatformSystemTrayIcon::ActivationReason reason);
68
73 QPlatformSystemTrayIcon *qpa_sys;
74 bool visible;
76
77private:
78 void install_sys_qpa();
79 void remove_sys_qpa();
80
81 void addPlatformMenu(QMenu *menu) const;
82};
83
84class QBalloonTip : public QWidget
85{
87public:
88 static void showBalloon(const QIcon &icon, const QString &title,
91 bool showArrow = true);
92 static void hideBalloon();
93 static bool isBalloonVisible();
94 static void updateBalloonPosition(QPoint pos);
95
96private:
97 QBalloonTip(const QIcon &icon, const QString &title,
98 const QString &msg, QSystemTrayIcon *trayIcon);
99 ~QBalloonTip();
100 void balloon(QPoint pos, std::chrono::milliseconds timeout, bool showArrow);
101
102protected:
103 void paintEvent(QPaintEvent *) override;
104 void resizeEvent(QResizeEvent *) override;
105 void mousePressEvent(QMouseEvent *e) override;
106 void timerEvent(QTimerEvent *e) override;
107
108private:
109 QSystemTrayIcon *trayIcon;
110 QPixmap pixmap;
111 QBasicTimer timer;
112 bool showArrow;
113};
114
115QT_END_NAMESPACE
116
117#endif // QT_NO_SYSTEMTRAYICON
118
119#endif // QSYSTEMTRAYICON_P_H
static void hideBalloon()
static bool isBalloonVisible()
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...
static void updateBalloonPosition(QPoint pos)
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:17
QPainter(QPaintDevice *)
Constructs a painter that begins painting the paint device immediately.
\inmodule QtCore\reentrant
Definition qpoint.h:30
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, std::chrono::milliseconds msecs)
The QSystemTrayIcon class provides an icon for an application in the system tray.
static QBalloonTip * theSolitaryBalloonTip