KIconThemes

kiconengine.h
1/*
2 This file is part of the KDE libraries
3 SPDX-FileCopyrightText: 2006 Hamish Rodda <rodda@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-only
6*/
7
8#ifndef KICONENGINE_H
9#define KICONENGINE_H
10
11#include "kiconthemes_export.h"
12#include <QIconEngine>
13#include <QPointer>
14
15class KIconColors;
16class KIconLoader;
17class KIconEnginePrivate;
18
19/**
20 * @class KIconEngine kiconengine.h KIconEngine
21 *
22 * \short A class to provide rendering of KDE icons.
23 *
24 * Currently, this class is not much more than a wrapper around QIconEngine.
25 * However, it should not be difficult to extend with features such as SVG
26 * rendered icons.
27 *
28 * Icon themes specifying a KDE-Extensions string list setting, will limit
29 * themselves to checking these extensions exclusively, in the order specified
30 * in the setting.
31 *
32 * @author Hamish Rodda <rodda@kde.org>
33 */
34class KICONTHEMES_EXPORT KIconEngine : public QIconEngine // exported for kdelibs4support's KIcon and plasma integration
35{
36public:
37 /**
38 * Constructs an icon engine for a KDE named icon.
39 *
40 * @param iconName the name of the icon to load
41 * @param iconLoader The KDE icon loader that this engine is to use.
42 * @param overlays Add one or more overlays to the icon. See KIconLoader::Overlays.
43 *
44 * @sa KIconLoader
45 */
46 KIconEngine(const QString &iconName, KIconLoader *iconLoader, const QStringList &overlays);
47
48 /**
49 * \overload
50 */
51 KIconEngine(const QString &iconName, KIconLoader *iconLoader);
52
53 /**
54 * Constructs an icon engine for a KDE named icon with a specific palette.
55 *
56 * @param iconName the name of the icon to load
57 * @param colors defines the colors we want to be applied on this icon
58 * @param iconLoader The KDE icon loader that this engine is to use.
59 */
60 KIconEngine(const QString &iconName, const KIconColors &colors, KIconLoader *iconLoader);
61
62 /**
63 * Constructs an icon engine for a KDE named icon with a specific palette and overlays.
64 *
65 * @param iconName the name of the icon to load
66 * @param colors defines the colors we want to be applied on this icon
67 * @param iconLoader The KDE icon loader that this engine is to use.
68 * @param overlays Add one or more overlays to the icon. See KIconLoader::Overlays.
69 *
70 * @since 6.1
71 */
72 KIconEngine(const QString &iconName, const KIconColors &colors, KIconLoader *iconLoader, const QStringList &overlays);
73
74 /**
75 * Destructor.
76 */
77 ~KIconEngine() override;
78
79 /// Reimplementation
80 QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
81 /// Reimplementation
82 void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) override;
83 /// Reimplementation
84 QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
85 QPixmap scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale) override;
86
87 /// Reimplementation
88 QString iconName() override;
89 /// Reimplementation
91
92 bool isNull() override;
93
94 QString key() const override;
95 QIconEngine *clone() const override;
96 bool read(QDataStream &in) override;
97 bool write(QDataStream &out) const override;
98
99private:
100 // TODO KF6: move those into the d-pointer
101 QPixmap createPixmap(const QSize &size, qreal scale, QIcon::Mode mode, QIcon::State state);
102 QString mIconName;
103 QStringList mOverlays;
104 KIconEnginePrivate *const d;
105};
106
107#endif
Sepecifies which colors will be used when recoloring icons as its stylesheet.
Definition kiconcolors.h:31
A class to provide rendering of KDE icons.
Definition kiconengine.h:35
QList< QSize > availableSizes(QIcon::Mode mode, QIcon::State state) override
Reimplementation.
Iconloader for KDE.
Definition kiconloader.h:71
virtual QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state)
virtual QIconEngine * clone() const const=0
virtual QString iconName()
virtual bool isNull()
virtual QString key() const const
virtual void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state)=0
virtual QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)
virtual bool read(QDataStream &in)
virtual QPixmap scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale)
virtual bool write(QDataStream &out) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:13:15 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.