struct SQuestion {
QString sQuestion;
std::vector> vAnswers;
}
questionnaire_plugin:
* std::vector<SQuestion> m_vQuestions;
save code:
open file;
stream << question;
stream << nofanswers;
foreach(answer) { stream << answer.string << answer.bool }
load code:
open file;
while(!file.endOfStream())
{
stream >> question;
stream >> nofanswers;
for(i = 0..nofanswers)
{
stream >> anwer.string >> answer.bool;
}
}
browsing:
forward, backward, front, back
on_pForward_click()
{
showQuestion(++m_iQuestion);
}
void showQuestion(int iQuestion, bool bEdit)
{
m_ui.pQuestionLabel->setText(m_vQuestions[m_iQuestion].sQuestion);
m_ui.pFrame->clear();
for(int i = 0; i < m_vQuestions[m_iQuestion].vAnswers.size(); ++i)
{
QCheckBox* pCheckBox = new QCheckBox(m_vQuestions[m_iQuestion].vAnswers[i].first);
pCheckBox->setChecked(m_vQuestions[m_iQuestion].vAnswers[i].second);
m_ui.pFrame->addWidget(pCheckBox);
}
}