How to use qtwebkit-plugins in my project?

Asked

Viewed 214 times

5

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

Read about in:

I tried to compile the code on Windows, but my QWebView is not working as expected, in other words the SpellCheck and Notification Web API don’t work, it’s like I haven’t been using the 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 on Repositorio Qtwebkit-plugins

How I’m using the mingw I used the command mingw32-make instead of make

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

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

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

Then I compiled a simple project using QWebView, so I tested the SpellCheck (<textarea spellcheck="true"></textarea>) but it didn’t work.

I tested the Notification Web API and it didn’t work either.

How to do the SpellCheck and the Notification Web API work?

Note:

When running a project my project with QT_DEBUG_PLUGINS=1 and use the 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 doesn’t work.

  • "My doubts are, is to use qtwebkit-plugins". I didn’t understand. Missed a "possible" there?

1 answer

0


In the Qt 5.2+ "packages are no longer used" com.nokia.Qt.* now we must use org.qt-project.Qt.*, so that the qtwebkit-plugins operation it is necessary to modify the 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 maintain 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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.