summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2012-05-27 04:02:09 +0200
committerQt by Nokia <qt-info@nokia.com>2012-06-08 00:12:05 +0200
commitdcf3c95175a93cf883e14a6d434b4306df50cf37 (patch)
tree71d3bccc8e52bd4111671116a6f7a87808968f62 /src/gui
parent2903db8b4ce77f5ff36da7c3c8fb43337881598f (diff)
Remove QFactoryInterface dependency from icon plugins
Change-Id: I65bed1646f3c5e89329a6bbe3dcdbdb5660b7004 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/image/qicon.cpp4
-rw-r--r--src/gui/image/qiconengineplugin.cpp20
-rw-r--r--src/gui/image/qiconengineplugin.h13
3 files changed, 16 insertions, 21 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index c2139c3336..9cfc8476aa 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -833,7 +833,7 @@ void QIcon::addFile(const QString &fileName, const QSize &size, Mode mode, State
// first try version 2 engines..
const int index = loader()->indexOf(suffix);
if (index != -1) {
- if (QIconEngineFactoryInterface *factory = qobject_cast<QIconEngineFactoryInterface*>(loader()->instance(index))) {
+ if (QIconEnginePlugin *factory = qobject_cast<QIconEnginePlugin*>(loader()->instance(index))) {
if (QIconEngine *engine = factory->create(fileName)) {
d = new QIconPrivate;
d->engine = engine;
@@ -1089,7 +1089,7 @@ QDataStream &operator>>(QDataStream &s, QIcon &icon)
} else {
const int index = loader()->indexOf(key);
if (index != -1) {
- if (QIconEngineFactoryInterface *factory = qobject_cast<QIconEngineFactoryInterface*>(loader()->instance(index))) {
+ if (QIconEnginePlugin *factory = qobject_cast<QIconEnginePlugin*>(loader()->instance(index))) {
if (QIconEngine *engine= factory->create()) {
icon.d = new QIconPrivate;
icon.d->engine = engine;
diff --git a/src/gui/image/qiconengineplugin.cpp b/src/gui/image/qiconengineplugin.cpp
index 29953a468e..a5a698be56 100644
--- a/src/gui/image/qiconengineplugin.cpp
+++ b/src/gui/image/qiconengineplugin.cpp
@@ -51,16 +51,22 @@ QT_BEGIN_NAMESPACE
\ingroup plugins
\inmodule QtGui
- \b {Use QIconEnginePluginV2 instead.}
-
The icon engine plugin is a simple plugin interface that makes it easy to
create custom icon engines that can be loaded dynamically into applications
through QIcon. QIcon uses the file or resource name's suffix to determine
what icon engine to use.
Writing a icon engine plugin is achieved by subclassing this base class,
- reimplementing the pure virtual functions keys() and create(), and
- exporting the class with the Q_EXPORT_PLUGIN2() macro.
+ reimplementing the pure virtual function create(), and
+ exporting the class with the Q_PLUGIN_METADATA() macro.
+
+ The json metadata should contain a list of icon engine keys that this plugin supports.
+ The keys correspond to the suffix of the file or resource name used when the plugin was
+ created. Keys are case insensitive.
+
+ \code
+ { "Keys": [ "myiconengine" ] }
+ \endcode
\sa {How to Create Qt Plugins}
*/
@@ -68,9 +74,7 @@ QT_BEGIN_NAMESPACE
/*!
\fn QStringList QIconEnginePlugin::keys() const
- Returns a list of icon engine keys that this plugin supports. The keys correspond
- to the suffix of the file or resource name used when the plugin was created.
- Keys are case insensitive.
+ Returns
\sa create()
*/
@@ -86,7 +90,7 @@ QT_BEGIN_NAMESPACE
/*!
Constructs a icon engine plugin with the given \a parent. This is invoked
- automatically by the Q_EXPORT_PLUGIN2() macro.
+ automatically by the plugin loader.
*/
QIconEnginePlugin::QIconEnginePlugin(QObject *parent)
: QObject(parent)
diff --git a/src/gui/image/qiconengineplugin.h b/src/gui/image/qiconengineplugin.h
index 9333400609..8ca0445dac 100644
--- a/src/gui/image/qiconengineplugin.h
+++ b/src/gui/image/qiconengineplugin.h
@@ -52,24 +52,15 @@ QT_BEGIN_NAMESPACE
class QIconEngine;
-struct Q_GUI_EXPORT QIconEngineFactoryInterface : public QFactoryInterface
-{
- virtual QIconEngine *create(const QString &filename = QString()) = 0;
-};
-
-#define QIconEngineFactoryInterface_iid \
- "org.qt-project.Qt.QIconEngineFactoryInterface"
-Q_DECLARE_INTERFACE(QIconEngineFactoryInterface, QIconEngineFactoryInterface_iid)
+#define QIconEngineFactoryInterface_iid "org.qt-project.Qt.QIconEngineFactoryInterface"
-class Q_GUI_EXPORT QIconEnginePlugin : public QObject, public QIconEngineFactoryInterface
+class Q_GUI_EXPORT QIconEnginePlugin : public QObject
{
Q_OBJECT
- Q_INTERFACES(QIconEngineFactoryInterface:QFactoryInterface)
public:
QIconEnginePlugin(QObject *parent = 0);
~QIconEnginePlugin();
- virtual QStringList keys() const = 0;
virtual QIconEngine *create(const QString &filename = QString()) = 0;
};