File indexing completed on 2024-04-14 03:40:29
0001 /*************************************************************************** 0002 * Copyright (C) 2004-2007 by Albert Astals Cid * 0003 * aacid@kde.org * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 ***************************************************************************/ 0010 0011 #ifndef BOXASKER_H 0012 #define BOXASKER_H 0013 0014 #include "askwidget.h" 0015 0016 class QPushButton; 0017 class QGroupBox; 0018 class QLabel; 0019 class QRadioButton; 0020 class QVBoxLayout; 0021 0022 class boxAsker : public askWidget 0023 { 0024 Q_OBJECT 0025 public: 0026 boxAsker(QWidget *parent, KGmap *m, QWidget *w, uint count); 0027 ~boxAsker(); 0028 0029 bool eventFilter(QObject *obj, QEvent *event) override; 0030 0031 public Q_SLOTS: 0032 void updateLayout(); 0033 0034 protected: 0035 virtual bool nextBoxAskerQuestionHook(const division *div, int i, bool isAnswer) = 0; 0036 void nextQuestionHook(const division *div) override; 0037 void setQuestion(const QString &q); 0038 virtual void setAnswerHook(int userSays) = 0; 0039 0040 void keyPressEvent(QKeyEvent *e) override; 0041 void keyReleaseEvent(QKeyEvent *e) override; 0042 0043 void setHeadWidget(QWidget *headWidget); 0044 QVector<QRadioButton*> p_radioButtons; 0045 0046 // the position the correct answer is in 0047 int p_position; 0048 0049 protected Q_SLOTS: 0050 void init(); 0051 void atLeastOneSelected(); 0052 0053 private Q_SLOTS: 0054 void checkAnswer(); 0055 0056 private: 0057 void layoutGroupBox(); 0058 void layoutAligned(); 0059 0060 QVBoxLayout *p_lay; 0061 QGridLayout *p_groupLayout; 0062 QPushButton *p_accept; 0063 0064 QWidget *p_headWidget; 0065 QLabel *p_label; 0066 QGroupBox *p_groupBox; 0067 QVector<QLabel*> p_answerLabels; 0068 }; 0069 0070 #endif