Prevent QWebView from blocking the application?



  • Hi,

    i am developing a application that runs some thread and has a QWebView in the main window.

    It seems, that QWebView blocks the whole application, including the threads, when there are non asynchronous javascript ajax request

    So for example, if i have a Ajax URL http://mysuperslowresponsesite that takes longer then 30 seconds to respond, then displaying a html document with the following (asynchronous ajax) works:

    [code]
    var xmlhttp = new XMLHttpRequest();
    xmlhttp.open('GET', 'http://mysuperslowresponsesite', true);
    xmlhttp.send(null);
    [/code]

    whereas the following (non asynchronous ajax) blocks the whole application including threads for (as it seems exactly) 30 seconds and then aborts the operation:

    [code]
    var xmlhttp = new XMLHttpRequest();
    xmlhttp.open('GET', 'http://mysuperslowresponsesite', false);
    xmlhttp.send(null);
    [/code]

    Any way to prevent the block, like starting the ui in a seperate thread or similar (which i tried but failed)



  • You cannot use QWebView in different thread from UI thread because QWebView is drawing UI elements and this drawing can only be done in main (UI) thread.

    So answer to your question is: No there is no such way, use asynchronous ajax.


Log in to reply
 

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