Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
4#ifndef QSYSTEMTRAYICON_P_H
5#define QSYSTEMTRAYICON_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtWidgets/private/qtwidgetsglobal_p.h>
19#include "qsystemtrayicon.h"
20#include "private/qobject_p.h"
21
22#ifndef QT_NO_SYSTEMTRAYICON
23
24#if QT_CONFIG(menu)
25#include "QtWidgets/qmenu.h"
26#endif
27#include "QtWidgets/qwidget.h"
28#include "QtGui/qpixmap.h"
29#include <qpa/qplatformsystemtrayicon.h>
30#include "QtCore/qstring.h"
31#include "QtCore/qpointer.h"
32
34
38class QToolButton;
39class QLabel;
40
42{
43 Q_DECLARE_PUBLIC(QSystemTrayIcon)
44
45public:
48
49 void install_sys();
50 void remove_sys();
51 void updateIcon_sys();
52 void updateToolTip_sys();
53 void updateMenu_sys();
54 QRect geometry_sys() const;
55 void showMessage_sys(const QString &title, const QString &msg, const QIcon &icon,
56 QSystemTrayIcon::MessageIcon msgIcon, int msecs);
57
58 void destroyIcon();
59
60 static bool isSystemTrayAvailable_sys();
61 static bool supportsMessages_sys();
62
64
65 QPointer<QMenu> menu;
70 bool visible;
72
73private:
74 void install_sys_qpa();
75 void remove_sys_qpa();
76
77 void addPlatformMenu(QMenu *menu) const;
78};
79
80class QBalloonTip : public QWidget
81{
83public:
84 static void showBalloon(const QIcon &icon, const QString &title,
85 const QString &msg, QSystemTrayIcon *trayIcon,
86 const QPoint &pos, int timeout, bool showArrow = true);
87 static void hideBalloon();
88 static bool isBalloonVisible();
89 static void updateBalloonPosition(const QPoint& pos);
90
91private:
92 QBalloonTip(const QIcon &icon, const QString &title,
93 const QString &msg, QSystemTrayIcon *trayIcon);
95 void balloon(const QPoint&, int, bool);
96
97protected:
98 void paintEvent(QPaintEvent *) override;
99 void resizeEvent(QResizeEvent *) override;
100 void mousePressEvent(QMouseEvent *e) override;
101 void timerEvent(QTimerEvent *e) override;
102
103private:
104 QSystemTrayIcon *trayIcon;
105 QPixmap pixmap;
106 int timerId;
107 bool showArrow;
108};
109
111
112#endif // QT_NO_SYSTEMTRAYICON
113
114#endif // QSYSTEMTRAYICON_P_H
115
static void hideBalloon()
static bool isBalloonVisible()
static void updateBalloonPosition(const QPoint &pos)
static void showBalloon(const QIcon &icon, const QString &title, const QString &msg, QSystemTrayIcon *trayIcon, const QPoint &pos, int timeout, bool showArrow=true)
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...
The QIcon class provides scalable icons in different modes and states.
Definition qicon.h:20
The QLabel widget provides a text or image display.
Definition qlabel.h:20
The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus.
Definition qmenu.h:26
\inmodule QtGui
Definition qevent.h:196
The QPaintEvent class contains event parameters for paint events.
Definition qevent.h:486
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
ActivationReason
This enum describes the reason the system tray was activated.
\inmodule QtCore\reentrant
Definition qpoint.h:25
\inmodule QtCore\reentrant
Definition qrect.h:30
The QResizeEvent class contains event parameters for resize events.
Definition qevent.h:548
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
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.
MessageIcon
This enum describes the icon that is shown when a balloon message is displayed.
\inmodule QtCore
Definition qcoreevent.h:366
The QToolButton class provides a quick-access button to commands or options, usually used inside a QT...
Definition qtoolbutton.h:20
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
QPoint pos
the position of the widget within its parent widget
Definition qwidget.h:111
Combined button and popup list for selecting options.
GLbitfield GLuint64 timeout
[4]
#define Q_OBJECT
QString title
[35]