Questions tagged [qfuturewatcher]

QFutureWatcher is a class in QFuture which allows monitoring of QFuture using signals and slots. It provides information and notifications for a QFuture.

8 questions
3
votes
1 answer

What happens when QFuture goes out of scope?

I have following code which works (but it should not work) void myfunction(){ auto future = function_which_return_future(); auto *watcher = new QFutureWatcher; …
LightSith
  • 795
  • 12
  • 27
2
votes
1 answer

Qt Program freeze when try to get MD5 of files

Hi im using this code for generate MD5 of files in QT QString Md5_gen(QString const &s) { QString pakchunk_Md5; QCryptographicHash crypto(QCryptographicHash::Md5); QFile pakchunk("D:/Games/TDPA - Man of Medan" + s); if…
sanab3343
  • 154
  • 1
  • 11
2
votes
1 answer

Free memory using QFuture on cancel thread

I am writing a program that uses QtConcurrent to start threads. In my case, I use it to render a QGraphicsView when I use the mouse scroll. I am starting the threads using the following code: if (future.isRunning()) { future.cancel(); } future…
Zharios
  • 183
  • 1
  • 18
2
votes
0 answers

Will finished() signal of QFutureWatcher be fired if job completes before it is attached?

Will the finished() signal of QFutureWatcher always be fired, even if the concurrent job that the QFuture represents has completed before the QFutureWatcher is attached to the QFuture? Consider the following example: // Start some…
Mr. Developerdude
  • 9,118
  • 10
  • 57
  • 95
1
vote
0 answers

how to use signals and slots with QtConcurrent::run and QFutureWatcher

I'm trying to copy files with the progress bar, I have a method that works with QtConcurrent::run but when I connect to progressBar nothing happens but the file is copied successfully. I would like to know what is wrong with my code and how to fix…
Aquiles
  • 13
  • 3
0
votes
0 answers

show progress QFutureWatcher connected to QProgressBar

I have a QFutureWatcher connected to a QProgressBar, the code is running but never show me the progress of the progressBar QProgressDialog progress; QFutureWatcher watcher; connect(&watcher, SIGNAL(finished()),&progress,…
0
votes
0 answers

Passing QString as parameter to a QFuture

I need to pass a filename as QString with path to a function covered in a QFuture and watched by a QFutureWatcher, but only the first character of this QString will be passed to this function. Here the declaration in the *.h file: qint64…
hkottmann
  • 1
  • 1
0
votes
0 answers

Qt C++ how to correctly delete QFutureWatcher?

My code sometimes crashes due to future's async. This is not production code, just very simple stuff for demonstrating what i want to do. I have to download some info and then return first obtained result. Just imagine i do not want to wait so i'm…