How to use qtwebkit-plugins in my project?

5

QtWebkit-plugins is a library that provides features for QWebView , such as SpellCheck/Corretor ortografico and Notification Web API .

  

Read about on:

     

I tried to compile the code in Windows, but my QWebView is not working as expected, in other words the SpellCheck and Notification Web API do not work, it's like I have not been using QtWebkit-plugins . What can it be?

I read in the documentation that to compile I should run the following command:

$ qmake
$ make && make install

Read more at QtWebkit-plugins repository

As I'm using mingw I used the command mingw32-make instead of make

  • I compiled the hunspell
  • I copied hunspell compiled to C:\Qt5.4.0.4\mingw491_32\bin and C:\Qt5.4.0.4\mingw491_32\lib
  • I compiled qtwebkit-plugins using the command:

    $ qmake
    $ mingw32-make && mingw32-make install
    
  • The files libqtwebkitpluginsd.a and qtwebkitplugins.dll

  • I copied libqtwebkitpluginsd.a to C:\Qt5.4.0.4\mingw491_32\lib
  • I copied qtwebkitplugins.dll to C:\Qt5.4.0.4\mingw491_32\plugins\webkit and C:\Qt5.4.0.4\mingw491_32\bin
  • In the environment variables I applied this QT_DEBUG_PLUGINS=1

Then I compiled a simple project that uses QWebView , so I tested the SpellCheck ( <textarea spellcheck="true"></textarea> ) but did not work.

I tried the Notification Web API and it also did not work.

How to SpellCheck and Notification Web API work?

Note:

When running a project my project with QT_DEBUG_PLUGINS=1 and use Notification Web API the following message appears:

Found metadata in lib C:/Qt5.4.0/5.4/mingw491_32/plugins/webkit/qtwebkitplugins.dll, metadata=
{
    "IID": "org.qtwebkit.QtWebKit.QtWebKitPlugin",
    "MetaData": {
    },
    "className": "QtWebKitPlugin",
    "debug": false,
    "version": 328704
}


loaded library "C:/Qt5.4.0/5.4/mingw491_32/plugins/webkit/qtwebkitplugins.dll"
QLibraryPrivate::unload succeeded on "C:/Qt5.4.0/5.4/mingw491_32/plugins/webkit/qtwebkitplugins.dll" 
QSystemTrayIcon::setVisible: No Icon set

It looks like the dll is loaded, but for some reason it does not work.

    
asked by anonymous 04.03.2015 / 21:21

1 answer

0

In Qt 5.2 + is no longer used the "packages" com.nokia.Qt.* we should now use org.qt-project.Qt.* , so in order for qtwebkit-plugins to work it is necessary to modify qwebkitplatformplugin.h

Change this:

QT_BEGIN_NAMESPACE
Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.9");

For this reason:

QT_BEGIN_NAMESPACE
Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "org.qt-project.Qt.WebKit.PlatformPlugin/1.9");

If you want to keep compatibility for QT-4.8 and QT-5 you can also do something like:

QT_BEGIN_NAMESPACE
#if QT_VERSION >= 0x050200
Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "org.qt-project.Qt.WebKit.PlatformPlugin/1.9")
#else
Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.9")
#endif
QT_END_NAMESPACE
    
08.03.2015 / 09:57