PDA

View Full Version : how to move the slider according to the images being displayed on a label



qt_user
2nd August 2010, 11:17
I have a group of images being selected through a filedialog. Now how to move the slider accordingly...Following is a partial code for the filedialog implementation...........
//MAINclass constructor
{
fileName = QFileDialog::getOpenFileNames(this,
tr("Open Image"), "C:/qt-win-opensource-src-4.5.0/bin/", tr("Image Files (*.png *.jpg *.bmp *.avi *.gif)"));

timer = new QTimer;
iterator = new QStringListIterator(fileName);
connect(videoPlayerControls->playPauseButton,SIGNAL(clicked()),this,SLOT(playVi deo()));
}

void VideoPlayer::playVideo()
{
connect(timer, SIGNAL(timeout()), this, SLOT(nextPicture()));
timer->start(40);

}

void VideoPlayer::nextPicture()
{
if(iterator->hasNext())
{
videoDisplayer->clear();
videoDisplayer->setPixmap(QPixmap(iterator->next()));
}
}


Now, the slider is in a different class; which function in the QSlider class should I use and how so as to proportionally move the slider according to the number of images displayed?
Thanx in advance....