QQuickWebView doesn't show url



  • Hello,

    I am new to Qt and I am trying to get a very simple program to work correctly, without success. Some background:

    • Using Qt5 built from git

    • Not using qmake build system because I want to use the Qt WebKit library in another project.

    • Using MS Visual Studio Express (2008 and 2010)

    Here is the code, cut down to a minimum to show my problem:

    @
    #include <QtQuick>
    #include <QtGui>
    #include "private/qquickwebview_p.h"

    int main(int argc, char** argv)
    {

    QGuiApplication app(argc, 0);
    QQuickView view(0);
    
    view.setSource(QUrl::fromLocalFile&#40;"Test.qml"&#41;);
    
    QList<QQmlError> errors = view.errors();
    if(errors.length() > 0) {
        return 1;
    }
    
    view.resize(700, 500);
    view.show();
    
    QQuickItem* root = view.rootObject();
    QQuickWebView* wv = (QQuickWebView*)root;
    
    QUrl address(QString("http://www.google.com/"));
    wv->setUrl(address);
        
    app.setQuitOnLastWindowClosed(true);
    return app.exec();
    

    }
    @

    The program compiles and runs without errors.
    It will open a toplevel window just as expected.
    But the top level window shows an empty white surface and won't load google.com.

    This is my qml file:
    @
    import QtWebKit 3.0

    WebView {
    }
    @

    I have been playing with Rectangles and other qquick items in the qml file, everything works fine but webkit.

    Any help would be very appreciated.


Log in to reply
 

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