QCustomPlot Discussion and Comments

Adding a realtime QCustomPlot to an existing C++ console-based applicationReturn to overview

What would be the best approach to add a realtime QCustomPlot to an existing C++ console-based application?

This existing application is used for audio processing. It processes 64 audio samples every 10 ms. I want to know what is the best approach to visualize these samples in realtime. The information I have seen on using QCustomPlot so far is based on building a new application with Qt at its core, but this is not an option for me. I basically want to integrate a QCustomPlot as a library in my application so that I can feed it the samples and visualize them. The existing application is handling all the real-time requirements and it is very important that the QT functionality does not influence it. Somewhere on the web I read that the class QProcess can be used for this purpose. However, I couldn't find an example of how. I would really appreciate if somebody gives me a hand with this.

This blog contains all the information that is needed (including example code) to implement what I described above. The only remaining task is filling in the "blanks" with the QCustomPlot realtime example code.

https://blog.pramp.com/inter-thread-communication-in-c-futures-promises-vs-sockets-aeebfffd2107

After doing some more progress, I actually reached a problem I could not fix using the approach I posted above and had to look for another solution.

The solution I found is based on these two Stack Overflow posts:

https://stackoverflow.com/questions/22289423/how-to-avoid-qt-app-exec-blocking-main-thread

https://stackoverflow.com/questions/58049601/communicating-with-a-gui-thread-that-is-not-the-main-thread/58050745?noredirect=1#comment102501021_58050745

That is how I managed to integrate a realtime Qt-based GUI to my existing signal processing application.

Hi there, thank you for pointing those very useful links. It makes sense to use signals and slots to communicate with your UI thread. However, I have struggled to implement what these posts are suggesting.

Would you kindly share a minimal example show how I might connect a signal in my main thread to a slot in the UI running in a worker std::thread?