Important: Please read the Qt Code of Conduct -

[SOLVED] QWebView, Google Maps Search Box slow response

  • Hi!

    I'm working on a QWebView for picking a location and exporting the longitude/latitude with Google Maps through html and javascript. I've recently added a places search box, and the problem occurs when the user enters text in the search box for the first time after the QWebView is initialized. After typing for about a second the whole view freezes for around 20 seconds, before the rest of the text can be entered. After the first search everything works perfectly.

    Have any of you encountered this problem before? It's not a problem in any other "regular" browser, and I've tried most combinations of API versions, setting region, different QWebSettings etc, but nothing seems to help. There are two listeners connected to the search box, one for "places_changed" and one for "bounds_changed".

    I'm kinda new to this, so please let me know if there is any information I can supply to make this easier to understand or diagnose. The html and javascript is a slightly extended version of Google's example at "Places Search Box API":

    Fixed it, turns out it is slow when the html file is loaded from a local file:
    @url = QUrl::fromLocalFile(path)

    It is not a problem when getting file from qrc resource: @QWebView->load(QUrl("qrc:///file.html")@

Log in to reply