Hi!
Yeah.. the docs on the QtConcurrent stuff are really poor!
What you could do is store your float data together with the width and height value together in a small class, like so:
class FloatImage
{
public:
FloatImage(QVector<const float*> data, int width, int height) : data(data),width(width),height(height) {}
QVector<const float*> data;
int width;
int height;
{
// Your code..
}
};
class FloatImage
{
public:
FloatImage(QVector<const float*> data, int width, int height) : data(data),width(width),height(height) {}
QVector<const float*> data;
int width;
int height;
QImage toImage()
{
// Your code..
}
};
To copy to clipboard, switch view to plain text mode
You can call this with QtConcurrent::run
FloatImage fi(yourData,200,100);
QFutureSynchronizer<QImage> synchronizer;
synchronizer.addFuture( QtConcurrent::run(fi,&FloatImage::toImage));
...
synchronizer.waitForFinished();
FloatImage fi(yourData,200,100);
QFutureSynchronizer<QImage> synchronizer;
synchronizer.addFuture( QtConcurrent::run(fi,&FloatImage::toImage));
...
synchronizer.waitForFinished();
To copy to clipboard, switch view to plain text mode
This shows how to wait for multiple operations with QFutureSynchronizer!
HIH
Johannes
Bookmarks