How do you know that you are actually loading the images into QPixmap? You don't do any error checking at all on this line of code:

Qt Code:
  1. model->setData(model->index(i,0),QPixmap(thumbnails.at(i)),Qt::DecorationRole);
To copy to clipboard, switch view to plain text mode 

You just assume the QPixmaps are loaded and stored in the model. Break this line of code into two lines and check that you actually have a valid pixmap before storing it in the model:

Qt Code:
  1. QPixmap pixmap( thumbnails.at( i ) );
  2. if ( !pixmap.isNull() )
  3. model->setData( model->index(i,0), pixmap, Qt::DecorationRole);
  4. else
  5. qDebug() << "Failed to load pixmap from file: " << thumbnails.at( i );
To copy to clipboard, switch view to plain text mode