hi, there
My application needs to browse thousands of images in thumbnail view. I tried QListWidget with icon mode but found it's extremely slow and memory consuming. Many image browser software like GWinView, which is using qt3, handles the problem nicely. How can I do this in qt4? The images are jpg or png format (I won't try other format at this time.) Here is the piece of code:
while (myIterator.hasNext())
{
QString myFileName
= myIterator.
next();
if (!myFileInfo.isFile()) continue;
mypItem->setIcon(myPixmap);
mypItem->setData(Qt::UserRole,myFileName);
listWgt1->addItem(mypItem);
}
listWgt1->sortItems(Qt::AscendingOrder);
while (myIterator.hasNext())
{
QString myFileName = myIterator.next();
QFileInfo myFileInfo(myFileName);
if (!myFileInfo.isFile()) continue;
QPixmap myPixmap(myFileName);
QListWidgetItem * mypItem = new QListWidgetItem(myFileInfo.baseName());
mypItem->setIcon(myPixmap);
mypItem->setData(Qt::UserRole,myFileName);
listWgt1->addItem(mypItem);
}
listWgt1->sortItems(Qt::AscendingOrder);
To copy to clipboard, switch view to plain text mode
The listWgt1 is a QListWidget set to icon mode. Comparing to Gwenview, the loading time is about twice longer and the scrolling is noticeably delayed (but tolerable). The scaling of thumbnails are fast. The memory consuming is much much larger than Gwenview.
Is there any other approach that I can do the thumbview in qt4 fast and memory efficient? (for several thousands of images). Thanks for help.
zl2k
Bookmarks