Qt5 with WebKit

  • I'm not sure why, because Qt4.8.5 works fine, but when I use the Linux offline .run file to build Qt5 (5.1.0 or 5.1.1), no WebKit support is included, but no errors are thrown. The QWebView widget doesn't appear in Designer and if I try and use it in Creator, I get the following C++ error when I try to build:

    @undefined reference to `QWebView::QWebView(QWidget*)'@

    This regards the following line:

    @webView = new QWebView(centralWidget);@

    Needless to say, I am including QWebView:

    @#include <QtWebKitWidgets/QWebView>@

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Do you have

    @QT += webkitwidgets@

    in your pro file ?

  • Thanks,
    That now works fine in creator. How do I build this if I write an app from scratch then? Also, how do I get it in designer?

  • Lifetime Qt Champion

    I am not sure to get your question this time. From scratch using qmake ? The same, you need to add this line. For designer (I can only guess here) I think it should show the widget once you've added the line (maybe re-run qmake)

  • OK, thanks. I didn't realise that Qt5 was dependant on .pro files now. I'm also getting these errors with webkit:

    /software/Qt/Qt5.1.1/5.1.1/gcc_64/lib/libQt5WebKit.so: undefined reference to deflateBound@ZLIB_1.2.0' /software/Qt/Qt5.1.1/5.1.1/gcc_64/lib/libQt5WebKit.so: undefined reference tog_variant_ref'
    /software/Qt/Qt5.1.1/5.1.1/gcc_64/lib/libQt5WebKit.so: undefined reference to gst_x_overlay_set_window_handle' /software/Qt/Qt5.1.1/5.1.1/gcc_64/lib/libQt5WebKit.so: undefined reference togst_query_parse_nth_buffering_range'
    /software/Qt/Qt5.1.1/5.1.1/gcc_64/lib/libQt5WebKit.so: undefined reference to g_variant_unref' /software/Qt/Qt5.1.1/5.1.1/gcc_64/lib/libQt5WebKit.so: undefined reference togst_element_link_pads_full'
    /software/Qt/Qt5.1.1/5.1.1/gcc_64/lib/libQt5WebKit.so: undefined reference to gst_is_initialized' /software/Qt/Qt5.1.1/5.1.1/gcc_64/lib/libQt5WebKit.so: undefined reference togst_query_get_n_buffering_ranges'
    collect2: ld returned 1 exit status

  • Lifetime Qt Champion

    Qt 5 as former Qt versions relies on pro files (you can also use cmake if you want)

    You seem to be missing the gstreamer and libz libraries, do you have the development package for them installed ?

Log in to reply

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