ErrMania
24th November 2011, 20:12
Hello,
i'm reading the tutorial about QConcurrent in the doc, i am not sure to understand something: the QLabel is added to the layout, and then we launch the concurrent function to scale the images :
http://doc.qt.nokia.com/4.7/qtconcurrent-imagescaling-imagescaling-cpp.html
int dim = sqrt(qreal(files.count())) + 1;
for (int i = 0; i < dim; ++i) {
for (int j = 0; j < dim; ++j) {
QLabel *imageLabel = new QLabel;
imageLabel->setFixedSize(imageSize,imageSize);
imagesLayout->addWidget(imageLabel,i,j);
labels.append(imageLabel);
}
}
// Use mapped to run the thread safe scale function on the files.
imageScaling->setFuture(QtConcurrent::mapped(files, scale));
unless i'm missing something in the code, it seems that the asynchronous function scale the images only after they are onscreen. So i am not sure to understand where i'm wrong.
Thanks for your help
i'm reading the tutorial about QConcurrent in the doc, i am not sure to understand something: the QLabel is added to the layout, and then we launch the concurrent function to scale the images :
http://doc.qt.nokia.com/4.7/qtconcurrent-imagescaling-imagescaling-cpp.html
int dim = sqrt(qreal(files.count())) + 1;
for (int i = 0; i < dim; ++i) {
for (int j = 0; j < dim; ++j) {
QLabel *imageLabel = new QLabel;
imageLabel->setFixedSize(imageSize,imageSize);
imagesLayout->addWidget(imageLabel,i,j);
labels.append(imageLabel);
}
}
// Use mapped to run the thread safe scale function on the files.
imageScaling->setFuture(QtConcurrent::mapped(files, scale));
unless i'm missing something in the code, it seems that the asynchronous function scale the images only after they are onscreen. So i am not sure to understand where i'm wrong.
Thanks for your help