KIconThemes

kiconengine.h
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 2006 Hamish Rodda <[email protected]>
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 
15 class KIconLoader;
16 
17 /**
18  * @class KIconEngine kiconengine.h KIconEngine
19  *
20  * \short A class to provide rendering of KDE icons.
21  *
22  * Currently, this class is not much more than a wrapper around QIconEngine.
23  * However, it should not be difficult to extend with features such as SVG
24  * rendered icons.
25  *
26  * Icon themes specifying a KDE-Extensions string list setting, will limit
27  * themselves to checking these extensions exclusively, in the order specified
28  * in the setting.
29  *
30  * @author Hamish Rodda <[email protected]>
31  */
32 class KICONTHEMES_EXPORT KIconEngine : public QIconEngine // exported for kdelibs4support's KIcon and plasma integration
33 {
34 public:
35  /**
36  * Constructs an icon engine for a KDE named icon.
37  *
38  * @param iconName the name of the icon to load
39  * @param iconLoader The KDE icon loader that this engine is to use.
40  * @param overlays Add one or more overlays to the icon. See KIconLoader::Overlays.
41  *
42  * @sa KIconLoader
43  */
44  KIconEngine(const QString &iconName, KIconLoader *iconLoader, const QStringList &overlays);
45 
46  /**
47  * \overload
48  */
49  KIconEngine(const QString &iconName, KIconLoader *iconLoader);
50 
51  /**
52  * Destructor.
53  */
54  ~KIconEngine() override;
55 
56  /// Reimplementation
57  QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
58  /// Reimplementation
59  void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) override;
60  /// Reimplementation
61  QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
62  /// Reimplementation
63  QString iconName() const override;
64  /// Reimplementation
65  QList<QSize> availableSizes(QIcon::Mode mode, QIcon::State state) const override;
66 
67  QString key() const override;
68  QIconEngine *clone() const override;
69  bool read(QDataStream &in) override;
70  bool write(QDataStream &out) const override;
71 
72  void virtual_hook(int id, void *data) override;
73 
74 private:
75  // TODO KF6: move those into the d-pointer
76  QPixmap createPixmap(const QSize &size, qreal scale, QIcon::Mode mode, QIcon::State state);
77  QString mIconName;
78  QStringList mOverlays;
79  QPointer<KIconLoader> mIconLoader;
80 };
81 
83 {
84 }
85 
86 #endif
A class to provide rendering of KDE icons.
Definition: kiconengine.h:32
~KIconEngine() override
Destructor.
Definition: kiconengine.h:82
virtual QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state)
virtual void virtual_hook(int id, void *data)
virtual QString key() const const
virtual bool read(QDataStream &in)
virtual QString iconName() const const
virtual QIconEngine * clone() const const =0
virtual void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state)=0
virtual QList< QSize > availableSizes(QIcon::Mode mode, QIcon::State state) const const
virtual QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)
virtual bool write(QDataStream &out) const const
Iconloader for KDE.
Definition: kiconloader.h:67
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Mar 4 2021 22:42:46 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.