File indexing completed on 2025-04-27 04:08:15
0001 /* 0002 * SPDX-FileCopyrightText: 2017 Boudewijn Rempt <boud@valdyas.org> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "IconImageProvider.h" 0008 #include <QDebug> 0009 #include "kis_icon_utils.h" 0010 0011 IconImageProvider::IconImageProvider() 0012 : QQuickImageProvider(QQuickImageProvider::Image) 0013 { 0014 } 0015 0016 0017 QImage IconImageProvider::requestImage(const QString &id, QSize */*size*/, const QSize &requestedSize) 0018 { 0019 QIcon icon = KisIconUtils::loadIcon(id); 0020 QSize properSize = QSize(10, 10); 0021 if (requestedSize.isValid()) { 0022 properSize = requestedSize; 0023 } 0024 if (!icon.isNull()) { 0025 return icon.pixmap(properSize).toImage(); 0026 } 0027 return QImage(properSize, QImage::Format_ARGB32); 0028 }