1/* vi: ts=8 sts=4 sw=4
2
3 This file is part of the KDE project, module kdecore.
4 SPDX-FileCopyrightText: 2000 Geert Jansen <jansen@kde.org>
5 SPDX-FileCopyrightText: 2000 Antonio Larrosa <larrosa@kde.org>
6
7 SPDX-License-Identifier: LGPL-2.0-only
8*/
9
10#ifndef KICONLOADER_H
11#define KICONLOADER_H
12
13#include <QObject>
14#include <QSize>
15#include <QString>
16#include <QStringList>
17#include <memory>
18
19#if __has_include(<optional>) && __cplusplus >= 201703L
20#include <optional>
21#endif
22
23#include <kiconthemes_export.h>
24
25class QIcon;
26class QMovie;
27class QPixmap;
28
29class KIconColors;
30class KIconLoaderPrivate;
31class KIconEffect;
32class KIconTheme;
33
34/**
35 * @class KIconLoader kiconloader.h KIconLoader
36 *
37 * Iconloader for KDE.
38 *
39 * KIconLoader will load the current icon theme and all its base themes.
40 * Icons will be searched in any of these themes. Additionally, it caches
41 * icons and applies effects according to the user's preferences.
42 *
43 * In KDE, it is encouraged to load icons by "Group". An icon group is a
44 * location on the screen where icons are being used. Standard groups are:
45 * Desktop, Toolbar, MainToolbar, Small and Panel. Each group can have some
46 * centrally-configured effects applied to its icons. This makes it possible
47 * to offer a consistent icon look in all KDE applications.
48 *
49 * The standard groups are defined below.
50 *
51 * @li KIconLoader::Desktop: Icons in the iconview of konqueror, kdesktop and similar apps.
52 * @li KIconLoader::Toolbar: Icons in toolbars.
53 * @li KIconLoader::MainToolbar: Icons in the main toolbars.
54 * @li KIconLoader::Small: Various small (typical 16x16) places: titlebars, listviews
55 * and menu entries.
56 * @li KIconLoader::Panel: Icons in kicker's panel
57 *
58 * The icons are stored on disk in an icon theme or in a standalone
59 * directory. The icon theme directories contain multiple sizes and/or
60 * depths for the same icon. The iconloader will load the correct one based
61 * on the icon group and the current theme. Icon themes are stored globally
62 * in share/icons, or, application specific in share/apps/$appdir/icons.
63 *
64 * The standalone directories contain just one version of an icon. The
65 * directories that are searched are: $appdir/pics and $appdir/toolbar.
66 * Icons in these directories can be loaded by using the special group
67 * "User".
68 *
69 */
70class KICONTHEMES_EXPORT KIconLoader : public QObject
71{
72 Q_OBJECT
73
74public:
75 /**
76 * Defines the context of the icon.
77 */
78 enum Context {
79 Any, ///< Some icon with unknown purpose.
80 Action, ///< An action icon (e.g. 'save', 'print').
81 Application, ///< An icon that represents an application.
82 Device, ///< An icon that represents a device.
83 MimeType, ///< An icon that represents a mime type (or file type).
84 Animation, ///< An icon that is animated.
85 Category, ///< An icon that represents a category.
86 Emblem, ///< An icon that adds information to an existing icon.
87 Emote, ///< An icon that expresses an emotion.
88 International, ///< An icon that represents a country's flag.
89 Place, ///< An icon that represents a location (e.g. 'home', 'trash').
90 StatusIcon, ///< An icon that represents an event.
91 };
92 Q_ENUM(Context)
93
94 /**
95 * The type of the icon.
96 */
97 enum Type {
98 Fixed, ///< Fixed-size icon.
99 Scalable, ///< Scalable-size icon.
100 Threshold, ///< A threshold icon.
101 };
102 Q_ENUM(Type)
103
104 /**
105 * The type of a match.
106 */
107 enum MatchType {
108 MatchExact, ///< Only try to find an exact match.
109 MatchBest, ///< Take the best match if there is no exact match.
110 MatchBestOrGreaterSize, ///< Take the best match or the match with a greater size if there is no exact match. @since 6.0
111 };
112 Q_ENUM(MatchType)
113
114 /**
115 * The group of the icon.
116 */
117 enum Group {
118 /// No group
119 NoGroup = -1,
120 /// Desktop icons
121 Desktop = 0,
122 /// First group
123 FirstGroup = 0,
124 /// Toolbar icons
125 Toolbar,
126 /// Main toolbar icons
127 MainToolbar,
128 /// Small icons, e.g. for buttons
129 Small,
130 /// Panel (Plasma Taskbar) icons
131 // TODO KF6: remove this (See https://phabricator.kde.org/T14340)
132 Panel,
133 /// Icons for use in dialog titles, page lists, etc
134 Dialog,
135 /// Last group
136 LastGroup,
137 /// User icons
138 User,
139 };
140 Q_ENUM(Group)
141
142 /**
143 * These are the standard sizes for icons.
144 */
145 enum StdSizes {
146 /// small icons for menu entries
147 SizeSmall = 16,
148 /// slightly larger small icons for toolbars, panels, etc
149 SizeSmallMedium = 22,
150 /// medium sized icons for the desktop
151 SizeMedium = 32,
152 /// large sized icons for the panel
153 SizeLarge = 48,
154 /// huge sized icons for iconviews
155 SizeHuge = 64,
156 /// enormous sized icons for iconviews
157 SizeEnormous = 128,
158 };
159 Q_ENUM(StdSizes)
160
161 /**
162 * Defines the possible states of an icon.
163 */
164 enum States {
165 DefaultState, ///< The default state.
166 ActiveState, ///< Icon is active.
167 DisabledState, ///< Icon is disabled.
168 SelectedState, ///< Icon is selected. @since 5.22
169 LastState, ///< Last state (last constant)
170 };
171 Q_ENUM(States)
172
173 /**
174 * Constructs an iconloader.
175 * @param appname Add the data directories of this application to the
176 * icon search path for the "User" group. The default argument adds the
177 * directories of the current application.
178 * @param extraSearchPaths additional search paths, either absolute or relative to GenericDataLocation
179 *
180 * Usually, you use the default iconloader, which can be accessed via
181 * KIconLoader::global(), so you hardly ever have to create an
182 * iconloader object yourself. That one is the application's iconloader.
183 */
184 explicit KIconLoader(const QString &appname = QString(), const QStringList &extraSearchPaths = QStringList(), QObject *parent = nullptr);
185
186 /**
187 * Cleanup
188 */
189 ~KIconLoader() override;
190
191 /**
192 * Returns the global icon loader initialized with the application name.
193 * @return global icon loader
194 */
195 static KIconLoader *global();
196
197 /**
198 * Adds @p appname to the list of application specific directories with @p themeBaseDir as its base directory.
199 * Assume the icons are in /home/user/app/icons/hicolor/48x48/my_app.png, the base directory would be
200 * /home/user/app/icons; KIconLoader automatically searches @p themeBaseDir + "/hicolor"
201 * This directory must contain a dir structure as defined by the XDG icons specification
202 * @param appname The application name.
203 * @param themeBaseDir The base directory of the application's theme (eg. "/home/user/app/icons")
204 */
205 void addAppDir(const QString &appname, const QString &themeBaseDir = QString());
206
207 /**
208 * Loads an icon. It will try very hard to find an icon which is
209 * suitable. If no exact match is found, a close match is searched.
210 * If neither an exact nor a close match is found, a null pixmap or
211 * the "unknown" pixmap is returned, depending on the value of the
212 * @p canReturnNull parameter.
213 *
214 * @param name The name of the icon, without extension.
215 * @param group The icon group. This will specify the size of and effects to
216 * be applied to the icon.
217 * @param size If nonzero, this overrides the size specified by @p group.
218 * See KIconLoader::StdSizes.
219 * @param state The icon state: @p DefaultState, @p ActiveState or
220 * @p DisabledState. Depending on the user's preferences, the iconloader
221 * may apply a visual effect to hint about its state.
222 * @param overlays a list of emblem icons to overlay, by name
223 * @see drawOverlays
224 * @param path_store If not null, the path of the icon is stored here,
225 * if the icon was found. If the icon was not found @p path_store
226 * is unaltered even if the "unknown" pixmap was returned.
227 * @param canReturnNull Can return a null pixmap? If false, the
228 * "unknown" pixmap is returned when no appropriate icon has been
229 * found. <em>Note:</em> a null pixmap can still be returned in the
230 * event of invalid parameters, such as empty names, negative sizes,
231 * and etc.
232 * @return the QPixmap. Can be null when not found, depending on
233 * @p canReturnNull.
234 */
235 QPixmap loadIcon(const QString &name,
236 KIconLoader::Group group,
237 int size = 0,
238 int state = KIconLoader::DefaultState,
239 const QStringList &overlays = QStringList(),
240 QString *path_store = nullptr,
241 bool canReturnNull = false) const;
242
243 /**
244 * Loads an icon. It will try very hard to find an icon which is
245 * suitable. If no exact match is found, a close match is searched.
246 * If neither an exact nor a close match is found, a null pixmap or
247 * the "unknown" pixmap is returned, depending on the value of the
248 * @p canReturnNull parameter.
249 *
250 * @param name The name of the icon, without extension.
251 * @param group The icon group. This will specify the size of and effects to
252 * be applied to the icon.
253 * @param scale The scale of the icon group to use. If no icon exists in the
254 * scaled group, a 1x icon with its size multiplied by the scale will be
255 * loaded instead.
256 * @param size If nonzero, this overrides the size specified by @p group.
257 * See KIconLoader::StdSizes.
258 * @param state The icon state: @p DefaultState, @p ActiveState or
259 * @p DisabledState. Depending on the user's preferences, the iconloader
260 * may apply a visual effect to hint about its state.
261 * @param overlays a list of emblem icons to overlay, by name
262 * @see drawOverlays
263 * @param path_store If not null, the path of the icon is stored here,
264 * if the icon was found. If the icon was not found @p path_store
265 * is unaltered even if the "unknown" pixmap was returned.
266 * @param canReturnNull Can return a null pixmap? If false, the
267 * "unknown" pixmap is returned when no appropriate icon has been
268 * found. <em>Note:</em> a null pixmap can still be returned in the
269 * event of invalid parameters, such as empty names, negative sizes,
270 * and etc.
271 * @return the QPixmap. Can be null when not found, depending on
272 * @p canReturnNull.
273 * @since 5.48
274 */
275 // TODO KF6 merge loadIcon() and loadScaledIcon()
276 QPixmap loadScaledIcon(const QString &name,
277 KIconLoader::Group group,
278 qreal scale,
279 int size = 0,
280 int state = KIconLoader::DefaultState,
281 const QStringList &overlays = QStringList(),
282 QString *path_store = nullptr,
283 bool canReturnNull = false) const;
284
285 /**
286 * Loads an icon. It will try very hard to find an icon which is
287 * suitable. If no exact match is found, a close match is searched.
288 * If neither an exact nor a close match is found, a null pixmap or
289 * the "unknown" pixmap is returned, depending on the value of the
290 * @p canReturnNull parameter.
291 *
292 * @param name The name of the icon, without extension.
293 * @param group The icon group. This will specify the size of and effects to
294 * be applied to the icon.
295 * @param scale The scale of the icon group to use. If no icon exists in the
296 * scaled group, a 1x icon with its size multiplied by the scale will be
297 * loaded instead.
298 * @param size If nonzero, this overrides the size specified by @p group.
299 * See KIconLoader::StdSizes. The icon will be fit into @p size
300 * without changing the aspect ratio, which particularly matters
301 * for non-square icons.
302 * @param state The icon state: @p DefaultState, @p ActiveState or
303 * @p DisabledState. Depending on the user's preferences, the iconloader
304 * may apply a visual effect to hint about its state.
305 * @param overlays a list of emblem icons to overlay, by name
306 * @see drawOverlays
307 * @param path_store If not null, the path of the icon is stored here,
308 * if the icon was found. If the icon was not found @p path_store
309 * is unaltered even if the "unknown" pixmap was returned.
310 * @param canReturnNull Can return a null pixmap? If false, the
311 * "unknown" pixmap is returned when no appropriate icon has been
312 * found. <em>Note:</em> a null pixmap can still be returned in the
313 * event of invalid parameters, such as empty names, negative sizes,
314 * and etc.
315 * @return the QPixmap. Can be null when not found, depending on
316 * @p canReturnNull.
317 * @since 5.81
318 */
319 QPixmap loadScaledIcon(const QString &name,
320 KIconLoader::Group group,
321 qreal scale,
322 const QSize &size = {},
323 int state = KIconLoader::DefaultState,
324 const QStringList &overlays = QStringList(),
325 QString *path_store = nullptr,
326 bool canReturnNull = false) const;
327
328#if __has_include(<optional>) && __cplusplus >= 201703L
329 /**
330 * Loads an icon. It will try very hard to find an icon which is
331 * suitable. If no exact match is found, a close match is searched.
332 * If neither an exact nor a close match is found, a null pixmap or
333 * the "unknown" pixmap is returned, depending on the value of the
334 * @p canReturnNull parameter.
335 *
336 * @param name The name of the icon, without extension.
337 * @param group The icon group. This will specify the size of and effects to
338 * be applied to the icon.
339 * @param scale The scale of the icon group to use. If no icon exists in the
340 * scaled group, a 1x icon with its size multiplied by the scale will be
341 * loaded instead.
342 * @param size If nonzero, this overrides the size specified by @p group.
343 * See KIconLoader::StdSizes. The icon will be fit into @p size
344 * without changing the aspect ratio, which particularly matters
345 * for non-square icons.
346 * @param state The icon state: @p DefaultState, @p ActiveState or
347 * @p DisabledState. Depending on the user's preferences, the iconloader
348 * may apply a visual effect to hint about its state.
349 * @param overlays a list of emblem icons to overlay, by name
350 * @see drawOverlays
351 * @param path_store If not null, the path of the icon is stored here,
352 * if the icon was found. If the icon was not found @p path_store
353 * is unaltered even if the "unknown" pixmap was returned.
354 * @param canReturnNull Can return a null pixmap? If false, the
355 * "unknown" pixmap is returned when no appropriate icon has been
356 * found. <em>Note:</em> a null pixmap can still be returned in the
357 * event of invalid parameters, such as empty names, negative sizes,
358 * and etc.
359 * @param colorScheme will define the stylesheet used to color this icon.
360 * Note this will only work if @p name is an svg file.
361 * @return the QPixmap. Can be null when not found, depending on
362 * @p canReturnNull.
363 * @since 5.88
364 */
365 QPixmap loadScaledIcon(const QString &name,
366 KIconLoader::Group group,
367 qreal scale,
368 const QSize &size,
369 int state,
370 const QStringList &overlays,
371 QString *path_store,
372 bool canReturnNull,
373 const std::optional<KIconColors> &colorScheme) const;
374#endif
375
376 /**
377 * Loads an icon for a mimetype.
378 * This is basically like loadIcon except that extra desktop themes are loaded if necessary.
379 *
380 * Consider using QIcon::fromTheme() with a fallback to "application-octet-stream" instead.
381 *
382 * @param iconName The name of the icon, without extension, usually from KMimeType.
383 * @param group The icon group. This will specify the size of and effects to
384 * be applied to the icon.
385 * @param size If nonzero, this overrides the size specified by @p group.
386 * See KIconLoader::StdSizes.
387 * @param state The icon state: @p DefaultState, @p ActiveState or
388 * @p DisabledState. Depending on the user's preferences, the iconloader
389 * may apply a visual effect to hint about its state.
390 * @param path_store If not null, the path of the icon is stored here.
391 * @param overlays a list of emblem icons to overlay, by name
392 * @see drawOverlays
393 * @return the QPixmap. Can not be null, the
394 * "unknown" pixmap is returned when no appropriate icon has been found.
395 */
396 QPixmap loadMimeTypeIcon(const QString &iconName,
397 KIconLoader::Group group,
398 int size = 0,
399 int state = KIconLoader::DefaultState,
400 const QStringList &overlays = QStringList(),
401 QString *path_store = nullptr) const;
402
403 /**
404 * Returns the path of an icon.
405 * @param name The name of the icon, without extension. If an absolute
406 * path is supplied for this parameter, iconPath will return it
407 * directly.
408 * @param group_or_size If positive, search icons whose size is
409 * specified by the icon group @p group_or_size. If negative, search
410 * icons whose size is - @p group_or_size.
411 * See KIconLoader::Group and KIconLoader::StdSizes
412 * @param canReturnNull Can return a null string? If not, a path to the
413 * "unknown" icon will be returned.
414 * @return the path of an icon, can be null or the "unknown" icon when
415 * not found, depending on @p canReturnNull.
416 */
417 QString iconPath(const QString &name, int group_or_size, bool canReturnNull = false) const;
418
419 /**
420 * Returns the path of an icon.
421 * @param name The name of the icon, without extension. If an absolute
422 * path is supplied for this parameter, iconPath will return it
423 * directly.
424 * @param group_or_size If positive, search icons whose size is
425 * specified by the icon group @p group_or_size. If negative, search
426 * icons whose size is - @p group_or_size.
427 * See KIconLoader::Group and KIconLoader::StdSizes
428 * @param canReturnNull Can return a null string? If not, a path to the
429 * "unknown" icon will be returned.
430 * @param scale The scale of the icon group.
431 * @return the path of an icon, can be null or the "unknown" icon when
432 * not found, depending on @p canReturnNull.
433 * @since 5.48
434 */
435 // TODO KF6 merge iconPath() with and without "scale" and move that argument after "group_or_size"
436 QString iconPath(const QString &name, int group_or_size, bool canReturnNull, qreal scale) const;
437
438 /**
439 * Loads an animated icon.
440 * @param name The name of the icon.
441 * @param group The icon group. See loadIcon().
442 * @param size Override the default size for @p group.
443 * See KIconLoader::StdSizes.
444 * @param parent The parent object of the returned QMovie.
445 * @return A QMovie object. Can be null if not found or not valid.
446 * Ownership is passed to the caller.
447 */
448 QMovie *loadMovie(const QString &name, KIconLoader::Group group, int size = 0, QObject *parent = nullptr) const;
449
450 /**
451 * Returns the path to an animated icon.
452 * @param name The name of the icon.
453 * @param group The icon group. See loadIcon().
454 * @param size Override the default size for @p group.
455 * See KIconLoader::StdSizes.
456 * @return the full path to the movie, ready to be passed to QMovie's constructor.
457 * Empty string if not found.
458 */
459 QString moviePath(const QString &name, KIconLoader::Group group, int size = 0) const;
460
461 /**
462 * Loads an animated icon as a series of still frames. If you want to load
463 * a .mng animation as QMovie instead, please use loadMovie() instead.
464 * @param name The name of the icon.
465 * @param group The icon group. See loadIcon().
466 * @param size Override the default size for @p group.
467 * See KIconLoader::StdSizes.
468 * @return A QStringList containing the absolute path of all the frames
469 * making up the animation.
470 */
471 QStringList loadAnimated(const QString &name, KIconLoader::Group group, int size = 0) const;
472
473 /**
474 * Queries all available icons for a specific group, having a specific
475 * context.
476 * @param group_or_size If positive, search icons whose size is
477 * specified by the icon group @p group_or_size. If negative, search
478 * icons whose size is - @p group_or_size.
479 * See KIconLoader::Group and KIconLoader::StdSizes
480 * @param context The icon context.
481 * @return a list of all icons
482 */
483 QStringList queryIcons(int group_or_size, KIconLoader::Context context = KIconLoader::Any) const;
484
485 /**
486 * Queries all available icons for a specific context.
487 * @param group_or_size The icon preferred group or size. If available
488 * at this group or size, those icons will be returned, in other case,
489 * icons of undefined size will be returned. Positive numbers are groups,
490 * negative numbers are negated sizes. See KIconLoader::Group and
491 * KIconLoader::StdSizes
492 * @param context The icon context.
493 * @return A QStringList containing the icon names
494 * available for that context
495 */
496 QStringList queryIconsByContext(int group_or_size, KIconLoader::Context context = KIconLoader::Any) const;
497
498 /**
499 * @internal
500 */
501 bool hasContext(KIconLoader::Context context) const;
502
503 /**
504 * Returns a list of all icons (*.png or *.xpm extension) in the
505 * given directory.
506 * @param iconsDir the directory to search in
507 * @return A QStringList containing the icon paths
508 */
509 QStringList queryIconsByDir(const QString &iconsDir) const;
510
511 /**
512 * Returns all the search paths for this icon loader, either absolute or
513 * relative to GenericDataLocation.
514 * Mostly internal (for KIconDialog).
515 * \since 5.0
516 */
517 QStringList searchPaths() const;
518
519 /**
520 * Returns the size of the specified icon group.
521 * Using e.g. KIconLoader::SmallIcon will return 16.
522 * @param group the group to check.
523 * @return the current size for an icon group.
524 */
525 int currentSize(KIconLoader::Group group) const;
526
527 /**
528 * Returns a pointer to the current theme. Can be used to query
529 * available and default sizes for groups.
530 * @note The KIconTheme will change if reconfigure() is called and
531 * therefore it's not recommended to store the pointer anywhere.
532 * @return a pointer to the current theme. 0 if no theme set.
533 */
534 KIconTheme *theme() const;
535
536 /**
537 * Returns a pointer to the KIconEffect object used by the icon loader.
538 * @return the KIconEffect.
539 */
540 KIconEffect *iconEffect() const;
541
542 /**
543 * Reconfigure the icon loader, for instance to change the associated app name or extra search paths.
544 * This also clears the in-memory pixmap cache (even if the appname didn't change, which is useful for unittests)
545 * @param appname the application name (empty for the global iconloader)
546 * @param extraSearchPaths additional search paths, either absolute or relative to GenericDataLocation
547 */
548 void reconfigure(const QString &appname, const QStringList &extraSearchPaths = QStringList());
549
550 /**
551 * Returns the unknown icon. An icon that is used when no other icon
552 * can be found.
553 * @return the unknown pixmap
554 */
555 static QPixmap unknown();
556
557 /**
558 * Draws overlays on the specified pixmap, it takes the width and height
559 * of the pixmap into consideration
560 * @param overlays List of up to 4 overlays to blend over the pixmap. The first overlay
561 * will be in the bottom right corner, followed by bottom left, top left
562 * and top right. An empty QString can be used to leave the specific position
563 * blank.
564 * @param pixmap to draw on
565 * @since 4.7
566 */
567 void drawOverlays(const QStringList &overlays, QPixmap &pixmap, KIconLoader::Group group, int state = KIconLoader::DefaultState) const;
568
569 bool hasIcon(const QString &iconName) const;
570
571 /**
572 * Sets the colors for this KIconLoader.
573 * NOTE: if you set a custom palette, if you are using some colors from
574 * application's palette, you need to track the application palette changes by yourself.
575 * If you no longer wish to use a custom palette, use resetPalette()
576 * @see resetPalette
577 * @since 5.39
578 */
579 void setCustomPalette(const QPalette &palette);
580
581 /**
582 * The colors that will be used for the svg stylesheet in case the
583 * loaded icons are svg-based, icons can be colored in different ways in
584 * different areas of the application
585 * @return the palette, if any, an invalid one if the user didn't set it
586 * @since 5.39
587 */
588 QPalette customPalette() const;
589
590 /**
591 * Resets the custom palette used by the KIconLoader to use the
592 * QGuiApplication::palette() again (and to follow it in case the
593 * application's palette changes)
594 * @since 5.39
595 */
596 void resetPalette();
597
598 /**
599 * @returns whether we have set a custom palette using @f setCustomPalette
600 *
601 * @since 5.85
602 * @see resetPalette, setCustomPalette
603 */
604 bool hasCustomPalette() const;
605
606public Q_SLOTS:
607 // TODO: while marked as deprecated, newIconLoader() is still used:
608 // internally by KIconLoadeer as well as by Plasma's Icons kcm module (state: 5.17)
609 // this needs some further cleanup work before removing it from the API with KICONTHEMES_ENABLE_DEPRECATED_SINCE
610 /**
611 * Re-initialize the global icon loader
612 *
613 * @todo Check deprecation, still used internally.
614 * @deprecated Since 5.0, use emitChange(Group)
615 */
616 KICONTHEMES_DEPRECATED_VERSION(5, 0, "Use KIconLoader::emitChange(Group)") // TODO KF6 remove
617 void newIconLoader();
618
619 /**
620 * Emits an iconChanged() signal on all the KIconLoader instances in the system
621 * indicating that a system's icon group has changed in some way. It will also trigger
622 * a reload in all of them to update to the new theme.
623 *
624 * @p group indicates the group that has changed
625 *
626 * @since 5.0
627 */
628 static void emitChange(Group group);
629
630Q_SIGNALS:
631 /**
632 * Emitted by newIconLoader once the new settings have been loaded
633 */
634 void iconLoaderSettingsChanged();
635
636 /**
637 * Emitted when the system icon theme changes
638 *
639 * @since 5.0
640 */
641 void iconChanged(int group);
642
643private:
644 friend class KIconLoaderPrivate;
645 // @internal the data object
646 std::unique_ptr<KIconLoaderPrivate> const d;
647
648 Q_PRIVATE_SLOT(d, void _k_refreshIcons(int group))
649};
650
651namespace KDE
652{
653/**
654 * \relates KIconLoader
655 * Returns a QIcon with an appropriate
656 * KIconEngine to perform loading and rendering. KIcons thus adhere to
657 * KDE style and effect standards.
658 * @since 5.0
659 */
660KICONTHEMES_EXPORT QIcon icon(const QString &iconName, KIconLoader *iconLoader = nullptr);
661KICONTHEMES_EXPORT QIcon icon(const QString &iconName, const KIconColors &colors, KIconLoader *iconLoader = nullptr);
662
663/**
664 * \relates KIconLoader
665 * Returns a QIcon for the given icon, with additional overlays.
666 * @since 5.0
667 */
668KICONTHEMES_EXPORT QIcon icon(const QString &iconName, const QStringList &overlays, KIconLoader *iconLoader = nullptr);
669
670}
671
672inline KIconLoader::Group &operator++(KIconLoader::Group &group)
673{
674 group = static_cast<KIconLoader::Group>(group + 1);
675 return group;
676}
677inline KIconLoader::Group operator++(KIconLoader::Group &group, int)
678{
679 KIconLoader::Group ret = group;
680 ++group;
681 return ret;
682}
683
684#endif // KICONLOADER_H
685

source code of kiconthemes/src/kiconloader.h