Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. WebView does not load url

WebView does not load url

Scheduled Pinned Locked Moved Solved Qt WebKit
2 Posts 1 Posters 462 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mark81
    wrote on 3 Feb 2020, 08:15 last edited by Mark81 2 Mar 2020, 08:16
    #1

    I'm trying a very simple test application on Raspberri Pi 3, with a Buildroot environment and Qt 5.12.5.

    main.cpp

    #include <QGuiApplication>
    #include <QQmlApplicationEngine>
    #include <QtWebView/QtWebView>
    
    int main(int argc, char *argv[])
    {
        QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    
        QGuiApplication app(argc, argv);
        QtWebView::initialize();
    
        QQmlApplicationEngine engine;
        const QUrl url(QStringLiteral("qrc:/main.qml"));
        QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, &app, [url](QObject *obj, const QUrl &objUrl) {
            if (!obj && url == objUrl) QCoreApplication::exit(-1);
        }, Qt::QueuedConnection);
        engine.load(url);
    
        return app.exec();
    }
    

    main.qml

    import QtQuick 2.12
    import QtQuick.Window 2.12
    import QtWebView 1.1
    
    Window {
        visible: true
        width: 640
        height: 480
    
        WebView {
            url: "http://www.google.it"
    
            onLoadProgressChanged: console.log(loadProgress)
            onLoadingChanged: console.log(loading)
        }
    }
    

    Here the output:

    # ./testWeb --no-sandbox
    QML debugging is enabled. Only use this in a safe environment.
    [0203/081353.795855:WARNING:resource_bundle_qt.cpp(116)] locale_file_path.empty() for locale 
    [0203/081353.906904:WARNING:resource_bundle_qt.cpp(116)] locale_file_path.empty() for locale
    

    The screen shows the blank window only.
    I don't think the warnings about the locale are critical to load an URL (anyway I'm trying to understand how to fix them).

    Any idea?
    Thanks in advance

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Mark81
      wrote on 3 Feb 2020, 10:11 last edited by
      #2

      Well, it was simple enough:

          anchors.fill: parent
      
      1 Reply Last reply
      1

      2/2

      3 Feb 2020, 10:11

      • Login

      • Login or register to search.
      2 out of 2
      • First post
        2/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved