1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include <qiconengineplugin.h>
5#include <qstringlist.h>
6
7#include "qsvgiconengine.h"
8
9#include <qiodevice.h>
10#include <qbytearray.h>
11#include <qdebug.h>
12
13QT_BEGIN_NAMESPACE
14
15class QSvgIconPlugin : public QIconEnginePlugin
16{
17 Q_OBJECT
18#ifndef QT_NO_COMPRESS
19 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QIconEngineFactoryInterface" FILE "qsvgiconengine.json")
20#else
21 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QIconEngineFactoryInterface" FILE "qsvgiconengine-nocompress.json")
22#endif
23
24public:
25 QIconEngine *create(const QString &filename = QString()) override;
26};
27
28QIconEngine *QSvgIconPlugin::create(const QString &file)
29{
30 QSvgIconEngine *engine = new QSvgIconEngine;
31 if (!file.isNull())
32 engine->addFile(fileName: file, size: QSize(), mode: QIcon::Normal, state: QIcon::Off);
33 return engine;
34}
35
36QT_END_NAMESPACE
37
38#include "main.moc"
39

source code of qtsvg/src/plugins/iconengines/svgiconengine/main.cpp