File indexing completed on 2024-11-10 09:37:55
0001 /* 0002 SPDX-FileCopyrightText: 2013 Martin Klapetek <mklapetek@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #ifndef KICONUTILS_H 0008 #define KICONUTILS_H 0009 0010 #include <kguiaddons_export.h> 0011 0012 #include <QIcon> 0013 0014 /** 0015 * @namespace KIconUtils 0016 * Provides utility functions for icons. 0017 */ 0018 namespace KIconUtils 0019 { 0020 /** 0021 * Adds the \a overlay over the \a icon in the specified \a position 0022 * 0023 * The \a overlay icon is scaled down approx. to 1/3 or 1/4 (depending on the icon size) 0024 * and placed in one of the corners of the base icon. 0025 */ 0026 KGUIADDONS_EXPORT QIcon addOverlay(const QIcon &icon, const QIcon &overlay, Qt::Corner position); 0027 0028 /** 0029 * Adds \a overlays over the \a icon 0030 * 0031 * The \a overlays is a QHash of Qt::Corner and QIcon. The Qt::Corner value 0032 * decides where the overlay icon will be painted, the QIcon value 0033 * is the overlay icon to be painted. 0034 * 0035 * The overlay icon is scaled down to 1/3 or 1/4 (depending on the icon size) 0036 * and placed in one of the corners of the base icon. 0037 */ 0038 KGUIADDONS_EXPORT QIcon addOverlays(const QIcon &icon, const QHash<Qt::Corner, QIcon> &overlays); 0039 0040 /** 0041 * Adds up to four overlays over the @p icon. 0042 * 0043 * The @p overlays is a QStringList of icon names (e.g. the emblems that are drawn on 0044 * icons in Dolphin and KFileWidget, e.g. symlink, un-mounted device ...etc). 0045 * 0046 * Overlays are added in this order: 0047 * - first icon is used to paint an overlay on the bottom-right corner 0048 * - second icon on the bottom-left corner 0049 * - third icon on the top-left corner 0050 * - fourth icon on the top-right corner 0051 * 0052 * Each overlay icon is scaled down to 1/3 or 1/4 (depending on the icon size). 0053 * 0054 * @since 5.90 0055 */ 0056 KGUIADDONS_EXPORT QIcon addOverlays(const QIcon &icon, const QStringList &overlays); 0057 0058 /** 0059 * Adds up to four overlays on the icon constructed from @p iconName. 0060 * 0061 * The @p overlays is a QStringList of icon names (e.g. the emblems that are drawn on 0062 * icons in Dolphin and KFileWidget, e.g. symlink, un-mounted device ...etc). 0063 * 0064 * Overlays are added in this order: 0065 * - first icon is used to paint an overlay on the bottom-right corner 0066 * - second icon on the bottom-left corner 0067 * - third icon on the top-left corner 0068 * - fourth icon on the top-right corner 0069 * 0070 * Each overlay icon is scaled down to 1/3 or 1/4 (depending on the icon size). 0071 * 0072 * All @c QIcon objects are constructed using @c QIcon::fromTheme(). 0073 * 0074 * @since 5.82 0075 */ 0076 KGUIADDONS_EXPORT QIcon addOverlays(const QString &iconName, const QStringList &overlays); 0077 } 0078 0079 #endif // KICONUTILS_H