[EDIT]:
aaaahh.. I should have wait a little more before posting that...
turns out it's a similar problem as the op had...
x ,y values being asked outside the container...
SORRY....[/EDIT]
Hi,
I'm reviving an old thread... I just stumbled upon this while trying to solve a pb of mine using QwtRasterData...
I have a QMap container filled with data created somewhere else in the program...
the following class is used like this
d_spectrogram->setData(SpectrogramData(&data));
this code:
{
public:
SpectrogramData(QMap<int, double*>* points):
{
datas = points;
}
virtual SpectrogramData *copy() const
{
SpectrogramData* spec_data = new SpectrogramData(datas);
return spec_data;
}
{
}
virtual double value(double x, double y) const
{
int X = qRound(x);
int Y = qRound(y);
return (datas->value(X))[Y];
}
private:
QMap<int, double*> *datas;
};
class SpectrogramData: public QwtRasterData
{
public:
SpectrogramData(QMap<int, double*>* points):
QwtRasterData(QwtDoubleRect(0.0, 0.0, 1999.0, 1999.0))
{
datas = points;
}
virtual SpectrogramData *copy() const
{
SpectrogramData* spec_data = new SpectrogramData(datas);
return spec_data;
}
virtual QwtDoubleInterval range() const
{
return QwtDoubleInterval(0.0, 1000.0);
}
virtual double value(double x, double y) const
{
int X = qRound(x);
int Y = qRound(y);
return (datas->value(X))[Y];
}
private:
QMap<int, double*> *datas;
};
To copy to clipboard, switch view to plain text mode
This consistently giving a segentation fault...happening when the object returned by the copy method is used...
Leave alone the fact that I dont understand why 2 SpectrogramData objects are used,
it seems that the copied object will contain a non null pointer to a non-empty container, as its parent...
If somebody can shed some light on the silly mistake I made!
Bookmarks