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
2
votes
0 answers

QT programming, QtConcurrent run function

I have a program which has class MainWindow that inherited from QMainWindow. I want to run a specific function in a new thread. Since I can't inherit from QThread so the best solution is to use QtConcurrent. I stored QtConcurrent result in a…
user9218823
2
votes
2 answers

QObject Cannot create children for a parent that is in a different thread

Hi have need to do some socket communication from background, I used QtConcurrent::run to this, but giving me the warning. QObject: Cannot create children for a parent that is in a different thread. (Parent is MainWindow(0x7fff3e69f500), parent's…
Haris
  • 13,645
  • 12
  • 90
  • 121
2
votes
0 answers

Cannot use QNetworkAccessManager with QtConcurrent

I'm trying to use QtConcurrent for not having to create a new slot for a simple QNetworkAccessManager::get request: QNetworkAccessManager *am = new QNetworkAccessManager(); QFuture future = QtConcurrent::run(am,…
Jacob Krieg
  • 2,834
  • 15
  • 68
  • 140
2
votes
1 answer

Any way to detect if a QObject belongs to a "dead" QThread?

The story : I make use of the QtConcurrent API for every "long" operation in my application. It works pretty well, but I face some problems with the QObjects creation. Consider this piece of code, which use a thread to create a "Foo" object…
Aurelien
  • 1,032
  • 2
  • 10
  • 24
2
votes
1 answer

QtConcurrent::run with MainWindow function, warning message "QObject::setParent: Cannot set parent, new parent is in a different thread"

I'm trying to use QtConcurrent::run to execute a function within my MainWindow class, so that the UI remains responsive during the calculations. Here is how I implemented it: void MainWindow::on_calculate_pb_clicked() { QFuture
Mitchell D
  • 465
  • 8
  • 24
2
votes
1 answer

Qt , QMutex: destroying locked mutex then app crash

I make an http operation(get,post etc...) by using QNetworkAccessManager. I run a few "get" operation in paralel. For this , I use QtConcurrent::run(this,&RestWebservice::GetHTTPData) to make multi HTTP operations. My problem is When I close the app…
Kevin yudo
  • 233
  • 4
  • 15
2
votes
1 answer

QFutureWatcher::progressValue returns a positive integer, but the min/max are both zero

The QFuture is iterating over a bidirectional iterator, which I assume is the root of the problem. However, the docs say that QFutureWatcher::progressValue "returns a value between progressMinimum and progressMaximum". I am calling…
moswald
  • 11,491
  • 7
  • 52
  • 78
2
votes
1 answer

QtConcurrent map() on in place array

I have a large array of float. I would like to call QtConcurrent::map() on it and change the values in place. Can I do that without making a copy of the array? It seems map() takes a QVector as parameter and I can't find a mean to initialize a…
Octo
  • 543
  • 1
  • 5
  • 16
2
votes
3 answers

How to call a non-class member function with pointers as parameters with QtConcurrent::run?

I want to call a recursive non-class member function used to erase a given folder with all of its files using Qt 4.8 for Embedded Linux: bool removeFiles(const QString & dirName, Interface::ProgressDialog* const poProgressDialog, qint32* const…
Momergil
  • 2,213
  • 5
  • 29
  • 59
2
votes
2 answers

QtConcurrent::run => QWaitCondition: Destroyed while threads are still waiting

I have the message "QWaitCondition: Destroyed while threads are still waiting" following the launch of N threads in a loop, and waiting for each in another loop. Here is the code : int nb_threads = QThread::idealThreadCount(); QFuture
Samfaitmal
  • 80
  • 10
2
votes
1 answer

QtConcurrent::blockingMapped calling function with more than 1 argument

I use QtConcurrent::blockingMapped() to execute the function on the list of single arguments on multiple threads. It's really great! But I'd like to do same thing calling the function that takes more than one argument, i.e: // prototype: static…
paws
  • 197
  • 1
  • 2
  • 13
2
votes
0 answers

QtConcurrent::mappedReduced

to improve my program, i want to use Qtconcurrent to parallelize my audio process. Unfortunately, i have many errors and i don't know why ... In my *.pro : QT += concurrent I use minGW with Qt 5.3.1 and when i try to build, the compiler said…
Gamso
  • 73
  • 2
  • 7
2
votes
3 answers

Correctly handling QtConcurrent with "infinite" loop

I'm doing a program in which the users can see the video from a camera and record it. I am using the QtMEL library to get the camera feed and record. When the camera starts it calls a function with QTconcurrent::run() to grab the frames. Inside this…
Solidus
  • 698
  • 1
  • 9
  • 23
2
votes
1 answer

Qt - get data and forward them on serial connection

I am trying to develop a simple Qt application. After I press a "START" button, the application should continuosly retrieves data from a device (using third party libraries) and forward them as soon as possible on a serial connection. The (ugly)…
2
votes
2 answers

Is it possible to modify QT qmake variable in the parent subdirs project?

I have the shared library project with structure like this: library.pro: TEMPLATE = subdirs CONFIG += ordered SUBDIRS += libs plugins test_programs ... QT += concurrent ... # Those files contains pure interfaces (C++ abstract classes) # with no…
eraxillan
  • 1,552
  • 1
  • 19
  • 40