[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/4.3/kdeedu/kwordquiz/src
From:       Peter Hedlund <peter () peterandlinda ! com>
Date:       2009-08-27 21:13:46
Message-ID: 1251407626.468927.18049.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1016469 by hedlund:

Backport. Fix checking answer in multiple choice.


 M  +8 -6      multipleview.cpp  
 M  +1 -0      multipleview.h  


--- branches/KDE/4.3/kdeedu/kwordquiz/src/multipleview.cpp #1016468:1016469
@@ -52,6 +52,8 @@
 
 void MultipleView::init()
 {
+  m_choices.clear();
+
   score->clear();
   score->setQuestionCount(m_quiz->questionCount());
   score->setAsPercent(Prefs::percent());
@@ -93,10 +95,10 @@
 {
   if (m_actionCollection->action("quiz_check")->isEnabled())
   {
-    if (m_choicesButtons->checkedButton() == 0)
+    if (m_choicesButtons->checkedId() == -1)
         return;
     
-    QString ans = m_choicesButtons->checkedButton()->text().mid(3, opt1->text().length());
+    QString ans = m_choices[m_choicesButtons->checkedId() - 1];
 
     bool fIsCorrect = m_quiz->checkAnswer(ans);
 
@@ -189,11 +191,11 @@
 
   lblAnswerLanguage->setText(m_quiz ->langAnswer());
 
-  QStringList sl = m_quiz->multiOptions();
+  m_choices = m_quiz->multiOptions();
 
-  opt1->setText("&1 " + sl[0]);
-  opt2->setText("&2 " + sl[1]);
-  opt3->setText("&3 " + sl[2]);
+  opt1->setText("&1 " + m_choices[0]);
+  opt2->setText("&2 " + m_choices[1]);
+  opt3->setText("&3 " + m_choices[2]);
 
   m_choicesButtons->setExclusive(false);
   opt1->setChecked(false);
--- branches/KDE/4.3/kdeedu/kwordquiz/src/multipleview.h #1016468:1016469
@@ -52,6 +52,7 @@
     QButtonGroup *m_choicesButtons;
     KWQQuizModel *m_quiz;
     KActionCollection *m_actionCollection;
+    QStringList m_choices;
 
     void showQuestion();
 };
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic