QCustomPlot Discussion and Comments

Multithreading in real-timeReturn to overview

Hello,

I want to make two threads. One with realtimeplot (taken from plot examples) and other with calculations done in real time. Can you tell me how can I run plot function in thread?

thank you in advence,
Alex

If you only need to start ONE function in another thread, you can use QtConcurrent::run() function with a QFutureWatcher & QFuture so get the information (status, return object/variable etc).

Else, you'll have to read on the QThread class...

The plot code has to be run in the main gui thread. it is one of the restrictions for qt paint.

As far as the other thread goes, i would create a qobject with a slot that takes in the values you need and a signal that gives the values you want to send back out of the thread, then call QObject->MoveToThread(QThread*) to move the object to a different thread, then just connect to the signals and run them when necessary.