QwtPlot set curve samples error
-
wrote on 3 Nov 2020, 18:14 last edited by zedhzelgc 11 Mar 2020, 18:15
Hello,
I am creating a graph with Qwt and I have a problem when I refresh the curve data with setSamples () function. I have the following error:The setSamples() function runs on a QFutureWatcher to avoid interface slow down by the processing of data to be plotted.
If I comment setSamples() the error does not occur. -
Lifetime Qt Championwrote on 3 Nov 2020, 19:06 last edited by SGaist 11 Sept 2020, 19:05
-
wrote on 4 Nov 2020, 12:50 last edited by
Thank you very much!
I have changed the code so that when I finish the QFutureWatcher sends a signal to a GUI thread slot. This slot updates the data with setSamples () and makes the graph replot. I didn't get the error again.In other occasions I have done it directly from the QFuture and I haven't received any error but knowing that the setSamples() is related to GUI and not only updates series data it is better to do it from the GUI thread.
-
Thank you very much!
I have changed the code so that when I finish the QFutureWatcher sends a signal to a GUI thread slot. This slot updates the data with setSamples () and makes the graph replot. I didn't get the error again.In other occasions I have done it directly from the QFuture and I haven't received any error but knowing that the setSamples() is related to GUI and not only updates series data it is better to do it from the GUI thread.
wrote on 9 Nov 2020, 16:01 last edited by@zedhzelgc said in QwtPlot set curve samples error:
Thank you very much!
I have changed the code so that when I finish the QFutureWatcher sends a signal to a GUI thread slot. This slot updates the data with setSamples () and makes the graph replot. I didn't get the error again.In other occasions I have done it directly from the QFuture and I haven't received any error but knowing that the setSamples() is related to GUI and not only updates series data it is better to do it from the GUI thread.
setSamples does not lead to any updates of the GUI - beside the autoReplot flag has been set.
But there might be races, when changing the samples while the update process is mapping the samples into paint device coordinates. You could derive from QwtSeriesData and add an mutex there in case concurrent access is important.
1/4