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
1 answer

Qt - How to combine QtConcurrent and QThreadPool for a QProgressBar?

In the mainwindow.ui I created a QProgressBar named progressBar and a QPushButton named speckle which starts the heavy computation. Inside the mainwindow.h I have an appropriate private slot for the button and a private function which represents the…
goulashsoup
  • 2,639
  • 2
  • 34
  • 60
1
vote
1 answer

How to use QtConcurrent::run with overloaded Function

I'm currently trying to parallelize my code, therefore I'm using QtConcurrent::run and the problem is, run doesn't know which function to choose. Is there a way to use run with an overloaded function or do I have find some sort of workaround?
Dänis
  • 29
  • 3
1
vote
1 answer

QTConcurrent doesn't compile

I have a recursive directory copy function I'd like to run in the background. The function takes two QString arguments, filepath and dir. From .pro: QT += core gui sql network concurrent greaterThan(QT_MAJOR_VERSION, 4): QT += widgets LIBS +=…
jocala
  • 31
  • 2
  • 6
1
vote
2 answers

QtConcurrent Map Cannot Use Class Method

Hello I am trying to pass QList to QtConcurrent::Map function, but it fails to start and I don't understand why, maybe some one knows what might be the problem? This is the Class Method Code void MainWindow::find_file(QStringList &lst){ QString…
Ace_White
  • 47
  • 7
1
vote
1 answer

Qt Concurrent run member function from another member function

I would like to launch a member function in a separate thread calling it from another member. Maybe the code below is clearer. There is a button which launches the counter in a thread and it works: void…
iGian
  • 11,023
  • 3
  • 21
  • 36
1
vote
0 answers

Function not running with QtConcurrent::run() when using QFutureWatcher

I want to call a function to delete files and folders from the system in a parallel thread called by QtConcurrent::run() (Qt for Embedded Linux 4.8). Using only a QFuture with QFuture::waitForFinished() to grab the result (I need to run some…
Momergil
  • 2,213
  • 5
  • 29
  • 59
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
1
vote
1 answer

How to use QtConcurrent to qCompress on QByteArray?

I want to write a little program which compress all files from a directory by using qCompress of QByteArray. However i want to run the compression on a multithreaded environment by using QtConcurrent. But i have some problems. Here my code…
JohnnyBeGoody
  • 253
  • 1
  • 3
  • 15
1
vote
0 answers

QFutureWatcher firing progress signals only once with zeros

I try to update progress bar value by QFutureWatcher signals like this: QObject::connect( &imageCreating_, &QFutureWatcher::finished, loader, &Loader::creatingImagesFinished ); QObject::connect( &imageCreating_,…
Sergey
  • 144
  • 1
  • 13
1
vote
1 answer

QtConcurrent::map Doesn't accept parameters

I made want to run a function with QtConcurrent::map, but I always get errors... I have two functions in Mainwindow: on_listWidget_itemClicked and _fillTreeWithList(QStringList selectedListWidget). Function on_listWidget_itemClicked should use map…
Kanashius
  • 111
  • 1
  • 3
1
vote
1 answer

QtConcurrency::mapped with a member function

How can I use QtConcurrent::mapped with a member function as operator? Currently I'm using a callable object (which is ugly solution): struct Vectorizer { Vectorizer(DialogCreateSamples* cs) : m_createSamples(cs) { } typedef QString…
sorush-r
  • 10,490
  • 17
  • 89
  • 173
1
vote
0 answers

Calling QtConcurrent::run freez my GUI

I call in a method1 (private slot) a method2 (private) asynchron with QtConcurrent::run. Sometimes it works well but sometimes my gui freez and I can't do anything more... void myclass::method1() { ..... // do some stuff ..... …
Andreas
  • 636
  • 1
  • 12
  • 29
1
vote
0 answers

How to get to know when qtconcurrent actually run

As mentioned in doc for QtConcurrent::run: Note that the function may not run immediately; the function will only be run when a thread is available. So here is a question: how to handle job running? QFutureWatcher signal start is not suitable…
Jeka
  • 1,364
  • 17
  • 33
1
vote
1 answer

QFutureIterator::next segfaults

I have the following Qt code, which segfaults in next(). I looked into the QtConcurrent code and it is not obvious to me, why it fails. namespace { std::tuple test( const int& data ) { return std::make_tuple(…
abergmeier
  • 13,224
  • 13
  • 64
  • 120
1
vote
2 answers

QtConcurrent threading is slow!! What am I doing wrong?

Why is my qtconcurrent::run() call just as slow as calling the member function through the object?? (Ex: QtConcurrent::run(&db, &DBConnect::loadPhoneNumbers) is just as slow as calling db.loadPhoneNumbers()) Read below for futher explanation I've…
HeapOfNu11
  • 13
  • 1
  • 3