QT Chart UI Lag
-
Hi,
Adding candles to a QCandlestickSeries does not work when on a non-UI thread. When adding the candles to the QCandlestickSeries on the UI thread there is a lag when using the UI. Is there a way to achieve adding candles to a worker thread or is there a best-practice I am missing to avoid the lag on the UI thread?
-
@MikeJO said in QT Chart UI Lag:
Is there a way to achieve adding candles to a worker thread
No, UI may only be changed by UI thread.
What one usually does is to do the heavy calculations in the worker thread and then emit a signal with calculated data as parameters and connect this signal to a slot in the UI theread. Then update the UI in that slot. -
Hi,
Thank you for your response.
I have implemented this logic, having only the candle added to the chart and it appears to have made things worse. Before I was adding the candles on a time-out of 500ms allowing "laggy" changes on the UI. Now the signal is constantly being fired as the updates are rapidly being received and I cannot use the UI at all until the updates are paused.
-
@MikeJO said in QT Chart UI Lag:
Now the signal is constantly being fired as the updates are rapidly being received
Then do not emit the signal on each update.
Accumulate several updates and then emit them as one signal...