Sharing vectors between classes
I have a pointcloud class that stores points:
Code:
{
Q_OBJECT
public:
explicit pointCloud
(QObject *parent
= 0);
signals:
public slots:
void addPoint(float x, float y, float z);
private:
struct point {
float x;
float y;
float z;
};
std::vector<point> points;
};
i create point cloud:
pointCloud pointcloud;
and filled the vector with points.
I now want to pass this vector to a QGLWidget for display.
Whats the best way to share this data?
Thanks,
Dubstar_04
Re: Sharing vectors between classes
Any way that makes sense for your application and is valid C++ is good. There is not single "best" answer to a broad general question.
Re: Sharing vectors between classes
I have tried passing the pointcloud object as a pointer and a reference and i couldn't get either to work.
would it be best to pass just the points vector?
The QGLWidget shouldn't alter the points data, just display it. i have read that a const vector by reference should be used, but i am a little out of my depth here.
Thanks for any tips,
Dubstar_04