PDA

View Full Version : QwtPlotMultiBarChart with raw data



Momergil
14th May 2014, 15:09
Hello!

I'ld like to know if there is a equivalent of QwtPlotCurve::setRawData(...) for QwtPlotMultiBarChart, that is, a way of setting the samples to QwtPlotMultiBarChart that don't perform a copy of the original data, but merely points to it (I'm asking because the manual isn't clear enough if all setSamples() perform a copy or not).

If there isn't, is there a way I could subclass QwtPlotMultiBarChart to create one? And Uwe, could you please add then such method in the next versions of Qwt?


Thanks,

Momergil

Uwe
14th May 2014, 15:27
A bar chart with so many values, that avoiding a copy is important ?

Anyway, QVector - like all Qt containers - is implicitly shared. So there is no real copy until you change one of the "copies" ( copy on write ). Beside that you can always use a QwtSeriesData bridge to your data, so that you are free to store your samples however you like. As Qwt doesn't see behind this bridge you can be sure, that they will never be copied - unless your code does it.

So it is more the other way round: QwtPlotCurve::setRawData() is legacy code and is only left over for convenience and compatibility. It doesn't offer much value since the very, very first versions of Qwt.

Uwe

Momergil
14th May 2014, 17:27
A bar chart with so many values, that avoiding a copy is important?

Actually not, but in developing for a embedded context, any processing or memory consumption that can be avoided is considered gain :)

Thanks, Uwe, for the reply!


Momergil