Results 1 to 3 of 3

Thread: How to use QWebView asynchronous call js function?

  1. #1
    Join Date
    Apr 2016
    Posts
    37
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default How to use QWebView asynchronous call js function?

    hi ,all.

    i use evaluateJavaScript , but i find that is so slow.

    i hope like QWebEngineView runJavaScript , asynchronous call.

    How do you give me a hint?

    thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to use QWebView asynchronous call js function?

    Bear in mind that QWebEngineView also has a single thread for the JavaScript world so the amount of time it takes to execute your script is similar, only that it doesn't block the UI. If you are only about asynchronousness, you can spawn a Worker in JS and make it execute your code.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Apr 2016
    Posts
    37
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to use QWebView asynchronous call js function?

    Thank you for your help.

    i use QWebView , when call evaluateJavaScript , UI is blocked.

    how to solve this problem.

    Same problem with me. This issue appears to be unresolved. https://forum.qt.io/topic/12974/eval...-main-thread/3

    my code:
    Qt Code:
    1. QTime time;
    2. time.start();
    3. QString method = QString(QString("add_html('%1')").arg(qsContent));
    4. this->page()->mainFrame()->evaluateJavaScript(method);
    5. qDebug()<<"time is : "<<time.elapsed();//1205ms
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 2
    Last Post: 12th April 2016, 09:13
  2. Replies: 2
    Last Post: 2nd December 2013, 05:43
  3. Replies: 4
    Last Post: 2nd August 2012, 08:42
  4. Qt function call in vb.net
    By abghosh in forum Qt Programming
    Replies: 7
    Last Post: 6th March 2010, 18:00
  5. function call
    By Walsi in forum Qt Programming
    Replies: 3
    Last Post: 12th June 2007, 10:13

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.