Hi,

on the phone we discussed the option of a platform plugin. I'd like to
recommend the following design for that:

1) Define the interface as a Qt interface:

WebCore/platform/qt/PlatformPluginInterface.h:

struct QWebKitPlatformPluginInterface
{
   virtual ~QWebKitPlatformPluginInterface() {}
   virtual void doSomething() = 0;
   ...
};

Q_DECLARE_INTERFACE(QWebKitPlatformPluginInterface, 
"com.nokia.Qt.WebKit.PlatformPluginInterface/1.0")

2) Copy (yes, copy) the header file into your plugin implementation source 
tree, implement it there and export it using Q_EXPORT_PLUGIN2.

3) Use QPluginLoader in WebCore to load the plugin, get a pointer to the plugin 
implementation using instance() and do

    QWebKitPlatformPluginInterface* iface = 
qobject_cast<QWebKitPlatformPluginInterface*>(loader->instance());


If you change the interface, make sure to also change the string passed to 
Q_DECLARE_INTERFACE. That will make
sure that the qobject_cast will return a null pointer if the plugin 
implementation was _compiled_ against a
different interface.

See also examples/tools/plugandpaint in Qt for an example of how to use the Qt 
plugin interfaces.


Good luck :)


Simon

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
webkit-qt mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-qt

Reply via email to