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

QtConcurrent Error: array used as initializer

im new to Qt, i need to use another thread for the member function below int length=interface->get_message(channelnumber_uint, &identifier, message, &can_flag_uint, timeout_uint); i tried this: QFuture future =…
0
votes
1 answer

QtConcurrent Error: Array Initialization Requires a brace-enclosed Initializer list

I am trying to create a progress bar for my class member function when it runs, but when I pass an array of strings and an array of bools into the QTConcurren::run function I get this error: Error C2075 …
BDD
  • 25
  • 1
  • 6
0
votes
0 answers

In Qt, how to cancel QtConcurrentRun if it is not finished by the time the application quits?

I have an application that does a presumably long operation on disk, that I want to start in the background as soon as the application opens. However, if the task is not done by the time the last window is closed, I need to cancel this…
Melodie
  • 305
  • 2
  • 8
0
votes
2 answers

Qt: How to avoid deadlock when multiple queued signals invoke same slot

In following code I meet deadlock in someOperation: class A : public QObject { Q_OBJECT public: explicit A(QObject* parent) : QObject(parent), data(0) {} public slots: void slot1() { someOperation(); } void slot2() { …
0
votes
0 answers

QtConcurrent map with QMap as input sequence

I have a data structure of QMap>>. I want to compare every single float with a threshold value using multi-threading(as the amount of float is huge, 1000*800*800). However QtConcurrent::map only accepts QList or QVector as input…
Komgcn
  • 323
  • 2
  • 12
0
votes
1 answer

C++ Qt QtConcurrent::filteredReduced from QVector of std::shared_ptr

I have a vector of shared_ptrs of my class Person, which looks like: QVector > vecOfPeople; One of Person's field is age and I want to calculate with QtConcurrent::filteredReduced for example how many there are people…
0
votes
2 answers

Prevent event loop blocking in modal dialog

I'm developing an application where a user may parse some binary files. Once he clicks the "parse"-button, he first may select some files, which are parsed afterwards. While the application is processing the files, I'd like to display a modal…
Jonas Möller
  • 363
  • 3
  • 16
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
0
votes
0 answers

QT QCustomPlot in a new thread

In my UI, I have a QCustomPlot and I have generatePlot function which uses from this QCustomPlot and runs in a new thread as follows: future = QtConcurrent::run(this, &MainWindow::generatePlot); In generatePlot function, I create QCPbars like…
user9218823
0
votes
1 answer

Iterating through QFutureSynchronizer::results

Can someone tell me what is wrong with these pieces of code : std::vector vUp; QFuture tu, td; foreach(boost::tie(tu, td), boost::combine(Up_corr.futures(), Down_corr.futures())) { vUp.push_back((tu.result()+td.result())*0.5); …
0
votes
0 answers

invalid use of non-static member function QtConcurrent

I have a function which is named RunProcess. I want to use it in a concurrent process to make GUI responsiveness, So I tried to run my function in concurrent process but It does not recognize the function. here is my class #include…
Majid Hojati
  • 1,740
  • 4
  • 29
  • 61
0
votes
1 answer

Qt Gui not updated because of threading issue

I am using a third party library which takes 60-90 seconds to dynamically load several libraries. It is an unfortunate design choice, but I can't change who the built their code. I am trying to use a QSplashScreen to at least tell the user to wait…
BSD
  • 329
  • 3
  • 13
0
votes
1 answer

QtConcurrent::run - Passing Pointers Issue

I'm attempting to run a function concurrently using QtConcurrent but I'm running into issues with one of the arguments. As a precursor, lets say I have the following classes and "interfaces": class DataMessage : public QObject { Q_OBJECT //…
weblar83
  • 681
  • 11
  • 32
0
votes
1 answer

malloc() fails in QtConcurrent::run()

On x86, it may fail to initialize QImage on worker thread. (Rare in x64) The probability increases when parallel processing is performed over the number of cores of the CPU. This occurs not only by reading from an image file, but also by…
0
votes
1 answer

How to clear QFuture results in QFutureWatcher

I tried to block multiple file at once, then copy them to another location. Both source and destination files should be blocked simultaneously. Therefore I can't use static QFile::copy() function. To hold and move files I use QSharedPointer< QFile >…
Tomilov Anatoliy
  • 15,657
  • 10
  • 64
  • 169