1 | /* |
2 | SPDX-FileCopyrightText: 2013 Martin Klapetek <mklapetek@kde.org> |
3 | |
4 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
5 | */ |
6 | |
7 | #ifndef KICONUTILS_H |
8 | #define KICONUTILS_H |
9 | |
10 | #include <kguiaddons_export.h> |
11 | |
12 | #include <QIcon> |
13 | |
14 | /*! |
15 | * \namespace KIconUtils |
16 | * \inmodule KGuiAddons |
17 | * |
18 | * \brief Provides utility functions for icons. |
19 | */ |
20 | namespace KIconUtils |
21 | { |
22 | /*! |
23 | * Adds the \a overlay over the \a icon in the specified \a position |
24 | * |
25 | * The \a overlay icon is scaled down approx. to 1/3 or 1/4 (depending on the icon size) |
26 | * and placed in one of the corners of the base icon. |
27 | */ |
28 | KGUIADDONS_EXPORT QIcon addOverlay(const QIcon &icon, const QIcon &overlay, Qt::Corner position); |
29 | |
30 | /*! |
31 | * Adds \a overlays over the \a icon |
32 | * |
33 | * The \a overlays is a QHash of Qt::Corner and QIcon. The Qt::Corner value |
34 | * decides where the overlay icon will be painted, the QIcon value |
35 | * is the overlay icon to be painted. |
36 | * |
37 | * The overlay icon is scaled down to 1/3 or 1/4 (depending on the icon size) |
38 | * and placed in one of the corners of the base icon. |
39 | */ |
40 | KGUIADDONS_EXPORT QIcon addOverlays(const QIcon &icon, const QHash<Qt::Corner, QIcon> &overlays); |
41 | |
42 | /*! |
43 | * Adds up to four overlays over the \a icon. |
44 | * |
45 | * The \a overlays is a QStringList of icon names (e.g. the emblems that are drawn on |
46 | * icons in Dolphin and KFileWidget, e.g. symlink, un-mounted device ...etc). |
47 | * |
48 | * Overlays are added in this order: |
49 | * \list |
50 | * \li first icon is used to paint an overlay on the bottom-right corner |
51 | * \li second icon on the bottom-left corner |
52 | * \li third icon on the top-left corner |
53 | * \li fourth icon on the top-right corner |
54 | * \endlist |
55 | * |
56 | * Each overlay icon is scaled down to 1/3 or 1/4 (depending on the icon size). |
57 | * |
58 | * \since 5.90 |
59 | */ |
60 | KGUIADDONS_EXPORT QIcon addOverlays(const QIcon &icon, const QStringList &overlays); |
61 | |
62 | /*! |
63 | * Adds up to four overlays on the icon constructed from \a iconName. |
64 | * |
65 | * The \a overlays is a QStringList of icon names (e.g. the emblems that are drawn on |
66 | * icons in Dolphin and KFileWidget, e.g. symlink, un-mounted device ...etc). |
67 | * |
68 | * Overlays are added in this order: |
69 | * \list |
70 | * \li first icon is used to paint an overlay on the bottom-right corner |
71 | * \li second icon on the bottom-left corner |
72 | * \li third icon on the top-left corner |
73 | * \li fourth icon on the top-right corner |
74 | * \endlist |
75 | * |
76 | * Each overlay icon is scaled down to 1/3 or 1/4 (depending on the icon size). |
77 | * |
78 | * All QIcon objects are constructed using QIcon::fromTheme(). |
79 | * |
80 | * \since 5.82 |
81 | */ |
82 | KGUIADDONS_EXPORT QIcon addOverlays(const QString &iconName, const QStringList &overlays); |
83 | } |
84 | |
85 | #endif // KICONUTILS_H |
86 | |