Questions tagged [qtconcurrent]

QtConcurrent is a Qt framework namespace providing high-level multithreading APIs.

QtConcurrent namespace was introduced in Qt 4.4. The QtConcurrent namespace provides high-level APIs that make it possible to write multi-threaded programs without using low-level threading primitives such as mutexes, read-write locks, wait conditions, or semaphores.

As of Qt 4.8.0, it includes:

  • 2 Classes
  • 2 Types
  • and mostly Functions

As of Qt 5, it became a separate add-on module, and includes:

  • QtConcurrent namespace
  • QFuture
  • QFutureIterator
  • QFutureWatcher
  • QFutureSynchronizer

Details can be found on the following page.

Resources:

193 questions
0
votes
1 answer

How can you add to a QStringList being operated on by QtConcurrent::map?

I'm trying to create an application that will perpetually monitor a folder, and add any new files to a queue for multi-threaded processing. This is what I have: int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QDir…
Anon
  • 2,267
  • 3
  • 34
  • 51
0
votes
1 answer

How to work with QConcurrent class in Qt

I am a student who is new to Qt. I started coding this program with Qt Concurrent functionality. The program is supposed to calculate whether a number diverges or converges to 1. I am assuming that if the length exceeds 100, it diverges. This is my…
Kamil Kamili
  • 1,757
  • 5
  • 24
  • 39
0
votes
2 answers

QFutureWatcher signal not working

My function, finishedCopy(), isn't being called when the QtConcurrent::run function copyFolder is finished. The copyFolder function does complete w/o errors. QFutureWatcher watcher; connect(&watcher, SIGNAL(finished()), this,…
jocala
  • 31
  • 2
  • 6
0
votes
0 answers

Concurrent bruteforce and memory overflow : the best of both worlds?

I'm working on a bruteforce algorithm for solving a kind of Puzzle. That puzzle is a rectangle, and for some reasons irrelevant here, the number of possible solutions of a rectangle whose size is width*height is 2^(min(width, height)) instead of…
0
votes
2 answers

QStandardItemModel* from non-GUI thread didn`t emit itemChanged signal

I have started database loading in non-GUI thread with QtCuncurrent::run. In this nonGui thread I have to create QStandardItemModel* and after that I received model in GUI thread with model = modelWatcher.result(); on QFutureWatcher finished()…
0
votes
1 answer

Crash when doing multi thread operation on SQLite database using Qt

I have a code which performs 3 async make operation on a database. This code crashs if I run 3 async operations, but if it's only one there is no problem. How to organize multi threaded operation on SQLite? I have tried QMutex.lock but It did not…
Kevin yudo
  • 233
  • 4
  • 15
0
votes
1 answer

QtConcurrent reduce with initial value

I want to calculate a bunch of pixels and then put them into a QImage using QtConcurrent::mappedReduced. But I get QImage::setPixel: coordinate (636,442) out of range error. That is presumably because of using the default QImage constructor which…
petoknm
  • 11
  • 6
0
votes
1 answer

QtConcurrent::run with a virtual class member

So I'm trying to encapsulate a timer class which will handle all of the gory details of multi-threading and timers. Here's my code: TimedEvent.h class TimedEvent : public QObject { Q_OBJECT public: explicit TimedEvent(QObject *parent = 0); …
0
votes
2 answers

Updating UI from the background (QtConcurrent) in Qt

I am trying to read a log file in the background and update the text in QTextEdit. Below is the code. But once I emit the signal the UI freezes. Can someone point me out what I am doing wrong here with QtConcurrent? Connect the signal to the…
jxgn
  • 741
  • 2
  • 15
  • 36
0
votes
0 answers

Qt/ QtConcurrent ,Http get never finish when using thread

I make simple HTTP get operation.I get JSON result , then parse it. I use this operations steps in functuon.I start function with QtConcurrent::run , HttpGet Function : void MobileOperations::GetHTTPData(MyGlobal::Metods MetodName, QString…
0
votes
1 answer

QtConcurrent in QT for Symbian

I have a question about supporting of QtConcurrent in Qt for Symbian. I use Qt 4.6.2 but I'dont understant how to use QtConcurrent. All works fine on Wice platform in the same version of QT, but doesn't work on Symbian. How to enable QtConcurrent,…
Sergey
  • 813
  • 2
  • 7
  • 18
0
votes
1 answer

QMutex with QConcurrent::run not working as expected?

I am making a Qt GUI application that uses a custom QLabel class (name as ImageInteraction) to show images from a streaming camera while also allowing mouse interaction on the image. As the GUI has other functionalities, the customized QLabel class…
the_naive
  • 2,936
  • 6
  • 39
  • 68
0
votes
1 answer

QtConcurrent map error c2440

I'm making an app for recognizing license plates in images. It works fine, but now I want to move the image analysis part of the code to a separate thread. I'm using Qt 5.4. After reading the documentation I decided that QtConcurrent::map was the…
0
votes
1 answer

QtConcurrent::map crashes if no QProgressDialog is shown

Consider this SLOT, in my main thread, trigged by a button, which takes a list of QTreeWidgetItem from a QTreeWidget. It uses a QtConcurrent::map() call to execute a long task. The watcher connects to a QProgressDialog to show progress. void…
Lymphatus
  • 336
  • 4
  • 6
0
votes
1 answer

Wait till all the Qt concurrent threads finished

I am running 5 threads as below for(int i=0; i< 5 ; i++ { QtConcurrent::run() } I want to wait here till all the threads get finished. void QFutureSynchronizer::waitForFinished () is hanging my main GUI. So I want to use some thing like this…
NDestiny
  • 1,133
  • 1
  • 12
  • 28