Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt 5.6 WebEngine / QWebEngineView not working anymore (works fine with Qt 5.5)

Qt 5.6 WebEngine / QWebEngineView not working anymore (works fine with Qt 5.5)

Scheduled Pinned Locked Moved Unsolved General and Desktop
qtwebengineqwebengineview
2 Posts 2 Posters 2.4k 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.
  • N Offline
    N Offline
    Nando
    wrote on 4 Jun 2016, 11:32 last edited by
    #1

    Hi,

    with Qt .5.5.x the code below worked fine when putting it into a QWebEngineView with setHtml(...).

    <html>
    <head>
        <script type="text/javascript" src="http://www.google.com/jsapi?autoload={'modules':[{name:'maps',version:3,other_params:'sensor=false'}]}"></script>
        <script type="text/javascript">
    
            function initialize() {
                var latlng = new google.maps.LatLng(52.12,8.23);
    
                var myOptions = {
                    zoom: 13,
                    center: latlng,
                    mapTypeId: google.maps.MapTypeId.SATELLITE,
                    mapTypeControlOptions: {
                        style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
                    },
                        navigationControlOptions: {
                            style: google.maps.NavigationControlStyle.ZOOM_PAN
                    },
                    scaleControl: true
                    };
    
                var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
                var distanceWidget = new DistanceWidget(map);
            }
    
            function DistanceWidget(map) {
                    this.set('map', map);
                    this.set('position', map.getCenter());
                    var marker = new google.maps.Marker({
                    draggable: true,
                    title: 'Move me!'
                });
    
                google.maps.event.addListener(marker, 'drag', function(event){
                       document.getElementById("markerLat").value = event.latLng.lat();
                       document.getElementById("markerLon").value = event.latLng.lng();
                });
    
    
                marker.bindTo('map', this);
    
                marker.bindTo('position', this);
            }
    
            DistanceWidget.prototype = new google.maps.MVCObject();
    
        </script>
    </head>
    
    <body onload="initialize()">
        <input id="markerLat" type="hidden">
        <input id="markerLon" type="hidden">
        <div id="map_canvas" style="width: 100%; height: 100%"></div>
    </body>
    </html>
    
    

    After switching the same code to Qt 5.6.x i always get the following js error:

    js: Uncaught ReferenceError: google is not defined
    js: Uncaught TypeError: Cannot read property 'value' of null

    Any ideas what happened here?

    Greetings

    Nando

    1 Reply Last reply
    0
    • L Offline
      L Offline
      LiZi
      wrote on 8 Jun 2016, 08:06 last edited by
      #2

      I had the same question as you,I think ,maybe your project is short of the '.js' file.
      You can add the '.js' file to the project-resource , then have a try.

      By the way ,In my project , It has the ',js' file,but there is still a quetion.
      In my projtct,I want load a HTML that use google maps api and show maps offline ,oc course I have doemloaded the map titles .the HTML can work in any browser, such as chrome, IE ,firefox and so on,but the html doesnot work in Qt5.6.0 which I use the QWebEngineWidget class.
      The error is :
      js: Uncaught TypeError:google.maps.LatLng is not a function
      js: Uncaught TypeError:google.maps.MAP is not a function

      So,this is my question,I haven't solved。

      1 Reply Last reply
      0

      1/2

      4 Jun 2016, 11:32

      • Login

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