how to make this into a loop
header file
Code:
public:
QStringListIterator *iterator;
public slots:
void slide();
private:
cpp file
Code:
picture
->setGeometry
(QRect(781,
2,
475,
360));
picture->show();
QDir dir
("/home/dev/ttm/images/");
dir.
setFilter(QDir::Files |
QDir::Hidden |
QDir::NoSymLinks);
fileNames <<
(dir.
absolutePath() + QDir::separator() + f
);
iterator = new QStringListIterator(fileNames);
connect(timer, SIGNAL(timeout()), this, SLOT(slide()));
timer->start(6000);
void mediazone::slide()
{
if(iterator->hasNext())
{
picture->clear();
picture
->setPixmap
(QPixmap(iterator
->next
()));
picture->show();
}
}
I want to make this loop once it hits the last file in the list how would i go about doing so thanks
Re: how to make this into a loop
Quote:
I want to make this loop once it hits the last file in the list how would i go about doing so thanks
Code:
void mediazone::slide()
{
if(iterator->hasNext())
{
picture->clear();
picture
->setPixmap
(QPixmap(iterator
->next
()));
picture->show();
}
else
{
iterator->toFront();
}
}
Re: how to make this into a loop
i forgot about the else :)
thanks that works perfect :)