questionAndAnswer.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef QUESTIONANDANSWER_H
  2. #define QUESTIONANDANSWER_H
  3. #include <QWidget>
  4. #include <QTimer>
  5. #include "paperDef.h"
  6. #include "CBaseWidget.h"
  7. #include "CHttpBll.h"
  8. namespace Ui {
  9. class questionAndAnswer;
  10. }
  11. class questionAndAnswer : public CQuestionBaseWidget
  12. {
  13. Q_OBJECT
  14. public:
  15. explicit questionAndAnswer(CSubQuestionStruct &sqs, QWidget *parent = nullptr);
  16. ~questionAndAnswer();
  17. int setUI(const int nWidth);
  18. void handinPaper();
  19. void audioPlayCountChange();
  20. int widgetType();
  21. signals:
  22. void markedItem(bool bMarked, int nIndex);
  23. void questionAnswered(bool bAnswered, int nIndex);
  24. void uploadAnswer(int nIndex, __int64 timeStamp, QString sAnswer);
  25. private slots:
  26. void on_btn_mark_clicked();
  27. void onAnswerChanged(bool bAnswer);
  28. void onTimeout();
  29. private:
  30. void initBody(Json::Value jBody, int nOrderIndex);
  31. void updateAnswer();
  32. QString generateAnswer(bool &bAnswered);
  33. bool eventFilter(QObject *obj, QEvent *ev);
  34. void setMarkStyle();
  35. Ui::questionAndAnswer *ui;
  36. CSubQuestionStruct &m_sqs;
  37. int m_nListHeight;
  38. bool b_isPressed;
  39. QTimer *m_pTimer;
  40. bool m_bAnswerChange;
  41. QString m_sAnswer;
  42. __int64 m_nTimeStap;
  43. };
  44. #endif // QUESTIONANDANSWER_H