7#ifndef KQUICK_ICON_PROVIDER_H
8#define KQUICK_ICON_PROVIDER_H
14#include <QQuickImageProvider>
31 : QQuickImageProvider(QQuickImageProvider::Pixmap)
35 QPixmap requestPixmap(
const QString &
id, QSize *size,
const QSize &requestedSize)
override
38 const QStringList source =
id.split(QLatin1Char(
'/'));
41 if (requestedSize.isValid()) {
42 pixmap = QIcon::fromTheme(source.at(0)).pixmap(requestedSize);
43 }
else if (size->isValid()) {
44 pixmap = QIcon::fromTheme(source.at(0)).pixmap(*size);
49 if (source.size() == 2) {
51 const QString state(source.at(1));
54 if (state == QLatin1String(
"active")) {
56 }
else if (state == QLatin1String(
"disabled")) {
58 }
else if (state == QLatin1String(
"last")) {
66 if (!pixmap.isNull() && size) {
67 *size = pixmap.size();
Applies effects to icons.
Definition kiconeffect.h:40
QImage apply(const QImage &src, int group, int state) const
Applies an effect to an image.
@ Desktop
Desktop icons.
Definition kiconloader.h:129
static KIconLoader * global()
Returns the global icon loader initialized with the application name.
@ 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
KIconEffect * iconEffect() const
Returns a pointer to the KIconEffect object used by the icon loader.
Class which exposes the KIcon* functioality to QML.
Definition kquickiconprovider.h:28