Results 1 to 4 of 4

Thread: Threaded JS/script?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2009
    Posts
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows
    Thanks
    4

    Default Threaded JS/script?

    Hi,
    I want threaded execution of long-running scripts and am unsure the best way to do this in Qt.

    In my app I want to allow users to write scripts in javascript that modify data in my app. Each script can show some settings which are defined in QML. Multiple scripts can be applied to the same data.

    The scripts are invoked whenever the data is modified and is considered a long-running process. Since there are potentially many such scripts being applied to a data set, I would like to have the scripts be threaded.

    I saw this which outlines the options: http://doc.qt.io/qt-5/threads-technologies.html

    I see I can use a WorkerScript to run the user's script from QML but:

    * It looks like I can't have the script post progress back to the QML UI such as a progress bar?
    * No way to cancel or restart in the event the user changes the settings while the WorkerScript is running?
    * No way to have the source be anything other than a standalone file? [it's messy to require multiple files per data filter and was hoping for a single file solution]

    I see QtThread but:

    * Is there a way to invoke a JS method from a thread and get updates/progress/cancel, etc.?
    * This wants a C++ method but I want to use a script, so it means I need to create a new context within the thread and this seems really bad/inefficient?

    I see QtConcurrent but:

    * Is there a way to invoke a JS method from within this and still get updates/progress/cancel, etc.?
    * This wants a C++ method but I want to use a script, so it means I need to create a new context within the thread and this seems really bad/inefficient?

    Or is there a better way to run a script that's callable, cancelable, reports progress and can be multi-threaded?

    All help appreciated!
    Brett
    Last edited by bibbinator; 22nd June 2015 at 18:00.

Similar Threads

  1. Qt script combined with java script
    By prachi kamble in forum Newbie
    Replies: 8
    Last Post: 16th April 2015, 13:30
  2. Qt & External Threaded API
    By mreyfout in forum Qt Programming
    Replies: 0
    Last Post: 28th October 2010, 22:39
  3. Can I include a script from script?
    By yycking in forum Qt Programming
    Replies: 1
    Last Post: 24th April 2009, 03:01
  4. Threaded TCP server
    By Sysace in forum Newbie
    Replies: 4
    Last Post: 21st February 2008, 12:37
  5. Threaded server.
    By nithinin2001 in forum Qt Programming
    Replies: 2
    Last Post: 15th November 2007, 16:37

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.