Look into QString::section().
I was able to use it to pick out desired sentences from one big text file to display the desired directions along with the images that can be iterated through (for a knot tying app).
Here is what I used to get it to work, maybe it will do what you need?
Code:
//open file for instructions
str = (QString::fromUtf8(":/images/docs/texts/instructions/Instructions.txt"));
QFile inputFile2(str);
inputFile2.open(QIODevice::ReadOnly);
QTextStream in2(&inputFile2);
QString line2 = in2.readAll();
QString instructions;
inputFile2.close();
str1.remove(" ");
instructions = line2.section(str1, 1, 1); //load instructions with all the selected instructions
int tmp(strLst.count()); //setup counter with number of images
for(int i = 0; i < tmp; i++)
{
inst += instructions.section('.', i, i); //load strlist inst with each sentance
// qDebug() << "*****" << inst.at(i) << "*******";
}
Good luck!
Jon