Remove QFactoryInterface from picture plugins
Change-Id: I7b02cbfb850d6a9fc90c1eb1e12a9950baf61e77 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
dcf3c95175
commit
1402660575
@ -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<QPictureFormatInterface*>(loader.instance(it.key())))
|
||||
if (QPictureFormatPlugin *format = qobject_cast<QPictureFormatPlugin*>(loader.instance(it.key())))
|
||||
format->installIOHandler(it.value());
|
||||
}
|
||||
#endif
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user