clStudentInfo.cpp 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #include "clStudentInfo.h"
  2. #include "ui_clStudentInfo.h"
  3. #include "CAppInfo.h"
  4. #include <QGraphicsDropShadowEffect>
  5. clStudentInfo::clStudentInfo(QWidget *parent) :
  6. QWidget(parent),
  7. ui(new Ui::clStudentInfo)
  8. {
  9. ui->setupUi(this);
  10. setStyleSheet(g_appInfoPtr->m_sQssStr);
  11. }
  12. clStudentInfo::~clStudentInfo()
  13. {
  14. delete ui;
  15. }
  16. void clStudentInfo::setUI(const int nLeft, const int nTop, const int nWidth, const int nHeight)
  17. {
  18. setGeometry(nLeft, nTop, nWidth, nHeight);
  19. ui->label_clsi_studentName->setText(g_appInfoPtr->m_sStudentName);
  20. ui->label_clsi_orgName->setText(g_appInfoPtr->m_sOrgName);
  21. ui->label_clsi_studentCode->setText(g_appInfoPtr->m_sStudentCode);
  22. ui->label_clsi_identity->setText(g_appInfoPtr->m_sStudentIdentityNumber);
  23. QString sFileName = g_appInfoPtr->m_sStudentPhotoPath.right(g_appInfoPtr->m_sStudentPhotoPath.length() - g_appInfoPtr->m_sStudentPhotoPath.lastIndexOf("/") - 1);
  24. sFileName = g_appInfoPtr->m_sCacheFileDir + sFileName;
  25. ui->widget_npw_BG->setGeometry(g_appInfoPtr->m_fRate*5, g_appInfoPtr->m_fRate*5, width()-g_appInfoPtr->m_fRate*10, height()-g_appInfoPtr->m_fRate*10);
  26. ui->label_studentPhoto->setGeometry(ui->widget_npw_BG->width() - g_appInfoPtr->m_fRate*20 - g_appInfoPtr->m_fRate*64, g_appInfoPtr->m_fRate*20,
  27. g_appInfoPtr->m_fRate*64, g_appInfoPtr->m_fRate*80);
  28. ui->label_studentPhoto->setPixmap(QPixmap(sFileName).scaled(ui->label_studentPhoto->width(), ui->label_studentPhoto->height(),
  29. Qt::IgnoreAspectRatio));
  30. ui->label_clsi_studentName->adjustSize();
  31. ui->label_clsi_studentName->setGeometry(g_appInfoPtr->m_fRate*20, g_appInfoPtr->m_fRate*20,
  32. ui->label_clsi_studentName->width(), ui->label_clsi_studentName->height());
  33. ui->label_clsi_studentCodeHint->adjustSize();
  34. ui->label_clsi_studentCodeHint->setGeometry(ui->label_clsi_studentName->x(), ui->label_clsi_studentName->y() + ui->label_clsi_studentName->height() + g_appInfoPtr->m_fRate*20,
  35. ui->label_clsi_studentCodeHint->width(), ui->label_clsi_studentCodeHint->height());
  36. ui->label_clsi_studentCode->adjustSize();
  37. ui->label_clsi_studentCode->setGeometry(ui->label_clsi_studentCodeHint->x() + ui->label_clsi_studentCodeHint->width() + g_appInfoPtr->m_fRate*34,
  38. ui->label_clsi_studentCodeHint->y(), ui->label_clsi_studentCode->width(), ui->label_clsi_studentCode->height());
  39. ui->label_clsi_identityHint->adjustSize();
  40. ui->label_clsi_identityHint->setGeometry(ui->label_clsi_studentName->x(), ui->label_clsi_studentCodeHint->y() + ui->label_clsi_studentCodeHint->height() + g_appInfoPtr->m_fRate*10,
  41. ui->label_clsi_identityHint->width(), ui->label_clsi_identityHint->height());
  42. ui->label_clsi_identity->adjustSize();
  43. ui->label_clsi_identity->setGeometry(ui->label_clsi_studentCode->x(), ui->label_clsi_identityHint->y(),
  44. ui->label_clsi_identity->width(), ui->label_clsi_identity->height());
  45. ui->label_clsi_orgNameHint->adjustSize();
  46. ui->label_clsi_orgNameHint->setGeometry(ui->label_clsi_studentName->x(), ui->label_clsi_identityHint->y() + ui->label_clsi_identityHint->height() + g_appInfoPtr->m_fRate*10,
  47. ui->label_clsi_orgNameHint->width(), ui->label_clsi_orgNameHint->height());
  48. ui->label_clsi_orgName->adjustSize();
  49. ui->label_clsi_orgName->setGeometry(ui->label_clsi_studentCode->x(), ui->label_clsi_orgNameHint->y(),
  50. ui->label_clsi_orgName->width(), ui->label_clsi_orgName->height());
  51. ui->label_HLine->setGeometry(ui->label_clsi_studentName->x(), ui->label_clsi_orgNameHint->y() + ui->label_clsi_orgNameHint->height() + g_appInfoPtr->m_fRate*20,
  52. ui->widget_npw_BG->width() - g_appInfoPtr->m_fRate*20*2,g_appInfoPtr->m_fRate*1 < 1 ? 1 : g_appInfoPtr->m_fRate*1);
  53. ui->btn_clsi_editPassword->setGeometry(ui->label_clsi_studentName->x(), ui->label_HLine->y() + ui->label_HLine->height() + g_appInfoPtr->m_fRate*20,
  54. g_appInfoPtr->m_fRate*135, g_appInfoPtr->m_fRate*32);
  55. ui->btn_clsi_exitLogin->setGeometry(ui->widget_npw_BG->width() - g_appInfoPtr->m_fRate*20 - ui->btn_clsi_editPassword->width(),
  56. ui->btn_clsi_editPassword->y(), ui->btn_clsi_editPassword->width(), ui->btn_clsi_editPassword->height());
  57. QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect;
  58. effect->setOffset(g_appInfoPtr->m_fRate*4,g_appInfoPtr->m_fRate*4);
  59. effect->setColor(QColor(0,0,0,30));
  60. effect->setBlurRadius(g_appInfoPtr->m_fRate*16);
  61. ui->widget_npw_BG->setGraphicsEffect(effect);
  62. }
  63. void clStudentInfo::on_btn_clsi_editPassword_clicked()
  64. {
  65. emit sgnStudentEditPassword();
  66. }
  67. void clStudentInfo::on_btn_clsi_exitLogin_clicked()
  68. {
  69. emit sgnStudentLogout();
  70. }