Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qwindowsiconengine.cpp
Go to the documentation of this file.
1
// Copyright (C) 2023 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
"qwindowsiconengine.h"
6
7
#
ifndef
QT_NO_ICON
8
9
#
include
<
QtCore
/
qoperatingsystemversion
.
h
>
10
#
include
<
QtGui
/
qguiapplication
.
h
>
11
#
include
<
QtGui
/
qpainter
.
h
>
12
#
include
<
QtGui
/
qpalette
.
h
>
13
14
QT_BEGIN_NAMESPACE
15
16
using
namespace
Qt::StringLiterals;
17
18
static
QString
getGlyphs
(QStringView iconName)
19
{
20
static
constexpr
std::pair<QLatin1StringView, QStringView> glyphMap[] = {
21
{
"address-book-new"_L1
, u"\ue780"},
22
{
"application-exit"_L1
, u"\ue8bb"},
23
{
"appointment-new"_L1
, u"\ue878"},
24
{
"call-start"_L1
, u"\uf715"},
25
{
"call-stop"_L1
, u"\uf405"},
26
{
"contact-new"_L1
, u"\ue8fa"},
27
{
"document-new"_L1
, u"\ue8a5"},
28
{
"document-open"_L1
, u"\ue8e5"},
29
{
"document-open-recent"_L1
, u"\ue823"},
30
{
"document-page-setup"_L1
, u"\ue7c3"},
31
{
"document-print"_L1
, u"\ue749"},
32
{
"document-print-preview"_L1
, u"\ue956"},
33
{
"document-properties"_L1
, u"\ue90f"},
34
{
"document-revert"_L1
, u"\ue7a7"},
// ?
35
{
"document-save"_L1
, u"\ue74e"},
// or e78c?
36
{
"document-save-as"_L1
, u"\ue792"},
37
{
"document-send"_L1
, u"\ue724"},
38
{
"edit-clear"_L1
, u"\ue894"},
39
{
"edit-copy"_L1
, u"\ue8c8"},
40
{
"edit-cut"_L1
, u"\ue8c6"},
41
{
"edit-delete"_L1
, u"\ue74d"},
42
{
"edit-find"_L1
, u"\ue721"},
43
//{"edit-find-replace"_L1, u"\u"},
44
{
"edit-paste"_L1
, u"\ue77f"},
45
{
"edit-redo"_L1
, u"\ue7a6"},
46
{
"edit-select-all"_L1
, u"\ue8b3"},
47
{
"edit-undo"_L1
, u"\ue7a7"},
48
{
"folder-new"_L1
, u"\ue8f4"},
49
//{"format-indent-less"_L1, u"\u"},
50
//{"format-indent-more"_L1, u"\u"},
51
{
"format-justify-center"_L1
, u"\ue8e3"},
52
//{"format-justify-fill"_L1, u"\ue235"},
53
{
"format-justify-left"_L1
, u"\ue8e4"},
54
{
"format-justify-right"_L1
, u"\ue8e2"},
55
{
"format-text-direction-ltr"_L1
, u"\ue9aa"},
56
{
"format-text-direction-rtl"_L1
, u"\ue9ab"},
57
{
"format-text-bold"_L1
, u"\ue8dd"},
58
{
"format-text-italic"_L1
, u"\ue8db"},
59
{
"format-text-underline"_L1
, u"\ue8dc"},
60
{
"format-text-strikethrough"_L1
, u"\uede0"},
61
//{"go-bottom"_L1,u"\ue258"},
62
{
"go-down"_L1
,u"\ue74b"},
63
//{"go-first"_L1, u"\ue5dc"},
64
{
"go-home"_L1
, u"\ue80f"},
65
// {"go-jump"_L1, u"\uf719"},
66
//{"go-last"_L1, u"\ue5dd"},
67
{
"go-next"_L1
, u"\ue72a"},
68
{
"go-previous"_L1
, u"\ue72b"},
69
//{"go-top"_L1, u"\ue25a"},
70
{
"go-up"_L1
, u"\ue74a"},
71
{
"help-about"_L1
, u"\ue946"},
72
//{"help-contents"_L1, u"\ue8de"},
73
{
"help-faq"_L1
, u"\ue897"},
74
{
"insert-image"_L1
, u"\ue946"},
75
{
"insert-link"_L1
, u"\ue71b"},
76
//{"insert-object"_L1, u"\u"},
77
//{"insert-text"_L1, u"\uf827"},
78
{
"list-add"_L1
, u"\ue710"},
79
{
"list-remove"_L1
, u"\ue738"},
80
{
"mail-forward"_L1
, u"\ue89c"},
81
//{"mail-mark-important"_L1, u"\ue937"},
82
//{"mail-mark-junk"_L1, u"\u"},
83
//{"mail-mark-notjunk"_L1, u"\u"},
84
{
"mail-mark-read"_L1
, u"\ue8c3"},
85
//{"mail-mark-unread"_L1, u"\ue9bc"},
86
{
"mail-message-new"_L1
, u"\ue70f"},
87
{
"mail-reply-all"_L1
, u"\ue8c2"},
88
{
"mail-reply-sender"_L1
, u"\ue8ca"},
89
{
"mail-send"_L1
, u"\ue724"},
90
//{"mail-send-receive"_L1, u"\u"},
91
{
"media-eject"_L1
, u"\uf847"},
92
{
"media-playback-pause"_L1
, u"\ue769"},
93
{
"media-playback-start"_L1
, u"\ue768"},
94
{
"media-playback-stop"_L1
, u"\ue71a"},
95
{
"media-record"_L1
, u"\ue7c8"},
96
{
"media-seek-backward"_L1
, u"\ueb9e"},
97
{
"media-seek-forward"_L1
, u"\ueb9d"},
98
{
"media-skip-backward"_L1
, u"\ue892"},
99
{
"media-skip-forward"_L1
, u"\ue893"},
100
//{"object-flip-horizontal"_L1, u"\u"},
101
//{"object-flip-vertical"_L1, u"\u"},
102
{
"object-rotate-left"_L1
, u"\ue80c"},
103
{
"object-rotate-right"_L1
, u"\ue80d"},
104
{
"process-stop"_L1
, u"\uf140"},
105
{
"system-lock-screen"_L1
, u"\uee3f"},
106
{
"system-log-out"_L1
, u"\uf3b1"},
107
//{"system-run"_L1, u"\u"},
108
{
"system-search"_L1
, u"\ue721"},
109
{
"system-reboot"_L1
, u"\ue777"},
// unsure?
110
{
"system-shutdown"_L1
, u"\ue7e8"},
111
{
"tools-check-spelling"_L1
, u"\uf87b"},
112
{
"view-fullscreen"_L1
, u"\ue740"},
113
{
"view-refresh"_L1
, u"\ue72c"},
114
{
"view-restore"_L1
, u"\ue777"},
115
//{"view-sort-ascending"_L1, u"\ue25a"},
116
//{"view-sort-descending"_L1, u"\ue258"},
117
{
"window-close"_L1
, u"\ue8bb"},
118
{
"window-new"_L1
, u"\ue78b"},
119
{
"zoom-fit-best"_L1
, u"\ue9a6"},
120
{
"zoom-in"_L1
, u"\ue8a3"},
121
{
"zoom-original"_L1
, u"\ue71e"},
122
{
"zoom-out"_L1
, u"\ue71f"},
123
124
{
"process-working"_L1
, u"\ue9f3"},
125
126
{
"accessories-calculator"_L1
, u"\ue8ef"},
127
{
"accessories-character-map"_L1
, u"\uf2b7"},
128
{
"accessories-dictionary"_L1
, u"\ue82d"},
129
//{"accessories-text-editor"_L1, u"\ue262"},
130
{
"help-browser"_L1
, u"\ue897"},
131
{
"multimedia-volume-control"_L1
, u"\ue767"},
132
{
"preferences-desktop-accessibility"_L1
, u"\ue776"},
133
{
"preferences-desktop-font"_L1
, u"\ue8d2"},
134
{
"preferences-desktop-keyboard"_L1
, u"\ue765"},
135
{
"preferences-desktop-locale"_L1
, u"\uf2b7"},
136
//{"preferences-desktop-multimedia"_L1, u"\uea75"},
137
{
"preferences-desktop-screensaver"_L1
, u"\uf182"},
138
//{"preferences-desktop-theme"_L1, u"\uf560"},
139
//{"preferences-desktop-wallpaper"_L1, u"\ue1bc"},
140
{
"system-file-manager"_L1
, u"\uec50"},
141
//{"system-software-install"_L1, u"\ueb71"},
142
{
"system-software-update"_L1
, u"\uecc5"},
143
{
"utilities-system-monitor"_L1
, u"\ue7f4"},
144
{
"utilities-terminal"_L1
, u"\ue756"},
145
146
//{"applications-accessories"_L1, u"\u"},
147
{
"applications-development"_L1
, u"\uec7a"},
148
//{"applications-engineering"_L1, u"\uea3d"},
149
{
"applications-games"_L1
, u"\ue7fc"},
150
//{"applications-graphics"_L1, u"\u"},
151
{
"applications-internet"_L1
, u"\ue774"},
152
{
"applications-multimedia"_L1
, u"\uea69"},
153
//{"applications-office"_L1, u"\u"},
154
//{"applications-other"_L1, u"\u"},
155
//{"applications-science"_L1, u"\uea4b"},
156
{
"applications-system"_L1
, u"\ue770"},
157
//{"applications-utilities"_L1, u"\u"},
158
//{"preferences-desktop"_L1, u"\ueb97"},
159
//{"preferences-desktop-peripherals"_L1, u"\u"},
160
//{"preferences-desktop-personal"_L1, u"\uf835"},
161
//{"preferences-other"_L1, u"\u"},
162
//{"preferences-system"_L1, u"\ue8b8"},
163
//{"preferences-system-network"_L1, u"\ue894"},
164
{
"system-help"_L1
, u"\ue946"},
165
166
{
"audio-card"_L1
, u"\ue8d6"},
167
{
"audio-input-microphone"_L1
, u"\ue720"},
168
{
"battery"_L1
, u"\ue83f"},
169
{
"camera-photo"_L1
, u"\ue722"},
170
{
"camera-video"_L1
, u"\ue714"},
171
{
"camera-web"_L1
, u"\ue8b8"},
172
{
"computer"_L1
, u"\ue7f8"},
// or e7fb?
173
{
"drive-harddisk"_L1
, u"\ueda2"},
174
{
"drive-optical"_L1
, u"\ue958"},
175
//{"drive-removable-media"_L1, u"\u"},
176
//{"input-gaming"_L1, u"\u"},
177
{
"input-keyboard"_L1
, u"\ue92e"},
178
{
"input-mouse"_L1
, u"\ue962"},
179
{
"input-tablet"_L1
, u"\ue70a"},
180
{
"media-flash"_L1
, u"\ue88e"},
181
//{"media-floppy"_L1, u"\u"},
182
{
"media-optical"_L1
, u"\ue958"},
183
{
"media-tape"_L1
, u"\ue96a"},
184
//{"modem"_L1, u"\u"},
185
//{"multimedia-player"_L1, u"\u"},
186
{
"network-wired"_L1
, u"\ue968"},
187
{
"network-wireless"_L1
, u"\ue701"},
188
//{"pda"_L1, u"\u"},
189
{
"phone"_L1
, u"\ue717"},
190
{
"printer"_L1
, u"\ue749"},
191
{
"scanner"_L1
, u"\ue8fe"},
192
//{"video-display"_L1, u"\uf06a"},
193
194
{
"emblem-default"_L1
, u"\uf56d"},
195
{
"emblem-documents"_L1
, u"\ue8a5"},
196
{
"emblem-downloads"_L1
, u"\ue896"},
197
{
"emblem-favorite"_L1
, u"\ue734"},
198
{
"emblem-important"_L1
, u"\ue8c9"},
199
{
"emblem-mail"_L1
, u"\ue715"},
200
{
"emblem-photos"_L1
, u"\ue91b"},
201
//{"emblem-readonly"_L1, u"\u"},
202
{
"emblem-shared"_L1
, u"\ue902"},
203
{
"emblem-symbolic-link"_L1
, u"\ue71b"},
204
{
"emblem-synchronized"_L1
, u"\uedab"},
205
{
"emblem-system"_L1
, u"\ue770"},
206
//{"emblem-unreadable"_L1, u"\u"},
207
208
{
"folder"_L1
, u"\ue8b7"},
209
//{"folder-remote"_L1, u"\u"},
210
//{"network-server"_L1, u"\ue875"},
211
//{"network-workgroup"_L1, u"\ue1a0"},
212
{
"start-here"_L1
, u"\ue8fc"},
// unsure
213
{
"user-bookmarks"_L1
, u"\ue8a4"},
214
//{"user-desktop"_L1, u"\ue30a"},
215
{
"user-home"_L1
, u"\ue80f"},
216
{
"user-trash"_L1
, u"\ue74d"},
217
218
//{"appointment-missed"_L1, u"\ue615"},
219
//{"appointment-soon"_L1, u"\uf540"},
220
{
"audio-volume-high"_L1
, u"\ue995"},
221
{
"audio-volume-low"_L1
, u"\ue993"},
222
{
"audio-volume-medium"_L1
, u"\ue994"},
223
{
"audio-volume-muted"_L1
, u"\ue992"},
224
//{"battery-caution"_L1, u"\ue19c"},
225
{
"battery-low"_L1
, u"\ue851"},
// ?
226
{
"dialog-error"_L1
, u"\ue783"},
227
{
"dialog-information"_L1
, u"\ue946"},
228
//{"dialog-password"_L1, u"\uf042"},
229
{
"dialog-question"_L1
, u"\uf142"},
// unsure
230
{
"dialog-warning"_L1
, u"\ue7ba"},
231
//{"folder-drag-accept"_L1, @u"\ue9a3"},
232
{
"folder-open"_L1
, u"\ue838"},
233
//{"folder-visiting"_L1, u"\ue8a7"},
234
//{"image-loading"_L1, u"\ue41a"},
235
//{"image-missing"_L1, u"\ue3ad"},
236
{
"mail-attachment"_L1
, u"\ue723"},
237
//{"mail-unread"_L1, u"\uf18a"},
238
//{"mail-read"_L1, u"\uf18c"},
239
{
"mail-replied"_L1
, u"\ue8ca"},
240
//{"mail-signed"_L1, u"\u"},
241
//{"mail-signed-verified"_L1, u"\u"},
242
{
"media-playlist-repeat"_L1
, u"\ue8ee"},
243
{
"media-playlist-shuffle"_L1
, u"\ue8b1"},
244
//{"network-error"_L1, u"\uead9"},
245
//{"network-idle"_L1, u"\ue51f"},
246
{
"network-offline"_L1
, u"\uf384"},
247
//{"network-receive"_L1, u"\ue2c0"},
248
//{"network-transmit"_L1, u"\ue2c3"},
249
//{"network-transmit-receive"_L1, u"\uca18"},
250
//{"printer-error"_L1, u"\uf7a0"},
251
//{"printer-printing"_L1, u"\uf7a1"},
252
//{"security-high"_L1, u"\ue32a"},
253
//{"security-medium"_L1, u"\ue9e0"},
254
//{"security-low"_L1, u"\uf012"},
255
//{"software-update-available"_L1, u"\ue923"},
256
//{"software-update-urgent"_L1, u"\uf05a"},
257
{
"sync-error"_L1
, u"\uea6a"},
258
{
"sync-synchronizing"_L1
, u"\ue895"},
259
//{"task-due"_L1, u"\u"},
260
//{"task-past-due"_L1, u"\u"},
261
{
"user-available"_L1
, u"\ue8cf"},
262
//{"user-away"_L1, u"\ue510"},
263
//{"user-idle"_L1, u"\u"},
264
//{"user-offline"_L1, u"\uf7b3"},
265
//{"user-trash-full"_L1, u"\ue872"}, //delete
266
//{"user-trash-full"_L1, u"\ue92b"}, //delete_forever
267
{
"weather-clear"_L1
, u"\ue706"},
268
//{"weather-clear-night"_L1, u"\uf159"},
269
//{"weather-few-clouds"_L1, u"\uf172"},
270
//{"weather-few-clouds-night"_L1, u"\uf174"},
271
//{"weather-fog"_L1, u"\ue818"},
272
{
"weather-overcast"_L1
, u"\ue753"},
273
//{"weather-severe-alert"_L1, u"\ue002"}, //warning
274
//{"weather-showers"_L1, u"\uf176"},
275
//{"weather-showers-scattered"_L1, u"\u"},
276
//{"weather-snow"_L1, u"\ue80f"}, //snowing
277
//{"weather-storm"_L1, u"\uf070"},
278
};
279
280
const
auto
it = std::find_if(std::begin(glyphMap),
281
std::end(glyphMap), [iconName](
const
auto
&c){
282
return
c.first == iconName;
283
});
284
285
return
it != std::end(glyphMap) ? it->second.toString()
286
: (iconName.length() == 1 ? iconName.toString() : QString());
287
}
288
289
namespace
{
290
static
auto
iconFont()
291
{
292
static
const
bool
isWindows11 = QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows11;
293
QFont font(isWindows11 ? u"Segoe Fluent Icons"_s
294
: u"Segoe MDL2 Assets"_s);
295
font.setStyleStrategy(QFont::NoFontMerging);
296
return
font;
297
}
298
}
299
300
QWindowsIconEngine::QWindowsIconEngine(
const
QString &iconName)
301
: QFontIconEngine(iconName, iconFont())
302
, m_glyphs(getGlyphs(iconName))
303
{
304
}
305
306
QWindowsIconEngine::~QWindowsIconEngine()
307
{}
308
309
QString QWindowsIconEngine::key()
const
310
{
311
return
u"QWindowsIconEngine"_s;
312
}
313
314
QIconEngine *QWindowsIconEngine::clone()
const
315
{
316
QWindowsIconEngine *that =
const_cast
<QWindowsIconEngine *>(
this
);
317
return
new
QWindowsIconEngine(that->iconName());
318
}
319
320
QString QWindowsIconEngine::string()
const
321
{
322
return
m_glyphs;
323
}
324
325
QT_END_NAMESPACE
326
327
#
endif
//QT_NO_ICON
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
getGlyphs
static QString getGlyphs(QStringView iconName)
Definition
qwindowsiconengine.cpp:18
qtbase
src
plugins
platforms
windows
qwindowsiconengine.cpp
Generated on
for Qt by
1.18.0