Results 1 to 1 of 1

Thread: QWebView XMLHttpRequest performance

  1. #1
    Join Date
    Sep 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default QWebView XMLHttpRequest performance

    Hello,

    I have created a simple Qt application with a webview and let it load a url:

    Qt Code:
    1. webView = new QWebView(this);
    2. setCentralWidget(webView);
    3. webView->load(QUrl("http://localhost:8080/responsetest.html"));
    To copy to clipboard, switch view to plain text mode 

    This loads a html page which uses XMLHttpRequest and displays the time it took to load it:

    Qt Code:
    1. <html>
    2. <body>
    3. <script>
    4. var num = 0;
    5.  
    6. function mouseClicked()
    7. {
    8. num++;
    9. var time = new Date().getTime();
    10.  
    11. var xmlhttp = new XMLHttpRequest();
    12.  
    13. xmlhttp.onreadystatechange = function()
    14. {
    15. if (xmlhttp.readyState==4 && xmlhttp.status==200)
    16. {
    17. time = new Date().getTime() - time;
    18. document.getElementById('link').innerHTML = "Response "+num+" took "+time+"ms.";
    19. }
    20. }
    21. xmlhttp.open("GET", "responsetest.html?q="+time, true);
    22. xmlhttp.send();
    23. }
    24. </script>
    25. <div><a onclick="mouseClicked()" id="link" href="#" >click me</a></div>
    26. </body>
    27. </html>
    To copy to clipboard, switch view to plain text mode 

    The thing is, it takes more than a second to load whereas other browsers need 7 milliseconds!

    Actually, my local server (mongoose) shows, that Qt is waiting one second before it is even attempting the request. Is that at all possible? And how could I fix it?

    I found out that even Safari shows this behaviour but Chrome and Firefox don't. What could be behind this?

    Cheers!
    Last edited by theH; 22nd September 2012 at 12:32.

Similar Threads

  1. Replies: 3
    Last Post: 20th November 2014, 17:12
  2. Qt GUI Performance Help!
    By SeppBauer in forum Qt for Embedded and Mobile
    Replies: 4
    Last Post: 27th July 2013, 05:18
  3. Qwt Performance
    By liran ritkop in forum Qwt
    Replies: 1
    Last Post: 27th April 2011, 14:28
  4. Qt performance
    By yagabey in forum Qt Programming
    Replies: 3
    Last Post: 22nd October 2008, 22:05
  5. UDP Performance bad
    By tigertap in forum Qt Programming
    Replies: 5
    Last Post: 17th March 2008, 16:53

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.