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.cpp
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
7
8#include <QtGui/private/qguiapplication_p.h>
9#include <QtGui/qpa/qplatformtheme.h>
10
11#ifndef QT_NO_SYSTEMTRAYICON
12
14
15/*!
16 \class QPlatformSystemTrayIcon
17 \inmodule QtGui
18 \brief The QPlatformSystemTrayIcon class abstracts the system tray icon and interaction.
19
20 \internal
21 \sa QSystemTrayIcon
22*/
23
24/*!
25 \enum QPlatformSystemTrayIcon::MessageIcon
26
27 This enum describes the icon that is shown when a balloon message is displayed.
28
29 \value NoIcon No icon is shown.
30 \value Information An information icon is shown.
31 \value Warning A standard warning icon is shown.
32 \value Critical A critical warning icon is shown.
33
34 \sa updateIcon(), showMessage(), QMessageBox
35*/
36
37/*!
38 \enum QPlatformSystemTrayIcon::ActivationReason
39
40 This enum describes the reason the system tray was activated.
41
42 \value Unknown Unknown reason
43 \value Context The context menu for the system tray entry was requested
44 \value DoubleClick The system tray entry was double clicked
45 \value Trigger The system tray entry was clicked
46 \value MiddleClick The system tray entry was clicked with the middle mouse button
47
48 \sa activated()
49*/
50
51QPlatformSystemTrayIcon::QPlatformSystemTrayIcon()
52{
53}
54
55QPlatformSystemTrayIcon::~QPlatformSystemTrayIcon()
56{
57}
58
59/*!
60 \fn void QPlatformSystemTrayIcon::init()
61 This method is called to initialize the platform dependent implementation.
62*/
63
64/*!
65 \fn void QPlatformSystemTrayIcon::cleanup()
66 This method is called to cleanup the platform dependent implementation.
67*/
68
69/*!
70 \fn void QPlatformSystemTrayIcon::updateIcon(const QIcon &icon)
71 This method is called when the \a icon did change.
72*/
73
74/*!
75 \fn void QPlatformSystemTrayIcon::updateToolTip(const QString &tooltip)
76 This method is called when the \a tooltip text did change.
77*/
78
79/*!
80 \fn void QPlatformSystemTrayIcon::updateMenu(QPlatformMenu *menu)
81 This method is called when the system tray \a menu did change.
82*/
83
84/*!
85 \fn QRect QPlatformSystemTrayIcon::geometry() const
86 This method returns the geometry of the platform dependent system tray icon on the screen.
87*/
88
89/*!
90 \fn void QPlatformSystemTrayIcon::showMessage(const QString &title, const QString &msg,
91 const QIcon &icon, MessageIcon iconType, int msecs)
92 Shows a balloon message for the entry with the given \a title, message \a msg and \a icon for
93 the time specified in \a msecs. \a iconType is used as a hint for the implementing platform.
94 \sa QSystemTrayIcon::showMessage()
95*/
96
97/*!
98 \fn bool QPlatformSystemTrayIcon::isSystemTrayAvailable() const
99 Returns \c true if the system tray is available on the platform.
100*/
101
102/*!
103 \fn bool QPlatformSystemTrayIcon::supportsMessages() const
104 Returns \c true if the system tray supports messages on the platform.
105*/
106
107/*!
108 \fn void QPlatformSystemTrayIcon::contextMenuRequested(QPoint globalPos, const QPlatformScreen *screen)
109 This signal is emitted when the context menu is requested.
110 In particular, on platforms where createMenu() returns nullptr,
111 its emission will cause QSystemTrayIcon to show a QMenu-based menu.
112 \sa activated()
113 \since 5.10
114*/
115
116/*!
117 \fn void QPlatformSystemTrayIcon::activated(QPlatformSystemTrayIcon::ActivationReason reason)
118 This signal is emitted when the user activates the system tray icon.
119 \a reason specifies the reason for activation.
120 \sa QSystemTrayIcon::ActivationReason, contextMenuRequested()
121*/
122
123/*!
124 \fn void QPlatformSystemTrayIcon::messageClicked()
125
126 This signal is emitted when the message displayed using showMessage()
127 was clicked by the user.
128
129 \sa activated()
130*/
131
132/*!
133 This method allows platforms to use a different QPlatformMenu for system
134 tray menus than what would normally be used for e.g. menu bars. The default
135 implementation falls back to a platform menu created by the platform theme,
136 which may be null on platforms without native menus.
137
138 \sa updateMenu()
139 \since 5.3
140 */
141
142QPlatformMenu *QPlatformSystemTrayIcon::createMenu() const
143{
144 return QGuiApplicationPrivate::platformTheme()->createPlatformMenu();
145}
146
147QT_END_NAMESPACE
148
149#include "moc_qplatformsystemtrayicon.cpp"
150
151#endif // QT_NO_SYSTEMTRAYICON
Combined button and popup list for selecting options.