added the previous item change

This commit is contained in:
Chris Cochrun 2022-08-06 07:23:57 -05:00
parent 420d521494
commit 770e2f4593
3 changed files with 53 additions and 17 deletions

View file

@ -210,3 +210,24 @@ bool Slide::next(QVariantMap nextItem)
return false;
}
bool Slide::previous(QVariantMap prevItem)
{
qDebug() << "Starting to go to previous item.";
qDebug() << "Slide Index: " << m_slideIndex << " Slide Size: " << m_slideSize;
QStringList text = m_serviceItem.value("text").toStringList();
if (m_slideIndex == 1) {
changeSlide(prevItem);
return true;
}
// since the string list is 0 indexed m_slideIndex actually
// maps to the next item. So the prev text is minus 2
int prevTextIndex = m_slideIndex - 2;
qDebug() << prevTextIndex;
qDebug() << text[prevTextIndex];
setText(text[prevTextIndex]);
m_slideIndex--;
return false;
}