Results 1 to 3 of 3

Thread: QProgressDialog updating with QtConcurrent::run() and QFutureWatcher

  1. #1
    Join Date
    Aug 2010
    Posts
    4
    Qt products
    Qt3 Qt4 PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QProgressDialog updating with QtConcurrent::run() and QFutureWatcher

    How do you modify examples/qtconcurrent/progressdialog/main.cpp to use QtConcurrent::run(...) with one threading function that knows the range and can send periodic updates?

    One working thread would be a more common thing to give an example for rather than the vector given to QtConcurrent::map(...) which then handles progress updating automatically.

    Thanks,
    Ted

  2. #2
    Join Date
    Jul 2009
    Location
    Enschede, Netherlands
    Posts
    462
    Thanked 69 Times in 67 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProgressDialog updating with QtConcurrent::run() and QFutureWatcher

    QtConcurrent::run() does not support progress information (nor does it support canceling or pausing). You will have to make target function report progress somehow.

    The idea of this example and QtConcurrent is that you do not have to worry about how many threads are used, how the synchronization is done and other threading issues. QtConcurrent::run() is more of a convenience function.
    Horse sense is the thing that keeps horses from betting on people. --W.C. Fields

    Ask Smart Questions

  3. #3
    Join Date
    Aug 2010
    Posts
    4
    Qt products
    Qt3 Qt4 PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QProgressDialog updating with QtConcurrent::run() and QFutureWatcher

    I realize that the example mentioned shows how to handle many threads, but I'm curious about the best Qt way of doing a single thread with progress and a cancel polling check from the worker thread.

    QtConcurrent::run()/QFuture appears to almost but not-quite have everything there but if it is not the Qt method for such a basic task, what in general is the best Qt way of doing a worker thread with progress and cancellation?

Similar Threads

  1. QFutureWatcher finished() signal not working
    By DiamonDogX in forum Qt Programming
    Replies: 13
    Last Post: 25th October 2011, 18:27
  2. Strange behaviour of QFutureWatcher on windows
    By spud in forum Qt Programming
    Replies: 0
    Last Post: 22nd July 2010, 16:47
  3. How to use progressTextChanged() signal in QFutureWatcher
    By DiamonDogX in forum Qt Programming
    Replies: 1
    Last Post: 9th June 2009, 15:41
  4. QProgressDialog
    By samirg in forum Qt Programming
    Replies: 5
    Last Post: 5th September 2007, 16:37
  5. qprogressDialog
    By mickey in forum Qt Programming
    Replies: 5
    Last Post: 17th July 2006, 14:16

Tags for this Thread

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.