Dispense with the iterator and keep the list and a simple index number (member variables) then:
void VideoDisplayer::nextPicture() {
if (m_index < list.size()-1)
m_index++;
showPicture();
}
void VideoDisplayer::prevPicture() {
if (m_index > 0)
m_index--;
showPicture();
}
void sliderReleased() {
int newIndex = localSlider->value();
if (...) // bounds checks omitted
m_index = newIndex;
showPicture();
}
void showPicture() {
// bounds checks omitted
videoLabel
->setPixmap
(QPixmap(list.
at(m_index
)));
videoLabel->adjustSize();
videoLabel->setScaledContents(true);
localSlider->setValue(m_index);
}
void VideoDisplayer::nextPicture() {
if (m_index < list.size()-1)
m_index++;
showPicture();
}
void VideoDisplayer::prevPicture() {
if (m_index > 0)
m_index--;
showPicture();
}
void sliderReleased() {
int newIndex = localSlider->value();
if (...) // bounds checks omitted
m_index = newIndex;
showPicture();
}
void showPicture() {
// bounds checks omitted
videoLabel->setPixmap(QPixmap(list.at(m_index)));
videoLabel->adjustSize();
videoLabel->setScaledContents(true);
localSlider->setValue(m_index);
}
To copy to clipboard, switch view to plain text mode
or some variation on the theme.
Edit: Use [code] tags around your code, it is the # on the editor tool bar.
Bookmarks