void BftpMaker::add() { Question q; q.setText(tr("empty")); q.addAnswer(Answer(tr("empty"), false)); q.addAnswer(Answer(tr("empty"), false)); q.addAnswer(Answer(tr("empty"), false)); _test.insertQuestion(++_currentQ, q); setQuestion(_currentQ); }
void BftpMaker::prev() { _test.removeQuestion(_currentQ); Question q; q.setText(textEdit->text()); for (int i = 0; i < ansList.size(); i++) { q.addAnswer(ansList[i]->answer()); } _test.insertQuestion(_currentQ, q); if (_currentQ != 0) setQuestion(--_currentQ); }
void BftpMaker::next() { _test.removeQuestion(_currentQ); Question q; q.setText(textEdit->text()); for (int i = 0; i < ansList.size(); i++) { q.addAnswer(ansList[i]->answer()); } _test.insertQuestion(_currentQ, q); if (_currentQ < _test.questions().size() - 1) setQuestion(++_currentQ); }
Question Theme::selectQuestion( const QSqlQuery &query ) const { // reject into new method. Question makeQuestion(const QSqlQueru &query) using namespace Tables::Question::Field; Question issue; QString id = query.value( query.record().indexOf( QUESTION_ID ) ).toString(), text = query.value( query.record().indexOf( TEXT ) ).toString(), type = query.value( query.record().indexOf( QUESTION_TYPE ) ).toString(); bool caseSens = query.value( query.record().indexOf( CASE_SENS ) ).toBool(), stripSpace = query.value( query.record().indexOf( STRIP_SPACE ) ).toBool(); QTime time = query.value( query.record().indexOf( RECOMENDED_TIME ) ).toTime(); issue.setId( id ); issue.setText( text ); issue.setType( type ); issue.setTime( time ); issue.setCaseSensitivity( caseSens ); issue.setStripSpaces( stripSpace ); return issue; }