awHandinPaper.cpp 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #include "awHandinPaper.h"
  2. #include "ui_awHandinPaper.h"
  3. #include "CAppInfo.h"
  4. #include <QDesktopWidget>
  5. awHandinPaper::awHandinPaper(int nAnswered, int nUnanswered, int nMarked, QWidget *parent) :
  6. QWidget(parent),
  7. ui(new Ui::awHandinPaper)
  8. {
  9. ui->setupUi(this);
  10. setStyleSheet(g_appInfoPtr->m_sQssStr);
  11. ui->label_awhp_answered->setText(QString::fromLocal8Bit("已答题目:%1").arg(nAnswered));
  12. ui->label_awhp_unanswered->setText(QString::fromLocal8Bit("未答题目:%1").arg(nUnanswered));
  13. ui->label_awhp_marked->setText(QString::fromLocal8Bit("标记题目:%1").arg(nMarked));
  14. initUI();
  15. }
  16. awHandinPaper::~awHandinPaper()
  17. {
  18. delete ui;
  19. }
  20. void awHandinPaper::initUI()
  21. {
  22. QDesktopWidget *dekwiget = QApplication::desktop();
  23. setGeometry(0, 0, dekwiget->width(), dekwiget->height());
  24. ui->widget_mask->setGeometry(0, 0, dekwiget->width(), dekwiget->height());
  25. ui->widget_awhp_BG->setGeometry((width() - g_appInfoPtr->m_fRate*480)/2, (height() - g_appInfoPtr->m_fRate*227)/2,
  26. g_appInfoPtr->m_fRate*480, g_appInfoPtr->m_fRate*227);
  27. ui->label_awhp_icon->setGeometry(g_appInfoPtr->m_fRate*30, g_appInfoPtr->m_fRate*30,
  28. g_appInfoPtr->m_fRate*40, g_appInfoPtr->m_fRate*40);
  29. ui->label_awhp_title->adjustSize();
  30. ui->label_awhp_title->setGeometry(ui->label_awhp_icon->x() + ui->label_awhp_icon->width() + g_appInfoPtr->m_fRate*20,
  31. ui->label_awhp_icon->y(), ui->label_awhp_title->width(), ui->label_awhp_title->height());
  32. ui->label_awhp_answered->adjustSize();
  33. ui->label_awhp_answered->setGeometry(ui->label_awhp_title->x(), ui->label_awhp_title->y() + ui->label_awhp_title->height() + g_appInfoPtr->m_fRate*20,
  34. ui->label_awhp_answered->width(), ui->label_awhp_answered->height());
  35. ui->label_awhp_unanswered->adjustSize();
  36. ui->label_awhp_unanswered->setGeometry(ui->label_awhp_answered->x(), ui->label_awhp_answered->y() + ui->label_awhp_answered->height() + g_appInfoPtr->m_fRate*5,
  37. ui->label_awhp_unanswered->width(), ui->label_awhp_unanswered->height());
  38. ui->label_awhp_marked->adjustSize();
  39. ui->label_awhp_marked->setGeometry(ui->label_awhp_unanswered->x(), ui->label_awhp_unanswered->y() + ui->label_awhp_unanswered->height() + g_appInfoPtr->m_fRate*5,
  40. ui->label_awhp_marked->width(), ui->label_awhp_marked->height());
  41. ui->label_multipleChoiceTips->adjustSize();
  42. ui->label_multipleChoiceTips->setGeometry(ui->label_awhp_unanswered->x(), ui->label_awhp_marked->y() + ui->label_awhp_marked->height() + g_appInfoPtr->m_fRate*15,
  43. ui->label_multipleChoiceTips->width(), ui->label_multipleChoiceTips->height());
  44. ui->label_multipleChoiceTips->setVisible(false);
  45. ui->btn_awhp_comfirm->setGeometry(ui->widget_awhp_BG->width() - g_appInfoPtr->m_fRate*(20 + 80),
  46. ui->widget_awhp_BG->height() - g_appInfoPtr->m_fRate*(20 + 30),
  47. g_appInfoPtr->m_fRate*80, g_appInfoPtr->m_fRate*30);
  48. ui->btn_awhp_cancel->setGeometry(ui->btn_awhp_comfirm->x() - g_appInfoPtr->m_fRate*10 - ui->btn_awhp_comfirm->width(), ui->btn_awhp_comfirm->y(),
  49. ui->btn_awhp_comfirm->width(), ui->btn_awhp_comfirm->height());
  50. }
  51. void awHandinPaper::showMutipleChoiceTip()
  52. {
  53. ui->label_multipleChoiceTips->setVisible(true);
  54. }
  55. void awHandinPaper::on_btn_awhp_cancel_clicked()
  56. {
  57. emit cancelHandinPaper();
  58. }
  59. void awHandinPaper::on_btn_awhp_comfirm_clicked()
  60. {
  61. emit handinPaper();
  62. }