With the grateful help of phenoboy and some modifications i was able to create a subclass of QwtSeriesData.
But now application crashes on close with this message in Debugger
can't find linker symbol for virtual table for `QwtSeriesStore<QPointF>' value
found `construction vtable for QwtSeriesStore<QPointF>-in-PlotCurve' instead
What is going wrong here? (clean Project, qmake, rebuild all done)
It looks like the app crahes here:
template <typename T>
QwtSeriesStore<T>::~QwtSeriesStore()
{
delete d_series; // CRASH
}
template <typename T>
QwtSeriesStore<T>::~QwtSeriesStore()
{
delete d_series; // CRASH
}
To copy to clipboard, switch view to plain text mode
Thx
Stefan
My code:
plotcurve.h
#include "qwt/subclass/seriesdata.h"
...
SeriesData curveData;
#include "qwt/subclass/seriesdata.h"
...
SeriesData curveData;
To copy to clipboard, switch view to plain text mode
plotcurve.cpp
void PlotCurve::newCurveData()
{
if( isPointerValid() )
{
// with subclass from QwtSeriesData
curveData.setMinYValue( d_data->pmdata.data()->valueMin );
curveData.setMaxYValue( d_data->pmdata.data()->valueMax );
curveData.setSamples(d_data->pmdata.data()->timestamps,
d_data->pmdata.data()->values);
curveData.setFactorY( d_data->unitPressureFactor );
setSamples( &curveData );
}
void PlotCurve::newCurveData()
{
if( isPointerValid() )
{
// with subclass from QwtSeriesData
curveData.setMinYValue( d_data->pmdata.data()->valueMin );
curveData.setMaxYValue( d_data->pmdata.data()->valueMax );
curveData.setSamples(d_data->pmdata.data()->timestamps,
d_data->pmdata.data()->values);
curveData.setFactorY( d_data->unitPressureFactor );
setSamples( &curveData );
}
To copy to clipboard, switch view to plain text mode
seriesdata.h
#include "qwt_series_data.h"
#include <QObject>
class SeriesData : public QwtSeriesData<QPointF>
{
public:
SeriesData();
virtual QPointF sample
( size_t index
) const;
virtual size_t size() const;
virtual QRectF boundingRect
() const;
double getFactorY() const;
void setFactorY(const double &value);
void setMaxYValue(const double &value);
void setMinYValue(const double &value);
void clear();
void setSamples( const QVector<double> &xData, const QVector<double> &yData );
QVector<double> &pointsX();
QVector<double> &pointsY();
protected:
QVector<double> points_x;
QVector<double> points_y;
double factorY;
double maxYValue;
double minYValue;
};
#include "qwt_series_data.h"
#include <QObject>
class SeriesData : public QwtSeriesData<QPointF>
{
public:
SeriesData();
virtual QPointF sample( size_t index ) const;
virtual size_t size() const;
virtual QRectF boundingRect() const;
double getFactorY() const;
void setFactorY(const double &value);
void setMaxYValue(const double &value);
void setMinYValue(const double &value);
void clear();
void setSamples( const QVector<double> &xData, const QVector<double> &yData );
QVector<double> &pointsX();
QVector<double> &pointsY();
QRectF _boundingRect;
protected:
QVector<double> points_x;
QVector<double> points_y;
double factorY;
double maxYValue;
double minYValue;
};
To copy to clipboard, switch view to plain text mode
#include "seriesdata.h"
#include "qwt_series_data.h"
SeriesData::SeriesData()
{
qDebug() << Q_FUNC_INFO;
factorY = 1;
points_x.reserve(1000);
points_y.reserve(1000);
}
QPointF SeriesData
::sample(size_t index
) const {
QPointF p
(points_x.
value(index
), points_y.
value(index
));
p.setY(factorY*p.y());
return p;
}
size_t SeriesData::size() const
{
return points_x.size();
}
QRectF SeriesData
::boundingRect() const {
return _boundingRect;
}
QVector<double> &SeriesData::pointsX()
{
return points_x;
}
QVector<double> &SeriesData::pointsY()
{
return points_y;
}
double SeriesData::getFactorY() const
{
return factorY;
}
void SeriesData::setFactorY(const double &value)
{
factorY = value;
}
void SeriesData::setMaxYValue(const double &value)
{
maxYValue = value;
}
void SeriesData::setMinYValue(const double &value)
{
minYValue = value;
}
void SeriesData::clear()
{
points_x.clear();
points_y.clear();
}
void SeriesData::setSamples(const QVector<double> &xData, const QVector<double> &yData)
{
points_x = xData;
points_y = yData;
_boundingRect.setLeft( (qreal)(xData.first()) );
_boundingRect.setRight( (qreal)(xData.last()) );
_boundingRect.setTop( maxYValue );
_boundingRect.setBottom( minYValue );
}
#include "seriesdata.h"
#include "qwt_series_data.h"
SeriesData::SeriesData()
{
qDebug() << Q_FUNC_INFO;
factorY = 1;
points_x.reserve(1000);
points_y.reserve(1000);
}
QPointF SeriesData::sample(size_t index) const
{
QPointF p(points_x.value(index), points_y.value(index));
p.setY(factorY*p.y());
return p;
}
size_t SeriesData::size() const
{
return points_x.size();
}
QRectF SeriesData::boundingRect() const
{
return _boundingRect;
}
QVector<double> &SeriesData::pointsX()
{
return points_x;
}
QVector<double> &SeriesData::pointsY()
{
return points_y;
}
double SeriesData::getFactorY() const
{
return factorY;
}
void SeriesData::setFactorY(const double &value)
{
factorY = value;
}
void SeriesData::setMaxYValue(const double &value)
{
maxYValue = value;
}
void SeriesData::setMinYValue(const double &value)
{
minYValue = value;
}
void SeriesData::clear()
{
points_x.clear();
points_y.clear();
}
void SeriesData::setSamples(const QVector<double> &xData, const QVector<double> &yData)
{
points_x = xData;
points_y = yData;
_boundingRect.setLeft( (qreal)(xData.first()) );
_boundingRect.setRight( (qreal)(xData.last()) );
_boundingRect.setTop( maxYValue );
_boundingRect.setBottom( minYValue );
}
To copy to clipboard, switch view to plain text mode
Bookmarks