diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp index fa5cf79bf2..eaf8f8fb1e 100644 --- a/src/gui/image/qpicture.cpp +++ b/src/gui/image/qpicture.cpp @@ -1411,7 +1411,7 @@ void qt_init_picture_plugins() const PluginKeyMap keyMap = loader.keyMap(); const PluginKeyMapConstIterator cend = keyMap.constEnd(); for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it) { - if (QPictureFormatInterface *format = qobject_cast(loader.instance(it.key()))) + if (QPictureFormatPlugin *format = qobject_cast(loader.instance(it.key()))) format->installIOHandler(it.value()); } #endif diff --git a/src/gui/image/qpictureformatplugin.cpp b/src/gui/image/qpictureformatplugin.cpp index cb46790d69..d5cbb0c661 100644 --- a/src/gui/image/qpictureformatplugin.cpp +++ b/src/gui/image/qpictureformatplugin.cpp @@ -59,21 +59,20 @@ QT_BEGIN_NAMESPACE transparently by applications. Writing an picture format plugin is achieved by subclassing this - base class, reimplementing the pure virtual functions keys(), + base class, reimplementing the pure virtual functions loadPicture(), savePicture(), and installIOHandler(), and - exporting the class with the Q_EXPORT_PLUGIN2() macro. + exporting the class with the Q_PLUGIN_METADATA() macro. + + The json file containing the metadata should contain one entry + with the list of picture formats supported by the plugin: + + \code + { "Keys": [ "mypictureformat" ] } + \endcode \sa {How to Create Qt Plugins} */ -/*! - \fn QStringList QPictureFormatPlugin::keys() const - - Returns the list of picture formats this plugin supports. - - \sa installIOHandler() -*/ - /*! \fn bool QPictureFormatPlugin::installIOHandler(const QString &format) diff --git a/src/gui/image/qpictureformatplugin.h b/src/gui/image/qpictureformatplugin.h index 7bcd32b4fd..40042c0d9c 100644 --- a/src/gui/image/qpictureformatplugin.h +++ b/src/gui/image/qpictureformatplugin.h @@ -57,27 +57,15 @@ class QImage; class QString; class QStringList; -struct Q_GUI_EXPORT QPictureFormatInterface : public QFactoryInterface -{ - virtual bool loadPicture(const QString &format, const QString &filename, QPicture *) = 0; - virtual bool savePicture(const QString &format, const QString &filename, const QPicture &) = 0; - - virtual bool installIOHandler(const QString &) = 0; -}; - #define QPictureFormatInterface_iid "org.qt-project.Qt.QPictureFormatInterface" -Q_DECLARE_INTERFACE(QPictureFormatInterface, QPictureFormatInterface_iid) - -class Q_GUI_EXPORT QPictureFormatPlugin : public QObject, public QPictureFormatInterface +class Q_GUI_EXPORT QPictureFormatPlugin : public QObject { Q_OBJECT - Q_INTERFACES(QPictureFormatInterface:QFactoryInterface) public: explicit QPictureFormatPlugin(QObject *parent = 0); ~QPictureFormatPlugin(); - virtual QStringList keys() const = 0; virtual bool loadPicture(const QString &format, const QString &filename, QPicture *pic); virtual bool savePicture(const QString &format, const QString &filename, const QPicture &pic); virtual bool installIOHandler(const QString &format) = 0;