Re: What am I doing wrong??
Hi,
I guess, that because you call question.next_question(); in a loop, the last time line is empty and thus all other previous found strings are deleted since the label would only show the last one. (Or what exactly is the output of your program?)
Further since it seems you are using a XML file, you could have a look at QDomDocument.
Re: What am I doing wrong??
It is not at all obvious where "myfile" used in Quiz::next_question(), that is Quiz::myfile, is opened. QuizDialog::myfile, as used in on_NextButton_clicked(), is not related to Quiz::myfile.
In on_NextButton_clicked() the local variable "question" and its members (including one called myfile) ceases to exist at the end of the method. Typically destruction of a stream of file object would close the stream/file. We cannot be certain what is happening here because we don't know what type QuizDialog::myfile is.
Re: What am I doing wrong??
Thanks for the help... I think I have managed a work around. I'm now storing each line as a string and then outputting them to the ui once the next_question() function has finished.
Thanks for your time and trouble :D