PDA

View Full Version : QImage::scaled takes long time



nrabara
15th December 2009, 13:19
Hi,

I am using List of QListWidgetItem inside QListWidget, and show the the image file in thumbnail view by scaling the image size to 64*64.

But this image scaling and showing Image as icon in 64*64 size takes long time.


QListWidgetItem *listItemRef;
QPixmap pixmap;
QIcon icon;
QString tempDirName;
QDir dir("/home/nirav");

QStringList dirList = dir.entryList();

this->setIconSize(QSize(64*64);

for(int cnt=0; cnt<dirList.count();cnt++)
{
tempDirName= dirList.at(cnt);
listWidgetItem.append(new QListWidgetItem(this));
QImage image(temDirName);
QIcon imageIcon;

// This image scaling takes long time 4 to 5 seconds on desktop & > 12 Sec on my ARM board
image = image.scaled(64,64,Qt::IgnoreAspectRation);
imageIcon.addPixmap(QPixmap::fromImage(image),QIco n::Normal,QIcon::On);
listItemRef->setIcon(imageIcon);
}



Can anybody suggest me, right way to load image as icon in listwidget with minimum time duration.