awHandinPaper.cpp 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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*420)/2, (height() - g_appInfoPtr->m_fRate*227)/2,
  26. g_appInfoPtr->m_fRate*420, 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->btn_awhp_comfirm->setGeometry(ui->widget_awhp_BG->width() - g_appInfoPtr->m_fRate*(20 + 80),
  42. ui->widget_awhp_BG->height() - g_appInfoPtr->m_fRate*(20 + 30),
  43. g_appInfoPtr->m_fRate*80, g_appInfoPtr->m_fRate*30);
  44. 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(),
  45. ui->btn_awhp_comfirm->width(), ui->btn_awhp_comfirm->height());
  46. }
  47. void awHandinPaper::on_btn_awhp_cancel_clicked()
  48. {
  49. emit cancelHandinPaper();
  50. }
  51. void awHandinPaper::on_btn_awhp_comfirm_clicked()
  52. {
  53. emit handinPaper();
  54. }