QFuture is a class from the Qt Toolkit which represents the result of an asynchronous computation.
Questions tagged [qfuture]
34 questions
1
vote
1 answer
Assigning to running QFuture
Can I assign another QFuture object to already running QFuture object? Like in the example below:
QFuture future = QtConcurrent::run(function);
future = QtConcurrent::run(anotherFunciton); //assume that future is still running at this…

Rames
- 918
- 11
- 27
1
vote
1 answer
Problems developing QFutureWatcher to improve image loading times
I am trying to load multiple images using multithreading through QFutureWatcher class but I am not being able to do it properly. My code read the url of the images and save them on a QVector. Then I Pass these QStrings to a function that load,…

Luis López
- 137
- 1
- 2
- 13
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
1 answer
Qt, multiple threads, QFuture,Watcher, setting up and getting results
I am trying to perform multiple long-running initializers on threads. I would like to get results as soon as they are available, regardless of order.
I have tried with a simple thread but got stuck where I needed to create multiple threads... and…

Thalia
- 13,637
- 22
- 96
- 190
0
votes
2 answers
How do you wait for `QtConcurrent::run` to finish without thread blocking?
Hey this should be a pretty straightforward question. Simply put:
Want to run a function in another thread.
Need to wait for the function to finish.
Do not want to freeze the thread though while waiting.
In other words, I'd like to use an…

Anon
- 2,267
- 3
- 34
- 51
0
votes
1 answer
Cannot take the address of an rvalue of type 'qlonglong' (aka 'long long')
I get this error while trying to use QtConcurrent:
Cannot take the address of an rvalue of type 'qlonglong' (aka 'long long')
I'm trying to compute the size of a folder. I made a method that returns the size, which is of type qlonglong. I want to…
user18597487
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
1 answer
Working with QFutures and OpenCV in Qt/C++
I have a simple Qt/C++ program which gathers a webcam image out of one of my LAN devices using a cv::VideoCapture object.
The application is being built using Qt Quick and has an Image QML Item which is being served with a picture every 500…

tai
- 477
- 1
- 5
- 16
0
votes
1 answer
Sending a series of messages to a client from a QWebSocketServer in real-time
I have implemented a websocket server in a QCoreApplication. As soon as a connection is established with a client, I wish to send a series of messages to it immediately in real-time with a delay of 0.5 seconds between messages. However, the…

Ganesh
- 33
- 7
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…

Jamie
- 1
- 1
0
votes
1 answer
Using QtConcurrent::map() function on QList yields segmentation fault
I am familiarizing myself with QtConcurrent library. I have a UI (MainWindow) where I run my functions to simulate a real world example of multithreading.
The QtConcurrent::map() function I am using requires some:
Iterator or a Sequence, in my…

CybeX
- 2,060
- 3
- 48
- 115
0
votes
2 answers
Qt calling threads in a loop
I have a code like this with function double myfunction(double) that takes a lot of time to finish.
Using Qt (https://doc.qt.io/qt-5/qtconcurrentrun.html), how can I run the loop utilizing a thread for every myfunction call to have smaller…

vlad
- 193
- 2
- 10
0
votes
1 answer
QT c++ QFutures with signals without QConcurrent, like promises/observables?
I'm fuguring out how to use Futures with non-blocking event driven code (in a separate thread or not, both) but how can i end the future from a slot (~resolve the promise based on an signal) ?
QByteArray RfidCardReader::startTask(QByteArray send)
{
…

Valentino Miori
- 477
- 1
- 7
- 16
0
votes
2 answers
QFuture Memoryleak
I want to parallelize a function and have the problem that after a few hours my memory is overloaded.
The test program calculates something simple, and works so far. Only the memory usage is constantly increasing.
QT Project file:
QT -= gui
QT +=…

metty
- 55
- 1
- 7
0
votes
0 answers
Can a QFutureWatcher be used to monitor multiple serial tasks all run with QConcurrent?
I have a series of tasks that need to happen on a set of images. There are 3 steps which I want to run one after each other, but the middle one needs to be run serially because it relies on the results of all the previous iterations. What I want is…

fooforever
- 379
- 1
- 3
- 14