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_qpa.cpp
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
#
include
"qsystemtrayicon_p.h"
6
7
#
include
<
QtGui
/
qpa
/
qplatformsystemtrayicon
.
h
>
8
#
include
<
qpa
/
qplatformtheme
.
h
>
9
#
include
<
private
/
qguiapplication_p
.
h
>
10
#
include
<
private
/
qhighdpiscaling_p
.
h
>
11
12
#
include
<
QApplication
>
13
#
include
<
QStyle
>
14
15
#
ifndef
QT_NO_SYSTEMTRAYICON
16
17
QT_BEGIN_NAMESPACE
18
19
QSystemTrayIconPrivate::QSystemTrayIconPrivate()
20
: qpa_sys(QGuiApplicationPrivate::platformTheme()->createPlatformSystemTrayIcon())
21
, visible(
false
), trayWatcher(
nullptr
)
22
{
23
}
24
25
QSystemTrayIconPrivate
::~
QSystemTrayIconPrivate
()
26
{
27
delete
qpa_sys
;
28
}
29
30
void
QSystemTrayIconPrivate
::
install_sys
()
31
{
32
if
(
qpa_sys
)
33
install_sys_qpa();
34
}
35
36
void
QSystemTrayIconPrivate
::
remove_sys
()
37
{
38
if
(
qpa_sys
)
39
remove_sys_qpa();
40
}
41
42
QRect
QSystemTrayIconPrivate
::
geometry_sys
()
const
43
{
44
if
(!
qpa_sys
)
45
return
QRect();
46
auto
screen = QGuiApplication::primaryScreen();
47
#
if
QT_CONFIG
(
menu
)
48
if
(menu)
49
screen = menu->screen();
50
#
endif
51
return
QHighDpi::fromNativePixels(qpa_sys->geometry(), screen);
52
}
53
54
void
QSystemTrayIconPrivate
::
updateIcon_sys
()
55
{
56
if
(qpa_sys)
57
qpa_sys->updateIcon(icon);
58
}
59
60
void
QSystemTrayIconPrivate
::
updateMenu_sys
()
61
{
62
#
if
QT_CONFIG
(
menu
)
63
if
(qpa_sys) {
64
if
(menu) {
65
addPlatformMenu(menu);
66
qpa_sys->updateMenu(menu->platformMenu());
67
}
else
{
68
qpa_sys->updateMenu(
nullptr
);
69
}
70
}
71
#
endif
72
}
73
74
void
QSystemTrayIconPrivate
::
updateToolTip_sys
()
75
{
76
if
(qpa_sys)
77
qpa_sys->updateToolTip(toolTip);
78
}
79
80
bool
QSystemTrayIconPrivate
::
isSystemTrayAvailable_sys
()
81
{
82
QScopedPointer<QPlatformSystemTrayIcon> sys(QGuiApplicationPrivate::platformTheme()->createPlatformSystemTrayIcon());
83
if
(sys)
84
return
sys->isSystemTrayAvailable();
85
else
86
return
false
;
87
}
88
89
bool
QSystemTrayIconPrivate
::
supportsMessages_sys
()
90
{
91
QScopedPointer<QPlatformSystemTrayIcon> sys(QGuiApplicationPrivate::platformTheme()->createPlatformSystemTrayIcon());
92
if
(sys)
93
return
sys->supportsMessages();
94
else
95
return
false
;
96
}
97
98
void
QSystemTrayIconPrivate
::
showMessage_sys
(
const
QString &title,
const
QString &message,
99
const
QIcon &icon, QSystemTrayIcon::MessageIcon msgIcon,
int
msecs)
100
{
101
if
(
qpa_sys
)
102
qpa_sys
->showMessage(title, message, icon,
103
static_cast
<QPlatformSystemTrayIcon::MessageIcon>(msgIcon), msecs);
104
}
105
106
QT_END_NAMESPACE
107
108
#
endif
// QT_NO_SYSTEMTRAYICON
QSystemTrayIconPrivate
Definition
qsystemtrayicon_p.h:44
QSystemTrayIconPrivate::updateIcon_sys
void updateIcon_sys()
Definition
qsystemtrayicon_qpa.cpp:54
QSystemTrayIconPrivate::isSystemTrayAvailable_sys
static bool isSystemTrayAvailable_sys()
Definition
qsystemtrayicon_qpa.cpp:80
QSystemTrayIconPrivate::remove_sys
void remove_sys()
Definition
qsystemtrayicon_qpa.cpp:36
QSystemTrayIconPrivate::~QSystemTrayIconPrivate
~QSystemTrayIconPrivate()
Definition
qsystemtrayicon_qpa.cpp:25
QSystemTrayIconPrivate::updateMenu_sys
void updateMenu_sys()
Definition
qsystemtrayicon_qpa.cpp:60
QSystemTrayIconPrivate::install_sys
void install_sys()
Definition
qsystemtrayicon_qpa.cpp:30
QSystemTrayIconPrivate::updateToolTip_sys
void updateToolTip_sys()
Definition
qsystemtrayicon_qpa.cpp:74
QSystemTrayIconPrivate::geometry_sys
QRect geometry_sys() const
Definition
qsystemtrayicon_qpa.cpp:42
QSystemTrayIconPrivate::supportsMessages_sys
static bool supportsMessages_sys()
Definition
qsystemtrayicon_qpa.cpp:89
QSystemTrayIconPrivate::qpa_sys
QPlatformSystemTrayIcon * qpa_sys
Definition
qsystemtrayicon_p.h:71
QSystemTrayIconPrivate::showMessage_sys
void showMessage_sys(const QString &title, const QString &msg, const QIcon &icon, QSystemTrayIcon::MessageIcon msgIcon, int msecs)
Definition
qsystemtrayicon_qpa.cpp:98
QPlatformGraphicsBufferHelper
\inmodule QtGui
qtbase
src
widgets
util
qsystemtrayicon_qpa.cpp
Generated on
for Qt by
1.14.0