Results 1 to 8 of 8

Thread: Help with understanding QFutureWatcher::progressTextChanged(const QString & progressT

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,328
    Thanks
    317
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Help with understanding QFutureWatcher::progressTextChanged(const QString & progr

    I was curious about this, so I spent a good hour yesterday going through the source code for QtConcurrent and I still have no clue how you can create a process that will send text update signals. What I learned was that these signals originate deep in the bowels of QtConcurrent as customized QEvent events, namely a QFutureCallOutEvent derived type, which internally contain a flag the describes a specific sub-type of the event - start, progress, finished, etc. QFutureWatcher, with the help of a few other internal classes, maps these events onto signals.

    These events are generated by the QtConcurrent thread execution mechanism which iterates over the list of things you want to process and which posts these events at various points. I could not find a case in the distributed Qt source code where the thread execution mechanism posts an event containing text. There is a setProgressValueAndText() method in one of the thread control classes, but the only place where I can find this being called is by another method, setProgressValue(), which simply calls it with an empty string. The QFutureWatcher::progressText() method seems to be an unused placeholder in case you want to go to the effort of actually implementing something that uses it.

    There are a dozen or more internal ordinary and template C++ classes that implement the QtConcurrent framework. The only way I can imagine implementing something that could also send text events would be to either derive from or implement a new thread execution iterator that could create text-containing events in addition to the normal numeric-only update events. And even then, I don't know how you would interface a process to this mechanism to relay process status. Even in the standard framework, the processes being threaded do not talk to the QtConcurrent framework. It is the thread execution iterator that sends these events based on where the iterator is in processing the list of things to do.

    Most of the discussion I have seen around this online say to implement your own set of signals if you need something that the standard QtConcurrent framework doesn't provide.
    Last edited by d_stranz; 26th February 2020 at 17:08.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Understanding argument `const char * uri` of `qmlRegisterType`
    By TheIndependentAquarius in forum Qt Quick
    Replies: 6
    Last Post: 23rd October 2013, 11:14
  2. Replies: 1
    Last Post: 18th April 2012, 19:14
  3. Replies: 2
    Last Post: 11th August 2011, 15:42
  4. How to use progressTextChanged() signal in QFutureWatcher
    By DiamonDogX in forum Qt Programming
    Replies: 1
    Last Post: 9th June 2009, 15:41
  5. Disturbing: const QString &
    By magland in forum General Programming
    Replies: 9
    Last Post: 28th November 2007, 15:34

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.