How to compile qtwebkit-plugins?



  • QtWebkit-plugins is a library that provides features to the QWebView eg SpellCheck and Notification Web API.

    Read about:

    I tried to compile the code in Windows, but my QWebView not working as expected, in other words SpellCheck and Notification Web API not working. It's like I've been not-using "QtWebkitplugins". Which can be?

    In the documentation that says to compile I have to run:

    $ qmake
    $ make && make install
    

    Read more in QtWebkit-plugins repository

    But I read on another issue (here in StackOverflow) that when I use the MingW I do not need to use qmake, so I tried to do the step-by-step to compile:

    • I compiled hunspell
    • Copied hunspell for C:\Qt5.4.0\5.4\mingw491_32\bin and C:\Qt5.4.0\5.4\mingw491_32\lib
    • Compiled the qtwebkit-plugins.pro project (clicked in Build on QtCreator)
    • Build generate libqtwebkitpluginsd.a and qtwebkitplugins.dll
    • Copied libqtwebkitpluginsd.a for C:\Qt5.4.0\5.4\mingw491_32\lib
    • Copied qtwebkitplugins.dll for C:\Qt5.4.0\5.4\mingw491_32\plugins\webkit and C:\Qt5.4.0\5.4\mingw491_32\bin

    After that I compiled another simple project that uses QWebView then tested the SpellCheck in a <textarea spellcheck="true"></textarea> and did not work.

    I tested the Notification Web API and also did not work.

    How do my projects work these features?


  • Lifetime Qt Champion

    Hi,

    You should run your application with the QT_DEBUG_PUGINS environment variable set to 1 to see if the plugins are found and if they encounter a problem loading. You can do that in the run part of the Project panel

    Hope it helps



  • @SGaist said:

    Hi,
    You should run your application with the QT_DEBUG_PUGINS environment variable set to 1 > to see if the plugins are found and if they encounter a problem loading. You can do that in the run part of the Project panel

    Hope it helps

    Thanks, I added in Project > Build Environment this var QT_DEBUG_PLUGINS = 1 and work, returning this:

    http://pastebin.com/LVmLWASZ

    But it not show qtwebkitplugins.dll in the log.

    How can I solve this issue?


  • Lifetime Qt Champion

    Just thought of something, why didn't you call mingw32-make install ?

    Also did you enable the plugins in the QWebSettings of your application ?



  • @SGaist said:

    Just thought of something, why didn't you call mingw32-make install ?

    Also did you enable the plugins in the QWebSettings of your application ?

    Thank you for your dedication,

    How to call the mingw32-make install?

    QWebsettings:

    QWebSettings *settings = QWebSettings::globalSettings();
    settings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true);
    settings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
    settings->setAttribute(QWebSettings::LocalStorageEnabled, true);
    settings->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
    settings->setAttribute(QWebSettings::JavascriptCanCloseWindows, true);
    settings->setAttribute(QWebSettings::JavascriptEnabled, true);
    settings->setAttribute(QWebSettings::NotificationsEnabled, true);
    
    //Enable OpenGL/webGL
    settings->setAttribute(QWebSettings::AcceleratedCompositingEnabled, true);
    settings->setAttribute(QWebSettings::WebGLEnabled, true);
    
    settings->setAttribute(QWebSettings::PluginsEnabled, true);
    settings->setAttribute(QWebSettings::JavaEnabled, false);
    
    settings->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
    
    settings->setAttribute(QWebSettings::AutoLoadImages, true);
    
    settings->setAttribute(QWebSettings::LocalContentCanAccessFileUrls, true);
    settings->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, true);
    
    settings->setAttribute(QWebSettings::DnsPrefetchEnabled, true);
    settings->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true);
    settings->setAttribute(QWebSettings::JavascriptCanAccessClipboard, false);
    settings->setAttribute(QWebSettings::ScrollAnimatorEnabled, true);
    
    settings->setOfflineWebApplicationCachePath(pathApp + "appcache");
    settings->setOfflineStoragePath(pathApp + "offlinestorage");
    settings->setLocalStoragePath(pathApp + "storage");
    settings->setIconDatabasePath(pathApp + "icons");

  • Lifetime Qt Champion

    As silly as it may sound, just go in the same folder where you built the plugin and call mingw32-make install unless make has an other name on your system ?



  • @SGaist said:

    As silly as it may sound, just go in the same folder where you built the plugin and call mingw32-make install unless make has an other name on your system ?

    Makefile generated: http://pastebin.com/dNyYJLH6

    After I tried this command mingw32-make && mingw32-make install, return this:

    cd src\ && ( if not exist Makefile C:\Qt5.4.0\5.4\mingw491_32\bin\qmake.exe C:\projects\qtwebkit-plugins-master\src\src.pro -o Makefile ) && mingw32-make -f Makefile
    mingw32-make[1]: Entering directory 'C:/projects/qtwebkit-plugins-master/src'
    mingw32-make -f Makefile.Release
    mingw32-make[2]: Entering directory 'C:/projects/qtwebkit-plugins-master/src'
    g++ -Wl,-s -shared -Wl,-subsystem,windows -mthreads -Wl,--out-implib,C:\projects\qtwebkit-plugins-master\src..\bin\libqtwebkitplugins.a -o ..\bin\qtwebkitplugins.dll ../build/plugin.o ../build/spellcheck.o ../build/speller.o ../build/notificationpresenter.o ../build/qrc_notifications.o ../build/moc_qwebkitplatformplugin.o ../build/moc_plugin.o ../build/moc_spellcheck.o ../build/moc_notificationpresenter.o -lglu32 -lopengl32 -lgdi32 -luser32 -lhunspell -LC:/Qt5.4.0/5.4/mingw491_32/lib -lQt5Widgets -lQt5Gui -lQt5Network -lQt5Core
    mingw32-make[2]: Leaving directory 'C:/projects/qtwebkit-plugins-master/src'
    mingw32-make[1]: Leaving directory 'C:/projects/qtwebkit-plugins-master/src'
    cd src\ && ( if not exist Makefile C:\Qt5.4.0\5.4\mingw491_32\bin\qmake.exe C:\projects\qtwebkit-plugins-master\src\src.pro -o Makefile ) && mingw32-make -f Makefile install
    mingw32-make[1]: Entering directory 'C:/projects/qtwebkit-plugins-master/src'
    mingw32-make -f Makefile.Release install
    mingw32-make[2]: Entering directory 'C:/projects/qtwebkit-plugins-master/src'
    mingw32-make[2]: Nothing to be done for 'install'.
    mingw32-make[2]: Leaving directory 'C:/projects/qtwebkit-plugins-master/src'
    mingw32-make[1]: Leaving directory 'C:/projects/qtwebkit-plugins-master/src'

    I copied .dll and .a generated for mingw folder and tested my project with webview (with QT_DEBUG_PLUGINS = 1).

    If have focus in <input type="text"> or <textarea> or use Notification Web API Application output tab (in QtCreator) returns:

    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 seems to me that the .dll is loaded, it just is not working. What did I do wrong?



  • I solved

    For this work in QT5.4+ is necessary to modified the qwebkitplatformplugin.h file

    Change this:

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

    By this:

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

    If needed compatibility with QT-4.8 change the code for this:

    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
    

    I send a pull-request https://github.com/QupZilla/qtwebkit-plugins/pull/4 in repository


  • Lifetime Qt Champion

    Good catch !

    Thanks for sharing your findings.

    One last thing to do is mark the thread as solved so other forum users may know as solution has been found :)



  • @SGaist said:

    One last thing to do is mark the thread as solved

    How to do it? Nothing appears but the editing buttons and sharing on social networks.

    Thanks.


  • Lifetime Qt Champion

    Don't you have somewhere on the page a "Mark Solved" button ? Or Topic Tools -> Mark Solved ?



  • @SGaist No, I migrated my account "qt-project.org/" and I think merge it with the account that already existed in "qt.io", perhaps the account has not been fully active.

    See images:

    Alt text
    Alt text


  • Lifetime Qt Champion

    Strange… Let's check with @tekojo tomorrow



  • @SGaist said:

    Strange… Let's check with @tekojo tomorrow

    Thanks!



  • @SGaist said:

    Strange… Let's check with @tekojo tomorrow

    I discovered, your account is moderator type (I think), my account is a normal user, so I'm not such a function, but @tekojo had an idea to use "tags" instead of this function, see: https://bugreports.qt.io/browse/QTWEBSITE-631



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.