Hi
I have a small piece of code to load a list of images
void MainWindow::listdisplay()
{
QDir dir
("/home/kamlesh/Gall/GALL/images/eBeam Gallery/Art & Design/2D Shapes");
dir.
setFilter(QDir::Files);
QList<QImage> images;
int sizeW = 20;
int sizeH = 20;
for(int i=0;i<=listfiles.count();i++)
{
[B
] QString filename
= listfiles.
at(i
);
bool x = tmp.load(filename);[/B]
//bool x = tmp.load("/home/kamlesh/Gall/GALL/images/eBeam Gallery/Art & Design/2D Shapes/Black Hexagon.png");
if(x == true){
thumb = (tmp.scaled( 1240, 1480 ).scaled( sizeW, sizeH, Qt::KeepAspectRatio )); //two passes
modl->setData( modl->index( i, 0 ), thumb, Qt::DecorationRole );}
}
//listwidget->addItems(listfiles);
viw->setModel(modl);
viw->show();
}
void MainWindow::listdisplay()
{
QDir dir("/home/kamlesh/Gall/GALL/images/eBeam Gallery/Art & Design/2D Shapes");
dir.setFilter(QDir::Files);
QList<QImage> images;
QImage thumb, tmp;
int sizeW = 20;
int sizeH = 20;
QStringList listfiles = dir.entryList(QStringList()<<"*.png",QDir::Files);
for(int i=0;i<=listfiles.count();i++)
{
[B] QString filename = listfiles.at(i);
bool x = tmp.load(filename);[/B]
//bool x = tmp.load("/home/kamlesh/Gall/GALL/images/eBeam Gallery/Art & Design/2D Shapes/Black Hexagon.png");
if(x == true){
thumb = (tmp.scaled( 1240, 1480 ).scaled( sizeW, sizeH, Qt::KeepAspectRatio )); //two passes
modl->setData( modl->index( i, 0 ), thumb, Qt::DecorationRole );}
}
//listwidget->addItems(listfiles);
viw->setModel(modl);
viw->show();
}
To copy to clipboard, switch view to plain text mode
Issue is that , I am able to get the filename , but when I use
QImage::load(filename)
it returns FALSE value
Bookmarks