| 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 "qiconengine.h" |
| 6 | |
| 7 | QT_BEGIN_NAMESPACE |
| 8 | |
| 9 | /*! |
| 10 | \class QIconEnginePlugin |
| 11 | \brief The QIconEnginePlugin class provides an abstract base for custom QIconEngine plugins. |
| 12 | |
| 13 | \ingroup plugins |
| 14 | \inmodule QtGui |
| 15 | |
| 16 | The icon engine plugin is a simple plugin interface that makes it easy to |
| 17 | create custom icon engines that can be loaded dynamically into applications |
| 18 | through QIcon. QIcon uses the file or resource name's suffix to determine |
| 19 | what icon engine to use. |
| 20 | |
| 21 | Writing a icon engine plugin is achieved by subclassing this base class, |
| 22 | reimplementing the pure virtual function create(), and |
| 23 | exporting the class with the Q_PLUGIN_METADATA() macro. |
| 24 | |
| 25 | The json metadata should contain a list of icon engine keys that this plugin supports. |
| 26 | The keys correspond to the suffix of the file or resource name used when the plugin was |
| 27 | created. Keys are case insensitive. |
| 28 | |
| 29 | \code |
| 30 | { "Keys": [ "myiconengine" ] } |
| 31 | \endcode |
| 32 | |
| 33 | \sa {How to Create Qt Plugins} |
| 34 | */ |
| 35 | |
| 36 | /*! |
| 37 | \fn QIconEngine* QIconEnginePlugin::create(const QString& filename) |
| 38 | |
| 39 | Creates and returns a QIconEngine object for the icon with the given |
| 40 | \a filename. |
| 41 | */ |
| 42 | |
| 43 | /*! |
| 44 | Constructs a icon engine plugin with the given \a parent. This is invoked |
| 45 | automatically by the plugin loader. |
| 46 | */ |
| 47 | QIconEnginePlugin::QIconEnginePlugin(QObject *parent) |
| 48 | : QObject(parent) |
| 49 | { |
| 50 | } |
| 51 | |
| 52 | /*! |
| 53 | Destroys the icon engine plugin. |
| 54 | |
| 55 | You never have to call this explicitly. Qt destroys a plugin |
| 56 | automatically when it is no longer used. |
| 57 | */ |
| 58 | QIconEnginePlugin::~QIconEnginePlugin() |
| 59 | { |
| 60 | } |
| 61 | |
| 62 | |
| 63 | QT_END_NAMESPACE |
| 64 | |
| 65 | #include "moc_qiconengineplugin.cpp" |
| 66 | |