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
1
vote
0 answers

QtConcurrent - grouped calls to same function in a thread

I would like to know best practice for calling same function generating a random point (random coordinates) several time in a thread. Actually, I already implemented parallelized calls for this function, say randomPoint(). Now, I would like to try…
kiriloff
  • 25,609
  • 37
  • 148
  • 229
0
votes
2 answers

term does not evaluate to a function taking 1 arguments QtConcurrent

Hi guys I really need your help All I want to do is to scale an image and run it using QtConcurrent .. I followed the documentation exactly but still I can't catch where is my fault here is the code void MainWindow::displayImages( QPixmap &image) { …
Poka Yoke
  • 373
  • 3
  • 8
  • 27
0
votes
1 answer

Is possible to use QtConcurrent with Ruby (mingw-32)?

How can I use the QtConcurrent Qt module in Ruby? I'm developing a small app that uses Qt (through the qtbindings binary gem) in Windows (Ruby 1.9.3 mingw-32) but I couldn't find a way to use threads (or use simple concurrent methods calls). Any…
Dorina
  • 3
  • 1
0
votes
0 answers

How should QChart be used to generate two different charts in concurrent mode?

In this code example two buttons are created: The first one displays a graph in a new window The second one prints a graph in another thread to make concurrent use and not hurt the main thread (it is not the case of the example but it could take a…
Jss
  • 1
0
votes
1 answer

QT5's QApplication::setOverrideCursor(Qt::WaitCursor); is blocking the previous operations

In my loadDatabase function, I have clearly set the status to display the message "loading coverage database..." before setOverrideCursor(Qt::WaitCursor), but the status bar is only displaying the message after restoreOverrideCursor() is called. I…
piggogo
  • 11
  • 2
0
votes
0 answers

Qt3D crashes when pickResultMode set to FrontAndBackFace

I am trying to understand how the various settings affect ObjectPicker behavior in Qt3D. When pickingSettings.pickResultMode is set to PickingSettings.FrontAndBackFace, the program crashes with a QtConcurrent exception as soon as the mouse is…
charles
  • 192
  • 1
  • 14
0
votes
0 answers

How to propagate exceptions to the main thread from a QtConcurrent::run with promise

I'm experimenting with the concurrent run with promise functionality from Qt6. How can I catch, from the GUI thread, any exception thrown in the worker thread? void MainWindow::on_pushButton_startTask_clicked() { auto lambda = [](QPromise&…
Rackbox
  • 283
  • 1
  • 11
0
votes
0 answers

QtConcurrent with UI. How to connect?

I have this static class: class NetworkTools { public: static QMap* getMbNames(const QString &html) { ... return result; } static QString download(const QUrl &url) { ... return…
SlimRG
  • 35
  • 6
0
votes
0 answers

Qt C++ GUI not drawing till pooled thread ends

I'm calling a function on QMainWindow's constructor via QtConcurrent in hope that the GUI will be up and showing while the background IO bound task will be processing in the background: MainWindow.h #ifndef MAINWINDOW_H #define…
JavaUser
  • 19
  • 3
0
votes
1 answer

How to put my function into a thread Qt Concurrent

I have function like this QList list; for (int i = 0; i < count; ++i) { auto *object = new MyObject(this); ProcessFunc1(object); ProcessFunc2(object); ProcessFunc3(object); // a heavy function that I would like to…
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
1 answer

Call QtConcurrent::run as slot

I'am trying to call asynchrone function like slot but when i click on the button nothing happen. Code: connect(ui->Button1, SIGNAL(clicked()), this, SLOT(QtConcurrent::run(func1))); func is declared in private slot. When i call function normally,…
thacaout
  • 33
  • 4
0
votes
0 answers

Effective way for main thread to wait with a timeout for a QtConcurrrentRun thread to finish some task

Thanks in advance. We are calling some third party API's from our Qt application. As a precautionary measure we are calling them from QtConcurrentRun thread and making main thread wait for a definite timeout using QWaitCondition wait(). The same…
0
votes
2 answers

QtConcurred spawned threads have same ID as main thread

In my desktop software I'm starting several QtConcurrent threads from the main window. I've checked the thread IDs with QThread::currentThreadId() and noticed that they have the same ID as the GUI thread. Made some experiments, and noticed that the…
il_mix
  • 553
  • 8
  • 20
0
votes
2 answers

Qt: using QWidgets in non GUI threads

I'm trying to understand what is and isn't allowed when it comes to QWidget and Qt concurrency. I've created a Widget which has a slow_function and I'm considering three cases: Run the slow_function on the GUI thread. This results in the expected…
linuxfever
  • 3,763
  • 2
  • 19
  • 43