views:

1294

answers:

3

I am trying to develop a plug-in for QtWebkit. But I am not able to find how to develop a plugin for QtWebKit, hopefully one that can be invoked by JavaScript. Does anyone know of any tutorials or documents that explain how to do this?

Webkit has been intregated into Qt and this integrated package is called QtWebkit. They have provided new method for for plugin creation.

-Regards, Vivek Gupta

A: 

Introduction to WebKit Plug-in Programming Topics is for WebKit, is QtWebKit that special?

eed3si9n
A: 

Actually Webkit has been intregated in Qt and this intregated package is called QtWebkit. And they have provided new method for for plugin creation.I just need a link or steps for creating a plugin in QtWebkit and that plugin should be invoked by java script.

Regards Vivek Gupta

+3  A: 

The simple answer is to write a subclass of QWebPage and set this on your webview. Then you can show your own HTML page and react to the appropriate object tag in the createPlugin method;

protected:
   QObject* createPlugin(const QString &classid, const QUrl &url, const QStringList &paramNames, const QStringList &paramValues)
   {
      if (classid=="lineedit") {
         QLineEdit *lineedit = new QLineEdit;
         return lineedit;
      }
      return 0;
}

and show something like the following HTML;

<object type="application/x-qt-plugin" classid="lineedit" id="lineedit">
can't load plugin
</object>

Remeber you need to turn on plugins, and possibly also JavaScript if you want more advanced functionality in the QWebSettings

To have more advanced functionality, you should use a QWebPluginFactory

Henrik Hartz