header file
Qt Code:
  1. public:
  2. QStringListIterator *iterator;
  3. QTimer *timer;
  4.  
  5. public slots:
  6. void slide();
  7.  
  8. private:
  9. QLabel *picture;
To copy to clipboard, switch view to plain text mode 

cpp file
Qt Code:
  1. picture = new QLabel(this);
  2.  
  3. picture->setGeometry(QRect(781,2,475,360));
  4. picture->show();
  5. QDir dir("/home/dev/ttm/images/");
  6. dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
  7. QStringList files = dir.entryList();
  8. QStringList fileNames;
  9.  
  10. foreach (QString f, files)
  11. fileNames << (dir.absolutePath() + QDir::separator() + f);
  12.  
  13. iterator = new QStringListIterator(fileNames);
  14.  
  15. timer = new QTimer(this);
  16. connect(timer, SIGNAL(timeout()), this, SLOT(slide()));
  17. timer->start(6000);
  18.  
  19. void mediazone::slide()
  20. {
  21.  
  22. if(iterator->hasNext())
  23. {
  24. picture->clear();
  25. picture->setPixmap(QPixmap(iterator->next()));
  26. picture->show();
  27.  
  28. }
  29.  
  30. }
To copy to clipboard, switch view to plain text mode 

I want to make this loop once it hits the last file in the list how would i go about doing so thanks