From 42a178da51dc54479c0937d7cbaffc7e72c9c57a Mon Sep 17 00:00:00 2001 From: Reto Zingg Date: Sat, 27 Mar 2010 02:03:44 +0200 Subject: [PATCH] add apply button --- TinyVocTrainer/tinyvoctrainer.cpp | 11 +++++++++-- TinyVocTrainer/tinyvoctrainer.h | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/TinyVocTrainer/tinyvoctrainer.cpp b/TinyVocTrainer/tinyvoctrainer.cpp index beafc72..c17e756 100644 --- a/TinyVocTrainer/tinyvoctrainer.cpp +++ b/TinyVocTrainer/tinyvoctrainer.cpp @@ -20,7 +20,11 @@ TinyVocTrainer::TinyVocTrainer(QWidget *parent) QHBoxLayout *hbox_question_lang = new QHBoxLayout(); QHBoxLayout *hbox_answer_lang = new QHBoxLayout(); QVBoxLayout *vbox_label = new QVBoxLayout(); + QHBoxLayout *hbox_buttons = new QHBoxLayout(); + QPushButton *button = new QPushButton("Apply"); + hbox_buttons->addWidget(button); + connect(button, SIGNAL(clicked(bool)), this, SLOT(slotInit(bool))); bgroup_lesson = new QButtonGroup(); bgroup_question_lang = new QButtonGroup(); @@ -120,6 +124,7 @@ TinyVocTrainer::TinyVocTrainer(QWidget *parent) vbox->addLayout(hbox_less); vbox->addLayout(hbox_question_lang); vbox->addLayout(hbox_answer_lang); + vbox->addLayout(hbox_buttons); vbox->addLayout(vbox_label); setLayout(vbox); @@ -190,7 +195,7 @@ void TinyVocTrainer::slotCheck(int buttonID){ if(buttonID == CorrectID){ qDebug() << "\\o/ correct answer..."; - slotInit(); + slotInit(1); return; } else{ @@ -199,7 +204,9 @@ void TinyVocTrainer::slotCheck(int buttonID){ } -void TinyVocTrainer::slotInit(){ +void TinyVocTrainer::slotInit(bool clicked){ + + Q_UNUSED(clicked); choiceList.clear(); for (int i=0; i < 3; ++i){ diff --git a/TinyVocTrainer/tinyvoctrainer.h b/TinyVocTrainer/tinyvoctrainer.h index 46bbef8..cdec950 100644 --- a/TinyVocTrainer/tinyvoctrainer.h +++ b/TinyVocTrainer/tinyvoctrainer.h @@ -49,7 +49,7 @@ private slots: void slotAnswer1(bool clicked = 0); void slotAnswer2(bool clicked = 0); void slotAnswer3(bool clicked = 0); - void slotInit(); + void slotInit(bool clicked = 0); }; -- 2.47.3