19#if __has_include(<optional>) && __cplusplus >= 201703L
23#include <kiconthemes_export.h>
30class KIconLoaderPrivate;
86#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(4, 8)
88 KICONTHEMES_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 4, 8,
"Use Place instead"),
89#elif KICONTHEMES_BUILD_DEPRECATED_SINCE(4, 8)
90 FileSystem_DEPRECATED_DO_NOT_USE,
138#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 104)
140 Panel KICONTHEMES_ENUMERATOR_DEPRECATED_VERSION(5, 104,
"Use another group or explicit size"),
142 Panel_DEPRECATED_DO_NOT_USE,
160 SizeSmallMedium = 22,
195 explicit
KIconLoader(const QString &appname = QString(), const QStringList &extraSearchPaths = QStringList(), QObject *parent =
nullptr);
216 void addAppDir(const QString &appname, const QString &themeBaseDir = QString());
246 QPixmap loadIcon(const QString &name,
250 const QStringList &overlays = QStringList(),
251 QString *path_store =
nullptr,
252 bool canReturnNull = false) const;
287 QPixmap loadScaledIcon(const QString &name,
292 const QStringList &overlays = QStringList(),
293 QString *path_store =
nullptr,
294 bool canReturnNull = false) const;
330 QPixmap loadScaledIcon(const QString &name,
333 const QSize &size = {},
335 const QStringList &overlays = QStringList(),
336 QString *path_store =
nullptr,
337 bool canReturnNull =
false)
const;
339#if __has_include(<optional>) && __cplusplus >= 201703L
376 QPixmap loadScaledIcon(
const QString &name,
381 const QStringList &overlays,
384 const std::optional<KIconColors> &colorScheme)
const;
411 const QStringList &overlays = QStringList(),
412 QString *path_store =
nullptr)
const;
423#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 0)
441 KICONTHEMES_DEPRECATED_VERSION(5, 0,
"Use QIcon::fromTheme(const QString&)")
442 QIcon loadIconSet(const QString &name,
KIconLoader::
Group group,
int size = 0,
bool canReturnNull = false);
459 QString
iconPath(
const QString &name,
int group_or_size,
bool canReturnNull =
false)
const;
478 QString
iconPath(
const QString &name,
int group_or_size,
bool canReturnNull, qreal scale)
const;
593 void reconfigure(
const QString &appname,
const QStringList &extraSearchPaths = QStringList());
602#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 82)
610 KICONTHEMES_DEPRECATED_VERSION_BELATED(5, 82, 3, 1,
"No known users")
626 bool hasIcon(
const QString &iconName)
const;
673 KICONTHEMES_DEPRECATED_VERSION(5, 0,
"Use KIconLoader::emitChange(Group)")
674 void newIconLoader();
685 static
void emitChange(
Group group);
691 void iconLoaderSettingsChanged();
698 void iconChanged(
int group);
701 friend class KIconLoaderPrivate;
703 std::unique_ptr<KIconLoaderPrivate> const d;
705 Q_PRIVATE_SLOT(d,
void _k_refreshIcons(
int group))
708#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 63)
717KICONTHEMES_DEPRECATED_VERSION(5, 63,
"See API dox for replacement")
718QPixmap DesktopIcon(const QString &name,
int size = 0,
int state =
KIconLoader::DefaultState, const QStringList &overlays = QStringList());
721#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 0)
728KICONTHEMES_DEPRECATED_VERSION(5, 0,
"Use QIcon::fromTheme(const QString&)")
729QIcon DesktopIconSet(const QString &name,
int size = 0);
732#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 63)
741KICONTHEMES_DEPRECATED_VERSION(5, 63,
"See API dox for replacement")
742QPixmap BarIcon(const QString &name,
int size = 0,
int state =
KIconLoader::DefaultState, const QStringList &overlays = QStringList());
745#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 0)
752KICONTHEMES_DEPRECATED_VERSION(5, 0,
"Use QIcon::fromTheme(const QString&)")
753QIcon BarIconSet(const QString &name,
int size = 0);
756#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 63)
765KICONTHEMES_DEPRECATED_VERSION(5, 63,
"See API dox for replacement")
766QPixmap SmallIcon(const QString &name,
int size = 0,
int state =
KIconLoader::DefaultState, const QStringList &overlays = QStringList());
769#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 0)
776KICONTHEMES_DEPRECATED_VERSION(5, 0,
"Use QIcon::fromTheme(const QString&)")
777QIcon SmallIconSet(const QString &name,
int size = 0);
780#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 63)
789KICONTHEMES_DEPRECATED_VERSION(5, 63,
"See API dox for replacement")
790QPixmap MainBarIcon(const QString &name,
int size = 0,
int state =
KIconLoader::DefaultState, const QStringList &overlays = QStringList());
793#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 0)
800KICONTHEMES_DEPRECATED_VERSION(5, 0,
"Use QIcon::fromTheme(const QString&)")
801QIcon MainBarIconSet(const QString &name,
int size = 0);
804#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 65)
812KICONTHEMES_DEPRECATED_VERSION(5, 65,
"See API dox for replacement")
813QPixmap UserIcon(const QString &name,
int state =
KIconLoader::DefaultState, const QStringList &overlays = QStringList());
816#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 0)
823KICONTHEMES_DEPRECATED_VERSION(5, 0,
"Use QIcon::fromTheme(const QString&)")
824QIcon UserIconSet(const QString &name);
827#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 66)
835KICONTHEMES_DEPRECATED_VERSION(5, 66,
"Use QStyle::pixelMetric or KIconLoader::currentSize")
848KICONTHEMES_EXPORT QIcon
icon(
const QString &iconName,
KIconLoader *iconLoader =
nullptr);
849KICONTHEMES_EXPORT QIcon icon(
const QString &iconName,
const KIconColors &colors,
KIconLoader *iconLoader =
nullptr);
856KICONTHEMES_EXPORT QIcon
icon(
const QString &iconName,
const QStringList &overlays,
KIconLoader *iconLoader =
nullptr);
Sepecifies which colors will be used when recoloring icons as its stylesheet.
Definition kiconcolors.h:31
Applies effects to icons.
Definition kiconeffect.h:40
Iconloader for KDE.
Definition kiconloader.h:74
QStringList queryIconsByContext(int group_or_size, KIconLoader::Context context=KIconLoader::Any) const
Queries all available icons for a specific context.
Group
The group of the icon.
Definition kiconloader.h:125
@ Small
Small icons, e.g. for buttons.
Definition kiconloader.h:137
@ User
User icons.
Definition kiconloader.h:149
@ LastGroup
Last group.
Definition kiconloader.h:147
@ MainToolbar
Main toolbar icons.
Definition kiconloader.h:135
@ Toolbar
Toolbar icons.
Definition kiconloader.h:133
@ Dialog
Icons for use in dialog titles, page lists, etc.
Definition kiconloader.h:145
QStringList queryIcons(int group_or_size, KIconLoader::Context context=KIconLoader::Any) const
Queries all available icons for a specific group, having a specific context.
QIcon icon(const QString &iconName, KIconLoader *iconLoader=nullptr)
Returns a QIcon with an appropriate KIconEngine to perform loading and rendering.
QStringList searchPaths() const
Returns all the search paths for this icon loader, either absolute or relative to GenericDataLocation...
void resetPalette()
Resets the custom palette used by the KIconLoader to use the QGuiApplication::palette() again (and to...
QIcon icon(const QString &iconName, const QStringList &overlays, KIconLoader *iconLoader=nullptr)
Returns a QIcon for the given icon, with additional overlays.
States
Defines the possible states of an icon.
Definition kiconloader.h:175
@ ActiveState
Icon is active.
Definition kiconloader.h:177
@ DisabledState
Icon is disabled.
Definition kiconloader.h:178
@ LastState
Last state (last constant)
Definition kiconloader.h:180
@ DefaultState
The default state.
Definition kiconloader.h:176
@ SelectedState
Icon is selected.
Definition kiconloader.h:179
QString moviePath(const QString &name, KIconLoader::Group group, int size=0) const
Returns the path to an animated icon.
QMovie * loadMovie(const QString &name, KIconLoader::Group group, int size=0, QObject *parent=nullptr) const
Loads an animated icon.
QStringList queryIconsByDir(const QString &iconsDir) const
Returns a list of all icons (*.png or *.xpm extension) in the given directory.
int currentSize(KIconLoader::Group group) const
Returns the current size of the icon group.
StdSizes
These are the standard sizes for icons.
Definition kiconloader.h:156
KPixmapSequence loadPixmapSequence(const QString &iconName, int size=SizeSmall) const
Loads a pixmapSequence given the xdg icon name.
void reconfigure(const QString &appname, const QStringList &extraSearchPaths=QStringList())
Reconfigure the icon loader, for instance to change the associated app name or extra search paths.
KIconTheme * theme() const
Returns a pointer to the current theme.
QPixmap loadMimeTypeIcon(const QString &iconName, KIconLoader::Group group, int size=0, int state=KIconLoader::DefaultState, const QStringList &overlays=QStringList(), QString *path_store=nullptr) const
Loads an icon for a mimetype.
bool hasCustomPalette() const
void drawOverlays(const QStringList &overlays, QPixmap &pixmap, KIconLoader::Group group, int state=KIconLoader::DefaultState) const
Draws overlays on the specified pixmap, it takes the width and height of the pixmap into consideratio...
static QPixmap unknown()
Returns the unknown icon.
QStringList loadAnimated(const QString &name, KIconLoader::Group group, int size=0) const
Loads an animated icon as a series of still frames.
void setCustomPalette(const QPalette &palette)
Sets the colors for this KIconLoader.
KIconEffect * iconEffect() const
Returns a pointer to the KIconEffect object used by the icon loader.
QPalette customPalette() const
The colors that will be used for the svg stylesheet in case the loaded icons are svg-based,...
QString iconPath(const QString &name, int group_or_size, bool canReturnNull, qreal scale) const
Returns the path of an icon.
Context
Defines the context of the icon.
Definition kiconloader.h:81
@ Category
An icon that represents a category.
Definition kiconloader.h:94
@ Emblem
An icon that adds information to an existing icon.
Definition kiconloader.h:95
@ StatusIcon
An icon that represents an event.
Definition kiconloader.h:99
@ Application
An icon that represents an application.
Definition kiconloader.h:84
@ Emote
An icon that expresses an emotion.
Definition kiconloader.h:96
@ Any
Some icon with unknown purpose.
Definition kiconloader.h:82
@ Place
An icon that represents a location (e.g. 'home', 'trash').
Definition kiconloader.h:98
@ MimeType
An icon that represents a mime type (or file type).
Definition kiconloader.h:92
@ Action
An action icon (e.g. 'save', 'print').
Definition kiconloader.h:83
@ International
An icon that represents a country's flag.
Definition kiconloader.h:97
@ Animation
An icon that is animated.
Definition kiconloader.h:93
@ Device
An icon that represents a device.
Definition kiconloader.h:85
Type
The type of the icon.
Definition kiconloader.h:106
@ Fixed
Fixed-size icon.
Definition kiconloader.h:107
@ Scalable
Scalable-size icon.
Definition kiconloader.h:108
@ Threshold
A threshold icon.
Definition kiconloader.h:109
MatchType
The type of a match.
Definition kiconloader.h:116
@ MatchBest
Take the best match if there is no exact match.
Definition kiconloader.h:118
@ MatchExact
Only try to find an exact match.
Definition kiconloader.h:117
QString iconPath(const QString &name, int group_or_size, bool canReturnNull=false) const
Returns the path of an icon.